/* ============================================
   1. RESET Y VARIABLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores principales */
    --color-primary: #2c3e50;
    --color-primary-dark: #1a252f;
    --color-secondary: #34495e;
    --color-accent: #e67e22;
    --color-accent-hover: #d35400;
    --color-light: #ecf0f1;
    --color-white: #ffffff;
    
    /* Escala de grises */
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f4;
    --gray-200: #e8eaed;
    --gray-300: #dadce0;
    --gray-400: #bdc1c6;
    --gray-500: #9aa0a6;
    --gray-600: #80868b;
    --gray-700: #5f6368;
    --gray-800: #3c4043;
    --gray-900: #202124;
    
    /* Layout */
    --header-height: 80px;
    --header-height-mobile: 70px;
    --max-width: 1200px;
    --border-radius: 10px;
    --border-radius-lg: 15px;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);
    --shadow-accent: 0 4px 15px rgba(230, 126, 34, 0.4);
    
    /* Transiciones */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* Fuentes */
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    color: var(--gray-800);
    overflow-x: hidden;
    background-color: var(--gray-100);
    padding-top: var(--header-height);
}

/* ============================================
   2. HEADER (UNIFICADO)
   ============================================ */
header {
    background: var(--color-white);
    box-shadow: var(--shadow-md);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    height: var(--header-height);
    transition: height var(--transition-base), 
                box-shadow var(--transition-base),
                background-color var(--transition-base);
}

header.scrolled {
    height: var(--header-height-mobile);
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 100%;
}

.logo span {
    color: var(--color-accent);
}

.logo-img {
    height: 60px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--color-secondary);
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-accent);
}

.nav-links > li > a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: width var(--transition-base);
}

.nav-links > li > a:hover::after,
.nav-links > li > a.active::after {
    width: 100%;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown > a::after {
    content: '▼';
    font-size: 0.7rem;
    margin-left: 5px;
    transition: transform var(--transition-base);
    display: inline-block;
}

.dropdown.active > a::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: var(--color-white);
    min-width: 220px;
    box-shadow: var(--shadow-xl);
    border-radius: var(--border-radius);
    padding: 0.5rem 0;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    list-style: none;
    border: 1px solid var(--gray-100);
    z-index: 1001;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: var(--color-white);
    border-left: 1px solid var(--gray-100);
    border-top: 1px solid var(--gray-100);
}

.dropdown:hover .dropdown-menu,
.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu li {
    width: 100%;
}

.dropdown-menu a {
    display: block;
    padding: 0.8rem 1.5rem;
    color: var(--color-secondary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.dropdown-menu a::after {
    display: none !important;
}

.dropdown-menu a:hover {
    background: var(--gray-50);
    color: var(--color-accent);
    border-left-color: var(--color-accent);
    padding-left: 1.8rem;
}

/* Menú móvil */
.mobile-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    padding: 10px;
    background: none;
    border: none;
    z-index: 1001;
}

.mobile-menu span {
    width: 25px;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
    transition: all var(--transition-base);
}

.mobile-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Skip link accesibilidad */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-white);
    padding: 8px;
    text-decoration: none;
    z-index: 101;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
}

/* ============================================
   3. PAGE HEADER (Para páginas internas)
   ============================================ */
.page-header {
    background: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), 
                url('../fotos/imagenInicio.png') center/cover no-repeat;
    color: var(--color-white);
    padding: 6rem 2rem;
    text-align: center;
    position: relative;
}

.page-header h1 {
    font-size: clamp(2rem, 5vw, 2.5rem);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.page-header p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    opacity: 0.9;
    position: relative;
    z-index: 1;
    color: var(--gray-300);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   4. SERVICIOS DETALLE
   ============================================ */
.servicio-detalle {
    padding: 5rem 2rem;
}

.servicio-detalle.venta {
    background: var(--color-white);
}

.servicio-detalle.compra {
    background: var(--color-primary);
}

.servicio-detalle.alquiler {
    background: var(--color-white);
}

.servicio-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.servicio-detalle.compra .servicio-container {
    direction: rtl;
}

.servicio-detalle.compra .servicio-texto {
    direction: ltr;
}

.servicio-imagen {
    height: 400px;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.servicio-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.servicio-imagen:hover img {
    transform: scale(1.05);
}

/* Textos para venta y alquiler (fondo blanco) */
.servicio-detalle.venta .servicio-texto h2,
.servicio-detalle.alquiler .servicio-texto h2 {
    color: var(--gray-900);
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

.servicio-detalle.venta .servicio-texto h2 span,
.servicio-detalle.alquiler .servicio-texto h2 span {
    color: var(--color-accent);
    display: block;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.servicio-detalle.venta .servicio-texto p,
.servicio-detalle.alquiler .servicio-texto p {
    color: var(--gray-600);
    margin-bottom: 1rem;
    line-height: 1.8;
    font-size: 1.1rem;
}

.servicio-detalle.venta .servicio-texto strong,
.servicio-detalle.alquiler .servicio-texto strong {
    color: var(--gray-800);
}

.servicio-detalle.venta .servicio-lista li,
.servicio-detalle.alquiler .servicio-lista li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--gray-600);
}

.servicio-detalle.venta .servicio-lista li::before,
.servicio-detalle.alquiler .servicio-lista li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
}

/* Textos para compra (fondo azul) */
.servicio-detalle.compra .servicio-texto h2 {
    color: var(--color-white);
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

.servicio-detalle.compra .servicio-texto h2 span {
    color: var(--color-accent);
    display: block;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.servicio-detalle.compra .servicio-texto p {
    color: var(--gray-300);
    margin-bottom: 1rem;
    line-height: 1.8;
    font-size: 1.1rem;
}

.servicio-detalle.compra .servicio-texto strong {
    color: var(--color-white);
}

.servicio-detalle.compra .servicio-lista li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--gray-300);
}

.servicio-detalle.compra .servicio-lista li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
}

.servicio-lista {
    list-style: none;
    margin: 1.5rem 0;
}

/* ============================================
   5. BOTONES
   ============================================ */
.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--color-accent);
    color: var(--color-white);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-accent);
    border: none;
    cursor: pointer;
    margin-top: 1rem;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.6);
    background: var(--color-accent-hover);
}

/* ============================================
   6. PROCESO
   ============================================ */
.proceso {
    background: var(--color-primary);
    color: var(--color-white);
    padding: 5rem 2rem;
}

.proceso-container {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.proceso h2 {
    font-size: clamp(1.8rem, 4vw, 2.2rem);
    margin-bottom: 3rem;
    color: var(--color-white);
}

.proceso-pasos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.paso {
    padding: 2rem;
    position: relative;
}

.paso-numero {
    width: 60px;
    height: 60px;
    background: var(--color-accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow-accent);
}

.paso h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    color: var(--color-white);
}

.paso p {
    opacity: 0.9;
    font-size: 0.95rem;
    color: var(--gray-300);
}

/* ============================================
   7. CTA FINAL
   ============================================ */
.cta-final {
    padding: 5rem 2rem;
    text-align: center;
    background: var(--gray-100);
}

.cta-final h2 {
    color: var(--gray-900);
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 1rem;
}

.cta-final p {
    color: var(--gray-600);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   8. FOOTER
   ============================================ */
footer {
    background: var(--color-primary);
    color: var(--gray-300);
    padding: 3rem 2rem 1rem;
    text-align: center;
}

.footer-content {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    text-align: left;
}

.footer-section h3 {
    color: var(--color-accent);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.footer-section p, 
.footer-section a {
    color: var(--gray-300);
    text-decoration: none;
    line-height: 1.8;
    margin-bottom: 0.5rem;
    transition: color var(--transition-fast);
}

.footer-section a:hover {
    color: var(--color-accent);
}

.footer-bottom {
    border-top: 1px solid var(--color-secondary);
    padding-top: 2rem;
    color: var(--gray-400);
    font-size: 0.9rem;
}

/* ============================================
   9. WHATSAPP FLOAT
   ============================================ */
.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 40px;
    right: 40px;
    background: #25d366;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-base);
    animation: pulse 2s infinite;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    animation: none;
}

.whatsapp-float img {
    width: 35px;
    height: 35px;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
    50% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.6); }
}

/* ============================================
   10. ANIMACIONES
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   11. RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .nav-links {
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 70px;
    }
    
    .nav-links {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background: var(--color-white);
        flex-direction: column;
        padding: 2rem;
        gap: 0;
        box-shadow: var(--shadow-lg);
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
        animation: slideDown 0.3s ease;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .mobile-menu {
        display: flex;
    }
    
    .dropdown {
        width: 100%;
        border-bottom: 1px solid var(--gray-200);
        padding: 0.5rem 0;
    }
    
    .dropdown > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
    }
    
    .dropdown-menu {
        position: static;
        box-shadow: none;
        opacity: 1;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        transform: none;
        transition: max-height 0.3s ease, padding 0.3s;
        background: var(--gray-50);
        border-radius: 0;
        margin: 0.5rem -2rem 0 -2rem;
        width: calc(100% + 4rem);
        padding: 0;
        border: none;
    }
    
    .dropdown.active .dropdown-menu {
        visibility: visible;
        max-height: 300px;
        padding: 0.5rem 0;
    }
    
    .dropdown-menu::before {
        display: none;
    }
    
    .dropdown-menu a {
        padding-left: 3rem;
    }
    
    .dropdown-menu a:hover {
        padding-left: 3.5rem;
    }
    
    .page-header {
        padding: 4rem 1.5rem;
    }
    
    .servicio-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .servicio-detalle.compra .servicio-container {
        direction: ltr;
    }
    
    .servicio-imagen {
        height: 250px;
        order: -1;
    }
    
    .proceso-pasos {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-content {
        text-align: center;
    }
    
    .whatsapp-float {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-float img {
        width: 30px;
        height: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .whatsapp-float {
        animation: none;
    }
}