/* ========================================
   HEADER COMPONENT - ESTUDIO-WEB
   Enfoque: MOBILE FIRST
   Breakpoints: 300px → 480px → 768px → 1024px → 1280px
   ======================================== */

/* ========== VARIABLES LOCALES ========== */
:root {
    --header-height-mobile: 60px;
    --header-height-desktop: 72px;
}

/* ========================================
   BASE - MÓVIL VERTICAL (300px+)
   ======================================== */

/* Header Base */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height-mobile);
    background: var(--secondary);
    z-index: 1000;
    transition: all 0.3s ease;
}

.header.scrolled {
    background: rgba(23, 43, 77, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Container del Header */
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Logo */
.header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 1001;
}

.header-logo-img {
    height: 38px;
    width: auto;
    transition: transform 0.3s ease;
}

/* Acciones del Header (CTA + Toggle) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* CTA Button - Visible en TODAS las resoluciones */
.header-cta {
    display: block;
}

.btn-header-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-header-cta:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

/* En móvil: mostrar texto, ocultar icono */
.btn-header-cta .btn-text {
    display: inline;
}

.btn-header-cta i {
    display: none;
}

/* Toggle Hamburguesa */
.header-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 4px;
}

.toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Cuando el menú está abierto, ocultar el toggle */
.header-toggle.active {
    display: none;
}

/* Navegación - Oculta por defecto en móvil */
.header-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    padding: 4.5rem 1.25rem 2rem;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    transition: right 0.35s ease;
    overflow-y: auto;
    z-index: 1000;
}

.header-nav.show {
    right: 0;
}

/* Lista de navegación */
.header-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-nav-item {
    position: relative;
}

.header-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.header-nav-link:hover,
.header-nav-link.active {
    background: var(--gray-100);
    color: var(--primary);
}

/* Flecha dropdown */
.dropdown-arrow {
    font-size: 0.875rem;
    color: var(--gray-500);
    transition: transform 0.2s ease;
}

.has-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown - Móvil */
.header-dropdown {
    max-height: 0;
    overflow: hidden;
    background: var(--gray-50);
    border-radius: 8px;
    margin-top: 0.25rem;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.has-dropdown.open .header-dropdown {
    max-height: 600px;
    padding: 0.5rem;
}

.dropdown-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dropdown-section {
    padding: 0.25rem;
}

.dropdown-label {
    display: block;
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: var(--gray-100);
}

.dropdown-item.active {
    background: rgba(0, 82, 204, 0.08);
}

.dropdown-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    font-size: 1rem;
    flex-shrink: 0;
}

.dropdown-highlight {
    background: rgba(255, 107, 53, 0.06);
    border-radius: 6px;
    margin-top: 0.25rem;
}

.dropdown-highlight .dropdown-icon {
    background: var(--accent);
}

/* Item especial para Funcionalidades Adicionales */
.dropdown-item-extras {
    background: rgba(255, 107, 53, 0.06);
    border-radius: 6px;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 107, 53, 0.2);
    padding-top: 0.875rem;
}

.dropdown-item-extras .dropdown-icon {
    background: var(--accent);
}

.dropdown-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.dropdown-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--secondary);
}

.dropdown-desc {
    font-size: 0.9375rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Botón cerrar móvil */
.header-nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 36px;
    height: 36px;
    background: var(--gray-100);
    border: none;
    border-radius: 8px;
    font-size: 1.125rem;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-nav-close:hover {
    background: var(--gray-200);
    color: var(--secondary);
}

/* Overlay */
.header-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.header-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Body padding para compensar header fijo */
body {
    padding-top: var(--header-height-mobile);
}

/* ========================================
   MÓVIL HORIZONTAL (480px+)
   ======================================== */
@media (min-width: 480px) {
    .header-container {
        padding: 0 1.25rem;
    }
    
    .header-logo-img {
        height: 42px;
    }
    
    /* CTA: Mostrar texto + icono */
    .btn-header-cta {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
    
    .btn-header-cta .btn-text {
        display: inline;
    }
    
    .btn-header-cta i {
        display: inline;
        font-size: 0.75rem;
        transition: transform 0.2s ease;
    }
    
    .btn-header-cta:hover i {
        transform: translateX(3px);
    }
    
    /* Nav panel más ancho */
    .header-nav {
        max-width: 360px;
        padding: 5rem 1.5rem 2rem;
    }
}

/* ========================================
   TABLET VERTICAL (768px+)
   ======================================== */
@media (min-width: 768px) {
    :root {
        --header-height-mobile: 68px;
    }
    
    .header-container {
        padding: 0 1.5rem;
    }
    
    .header-logo-img {
        height: 46px;
    }
    
    .btn-header-cta {
        padding: 0.5rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .header-nav {
        max-width: 380px;
    }
}

/* ========================================
   DESKTOP (1024px+)
   ======================================== */
@media (min-width: 1024px) {
    :root {
        --header-height-mobile: var(--header-height-desktop);
    }
    
    .header-container {
        padding: 0 2rem;
    }
    
    .header-logo-img {
        height: 50px;
    }
    
    /* Ocultar toggle */
    .header-toggle {
        display: none;
    }
    
    /* Navegación inline */
    .header-nav {
        position: static;
        width: auto;
        max-width: none;
        height: auto;
        background: transparent;
        padding: 0;
        box-shadow: none;
        overflow: visible;
    }
    
    .header-nav-close {
        display: none;
    }
    
    .header-nav-list {
        flex-direction: row;
        align-items: center;
        gap: 0.25rem;
    }
    
    .header-nav-link {
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
        color: rgba(255, 255, 255, 0.85);
        justify-content: flex-start;
    }
    
    .header-nav-link:hover,
    .header-nav-link.active {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }
    
    .dropdown-arrow {
        color: rgba(255, 255, 255, 0.7);
    }
    
    /* Dropdown desktop */
    .header-dropdown {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        width: 480px;
        max-height: none;
        overflow: visible;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 
                    0 0 0 1px rgba(0, 0, 0, 0.05);
        opacity: 0;
        visibility: hidden;
        padding: 0.5rem;
        margin-top: 0;
        transition: all 0.25s ease;
    }
    
    .has-dropdown:hover .header-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
    
    .has-dropdown.open .header-dropdown {
        max-height: none;
    }
    
    .has-dropdown:hover .dropdown-arrow {
        transform: rotate(180deg);
    }
    
    .dropdown-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .dropdown-section {
        padding: 0.5rem;
    }
    
    .dropdown-highlight {
        background: var(--gray-50);
    }
    
    .dropdown-item {
        padding: 0.75rem;
    }
    
    .dropdown-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }
    
    .dropdown-title {
        font-size: 0.875rem;
    }
    
    .dropdown-desc {
        font-size: 0.75rem;
        white-space: normal;
    }
    
    /* CTA Desktop */
    .btn-header-cta {
        padding: 0.625rem 1.5rem;
        font-size: 0.875rem;
    }
    
    .header-actions {
        gap: 0;
    }
}

/* ========================================
   DESKTOP GRANDE (1280px+)
   ======================================== */
@media (min-width: 1280px) {
    .header-container {
        padding: 0 3rem;
    }
    
    .header-nav-link {
        padding: 0.625rem 1.125rem;
    }
    
    .header-dropdown {
        width: 540px;
    }
}

/* ========================================
   PANTALLAS MUY PEQUEÑAS (<340px)
   ======================================== */
@media (max-width: 340px) {
    .header-container {
        padding: 0 0.5rem;
    }
    
    .header-logo-img {
        height: 32px;
    }
    
    .btn-header-cta {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
    
    .header-toggle {
        width: 28px;
        height: 28px;
    }
}
