/**
 * Xeora Frontend Header Menu Styles
 * 
 * Stili per l'header menu unificato Xeora.
 * Responsive design con supporto mobile hamburger menu.
 * 
 * @package Xeora
 * @subpackage Assets/CSS/Frontend
 * @since 2.2.0
 * @updated 2.3.0 - Add button styles for modal auth
 * @updated 3.3.0 - Add dropdown menu and two-tier navigation
 * @updated 3.3.1 - Fix dropdown text visibility
 */

/* ==========================================================================
   VARIABILI CSS
   ========================================================================== */
:root {
    --xeora-header-bg: #222222;
    --xeora-header-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --xeora-header-height: 70px;
    --xeora-text-color: #ffffff;
    --xeora-text-hover: #4da6ff;
    --xeora-primary-color: #0073aa;
    --xeora-primary-hover: #005a87;
    --xeora-transition: all 0.3s ease;
    --xeora-mobile-breakpoint: 768px;
    --xeora-dropdown-bg: #2a2a2a;  /* ✅ FIX: Sfondo scuro dropdown */
    --xeora-dropdown-text: #e0e0e0;  /* ✅ FIX: Testo chiaro */
    --xeora-dropdown-text-hover: #4da6ff;
    --xeora-dropdown-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   HEADER PRINCIPALE
   ========================================================================== */
.xeora-header-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--xeora-header-bg) !important;
    box-shadow: var(--xeora-header-shadow);
    z-index: 9999;
    transition: var(--xeora-transition);
}

/* Dark header variant - white text */
.xeora-header-dark,
.xeora-header-dark .xeora-header-container,
.xeora-header-dark .xeora-menu-link,
.xeora-header-dark .xeora-dropdown-toggle,
.xeora-header-dark .xeora-text {
    color: #ffffff !important;
}

/* Container */
.xeora-header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: var(--xeora-header-height);
}

/* ==========================================================================
   LOGO
   ========================================================================== */
.xeora-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.xeora-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.xeora-logo-img {
    height: 50px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    transition: var(--xeora-transition);
}

.xeora-logo-img:hover {
    opacity: 0.9;
}

/* ==========================================================================
   NAVIGATION MENU
   ========================================================================== */
.xeora-nav {
    display: flex;
    align-items: center;
    gap: 40px;
}

.xeora-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Primary navigation (always visible) */
.xeora-menu-primary {
    gap: 15px;
}

/* Secondary navigation (user account) */
.xeora-menu-secondary {
    gap: 12px;
}

.xeora-menu-item {
    margin: 0;
    padding: 0;
    position: relative;
}

.xeora-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    text-decoration: none;
    color: var(--xeora-text-color);
    font-weight: 500;
    font-size: 15px;
    border-radius: 6px;
    transition: var(--xeora-transition);
    white-space: nowrap;
}

.xeora-menu-link:hover {
    color: var(--xeora-text-hover);
    background: rgba(0, 115, 170, 0.05);
}

/* Primary links (Prenota, Eventi) - more emphasis */
.xeora-link-primary {
    font-weight: 600;
    font-size: 16px;
}

/* Icon */
.xeora-icon {
    font-size: 18px;
    line-height: 1;
}

/* ==========================================================================
   DROPDOWN MENU
   ========================================================================== */

.xeora-dropdown {
    position: relative;
}

.xeora-dropdown-toggle {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--xeora-text-color);
    font-weight: 500;
    font-size: 15px;
    border-radius: 6px;
    transition: var(--xeora-transition);
    white-space: nowrap;
}

.xeora-dropdown-toggle:hover {
    color: var(--xeora-text-hover);
    background: rgba(0, 115, 170, 0.05);
}

.xeora-dropdown-toggle:focus {
    outline: none;
}

.xeora-dropdown-toggle:focus-visible {
    outline: 2px solid var(--xeora-primary-color);
    outline-offset: 2px;
}

.xeora-dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.xeora-dropdown.active .xeora-dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu */
.xeora-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--xeora-dropdown-bg);
    border-radius: 8px;
    box-shadow: var(--xeora-dropdown-shadow);
    list-style: none;
    margin: 0;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.xeora-dropdown.active .xeora-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.xeora-dropdown-item {
    margin: 0;
    padding: 0;
}

.xeora-dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--xeora-dropdown-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--xeora-transition);
}

.xeora-dropdown-link:hover {
    background: rgba(0, 115, 170, 0.08);
    color: var(--xeora-dropdown-text-hover);
}

.xeora-dropdown-link .xeora-icon {
    font-size: 16px;
}

.xeora-dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 8px 0;
}

/* Logout link in dropdown */
.xeora-dropdown-link.xeora-logout {
    color: #dc3545;
}

.xeora-dropdown-link.xeora-logout:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #c82333;
}

/* ==========================================================================
   BUTTON STYLES (per modal auth)
   ========================================================================== */

/* Reset button styles e applica stili link */
.xeora-menu-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
}

.xeora-menu-btn:focus {
    outline: none;
}

.xeora-menu-btn:focus-visible {
    outline: 2px solid var(--xeora-primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   PRIMARY BUTTON
   ========================================================================== */
.xeora-btn-primary {
    background: var(--xeora-primary-color);
    color: #ffffff !important;
    font-weight: 600;
    padding: 10px 20px;
}

.xeora-btn-primary:hover {
    background: var(--xeora-primary-hover);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

/* Logout link */
.xeora-logout {
    color: #dc3545 !important;
}

.xeora-logout:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #c82333 !important;
}

/* ==========================================================================
   MOBILE TOGGLE
   ========================================================================== */
.xeora-mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--xeora-transition);
}

.xeora-mobile-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.xeora-hamburger-line {
    width: 100%;
    height: 3px;
    background: #b8cc0b; /* ✅ FIX: Icona menu colore richiesto */
    border-radius: 2px;
    transition: var(--xeora-transition);
}

/* ✅ FIX: Dropdown background scuro */
.xeora-dropdown-menu {
    background: #2a2a2a !important;
    border: 1px solid rgba(184, 204, 11, 0.2); /* Bordo sottile colore #b8cc0b */
}

/* Animazione hamburger → X */
.xeora-mobile-toggle[aria-expanded="true"] .xeora-hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.xeora-mobile-toggle[aria-expanded="true"] .xeora-hamburger-line:nth-child(2) {
    opacity: 0;
}

.xeora-mobile-toggle[aria-expanded="true"] .xeora-hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ==========================================================================
   HEADER SPACER
   ========================================================================== */
.xeora-header-spacer {
    height: var(--xeora-header-height);
    width: 100%;
}

/* ==========================================================================
   RESPONSIVE - MOBILE
   ========================================================================== */
@media (max-width: 768px) {
    /* Logo più piccolo */
    .xeora-logo-img {
        height: 40px;
    }

    /* Mostra hamburger menu */
    .xeora-mobile-toggle {
        display: flex;
    }


    /* Menu verticale */
    .xeora-menu {
        flex-direction: column;
        gap: 0;
        width: 100%;
        padding: 0 20px;
    }

    /* Separatore visivo tra primary e secondary */
    .xeora-menu-primary {
        padding-bottom: 15px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .xeora-menu-secondary {
        padding-top: 5px;
    }

    .xeora-menu-item {
        width: 100%;
    }

    .xeora-menu-link,
    .xeora-menu-btn,
    .xeora-dropdown-toggle {
        width: 100%;
        justify-content: flex-start;
        padding: 14px 16px;
        border-radius: 8px;
    }

    /* Separatore tra voci */
    .xeora-menu-item:not(:last-child) {
        margin-bottom: 8px;
    }

    /* Button full width su mobile */
    .xeora-btn-primary {
        width: 100%;
        justify-content: center;
    }

    /* Dropdown su mobile - Full width sotto toggle */
    .xeora-dropdown-menu {
        position: static;
        width: 100%;
        margin-top: 8px;
        box-shadow: none;
        border: 1px solid rgba(255, 255, 255, 0.1);
        transform: none;
        background: #2a2a2a;  /* ✅ FIX: Sfondo scuro su mobile */
    }

    .xeora-dropdown.active .xeora-dropdown-menu {
        transform: none;
    }

    .xeora-dropdown-link {
        padding: 12px 20px;
        color: var(--xeora-text-color);
    }

    .xeora-dropdown-link:hover {
        background: rgba(0, 115, 170, 0.08);
    }
}

/* ==========================================================================
   TABLET
   ========================================================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .xeora-header-container {
        padding: 0 30px;
    }

    .xeora-nav {
        gap: 30px;
    }

    .xeora-menu {
        gap: 10px;
    }

    .xeora-menu-link,
    .xeora-menu-btn,
    .xeora-dropdown-toggle {
        font-size: 14px;
        padding: 8px 12px;
    }

    .xeora-link-primary {
        font-size: 15px;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Focus visible per accessibilità keyboard */
.xeora-menu-link:focus-visible,
.xeora-menu-btn:focus-visible,
.xeora-dropdown-toggle:focus-visible,
.xeora-dropdown-link:focus-visible,
.xeora-mobile-toggle:focus-visible {
    outline: 2px solid var(--xeora-primary-color);
    outline-offset: 2px;
}

/* Riduci animazioni per utenti con preferenze ridotte */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
    .xeora-header-menu,
    .xeora-header-spacer {
        display: none;
    }
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Hide on mobile */
.xeora-hide-mobile {
    display: block;
}

@media (max-width: 768px) {
    .xeora-hide-mobile {
        display: none;
    }
}

/* Hide on desktop */
.xeora-hide-desktop {
    display: none;
}

@media (max-width: 768px) {
    .xeora-hide-desktop {
        display: block;
    }
}

/* ==========================================================================
   LANGUAGE SWITCHER
   ========================================================================== */
.xeora-menu-language {
    margin-left: auto; /* Push language switcher to the far right */
    gap: 5px;
}

.xeora-lang-switch {
    padding: 8px 10px;
    min-width: 44px;
    justify-content: center;
}

.xeora-lang-switch:hover {
    background: rgba(255, 255, 255, 0.1);
}

.xeora-lang-switch.active {
    background: rgba(255, 255, 255, 0.15);
    position: relative;
}

.xeora-lang-switch.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.xeora-lang-flag {
    font-size: 18px;
    line-height: 1;
}

/* Language switcher on mobile */
@media (max-width: 768px) {
    .xeora-menu-language {
    margin-left: auto; /* Push language switcher to the far right */
        padding: 10px 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        margin-bottom: 10px;
        width: 100%;
        justify-content: center;
    }
    
    .xeora-lang-switch {
        width: 60px;
        justify-content: center;
    }

    
    .xeora-nav.mobile-open {
        right: 0;
    }
    
    .xeora-mobile-overlay {
        display: none;
    }
    
    .xeora-mobile-overlay[style*="display: block"] {
        display: block !important;
    }
}

/* === EMERGENCY MOBILE SIDEBAR FIX === */
@media (max-width: 768px) {
    .xeora-nav {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 80% !important;
        max-width: 300px !important;
        height: 100vh !important;
        background: #222222 !important;
        flex-direction: column !important;
        padding: 60px 20px 20px !important;
        gap: 20px !important;
        box-shadow: -2px 0 10px rgba(0,0,0,0.1) !important;
        transition: right 0.3s ease !important;
        z-index: 9999 !important;
        overflow-y: auto !important;
        display: flex !important;
    }
    
    .xeora-nav.mobile-open {
        right: 0 !important;
    }
}
@media (max-width: 768px) {
    
    #xeora-header-menu .xeora-nav.mobile-open {
        right: 0 !important;
    }
}

/* Desktop dropdown - uses .active on dropdown */
@media (min-width: 769px) {
    .xeora-menu-customer .xeora-dropdown-toggle {
        display: flex !important;
    }
}

/* Mobile customer menu - convert dropdown to vertical list when menu is open */
@media (max-width: 768px) {
    /* Hide the toggle button on mobile */
    .xeora-menu-customer .xeora-dropdown-toggle {
        display: none !important;
    }
    
    /* Show dropdown menu inside mobile nav when menu is open */
    .xeora-nav.mobile-open .xeora-menu-customer .xeora-dropdown-menu {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: static !important;
        transform: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        min-width: auto !important;
    }
    
    .xeora-nav.mobile-open .xeora-menu-customer .xeora-dropdown-item {
        width: 100% !important;
    }
    
    .xeora-nav.mobile-open .xeora-menu-customer .xeora-dropdown-link {
        padding: 12px 20px !important;
        display: block !important;
        background: rgba(255,255,255,0.1) !important;
        margin-bottom: 2px !important;
    }
    
    .xeora-menu-customer .xeora-dropdown-divider {
        display: none;
    }
}
