/**
 * ==========================================================================
 * BAGSANDGO HEADER STYLES - REFACTORIZADO CON BEM
 * ==========================================================================
 * 
 * Modern header with smart scroll, adaptive colors, and mobile-first approach
 * BEM Architecture | CSS Variables | Performance Optimized
 * 
 * @package BagsAndGo
 * @version 2.0.1
 */

/* ==========================================================================
   CSS VARIABLES - ADAPTIVE HEADER MODES
   ========================================================================== */

:root {
    /* Default: Transparent White Mode (Home) */
    --header-bg: transparent;
    --header-text: #ffffff;
    --header-text-hover: #FF6B35;
    --header-border: rgba(255, 255, 255, 0.1);
    --header-shadow: none;
    
    /* Logo visibility */
    --logo-white-display: block;
    --logo-color-display: none;
    
    /* Mobile Menu */
    --mobile-menu-bg: rgba(18, 30, 53, 0.98);
    --mobile-menu-text: #ffffff;
    --mobile-menu-border: rgba(255, 255, 255, 0.1);
    --mobile-menu-hover-bg: rgba(255, 255, 255, 0.1);
    
    /* Dropdown */
    --dropdown-bg: rgba(18, 30, 53, 0.98);
    --dropdown-text: #ffffff;
    --dropdown-border: rgba(255, 255, 255, 0.1);
    
    /* Banner - DESACTIVADO */
    --banner-bg: #FF6B35;
    --banner-text: #ffffff;
    
    /* Dimensions - SIN BANNER */
    --header-banner-height: 0px;
    --header-main-height: 80px;
    --header-total-height: 80px; /* Solo header main, sin banner */
    
    /* Transitions */
    --header-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --scroll-transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header Dark Mode (Posts, Archives) */
body.header-dark {
    --header-bg: #121E35;
    --header-text: #ffffff;
    --header-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    
    --logo-white-display: block;
    --logo-color-display: none;
    
    --mobile-menu-bg: rgba(18, 30, 53, 0.98);
    --mobile-menu-text: #ffffff;
    
    --dropdown-bg: rgba(18, 30, 53, 0.98);
    --dropdown-text: #ffffff;
}

/* Header Light Mode (FAQ, Pricing, Contact, Blog) */
body.header-light {
    --header-bg: #ffffff;
    --header-text: #121E35;
    --header-text-hover: #FF6B35;
    --header-border: rgba(18, 30, 53, 0.1);
    --header-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    
    --logo-white-display: none;
    --logo-color-display: block;
    
    --mobile-menu-bg: rgba(255, 255, 255, 0.98);
    --mobile-menu-text: #121E35;
    --mobile-menu-border: rgba(18, 30, 53, 0.1);
    --mobile-menu-hover-bg: rgba(18, 30, 53, 0.05);
    
    --dropdown-bg: rgba(255, 255, 255, 0.98);
    --dropdown-text: #121E35;
    --dropdown-border: rgba(18, 30, 53, 0.1);
}

/* ==========================================================================
   SITE HEADER - CONTAINER PRINCIPAL
   ========================================================================== */

.site-header {
    position: fixed;
    top: 20px; /* Separado del borde superior */
    left: 50%;
    transform: translateX(-50%); /* Centrado horizontal */
    z-index: 9999;
    width: calc(100% - 40px); /* 20px margen a cada lado */
    max-width: 1600px; /* Aumentado para contenido del nav (era 1400px) */
    transition: var(--scroll-transition);
    will-change: transform;
}

/* Smart Scroll States */
.site-header.is-hidden {
    transform: translateX(-50%) translateY(-100%); /* Mantiene centrado al ocultar */
}

/* Wrapper unificado para control total */
.site-header__inner {
    position: relative;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: var(--header-transition);
    overflow: visible; /* IMPORTANTE: visible para permitir dropdowns */
    /* Usar clip-path solo para el contenido interno, no para dropdowns */
}

/* Pseudo-elemento para mantener el border-radius visual */
.site-header__inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    border-radius: inherit;
    z-index: -1;
    pointer-events: none;
}

/* ==========================================================================
   BANNER PROMOCIONAL - DESACTIVADO
   ========================================================================== */

.site-header__banner {
    display: none; /* Banner desactivado temporalmente */
    height: var(--header-banner-height);
    background: var(--banner-bg);
    overflow: hidden;
    position: relative;
}

.banner__link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.banner__ticker {
    display: flex;
    animation: ticker-scroll 30s linear infinite;
    will-change: transform;
}

.ticker__item {
    flex-shrink: 0;
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--header-banner-height);
}

.ticker__text {
    font-size: 14px;
    font-weight: 500;
    color: var(--banner-text);
    white-space: nowrap;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

/* ==========================================================================
   HEADER PRINCIPAL
   ========================================================================== */

.site-header__main {
    height: var(--header-main-height);
    border-bottom: none;
    border-radius: 16px;
    /* NO overflow hidden - los dropdowns son position: absolute y no se ven afectados por el overflow del padre */
    position: relative;
    background: transparent; /* El fondo lo maneja el inner */
}

.header-main__container {
    width: 100%;
    margin: 0 auto;
    padding: 0 32px; /* Padding interno para el contenido */
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Cambiado de center a space-between para mejor distribución */
    gap: 24px; /* Reducido para dar más espacio al contenido */
}

/* ==========================================================================
   LOGO
   ========================================================================== */

.header-main__logo {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.logo__link {
    display: block;
    line-height: 0;
}

.logo__img {
    height: 36px;
    max-width: 200px;
    width: auto;
    transition: opacity 0.3s ease;
}

.logo__img--white {
    display: var(--logo-white-display);
}

.logo__img--color {
    display: var(--logo-color-display);
}

.logo__tagline {
    display: none; /* Oculto por defecto, mostrar solo en desktop grande */
    flex-direction: column;
    gap: 2px;
}

.tagline__line {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.2;
    color: var(--header-text);
    white-space: nowrap;
}

/* ==========================================================================
   NAVEGACIÓN DESKTOP
   ========================================================================== */

.header-main__nav {
    display: none; /* Mobile first: oculto por defecto */
    align-items: center;
    gap: 24px; /* Reducido de 32px para contenido más compacto */
    flex: 1; /* Toma espacio disponible */
    justify-content: center; /* Centra el nav dentro de su espacio */
    max-width: 800px; /* Máximo para que no se extienda demasiado */
}

.nav__item {
    position: relative;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--header-text);
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

.nav__link:hover {
    color: var(--header-text-hover);
}

.nav__text {
    white-space: nowrap;
}

.nav__arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.nav__item--dropdown.is-open .nav__arrow {
    transform: rotate(180deg);
}

/* Dropdowns */
.nav__dropdown {
    position: absolute;
    top: calc(100% + 8px); /* Espacio desde el nav item */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 300px;
    background: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1000; /* Aumentado para aparecer sobre todo */
}

.nav__item--dropdown.is-open .nav__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: all;
}

.dropdown__content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Services Dropdown */
.service__item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    text-decoration: none;
    color: var(--dropdown-text);
    transition: all 0.2s ease;
}

body.header-light .service__item {
    background: rgba(18, 30, 53, 0.03);
}

.service__item:hover {
    background: rgba(255, 107, 53, 0.1);
    transform: translateY(-2px);
}

.service__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 107, 53, 0.1);
    border-radius: 8px;
}

.service__icon svg {
    width: 24px;
    height: 24px;
    color: #FF6B35;
}

.service__content h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--dropdown-text);
}

.service__content p {
    font-size: 13px;
    margin: 0 0 6px 0;
    opacity: 0.7;
}

.service__price {
    font-size: 14px;
    font-weight: 600;
    color: #FF6B35;
}

/* Locations Dropdown */
.nav__dropdown--locations {
    min-width: 400px;
}

.locations__grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.location__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: background 0.2s ease;
}

body.header-light .location__row {
    background: rgba(18, 30, 53, 0.02);
}

.location__row:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.header-light .location__row:hover {
    background: rgba(18, 30, 53, 0.05);
}

.location__info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.location__icon {
    font-size: 20px;
    line-height: 1;
}

.location__name {
    font-size: 14px;
    font-weight: 500;
    color: var(--dropdown-text);
}

.location__actions {
    display: flex;
    gap: 8px;
}

.location__action {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.location__action--transfer {
    background: #FF6B35;
    color: #ffffff;
}

.location__action--transfer:hover {
    background: #FF5722;
    transform: translateY(-1px);
}

.location__action--storage {
    background: rgba(255, 255, 255, 0.1);
    color: var(--dropdown-text);
}

body.header-light .location__action--storage {
    background: rgba(18, 30, 53, 0.08);
}

.location__action--storage:hover {
    background: rgba(255, 255, 255, 0.2);
}

body.header-light .location__action--storage:hover {
    background: rgba(18, 30, 53, 0.15);
}

/* ==========================================================================
   HEADER ACTIONS
   ========================================================================== */

.header-main__actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

/* Language Switcher */
.header-actions__language {
    display: none; /* Mobile first: oculto por defecto */
}

.language__toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

body.header-light .language__toggle {
    background: rgba(18, 30, 53, 0.05);
}

.language__toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

body.header-light .language__toggle:hover {
    background: rgba(18, 30, 53, 0.1);
}

.language__toggle img {
    width: 20px;
    height: 14px;
    border-radius: 2px;
}

.language__toggle span {
    font-size: 13px;
    font-weight: 600;
    color: var(--header-text);
}

/* CTA Button */
.header-actions__cta {
    display: block; /* CAMBIADO: Visible por defecto (mobile-first) */
}

.cta__button {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px; /* Más compacto para mobile */
    background: #FF6B35;
    color: #ffffff;
    font-size: 13px; /* Más pequeño para mobile */
    font-weight: 700;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    white-space: nowrap;
}

/* Desktop size */
@media (min-width: 768px) {
    .cta__button {
        padding: 12px 24px;
        font-size: 14px;
    }
}

.cta__button:hover {
    background: #FF5722;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.cta__text {
    white-space: nowrap;
}

/* Mobile Menu Toggle - VISIBLE POR DEFECTO EN MOBILE */
.header-actions__mobile-toggle {
    display: flex; /* VISIBLE por defecto para mobile-first */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.toggle__line {
    width: 24px;
    height: 2px;
    background: var(--header-text);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-actions__mobile-toggle.is-active .toggle__line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.header-actions__mobile-toggle.is-active .toggle__line:nth-child(2) {
    opacity: 0;
}

.header-actions__mobile-toggle.is-active .toggle__line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   MOBILE MENU - SIMPLE & FUNCTIONAL REBUILD
   ========================================================================== */

/* Overlay - Backdrop oscuro */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9998;
}

body.mobile-menu-open .mobile-overlay {
    opacity: 1;
    visibility: visible;
}

/* Panel deslizante desde la derecha */
.mobile-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 380px;
    height: 100%;
    background: #ffffff;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.mobile-menu-open .mobile-panel {
    transform: translateX(0);
}

/* Header del panel con logo y botón cerrar */
.mobile-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mobile-panel__logo img {
    height: 32px;
    width: auto;
}

.mobile-panel__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-panel__close:hover {
    background: #e0e0e0;
}

.mobile-panel__close svg {
    width: 20px;
    height: 20px;
    color: #121E35;
}

/* Contenido del panel - navegación clonada */
.mobile-panel__content {
    padding: 20px;
}

.mobile-panel__nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-panel__nav li {
    margin-bottom: 8px;
}

.mobile-panel__nav a {
    display: block;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
    color: #121E35;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.mobile-panel__nav a:hover {
    background: #f5f5f5;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - MOBILE FIRST
   ========================================================================== */

/* Mobile Base Styles (ya definidos arriba) */

/* Tablet Portrait (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .site-header {
        width: calc(100% - 32px);
        max-width: 1000px;
    }
    
    .header-main__container {
        padding: 0 24px;
        gap: 20px;
    }
    
    /* En tablet: mostrar nav simplificada */
    .header-main__nav {
        display: flex;
        gap: 16px;
    }
    
    .nav__link {
        font-size: 14px;
    }
    
    /* Ocultar tagline en tablet */
    .logo__tagline {
        display: none;
    }
    
    /* Mostrar language switcher y CTA */
    .header-actions__language {
        display: block;
    }
    
    .header-actions__cta {
        display: block;
    }
    
    /* Ocultar hamburger en tablet */
    .header-actions__mobile-toggle {
        display: none;
    }
    
    /* Dropdowns más compactos */
    .nav__dropdown {
        min-width: 280px;
    }
    
    .nav__dropdown--locations {
        min-width: 350px;
    }
}

/* Desktop (1025px+) */
@media (min-width: 1025px) {
    /* Show desktop navigation completa */
    .header-main__nav {
        display: flex;
        gap: 32px;
    }
    
    /* Show language switcher */
    .header-actions__language {
        display: block;
    }
    
    /* Show CTA button */
    .header-actions__cta {
        display: block;
    }
    
    /* Hide mobile menu toggle */
    .header-actions__mobile-toggle {
        display: none;
    }
    
    /* Show logo tagline */
    .logo__tagline {
        display: flex;
    }
}

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
    .site-header {
        max-width: 1700px; /* Más ancho en pantallas grandes (era 1600px) */
    }
    
    .header-main__container {
        padding: 0 48px; /* Más padding en pantallas grandes */
        gap: 32px; /* Más espacio entre elementos */
    }
    
    .header-main__nav {
        gap: 32px; /* Más espacio en nav grande */
        max-width: 900px; /* Más ancho para nav en pantallas grandes */
    }
    
    .nav__link {
        font-size: 16px;
    }
}

/* Mobile (hasta 767px) */
@media (max-width: 767px) {
    /* Header floating ajustado para mobile */
    .site-header {
        top: 12px; /* Menos margen superior en mobile */
        width: calc(100% - 24px); /* 12px margen a cada lado */
        max-width: none; /* Sin max-width en mobile */
    }
    
    .site-header__inner {
        border-radius: 12px; /* Border radius más pequeño en mobile */
    }
    
    .site-header__main {
        height: 60px;
    }
    
    .header-main__container {
        padding: 0 16px;
        gap: 12px;
    }
    
    .logo__img {
        height: 28px;
        max-width: 145px; /* Tamaño máximo del logo en mobile */
    }
    
    .header-main__actions {
        gap: 12px;
    }
    
    /* MOSTRAR hamburger en mobile */
    .header-actions__mobile-toggle {
        display: flex !important;
    }
    
    /* Ocultar elementos desktop pero MANTENER CTA */
    .header-main__nav,
    .header-actions__language {
        display: none !important;
    }
    
    /* CTA visible y compacto en mobile */
    .header-actions__cta {
        display: block !important; /* VISIBLE */
        order: 1; /* Antes del hamburger */
    }
    
    .cta__button {
        padding: 8px 12px !important; /* Extra compacto */
        font-size: 12px !important;
        border-radius: 6px !important;
    }
    
    .header-actions__mobile-toggle {
        order: 2; /* Hamburger después del CTA */
    }
    
    /* Asegurar que mobile menu esté disponible */
    .mobile-menu__overlay {
        display: block;
    }
    
    /* Update CSS variables for mobile - SIN BANNER */
    :root {
        --header-banner-height: 0px;
        --header-main-height: 60px;
        --header-total-height: 60px;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.skip-link:focus {
    position: absolute !important;
    left: 6px !important;
    top: 6px !important;
    z-index: 999999;
}

/* Focus visible styles */
.nav__link:focus-visible,
.cta__button:focus-visible,
.language__toggle:focus-visible {
    outline: 2px solid #FF6B35;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   BODY SPACING FOR FLOATING HEADER
   ========================================================================== */

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .site-header {
        position: static;
    }
    
    .site-header__banner,
    .header-actions__cta,
    .header-actions__mobile-toggle,
    .mobile-menu {
        display: none !important;
    }
}
