/* ===== HEADER MODERNO CON ESTRUCTURA MEJORADA ===== */

/* Header principal - Diseño clean y sofisticado */
.site-header {
    background: linear-gradient(180deg, 
        rgba(248, 249, 250, 0.95) 0%, 
        rgba(255, 255, 255, 0.90) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 1px 0 rgba(0, 0, 0, 0.05),
        0 8px 32px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Barra superior con información de contacto */
.header-top-bar {
    background: linear-gradient(135deg, 
        rgba(139, 0, 0, 0.08) 0%, 
        rgba(139, 0, 0, 0.05) 100%);
    border-bottom: 1px solid rgba(139, 0, 0, 0.1);
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.header-contact {
    display: flex;
    align-items: center;
}

.contact-item {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s ease;
}

.contact-item:hover {
    color: #3f111c;
}

.contact-item a {
    color: inherit;
    text-decoration: none;
}

.header-social {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(139, 0, 0, 0.08);
    color: #3f111c;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover {
    background: #3f111c;
    color: white;
    transform: translateY(-2px);
}

/* Navegación principal moderna */
.main-navigation {
    position: relative;
    z-index: 10;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    gap: 2rem;
}

/* Sección del logo mejorada */
.logo-section {
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-link:hover {
    transform: translateY(-2px);
}

.site-logo {
    height: 45px;
    width: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: contrast(1.1) brightness(1.05);
    border-radius: 8px;
}

.brand-link:hover .site-logo {
    transform: scale(1.05);
    filter: contrast(1.15) brightness(1.1);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.brand-name {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.02em;
    line-height: 1;
}

.brand-tagline {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
    line-height: 1;
}

/* Botón móvil moderno */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    padding: 0.75rem;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.mobile-menu-toggle:hover {
    border-color: #3f111c;
    background: rgba(139, 0, 0, 0.05);
    transform: scale(1.05);
}

.menu-line {
    display: block;
    width: 20px;
    height: 2px;
    background: #374151;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 1px;
}

.mobile-menu-toggle:hover .menu-line {
    background: #3f111c;
}

.menu-text {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    margin-top: 0.125rem;
}

/* Navegación principal */
.primary-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.01em;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
    color: #3f111c;
    background: rgba(139, 0, 0, 0.08);
    border-color: rgba(139, 0, 0, 0.15);
    transform: translateY(-1px);
}

.nav-icon {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: #6b7280;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover .nav-icon {
    color: #3f111c;
    transform: scale(1.1);
}

.nav-text {
    white-space: nowrap;
}

/* Acciones secundarias */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.action-item {
    position: relative;
}

.action-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem;
    border-radius: 8px;
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-link:hover {
    background: rgba(139, 0, 0, 0.08);
    border-color: rgba(139, 0, 0, 0.2);
    transform: scale(1.05);
    color: #3f111c;
}

.action-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    animation: pulse 2s infinite;
    min-width: 20px;
    text-align: center;
}

/* Usuario */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    flex-shrink: 0;
}

.avatar-img,
.avatar-img-large {
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
}

.avatar-img {
    width: 32px;
    height: 32px;
}

.avatar-img-large {
    width: 48px;
    height: 48px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1;
}

.user-role {
    font-size: 0.7rem;
    color: #6b7280;
    line-height: 1;
}

/* Mega Menu moderno */
.mega-menu {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.5);
    margin-top: 0.75rem;
    padding: 0;
    min-width: 600px;
    max-width: 800px;
    overflow: hidden;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.mega-menu-content {
    padding: 2rem;
}

.mega-menu-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.mega-menu-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
    font-family: 'Inter', sans-serif;
}

.mega-menu-subtitle {
    color: #6b7280;
    font-size: 1rem;
    margin: 0;
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.mega-menu-grid.vineyards {
    grid-template-columns: 1.5fr 1fr 1fr;
}

.mega-menu-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mega-menu-featured {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, 
        rgba(139, 0, 0, 0.08) 0%, 
        rgba(139, 0, 0, 0.05) 100%);
    border: 1px solid rgba(139, 0, 0, 0.15);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: inherit;
}

.mega-menu-featured:hover {
    background: linear-gradient(135deg, 
        rgba(139, 0, 0, 0.12) 0%, 
        rgba(139, 0, 0, 0.08) 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 0, 0, 0.15);
}

.featured-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #3f111c;
    color: white;
    border-radius: 12px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.featured-content h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.featured-content p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    font-family: 'Inter', sans-serif;
}

.section-title.red-wines {
    color: #dc2626;
}

.section-title.white-wines {
    color: #d97706;
}

.section-title.vineyards-primary {
    color: #059669;
}

.section-title.vineyards-secondary {
    color: #7c3aed;
}

.menu-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.menu-item:hover {
    background: rgba(139, 0, 0, 0.06);
    color: #3f111c;
    transform: translateX(4px);
    border-color: rgba(139, 0, 0, 0.1);
}

.item-icon {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.item-icon.red {
    background: #dc2626;
}

.item-icon.white {
    background: #d97706;
}

.item-icon.vineyard {
    background: #059669;
}

/* Menu de usuario mejorado */
.user-menu {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px) saturate(200%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 0;
    min-width: 280px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.user-menu-header {
    background: linear-gradient(135deg, 
        rgba(139, 0, 0, 0.08) 0%, 
        rgba(139, 0, 0, 0.05) 100%);
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.user-profile-full {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-name-full {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.user-role-full {
    font-size: 0.875rem;
    color: #6b7280;
}

.user-menu-body {
    padding: 1rem;
}

.user-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 0.25rem;
}

.user-menu .menu-item:hover {
    background: rgba(139, 0, 0, 0.08);
    color: #3f111c;
    transform: translateX(4px);
}

.user-menu .menu-item.logout {
    color: #dc2626;
    margin-top: 0.5rem;
}

.user-menu .menu-item.logout:hover {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
}

.menu-divider {
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(0, 0, 0, 0.08) 50%, 
        transparent);
    margin: 0.75rem 0;
}

.user-menu .menu-item i {
    width: 14px;
    text-align: center;
    font-size: 0.8rem;
}

/* Animaciones de entrada */
.nav-item.dropdown:hover .mega-menu,
.user-dropdown:hover .user-menu {
    display: block;
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* Login button styling */
.login-btn {
    background: linear-gradient(135deg, #3f111c 0%, #A0522D 100%);
    color: white !important;
    border: none;
    padding: 0.75rem 1.5rem;
}

.login-btn:hover {
    background: linear-gradient(135deg, #660000 0%, #8B4513 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 0, 0, 0.25);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .nav-container {
        padding: 0 1.5rem;
    }
    
    .brand-text {
        display: none;
    }
    
    .mega-menu {
        min-width: 500px;
        max-width: 90vw;
    }
    
    .mega-menu-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    .mega-menu-grid.vineyards {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 991px) {
    .header-top-bar {
        display: none;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .primary-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(25px) saturate(200%);
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 16px;
        margin: 1rem;
        padding: 1.5rem;
        box-shadow: 
            0 20px 25px -5px rgba(0, 0, 0, 0.1),
            0 10px 10px -5px rgba(0, 0, 0, 0.04);
        flex-direction: column;
        gap: 0.5rem;
        z-index: 1000;
    }
    
    .navbar-collapse.show .primary-nav {
        display: flex;
    }
    
    .nav-link {
        justify-content: flex-start;
        padding: 0.75rem 1rem;
        width: 100%;
        border: 1px solid rgba(0, 0, 0, 0.06);
        background: rgba(248, 250, 252, 0.8);
        font-size: 0.8rem;
    }
    
    .nav-actions {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
    }
    
    .action-link {
        justify-content: center;
        width: 100%;
        padding: 0.75rem;
        font-size: 0.8rem;
    }
    
    .mega-menu {
        position: static !important;
        transform: none !important;
        margin-top: 0.5rem;
        min-width: auto;
        max-width: none;
        border-radius: 12px;
    }
    
    .mega-menu-content {
        padding: 1.5rem;
    }
    
    .mega-menu-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .mega-menu-grid.vineyards {
        grid-template-columns: 1fr;
    }
    
    .mega-menu-featured {
        padding: 1.25rem;
    }
    
    .user-menu {
        position: static !important;
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .site-logo {
        height: 40px;
    }
}

@media (max-width: 576px) {
    .nav-container {
        padding: 0 0.75rem;
    }
    
    .nav-wrapper {
        padding: 0.75rem 0;
        gap: 1rem;
    }
    
    .site-logo {
        height: 35px;
    }
    
    .mobile-menu-toggle {
        padding: 0.625rem;
        width: 42px;
        height: 42px;
    }
    
    .menu-line {
        width: 18px;
        height: 2px;
    }
    
    .menu-text {
        font-size: 0.6875rem;
    }
    
    .primary-nav {
        margin: 0.75rem;
        padding: 1.25rem;
    }
    
    .nav-link {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    .mega-menu-content {
        padding: 1.25rem;
    }
    
    .mega-menu-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }
    
    .mega-menu-title {
        font-size: 1.25rem;
    }
    
    .mega-menu-subtitle {
        font-size: 0.9rem;
    }
    
    .mega-menu-featured {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
    
    .featured-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
}

/* Efectos de entrada mejorados */
html {
    scroll-behavior: smooth;
}

.mega-menu,
.user-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.98);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item.dropdown:hover .mega-menu,
.user-dropdown:hover .user-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Estados de focus mejorados para accesibilidad */
.nav-link:focus,
.action-link:focus,
.mobile-menu-toggle:focus,
.menu-item:focus {
    outline: 2px solid #3f111c;
    outline-offset: 2px;
    border-radius: 12px;
}

/* Micro-interacciones */
.nav-link,
.action-link,
.menu-item,
.mobile-menu-toggle {
    will-change: transform;
}

/* Scroll effects */
.site-header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px) saturate(200%);
    box-shadow: 
        0 1px 0 rgba(0, 0, 0, 0.08),
        0 12px 40px rgba(0, 0, 0, 0.08);
}

.site-header.scrolled .header-top-bar {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

/* Loading states */
.nav-link.loading,
.action-link.loading {
    position: relative;
    pointer-events: none;
}

.nav-link.loading::after,
.action-link.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: #3f111c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark mode support (preparado para futuras implementaciones) */
@media (prefers-color-scheme: dark) {
    /* Las variables CSS pueden ser implementadas aquí para soporte de tema oscuro */
}

/* Reducir motion para usuarios con preferencias de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .nav-link,
    .action-link,
    .menu-item,
    .mobile-menu-toggle,
    .mega-menu,
    .user-menu {
        transition: none;
        animation: none;
    }
}

/* Print styles */
@media print {
    .site-header {
        display: none;
    }
}