/* ============================================
   HEADER PREMIUM - VERSIÓN DEFINITIVA
   ============================================ */

/* ============ VARIABLES ============ */
:root {
    --header-bg: var(--secondary, #03045E);
    --header-bg-scrolled: rgba(3, 4, 94, 0.98);
    --header-border: #2FA39A;
    --header-text: rgba(255, 255, 255, 0.95);
    --header-text-hover: var(--accent, #B8FB3C);
    --header-icon: #2FA39A;
    --dropdown-bg: #0B0C6E;
    --dropdown-border: rgba(47, 163, 154, 0.5);
    --dropdown-hover: rgba(184, 251, 60, 0.15);
    --whatsapp-bg: #25D366;
    --whatsapp-hover: #128C7E;
    --whatsapp-glow: rgba(37, 211, 102, 0.4);
    --transition: all 0.3s ease;
}

/* ============ HEADER PRINCIPAL ============ */
header {
    background: var(--header-bg);
    padding: 0.6rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: transform 0.4s ease, padding 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid var(--header-border);
}

header.scrolled {
    padding: 0.4rem 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: var(--header-bg-scrolled);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
}

header.header-hidden {
    transform: translateY(-100%);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    position: relative;
}

/* ============ LOGO ============ */
.logo {
    display: flex;
    align-items: center;
    z-index: 1001;
    flex-shrink: 0;
}

.logo:focus-visible {
    outline: 2px solid var(--header-text-hover);
    outline-offset: 4px;
    border-radius: 4px;
}

.logo-img {
    height: 55px;
    width: auto;
    max-width: 200px;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: brightness(1.1) drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

@media (hover: hover) {
    .logo:hover .logo-img {
        transform: scale(1.08);
        filter: brightness(1.2) drop-shadow(0 4px 8px rgba(184,251,60,0.3));
    }
}

/* ============ NAVEGACIÓN PRINCIPAL ============ */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.2rem;
    position: relative;
}

.nav-item {
    position: static; /* Cambiado a static para que los dropdowns se posicionen relativos al header */
}

.nav-link {
    color: var(--header-text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.8px;
    padding: 0.6rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: var(--transition);
    text-transform: uppercase;
    font-family: 'Poppins', sans-serif;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.nav-link:focus-visible {
    outline: 2px solid var(--header-text-hover);
    outline-offset: 4px;
    border-radius: 4px;
}

.nav-link i {
    font-size: 0.7rem;
    color: var(--header-icon);
    transition: transform 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--header-text-hover);
    border-bottom-color: var(--header-text-hover);
}

.nav-link:hover i {
    transform: rotate(180deg);
    color: var(--header-text-hover);
}

/* ============ DROPDOWNS - VERSIÓN CORREGIDA ============ */
/* Contenedor para posicionar todos los dropdowns */
.header-content {
    position: relative;
}

/* Dropdown base - TODOS CON LA MISMA POSICIÓN */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: min(90vw, 1000px);
    min-width: 900px; /* Ancho mínimo fijo para desktop */
    background: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: 20px;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-height: 80vh;
    overflow-y: auto;
    
    /* Grid de 3 columnas - FORZADO */
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem !important;
    align-items: start;
}

/* Ajuste para pantallas más pequeñas */
@media (max-width: 1300px) {
    .dropdown-menu {
        min-width: 800px;
        width: min(95vw, 900px);
        gap: 0.8rem !important;
    }
}

@media (max-width: 1100px) {
    .dropdown-menu {
        min-width: 700px;
        width: min(95vw, 800px);
        padding: 1.2rem;
    }
}

/* Items del dropdown - ESTILO COMPACTO */
.dropdown-menu .dropdown-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    text-decoration: none;
    padding: 0.8rem !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(184, 251, 60, 0.1) !important;
    transition: all 0.3s ease;
    color: white;
    gap: 0.8rem;
    width: 100%;
    min-width: 0; /* Para evitar desbordamiento */
    height: auto;
    box-sizing: border-box;
}

.dropdown-menu .dropdown-item:hover {
    background: rgba(184, 251, 60, 0.15) !important;
    border-color: var(--accent) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2) !important;
}

/* Imagen - TAMAÑO FIJO */
.dropdown-menu .dropdown-item .item-image {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--header-border);
    position: relative;
}

.dropdown-menu .dropdown-item .item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Badge */
.item-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--accent);
    color: var(--secondary);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    white-space: nowrap;
}

/* Contenido del item - CON CONTROL DE DESBORDAMIENTO */
.dropdown-menu .dropdown-item .item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0; /* Importante para text-overflow */
    overflow: hidden;
}

.dropdown-menu .dropdown-item .item-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.dropdown-menu .dropdown-item .item-price {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.2;
    margin: 0;
}

.dropdown-menu .dropdown-item .item-desc {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.dropdown-menu .dropdown-item .item-duration {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin-top: 0.1rem;
    white-space: nowrap;
}

.dropdown-menu .dropdown-item .item-duration i {
    color: var(--accent);
    font-size: 0.55rem;
}

/* Características - EN LÍNEA */
.dropdown-menu .dropdown-item .item-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    margin-top: 0.15rem;
}

.dropdown-menu .dropdown-item .item-features span {
    background: rgba(184, 251, 60, 0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.5rem;
    color: var(--accent);
    border: 1px solid rgba(184, 251, 60, 0.2);
    white-space: nowrap;
}

/* Precio total */
.dropdown-menu .dropdown-item .item-total-price {
    margin-top: 0.1rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.1rem;
    white-space: nowrap;
}

/* Item "Ver Todos" - ANCHO COMPLETO */
.dropdown-menu .view-all-item {
    grid-column: 1 / -1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    background: rgba(184, 251, 60, 0.1) !important;
    border: 2px dashed var(--accent) !important;
    margin-top: 0.5rem;
    padding: 0.8rem !important;
    min-height: auto !important;
    width: 100% !important;
}

.dropdown-menu .view-all-item .item-content {
    align-items: center;
    text-align: center;
}

.dropdown-menu .view-all-item .item-title {
    color: var(--accent) !important;
    font-size: 0.9rem !important;
}

.dropdown-menu .view-all-item .item-desc i {
    font-size: 0.8rem;
    color: var(--accent);
    animation: arrow-pulse 1.5s infinite;
}

/* Flecha del dropdown */
.nav-item.dropdown::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: var(--dropdown-bg);
    border-left: 1px solid var(--dropdown-border);
    border-top: 1px solid var(--dropdown-border);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
    pointer-events: none;
}

.nav-item.dropdown:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Scrollbar */
.dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu::-webkit-scrollbar-track {
    background: var(--dropdown-bg);
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

/* Responsive - OCULTAR EN MÓVIL */
@media (max-width: 992px) {
    .dropdown-menu {
        display: none !important;
    }
    
    .nav-item.dropdown::before {
        display: none;
    }
}

/* ============ BOTÓN WHATSAPP ============ */
.whatsapp-btn {
    background: var(--whatsapp-bg);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: 0 4px 15px var(--whatsapp-glow);
    flex-shrink: 0;
    position: relative;
    animation: pulse-whatsapp 2s infinite;
}

@keyframes pulse-whatsapp {
    0% { box-shadow: 0 0 0 0 var(--whatsapp-glow); }
    70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.whatsapp-btn:hover {
    background: var(--whatsapp-hover);
    transform: scale(1.15) rotate(5deg);
    animation: none;
}

/* ============ BOTÓN HAMBURGUESA ============ */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 32px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    flex-shrink: 0;
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: var(--transition);
    transform-origin: center;
}

.hamburger-menu.active span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-menu.active span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

/* ============ MENÚ MÓVIL ============ */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(85%, 400px);
    height: 100vh;
    background: linear-gradient(135deg, var(--dropdown-bg) 0%, #0A0B5E 100%);
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 40px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
}

.mobile-menu-overlay.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(184, 251, 60, 0.2);
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 5;
}

.mobile-logo img {
    height: 45px;
    width: auto;
}

.close-menu {
    background: rgba(184, 251, 60, 0.1);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: 1px solid rgba(184, 251, 60, 0.2);
}

.close-menu:hover {
    background: var(--header-text-hover);
    color: var(--header-bg);
    transform: rotate(90deg) scale(1.1);
}

/* Navegación móvil */
.mobile-nav-list {
    list-style: none;
    margin: 0 0 2rem 0;
    padding: 0;
}

.mobile-nav-item {
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateX(20px);
    animation: slideInMobile 0.4s ease forwards;
}

.mobile-nav-item:nth-child(1) { animation-delay: 0.05s; }
.mobile-nav-item:nth-child(2) { animation-delay: 0.1s; }
.mobile-nav-item:nth-child(3) { animation-delay: 0.15s; }
.mobile-nav-item:nth-child(4) { animation-delay: 0.2s; }
.mobile-nav-item:nth-child(5) { animation-delay: 0.25s; }
.mobile-nav-item:nth-child(6) { animation-delay: 0.3s; }
.mobile-nav-item:nth-child(7) { animation-delay: 0.35s; }
.mobile-nav-item:nth-child(8) { animation-delay: 0.4s; }
.mobile-nav-item:nth-child(9) { animation-delay: 0.45s; }

@keyframes slideInMobile {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 12px;
    transition: var(--transition);
    background: rgba(255,255,255,0.03);
    text-transform: uppercase;
    border: 1px solid rgba(184, 251, 60, 0.1);
}

.mobile-nav-link i {
    font-size: 0.9rem;
    color: #2FA39A;
    transition: transform 0.3s ease;
}

.mobile-nav-link:hover {
    background: rgba(184, 251, 60, 0.1);
    color: var(--header-text-hover);
    border-color: rgba(184, 251, 60, 0.3);
    transform: translateX(5px);
}

/* Submenú móvil */
.mobile-submenu {
    list-style: none;
    margin: 0.5rem 0 0 1rem;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.mobile-nav-item.has-submenu.active .mobile-submenu {
    max-height: 800px;
}

.mobile-submenu li {
    margin-bottom: 0.3rem;
}

.mobile-submenu li a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem 0.7rem 1.5rem;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
}

.mobile-submenu li a .submenu-image {
    width: 35px;
    height: 35px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(184, 251, 60, 0.2);
}

.mobile-submenu li a .submenu-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mobile-submenu li a .submenu-content {
    flex: 1;
}

.mobile-submenu li a .submenu-title {
    font-weight: 500;
    display: block;
}

.mobile-submenu li a .submenu-price {
    font-size: 0.75rem;
    color: var(--header-text-hover);
}

.mobile-submenu li a:hover {
    color: var(--header-text-hover);
    background: rgba(184, 251, 60, 0.1);
    padding-left: 2rem;
}

/* View All móvil */
.view-all-mobile {
    justify-content: center !important;
    background: rgba(184, 251, 60, 0.1) !important;
    margin-top: 0.5rem !important;
}

.view-all-mobile .submenu-title {
    color: var(--accent) !important;
    font-weight: 600 !important;
}

/* WhatsApp móvil */
.mobile-nav-link.whatsapp-link {
    background: var(--whatsapp-bg);
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1rem;
    border: none;
    font-size: 1.1rem;
    padding: 1.2rem;
    border-radius: 50px;
    animation: pulse-whatsapp-mobile 2s infinite;
}

@keyframes pulse-whatsapp-mobile {
    0% { box-shadow: 0 0 0 0 var(--whatsapp-glow); }
    70% { box-shadow: 0 0 0 12px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.mobile-nav-link.whatsapp-link i {
    color: white;
    font-size: 1.3rem;
}

.mobile-nav-link.whatsapp-link:hover {
    background: var(--whatsapp-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4);
}

/* Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1200px) {
    .logo-img {
        height: 48px;
        max-width: 170px;
    }
    
    .nav-list {
        gap: 0.8rem;
    }
    
    .nav-link {
        font-size: 0.75rem;
        padding: 0.6rem 0.4rem;
    }
}

@media (max-width: 992px) {
    .main-nav {
        display: none;
    }
    
    .hamburger-menu {
        display: flex;
    }
    
    .whatsapp-btn {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.5rem 0;
    }
    
    .logo-img {
        height: 42px;
        max-width: 150px;
    }
    
    .whatsapp-btn {
        display: none;
    }
    
    .hamburger-menu {
        width: 30px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .logo-img {
        height: 38px;
        max-width: 130px;
    }
    
    .hamburger-menu {
        width: 28px;
        height: 20px;
    }
    
    .mobile-menu-overlay {
        width: 90%;
    }
    
    .mobile-nav-link {
        padding: 0.9rem 1rem;
        font-size: 0.95rem;
    }
}

/* ============ UTILIDADES ============ */
.container {
    width: min(90%, 1280px);
    margin: 0 auto;
    padding: 0 20px;
}

body.menu-open {
    overflow: hidden;
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .whatsapp-btn,
    .logo:hover .logo-img {
        animation: none !important;
        transform: none !important;
    }
}