/* ============================================
   VARIABLES GLOBALES
   ============================================ */
:root {
    /* Paleta de colores profesional */
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #dbeafe;
    --secondary-color: #374151;
    --light-color: #f9fafb;
    --light-gray: #f3f4f6;
    --medium-gray: #e5e7eb;
    --white: #ffffff;
    --black: #000000;
    
    /* Variables específicas del header */
    --header-bg: rgba(255, 255, 255, 0.98);
    --header-top-bg: var(--primary-dark);
    --header-top-text: rgba(255, 255, 255, 0.95);
    --header-shadow: 0 4px 20px rgba(30, 58, 138, 0.12);
    --header-border: rgba(30, 58, 138, 0.08);
    --primary-gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    
    /* Variables de diseño */
    --border-radius: 8px;
    --transition: all 0.3s ease;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ============================================
   RESET Y CONFIGURACIÓN BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    font-family: system-ui, -apple-system, sans-serif;
}

/* ============================================
   HEADER PRINCIPAL
   ============================================ */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--header-shadow);
    transition: var(--transition);
    max-width: 100vw;
    overflow: hidden;
}

/* Barra superior del header */
.header-top-bar {
    background: var(--header-top-bg);
    color: var(--header-top-text);
    padding: 8px 0;
    font-size: 0.85rem;
    transition: var(--transition);
    max-height: 40px;
    overflow: hidden;
}

.header-top-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Sección principal del header */
.header-main {
    padding: 15px 0;
    border-bottom: 1px solid var(--header-border);
    transition: var(--transition);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

/* ============================================
   LOGO
   ============================================ */
.logo-wrapper {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.02);
}

.logo-image {
    height: 50px;
    width: auto;
    object-fit: contain;
    transition: filter 0.3s ease;
}

.logo:hover .logo-image {
    filter: brightness(1.1);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-primary {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--primary-color);
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

.logo-secondary {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--secondary-color);
    letter-spacing: 1px;
    margin-top: 2px;
}

/* ============================================
   NAVEGACIÓN PRINCIPAL (DESKTOP)
   ============================================ */
.main-nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-menu {
    display: flex;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 10px;
    transition: var(--transition);
    min-width: 80px;
}

.nav-link:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.nav-link.active {
    background: var(--primary-gradient);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.nav-icon {
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.nav-text {
    font-size: 0.85rem;
}

/* ============================================
   BOTÓN CTA
   ============================================ */
.nav-cta {
    margin-left: 20px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    padding: 12px 25px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--box-shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.2);
}

/* ============================================
   BOTÓN MENÚ MÓVIL
   ============================================ */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.menu-line {
    width: 100%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: var(--transition);
}

.mobile-menu-btn.active .menu-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .menu-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .menu-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ============================================
   OVERLAY PARA MENÚ MÓVIL
   ============================================ */
.nav-overlay {
    display: none;
}

/* ============================================
   RESPONSIVE DESIGN - TABLET Y MÓVIL
   ============================================ */
@media (max-width: 992px) {
    /* Ajustes generales */
    .header-container {
        padding: 0 15px;
    }
    
    /* Ocultar barra superior en móvil */
    .header-top-bar {
        display: none;
    }
    
    /* Reducir padding del header */
    .header-main {
        padding: 12px 0;
    }
    
    /* Ajustar logo */
    .logo-image {
        height: 40px;
    }
    
    .logo-primary {
        font-size: 1.5rem;
    }
    
    .logo-secondary {
        font-size: 0.85rem;
    }
    
    /* Ocultar navegación desktop */
    .main-nav {
        display: none;
    }
    
    /* Mostrar botón menú móvil */
    .mobile-menu-btn {
        display: flex;
    }
    
    /* Estilos para menú móvil activo */
    .main-nav.mobile-active {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        background: var(--white);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 80px 20px 30px;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .nav-menu.mobile-active {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .nav-item.mobile-active {
        width: 100%;
    }
    
    .nav-link.mobile-active {
        flex-direction: row;
        justify-content: flex-start;
        padding: 15px 20px;
        border-radius: 8px;
        min-width: auto;
        gap: 15px;
        font-size: 1rem;
    }
    
    .nav-icon.mobile-active {
        margin-bottom: 0;
        font-size: 1.3rem;
        width: 24px;
    }
    
    .nav-cta.mobile-active {
        margin: 20px 0 0;
        width: 100%;
    }
    
    .btn-primary.mobile-active {
        width: 100%;
        justify-content: center;
    }
    
    /* Overlay para menú móvil */
    .nav-overlay.active {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(3px);
        z-index: 999;
    }
}

/* ============================================
   RESPONSIVE DESIGN - MÓVIL PEQUEÑO
   ============================================ */
@media (max-width: 576px) {
    .header-container {
        padding: 0 10px;
    }
    
    .logo-image {
        height: 35px;
    }
    
    .logo-primary {
        font-size: 1.3rem;
    }
    
    .logo-secondary {
        font-size: 0.75rem;
    }
    
    .btn-primary {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* ============================================
   EFECTO SCROLL (Opcional)
   ============================================ */
.main-header.scrolled {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.main-header.scrolled .header-top-bar {
    max-height: 0;
    padding: 0;
    opacity: 0;
}

.main-header.scrolled .header-main {
    padding: 8px 0;
}

.main-header.scrolled .logo-image {
    height: 40px;
}

.main-header.scrolled .logo-primary {
    font-size: 1.5rem;
}

.main-header.scrolled .logo-secondary {
    font-size: 0.85rem;
}

/* ============================================
   ESTILOS PARA LA BARRA DE PROGRESO (Opcional)
   ============================================ */
.header-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
    z-index: 1001;
}

/* ============================================
   CLASES DE UTILIDAD
   ============================================ */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.text-center {
    text-align: center;
}

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

/* ============================================
   CORRECCIONES ESPECÍFICAS PARA iOS/SAFARI
   ============================================ */
@supports (-webkit-touch-callout: none) {
    .main-header {
        position: -webkit-sticky;
        position: sticky;
    }
    
    .main-nav.mobile-active {
        -webkit-overflow-scrolling: touch;
    }
}