/* ===================================================================
   NAVBAR APPLE GLASS PRO MAX — PREMIUM (MEJORADO)
   =================================================================== */

/* ==============================================================
   TRANSICIONES Y ANIMACIONES SUAVES
   ============================================================== */

/* Transición suave para el dropdown */
.nav-dropdown .dropdown-content {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

/* Dropdown abierto */
.nav-dropdown.open .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Animación de la flecha */
.dropdown-arrow {
    display: inline-block;
    transition: transform 0.3s ease;
    margin-left: 5px;
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

/* Mejorar hover en items del dropdown */
.dropdown-item {
    transition: all 0.2s ease;
    background-color: #fff4f9;
}

.dropdown-item:hover {
    transition: all 0.2s ease;
    color: white !important;
    background-color: red !important;
}


/* Asegurar que el dropdown tenga suficiente área de hover */
.nav-dropdown {
    position: relative;
}

/* Agregar padding invisible para extender el área de hover */
.nav-dropdown.open::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

/* Dropdown móvil con transición */
#mobileMenu .dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobileMenu .nav-dropdown.mobile-active .dropdown-content {
    max-height: 300px;
}

/* Fade in para los items del dropdown móvil */
#mobileMenu .dropdown-content a {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

#mobileMenu .nav-dropdown.mobile-active .dropdown-content a {
    opacity: 1;
    transform: translateX(0);
}

/* Agregar delays escalonados para efecto cascada */
#mobileMenu .nav-dropdown.mobile-active .dropdown-content a:nth-child(1) {
    transition-delay: 0.1s;
}

#mobileMenu .nav-dropdown.mobile-active .dropdown-content a:nth-child(2) {
    transition-delay: 0.15s;
}

#mobileMenu .nav-dropdown.mobile-active .dropdown-content a:nth-child(3) {
    transition-delay: 0.2s;
}

#mobileMenu .nav-dropdown.mobile-active .dropdown-content a:nth-child(4) {
    transition-delay: 0.25s;
}

/* Cursor pointer para mejor UX */
.dropdown-btn {
    cursor: pointer;
    user-select: none;
}

/* Indicador visual cuando está activo */
.nav-dropdown.has-active .dropdown-btn {
    color: #3498db;
    font-weight: 600;
}

/* Sombra suave para el dropdown */
.dropdown-content {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Hover smooth en desktop */
@media (min-width: 769px) {
    .nav-dropdown:hover .dropdown-content {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }
}

/* Altura base del nav */
:root {
    --nav-height: 75px;
    --nav-height-scrolled: 65px;

    /* Fondos mejorados con más transparencia */
    --nav-glass-bg: rgba(255, 255, 255, 0.25);
    --nav-glass-bg-scrolled: rgba(255, 255, 255, 0.4);

    /* Bordes más sutiles */
    --nav-glass-border: rgba(255, 255, 255, 0.35);

    /* Sombras más dramáticas */
    --nav-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --nav-glass-shadow-scrolled: 0 4px 24px rgba(0, 0, 0, 0.12);
}

/* ============================================================
   NAVBAR BASE MEJORADO
   ============================================================ */
.navbar {
    width: 100%;
    position: fixed;
    top: 0;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    z-index: 9999;

    background: var(--nav-glass-bg);
    border-bottom: 1px solid var(--nav-glass-border);
    box-shadow: var(--nav-glass-shadow);

    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Contenedor interno */
.nav-container {
    max-width: 1400px;
    width: 100%;
    margin: auto;
    padding: 0 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================================
   LOGO MEJORADO (MÁS GRANDE)
   ============================================================ */
.logo {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logo img {
    width: 85px;
    height: 85px;
    border-radius: 16px;
    object-fit: cover;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover img {
    transform: scale(1.08) rotate(2deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Logo más pequeño al scrollear */
.navbar.scrolled .logo img {
    width: 50px;
    height: 50px;
}

/* ============================================================
   LINKS MEJORADOS
   ============================================================ */
.nav-links {
    display: flex;
    gap: 35px;
    list-style: none;
    align-items: center;
    margin: 0;
}

.nav-link {
    padding: 8px 16px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #ffffff;
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.nav-link:hover {
    color: gray;
    transition: 0.5s;
    background: rgba(255, 255, 255, 0.15);
}

.nav-link:hover::after {
    width: 70%;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    color: #001861 !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.nav-link.active::after {
    display: none;
}

/* ============================================================
   DROPDOWN MEJORADO
   ============================================================ */
.nav-dropdown {
    position: relative;
}

.dropdown-arrow {
    font-size: 11px;
    margin-left: 6px;
    transition: transform 0.3s ease;
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-content {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    min-width: 240px;

    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    border-radius: 16px;

    padding: 12px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 10000;
}

/* Mostrar dropdown con hover */
.nav-dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-content:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-dropdown.open .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-item {
    padding: 14px 20px;
    font-size: 14px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
}

.dropdown-item i {
    width: 18px;
    text-align: center;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.15);
    padding-left: 24px;
}

.dropdown-item.active {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-weight: 700;
}

/* ============================================================
   CARRITO MEJORADO
   ============================================================ */
.cart-icon {
    background: #001861;
    padding: 8px 10px;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    font-size: 15px;
    color: #ffffff;
}

.cart-icon:hover {
    background: orange;
    color: black;
    transform: scale(1.05);
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: rgba(255, 255, 255, 0.9);
    color: #000000;
    border-radius: 999px;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 700;
    display: none;
    min-width: 18px;
    text-align: center;
}

.cart-badge.show { 
    display: inline-block;
    animation: badgePulse 0.3s ease;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ============================================================
   SCROLLED STATE (ESTILO SAFARI IOS MEJORADO)
   ============================================================ */
.navbar.scrolled {
    height: var(--nav-height-scrolled);
    background:rgb(255 255 255 / 0%);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    box-shadow: var(--nav-glass-shadow-scrolled);
    animation: slideDown 0.4s ease;
}

.navbar.scrolled .nav-link{
    color: white;
     text-shadow:
    1px 1px 1px black,
    2px 2px 1px black;
}

.navbar.scrolled .nav-link.active{
    color: yellow !important;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================================
   HAMBURGER MEJORADO
   ============================================================ */
.hamburger {
    width: 30px;
    height: 24px;
    display: none;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    z-index: 100000;
}

.hamburger span {
    width: 100%;
    height: 3px;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger.active span:nth-child(1) { 
    transform: translateY(10px) rotate(45deg); 
}

.hamburger.active span:nth-child(2) { 
    opacity: 0;
    transform: translateX(-20px);
}

.hamburger.active span:nth-child(3) { 
    transform: translateY(-10px) rotate(-45deg); 
}

/* ============================================================
   MOBILE MENU MEJORADO
   ============================================================ */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;

    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(30px);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);

    padding: 2rem 1.5rem;
    padding-top: 90px;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99999;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-links li {
    margin-bottom: 0.5rem;
    animation: slideInRight 0.3s ease forwards;
    opacity: 0;
}

.mobile-menu.active .mobile-nav-links li:nth-child(1) { animation-delay: 0.1s; }
.mobile-menu.active .mobile-nav-links li:nth-child(2) { animation-delay: 0.15s; }
.mobile-menu.active .mobile-nav-links li:nth-child(3) { animation-delay: 0.2s; }
.mobile-menu.active .mobile-nav-links li:nth-child(4) { animation-delay: 0.25s; }
.mobile-menu.active .mobile-nav-links li:nth-child(5) { animation-delay: 0.3s; }
.mobile-menu.active .mobile-nav-links li:nth-child(6) { animation-delay: 0.35s; }

@keyframes slideInRight {
    from {
        transform: translateX(30px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.mobile-nav-links a {
    color: #1a1a1a;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-nav-links a i {
    width: 20px;
    text-align: center;
}

.mobile-nav-links a:hover {
    background: rgba(0, 0, 0, 0.06);
}

.mobile-nav-links a.active {
    background: linear-gradient(135deg, #000000 0%, #001861 100%);
    color: #ffffff;
}

/* Dropdown móvil */
.mobile-menu .nav-dropdown .dropdown-content {
    position: static;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transform: none;
    margin-top: 8px;
    margin-left: 20px;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    padding: 0;
}

.mobile-menu .nav-dropdown.mobile-active .dropdown-content {
    opacity: 1;
    visibility: visible;
    max-height: 500px;
    pointer-events: auto;
    padding: 8px 0;
}

.mobile-cart-icon {
    background: rgba(0, 0, 0, 0.06);
    padding: 14px 12px;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mobile-cart-icon:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* ============================================================
   MENU OVERLAY MEJORADO
   ============================================================ */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 9998;
}

.menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   ESTILOS PARA PERFIL DE USUARIO
   ============================================================ */
.user-profile {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.user-initial {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #000000 0%, #001861 100%);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.btn-login {
    background:rgb(5 32 102);
    color: #ffffff !important;
    padding: 10px 24px !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transition: all 0.3s ease !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-login:hover {
    background: rgb(147 3 103 / 97%)!important;
    transform: translateY(-2px) !important;
    box-shadow: 255 6px 20px rgba(0, 0, 0, 0.2) !important;
}

.user-info-dropdown {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 8px;
}

.user-info-name {
    font-weight: 600;
    color: #000000;
    font-size: 0.95rem;
}

.user-info-email {
    font-size: 0.85rem;
    color: #000000;
    margin-top: 2px;
}

.user-role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 6px;
}

.role-admin {
    background: rgba(255, 255, 255, 0.2);
    color: indigo;
}

.role-cliente {
    background: rgba(34, 197, 94, 0.3);
    color: orange;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media(max-width: 900px) {
    .nav-links { 
        display: none; 
    }
    
    .hamburger { 
        display: flex; 
    }
    
    .nav-container {
        padding: 0 1.5rem;
    }
    
    .logo img {
        width: 55px;
        height: 55px;
    }
    
    .navbar.scrolled .logo img {
        width: 45px;
        height: 45px;
    }
}

@media(max-width: 480px) {
    .mobile-menu {
        width: 90%;
    }
    
    .logo img {
        width: 50px;
        height: 50px;
    }
}