/**
 * HEADER COMPONENT STYLES - LOGO WITH HASHTAG
 */

.main-header {
    width: 100%;
    z-index: 1000;
}

.header-main-section {
    padding: 22px 0;
}

.header-main-section .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- LOGO: BOLD MODERN WITH HASHTAG --- */
.logo-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all var(--transition-smooth);
}

.logo-wrapper:hover {
    transform: translateY(-1px);
}

.logo-icon {
    height: 48px;
    width: 48px;
    object-fit: contain;
    border-radius: 50%;
    background: transparent;
    padding: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: all var(--transition-smooth);
}

.logo-wrapper:hover .logo-icon {
    transform: scale(1.06) rotate(-4deg);
    box-shadow: 0 6px 15px rgba(255, 77, 109, 0.25);
    filter: drop-shadow(0 0 4px rgba(255, 77, 109, 0.2));
}

.logo-text-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-main {
    font-family: var(--font-heading);
    font-size: 36px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-peco {
    color: var(--brand-pink);
    transition: color var(--transition-fast);
}

.logo-relle {
    color: var(--ui-dark);
    transition: color var(--transition-fast);
}

.logo-wrapper:hover .logo-relle {
    color: var(--brand-pink);
}

.logo-wrapper:hover .logo-peco {
    color: var(--ui-dark);
}

.logo-sub {
    font-family: var(--font-main);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--ui-grey);
    margin-top: 3px;
    transition: color var(--transition-fast);
    line-height: 1;
    text-align: center;
}

.logo-wrapper:hover .logo-sub {
    color: var(--brand-pink);
}

/* Footer variant */
.footer-logo-variant .logo-relle {
    color: var(--ui-white) !important;
}

.footer-logo-variant .logo-sub {
    color: #888 !important;
}

.footer-logo-variant:hover .logo-peco {
    color: var(--ui-white) !important;
}

.footer-logo-variant:hover .logo-relle {
    color: var(--brand-pink) !important;
}

.footer-logo-variant:hover .logo-sub {
    color: var(--ui-white) !important;
}

/* --- TAGLINE --- */
.tagline {
    flex-grow: 1;
    text-align: center;
    padding: 0 20px;
}

.tagline-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    padding: 4px 0;
    border-radius: 0;
    border: none;
}

.crown-wrapper {
    position: relative;
    display: inline-block;
}

.king-icon-small {
    position: absolute;
    top: -7px; /* Raised very slightly as requested */
    right: -6px;
    width: 18px;
    height: auto;
    opacity: 0.95; /* Increased opacity for more contrast */
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15)) brightness(0.9); /* Darkened slightly for contrast */
    transform: rotate(12deg);
    transition: var(--transition-fast);
}

.tagline-wrapper:hover .king-icon-small {
    opacity: 1;
    top: -9px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)) brightness(1);
}

.tagline-text {
    font-family: var(--font-heading);
    font-weight: 400; /* Thinner for contrast */
    font-size: 20px;
    color: var(--ui-grey);
    text-transform: none;
    letter-spacing: -0.2px;
    display: block;
}

.tagline-text .accent {
    color: var(--brand-pink);
    font-weight: 900;
    text-shadow: 0 0 10px rgba(255, 77, 109, 0.15);
}

/* --- SEARCH & ACTIONS --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-form-header {
    width: 330px;
    transition: width var(--transition-smooth);
}

.search-form-header:focus-within {
    width: 360px;
}

.search-input-wrapper {
    position: relative;
    background: var(--ui-white);
    border-radius: var(--radius-pill);
    padding: 0 18px;
    height: 38px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    transition: var(--transition-smooth);
    width: 100%;
}

.search-input-wrapper:focus-within {
    border-color: var(--brand-pink);
    box-shadow: 0 4px 15px rgba(255, 77, 109, 0.2);
}

.search-field {
    background: transparent;
    border: none;
    color: var(--ui-dark);
    padding: 0;
    outline: none;
    font-size: 14px;
    width: 100%;
    font-family: var(--font-main);
}

.search-submit {
    background: transparent;
    border: none;
    color: var(--brand-pink);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    padding: 0;
}

.btn-insert-header {
    background: var(--brand-pink);
    color: var(--ui-white) !important;
    padding: 9px 22px;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 900;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(255, 77, 109, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-insert-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 77, 109, 0.4);
    filter: brightness(1.1);
}

.btn-insert-header i {
    font-size: 18px;
    display: block;
}

/* --- NAVIGATION BAR --- */
.navigation-wrapper {
    margin-bottom: var(--layout-gap);
    background: var(--ui-dark-grey); /* Sfondo al 100% */
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.main-navigation {
    background: transparent; /* Sfondo rimosso da qui */
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.nav-menu {
    display: flex;
    justify-content: center; /* Centrato */
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li a {
    color: var(--ui-white);
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all var(--transition-fast);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    letter-spacing: 0.5px;
}

.nav-menu li a:hover {
    color: var(--brand-pink);
    background: rgba(255, 255, 255, 0.03);
}

/* --- SECONDARY NAVIGATION BAR --- */
.secondary-navigation-wrapper {
    background: var(--ui-white); /* Elegant clean white background */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05); /* Faint bottom border for separation */
    padding: 8px 0;
}

.secondary-navigation {
    display: flex;
    justify-content: center;
}

.secondary-nav-menu {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.secondary-nav-menu li a {
    color: var(--ui-grey); /* Sophisticated dark grey text */
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: all var(--transition-fast);
    letter-spacing: 0.6px;
    border-radius: var(--radius-sm);
}

.secondary-nav-menu li a:hover {
    color: var(--brand-pink);
    background: rgba(255, 77, 109, 0.06); /* Premium light pink background hover effect */
}

/* --- FILTER BAR --- */
.filter-bar-wrapper {
    padding: 0;
    margin-bottom: var(--layout-gap); /* FIXED 25px */
}

.filter-bar-container {
    background: var(--brand-teal-light);
    border: 1px dashed var(--brand-teal-dark);
    border-radius: 12px;
    padding: 10px 15px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    width: 100%;
    scrollbar-width: none;
}

.filter-pill {
    background: var(--ui-white);
    color: var(--brand-teal-dark);
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
}

.filter-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    color: var(--brand-pink);
}

.filter-pill.active {
    background: var(--brand-teal);
    color: var(--ui-white);
}

/* Responsive */
@media (max-width: 1200px) {
    .tagline { display: none; }
}

/* ============================================================
   MOBILE HEADER (≤768px)
   ============================================================ */
@media (max-width: 768px) {

    /* Lock scroll e overlay quando il menu è aperto */
    body.nav-menu-open {
        overflow: hidden !important;
    }
    
    body.nav-menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 9998;
        animation: fadeIn 0.25s ease;
    }

    /* Logo ridimensionato per mobile */
    .logo-main {
        font-size: 24px !important;
    }
    
    .logo-sub {
        font-size: 8px !important;
        letter-spacing: 0.8px !important;
    }
    
    .logo-icon {
        height: 38px !important;
        width: 38px !important;
    }

    /* Nasconde elementi desktop */
    .search-form-header { display: none !important; }
    .btn-insert-header  { display: none !important; }

    /* Mostra controlli mobile */
    .mobile-header-controls {
        display: flex !important;
        align-items: center;
        gap: 5px;
    }

    .header-main-section { padding: 12px 0; }
    .header-main-section .container { padding: 0 16px; }

    /* ---- HAMBURGER BUTTON ---- */
    .hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        border-radius: 10px;
        transition: background 0.2s;
        position: relative;
        z-index: 10001; /* Sopra al drawer */
    }
    .hamburger-btn:hover { background: rgba(0,0,0,0.05); }
    .hamburger-btn span {
        display: block;
        width: 22px;
        height: 2px;
        background: #0f172a;
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        transform-origin: center;
    }
    
    /* Quando il menu è aperto, rendiamo l'hamburger di colore chiaro per contrastare con il drawer scuro */
    .hamburger-btn.active span {
        background: #ffffff;
    }

    /* Stato aperto */
    .hamburger-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .hamburger-btn.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
    .hamburger-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* ---- MOBILE SEARCH TOGGLE ---- */
    .mobile-search-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        color: #0f172a;
        font-size: 20px;
        border-radius: 10px;
        transition: background 0.2s;
        position: relative;
        z-index: 10001;
    }
    .mobile-search-toggle:hover { background: rgba(0,0,0,0.05); }

    /* ---- MOBILE SEARCH BAR ---- */
    .mobile-search-bar {
        display: none;
        padding: 10px 0 14px;
        background: white;
        border-top: 1px solid #f1f5f9;
        animation: slideDown 0.25s ease;
    }
    .mobile-search-bar.open { display: block; }
    .mobile-search-inner {
        display: flex;
        align-items: center;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 50px;
        padding: 0 16px;
        height: 46px;
        gap: 10px;
    }
    .mobile-search-inner input {
        flex: 1;
        border: none;
        background: transparent;
        font-size: 15px;
        outline: none;
        color: #0f172a;
    }
    .mobile-search-inner button {
        background: none;
        border: none;
        color: var(--brand-pink);
        font-size: 20px;
        cursor: pointer;
        display: flex;
        align-items: center;
        padding: 0;
    }

    /* ---- PREMIUM MOBILE OFF-CANVAS DRAWER ---- */
    .navigation-wrapper {
        display: block !important; /* Sempre attivo per gestire le transizioni CSS */
        position: fixed;
        top: 0;
        right: -320px; /* Nascosto a destra */
        width: 300px;
        height: 100vh;
        margin-bottom: 0 !important; /* Reset desktop margin – drawer è fixed */
        background: rgba(15, 23, 42, 0.97); /* Slate 900 Glassmorphism */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
        z-index: 9999;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        border-left: 1px solid rgba(255, 255, 255, 0.08);
        padding-top: 80px; /* Spazio per non sovrapporsi al logo/hamburger */
        padding-bottom: 40px;
        box-sizing: border-box;
    }
    
    .navigation-wrapper.mobile-open {
        right: 0 !important;
    }

    .navigation-wrapper .container {
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Menu principale nel drawer */
    .nav-menu {
        flex-direction: column !important;
        padding: 0 20px !important;
        margin: 0 !important;
        list-style: none !important;
    }
    
    .nav-menu li {
        width: 100% !important;
    }
    
    .nav-menu li a {
        padding: 12px 16px !important;
        border-right: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        color: rgba(255, 255, 255, 0.9) !important;
        justify-content: flex-start !important;
        border-radius: var(--radius-sm);
        margin-bottom: 4px;
        transition: all var(--transition-fast) !important;
    }
    
    .nav-menu li a:hover,
    .nav-menu li.current-menu-item a {
        color: var(--brand-pink) !important;
        background: rgba(255, 77, 109, 0.08) !important;
        padding-left: 20px !important; /* Effetto traslazione all'hover */
    }

    /* ---- MOBILE SECONDARY NAV (GRID COMPATTA) ---- */
    .secondary-navigation-wrapper {
        background: transparent !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-bottom: none !important;
        margin-top: 20px !important;
        padding: 20px 20px 10px 20px !important;
    }

    .secondary-navigation-wrapper::before {
        content: 'Collegamenti Rapidi';
        display: block;
        font-family: var(--font-heading);
        font-size: 11px;
        font-weight: 900;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.35);
        letter-spacing: 1px;
        margin-bottom: 15px;
        padding-left: 4px;
    }

    .secondary-nav-menu {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
        flex-direction: row !important; /* Sovrascrive flex direction desktop */
    }

    .secondary-nav-menu li {
        width: 100% !important;
        margin: 0 !important;
    }

    .secondary-nav-menu li a {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 10px 8px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        text-align: center;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.7) !important;
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
        border-radius: var(--radius-md) !important;
        transition: all var(--transition-fast) !important;
        width: 100% !important;
        box-sizing: border-box !important;
        letter-spacing: 0.3px;
    }

    .secondary-nav-menu li a:hover {
        color: var(--brand-pink) !important;
        background: rgba(255, 77, 109, 0.08) !important;
        border-color: rgba(255, 77, 109, 0.3) !important;
        transform: translateY(-1px);
    }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    
    @keyframes fadeIn {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}

/* ---- Nasconde .mobile-header-controls su desktop ---- */
@media (min-width: 769px) {
    .mobile-header-controls { display: none !important; }
    .mobile-search-bar { display: none !important; }
}

/* --- USER MENU DROPDOWN (Premium Glassmorphism Style) --- */
.user-menu-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.btn-user-header {
    background: var(--ui-dark);
    color: var(--ui-white) !important;
    padding: 9px 22px;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 900;
    border: 1px solid rgba(255, 77, 109, 0.35);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    outline: none;
}

.btn-user-header:hover {
    background: #1e293b;
    border-color: var(--brand-pink);
    box-shadow: 0 6px 20px rgba(255, 77, 109, 0.25);
    transform: translateY(-2px);
}

.btn-user-header i {
    font-size: 18px;
    display: block;
    color: var(--brand-pink);
}

.btn-user-header .arrow-icon {
    font-size: 12px;
    transition: transform var(--transition-fast);
    color: var(--ui-grey);
}

.user-menu-dropdown-wrapper:hover .btn-user-header .arrow-icon {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(15, 23, 42, 0.96); /* Slate 900 Glassmorphism */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    min-width: 200px;
    padding: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: none;
    z-index: 1100;
    flex-direction: column;
    gap: 4px;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Invisible hover bridge to prevent menu from closing when moving mouse over the 10px gap */
.user-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    height: 15px;
    background: transparent;
}

/* Hover trigger on desktop & JS trigger show */
.user-menu-dropdown-wrapper:hover .user-dropdown-menu,
.user-menu-dropdown-wrapper:focus-within .user-dropdown-menu,
.user-dropdown-menu.show {
    display: flex;
}

.user-dropdown-menu .dropdown-item {
    color: rgba(255, 255, 255, 0.85) !important;
    padding: 10px 16px;
    border-radius: 10px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-fast);
}

.user-dropdown-menu .dropdown-item:hover {
    background: rgba(255, 77, 109, 0.1);
    color: var(--brand-pink) !important;
}

.user-dropdown-menu .dropdown-item i {
    font-size: 18px;
    width: 18px;
    display: flex;
    justify-content: center;
}

.user-dropdown-menu .logout-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444 !important;
}

/* Responsive: Hide user menu on mobile just like the original button */
@media (max-width: 768px) {
    .user-menu-dropdown-wrapper { display: none !important; }
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
