/* ========================================
   MENU & NAVIGATION - STYLES DÉDIÉS
   ======================================== */

/* Variables spécifiques au menu */
:root {
    --header-vertical-padding: 14px;
    --header-backdrop-blur-amount: 8px;
    --header-background-opacity: 0.75;
}

/* ========================================
   HEADER PRINCIPAL - GLASSMORPHISM UNIFIÉ
   ======================================== */
.header {
    position: sticky;
    top: 0;
    z-index: var(--header-z-index); /* Header au-dessus du menu et des dropdowns */
    /* UNIFIÉ: Glassmorphism MEDIUM pour le header */
    background: var(--glass-bg-medium);
    border: 1px solid var(--glass-border-medium);
    border-radius: 8px;
    backdrop-filter: var(--glass-backdrop-medium);
    -webkit-backdrop-filter: var(--glass-backdrop-medium);
    box-shadow: var(--glass-shadow-medium);
    transition: var(--glass-transition);
    margin-bottom: 0; /* colle davantage le bloc suivant */
    width: 100%;
    height: 70px;
    overflow: visible; /* permet au logo de dépasser pour l'effet de relief */
}

/* Mode sombre - UNIFIÉ */
body.dark-mode .header {
    background: var(--glass-bg-medium-dark);
    border-color: var(--glass-border-medium-dark);
    box-shadow: var(--glass-shadow-medium-dark);
}

/* Glassmorphism dynamique - plus spécifique et prioritaire */
.header[data-dynamic-glassmorphism="true"] {
    animation: headerGlassmorphismFadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes headerGlassmorphismFadeIn {
    from {
        opacity: 0.8;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Amélioration de la lisibilité du texte sur le glassmorphism */
.header[data-dynamic-glassmorphism="true"] .logo {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.header[data-dynamic-glassmorphism="true"] .yearly-release-counter {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.header[data-dynamic-glassmorphism="true"] .header-btn {
    text-shadow: none;
    background: none;
    border: none;
    box-shadow: none;
}

/* Amélioration de la recherche sur glassmorphism */
.header[data-dynamic-glassmorphism="true"] .modern-search-wrapper {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: var(--glass-backdrop-subtle);
    -webkit-backdrop-filter: var(--glass-backdrop-subtle);
}

.header[data-dynamic-glassmorphism="true"] .modern-search-wrapper:focus-within {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* Forcer un padding fixe (éviter md:p-4 qui gonfle la hauteur en desktop) */
.controls-wrapper > .flex {
    padding: 12px; /* p-3 constant */
}

.header[data-dynamic-glassmorphism="true"] .modern-search-input {
    color: rgba(255, 255, 255, 0.9);
}

.header[data-dynamic-glassmorphism="true"] .modern-search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.header[data-dynamic-glassmorphism="true"] .modern-search-icon {
    color: var(--text-dark);
    filter: none;
}

.header[data-dynamic-glassmorphism="true"] .modern-search-wrapper:focus-within .modern-search-icon {
    color: var(--primary);
}

/* Mode sombre avec glassmorphism */
body.dark-mode .header[data-dynamic-glassmorphism="true"] .modern-search-wrapper {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .header[data-dynamic-glassmorphism="true"] .modern-search-wrapper:focus-within {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    height: 70px;
    position: relative;
}

/* Piste couvrant tout le header pour Mario/Sonic (quand les onglets sont retirés) */
.header-runner-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1; /* sous le logo et actions (z=2), au-dessus du fond */
}

/* Positionnement du compteur au centre */
.yearly-release-counter-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

/* ========================================
   LOGO ET BRANDING
   ======================================== */
.logo {
    display: flex;
    align-items: flex-end; /* aligne l'image sur le bas du header pour éviter toute coupe en haut */
    text-decoration: none;
    transition: opacity var(--transition-speed) var(--transition-timing);
    outline-offset: 4px;
    height: 70px;
    position: relative;
    z-index: var(--header-logo-z-index); /* logo au-dessus du header */
}

.logo-image {
    height: 91px; /* +30% vs 70px */
    width: auto;
    object-fit: contain;
    display: block; /* évite l'espace inline et toute coupe inattendue */
    transform: translateY(13px); /* ajustement -1px supplémentaire */
    will-change: transform;
    transition: opacity var(--transition-speed) var(--transition-timing);
}

/* Réutilise les sprites globaux de sections.css pour le header */
.header-runner-track .runner-sprite.mario { animation: runnerMarioCycle 10s linear infinite; }
.header-runner-track .runner-sprite.sonic { animation: runnerSonicCycle 10s linear infinite; }

.logo:hover {
    opacity: 0.8;
}

.logo:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    border-radius: 6px;
}

.logo:active {
    opacity: 0.6;
}

/* Conteneur central, accueille deux groupes superposés: compteur et ticker */
.yearly-release-counter-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    max-width: 720px;
    height: 40px;
}

/* Groupes */
.header-counter-wrap, .header-ticker-wrap {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}
.header-counter-wrap.show, .header-ticker-wrap.show { opacity: 1; transition: opacity 400ms ease-in; }
.header-counter-wrap.hide, .header-ticker-wrap.hide { opacity: 0; transition: opacity 300ms ease-out; }

.header-ticker {
    font-family: var(--font-retro);
    font-size: 16px;
    color: rgba(255,255,255,0.9);
    letter-spacing: 0.03em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
    pointer-events: none;
}

.header-ticker-tag {
    font-family: var(--font-retro);
    font-size: 13px;
    color: rgba(255,255,255,0.75);
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: 4px 6px;
    margin-right: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.header-ticker.show { opacity: 1; transition: opacity 400ms ease-in; }
.header-ticker.hide { opacity: 0; transition: opacity 300ms ease-out; }
.header-counter-icon, .header-ticker-icon { font-size: 18px; color: rgba(255,255,255,0.85); filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35)); }
.yearly-release-counter { font-size: 16px; font-weight: 600; color: rgba(255,255,255,0.92); text-shadow: 0 1px 2px rgba(0,0,0,0.35); }

@keyframes fadeInSubtle {
    0% {
        opacity: 0;
        transform: translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.yearly-release-icon {
    font-size: 1.2em;
    color: rgba(173, 216, 230, 0.6);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    transition: opacity var(--transition-normal) ease-in-out;
}

.yearly-release-counter {
    font-size: 0.8em;
    font-weight: 500;
    color: rgba(173, 216, 230, 0.6);
    white-space: nowrap;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: opacity var(--transition-normal) ease-in-out;
}

/* Effet de fade in/fade out au hover */
.yearly-release-counter-container:hover .yearly-release-icon,
.yearly-release-counter-container:hover .yearly-release-counter {
    opacity: 0.9;
    color: rgba(173, 216, 230, 0.8);
}

body.dark-mode .yearly-release-counter {
    color: rgba(173, 216, 230, 0.6);
}

body.dark-mode .yearly-release-icon {
    color: rgba(173, 216, 230, 0.6);
}

.yearly-release-counter:empty {
    display: none;
}

.yearly-release-counter-container:empty {
    display: none;
}

/* ========================================
   BARRE DE RECHERCHE - STYLES DE BASE SEULEMENT
   ======================================== */
.modern-search-wrapper {
    display: flex;
    align-items: center;
    padding: 0 10px;
    height: 40px;
    background: rgba(31,42,55,0.06); /* fond plus sombre en clair */
    border: 1px solid rgba(31,42,55,0.12);
    border-radius: 6px;
    backdrop-filter: var(--glass-backdrop-subtle);
    -webkit-backdrop-filter: var(--glass-backdrop-subtle);
    box-shadow: 0 6px 18px rgba(31,42,55,0.08);
    position: relative;
}

.discreet-search-wrapper {
    flex-grow: 0.3;
    max-width: 200px;
    min-width: 140px;
    height: 40px;
    display: flex;
    align-items: center;
}

.modern-search-input {
    padding: 8px 0;
    flex-grow: 1;
    outline: none;
    min-width: 100px;
    height: 100%;
    background: transparent;
    border: none;
    color: #fff; /* texte blanc en thème clair pour lisibilité */
    position: relative;
    z-index: 2; /* texte au-dessus du verre */
    box-shadow: none;
}

.modern-search-icon {
    color: var(--text-dark);
}

/* ========================================
   BOUTON DE SUPPRESSION RECHERCHE
   ======================================== */
.search-clear-btn {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: color var(--transition-speed) var(--transition-timing),
                background-color var(--transition-speed) var(--transition-timing),
                opacity var(--transition-speed) var(--transition-timing),
                transform var(--transition-speed-fast) ease;
    outline: none;
    z-index: 2;
    width: 28px;
    height: 28px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-clear-btn.modern-search-clear {
    margin-left: 6px;
    opacity: 0;
    pointer-events: none;
}

.modern-search-input:not(:placeholder-shown) + .modern-search-clear,
.modern-search-wrapper:focus-within .modern-search-input:not(:placeholder-shown) + .modern-search-clear {
    opacity: 1;
    pointer-events: auto;
}

.search-clear-btn iconify-icon {
    font-size: 1em;
}

.search-clear-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.search-clear-btn:hover {
    color: var(--danger);
    background-color: rgba(var(--danger-rgb),0.1);
    transform: scale(1.1);
}

.search-clear-btn:focus-visible {
    color: var(--danger);
    box-shadow: 0 0 0 var(--focus-ring-width) rgba(var(--danger-rgb),0.3);
}

.search-clear-btn:active {
    color: white;
    background-color: var(--danger);
    transform: scale(0.95);
}

/* ========================================
   ACTIONS DU HEADER
   ======================================== */
.header-actions {
    display: flex;
    align-items: center;
}

.header-btn {
    background: none;
    border: none;
    color: #fff;
    margin-left: 18px;
    cursor: pointer;
    transition: color var(--transition-fast) ease;
    position: relative;
    padding: 8px;
    border-radius: 6px;
    outline: none;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    overflow: visible;
}

/* Effet de brillance au hover pour les boutons du header */
.header-btn::before { content: none; }

.header-btn iconify-icon { font-size: 1.2em; color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.55)); }

body.dark-mode .header-btn { 
    background: none; 
    border: none; 
    box-shadow: none; 
    color: #fff; 
}

.header-btn {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
}

.header-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.25) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    background-position: -100% 0;
    background-repeat: no-repeat;
}

.header-btn:hover { 
    background: none; 
    transform: scale(1.1); 
    will-change: transform; 
    box-shadow: none; 
}

.header-btn:hover::after {
    opacity: 1;
    animation: shimmer-sweep 2.5s ease-in-out infinite;
}

.header-btn:hover iconify-icon {
    animation: iconPulse 0.6s ease-in-out;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

.header-btn:focus-visible { color: #fff; box-shadow: 0 0 0 var(--focus-ring-width) var(--focus-ring-color); }

.header-btn:active { 
    transform: scale(0.95); 
}

/* Animation de pulse pour les icônes au hover */
@keyframes iconPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

/* Effet de brillance - shimmer sweep (même que les cartes de jeux) */
@keyframes shimmer-sweep {
    0% {
        background-position: -100% 0;
    }
    50% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

/* Effet de transition fluide pour tous les états */
.header-btn {
    background: none;
    border: none;
    color: #fff;
    margin-left: 18px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 8px;
    border-radius: 6px;
    outline: none;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    overflow: visible;
}

/* ========================================
   INDICATEUR FILTRES AVANCÉS
   ======================================== */
#advancedFiltersBtn.has-active-advanced-filters::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background-color: var(--secondary);
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--card-bg-light);
    pointer-events: none;
    transition: transform var(--transition-fast) ease-out, opacity 0.2s ease-out;
    transform: scale(1);
    opacity: 1;
}

body.dark-mode #advancedFiltersBtn.has-active-advanced-filters::after {
    box-shadow: 0 0 0 2px var(--card-bg-dark);
}

/* ========================================
   BADGE DE NOTIFICATION
   ======================================== */
.notification-badge {
    position: absolute;
    top: 2px; /* badge légèrement rentré pour éviter le clipping avec overflow hidden */
    right: 2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 50%;
    background-color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11.5px;
    font-weight: bold;
    color: white;
    transition: transform var(--transition-speed) ease-out,
                opacity var(--transition-speed) ease-out;
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 0 2px var(--bg-light);
    z-index: 2; /* Au-dessus de la brillance du bouton */
    pointer-events: none;
}

body.dark-mode .notification-badge {
    box-shadow: 0 0 0 2px var(--bg-dark);
}

.notification-badge.hidden {
    transform: scale(0);
    opacity: 0;
}

/* ========================================
   RESPONSIVE DESIGN POUR LE MENU
   ======================================== */
@media (max-width: 768px) {
    .header { height: auto; }
    .header-content {
        padding: 0;
        height: 70px;
        flex-wrap: wrap;
    }
    
    .logo {
        margin-bottom: 8px;
        width: 100%;
        justify-content: center;
        height: 70px;
    }
    
    .logo-image {
        height: 60px;
    }
    
    .yearly-release-counter-container {
        position: static;
        transform: none;
        margin: 8px auto;
        order: 2;
    }
    
    .yearly-release-counter {
        font-size: 0.8em;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
        margin-top: 8px;
        flex-wrap: wrap;
        gap: 8px;
        order: 3;
    }
    
    .header-btn {
        margin-left: 6px;
        margin-right: 6px;
        width: 38px;
        height: 38px;
    }
    
    .header-btn iconify-icon {
        font-size: 1.1em;
    }

    /* Hauteur auto pour permettre 2 lignes (compteur puis actions) */
    .header-content {
        height: auto;
        min-height: 70px;
        padding: 6px 0;
    }

    /* Menu: empiler verticalement (1: plateformes, 2: recherche, 3: temporalité) */
    .controls-wrapper > .flex > .flex {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .platform-filter-wrapper-main { order: 1; width: 100%; }
    .search-container-controls { order: 2; width: 100%; }
    .period-filter-wrapper-main { order: 3; width: 100%; }
    .controls-actions-group { order: 4; width: 100%; display: flex; justify-content: flex-end; }

    /* Recherche pleine largeur sur mobile */
    .modern-search-wrapper,
    .discreet-search-wrapper {
        width: 100%;
        max-width: none;
    }

    /* Supprimer les divs d'espacement inline du layout mobile */
    .controls-wrapper [style*="width: 24px"],
    .controls-wrapper [style*="width: 16px"] {
        display: none;
    }

    /* Répartition homogène des boutons de temporalité */
    #periodFilterContainer {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }
}

@media (max-width: 576px) {
    .header-content {
        padding: 0;
        height: 70px;
    }
    
    .logo {
        height: 70px;
    }
    
    .logo-image {
        height: 50px;
    }
    
    .yearly-release-counter-container {
        padding: 6px 12px;
    }
    
    .yearly-release-counter {
        font-size: 0.75em;
    }
    
    .header-actions {
        gap: 6px;
    }
    
    .header-btn {
        width: 36px;
        height: 36px;
        margin-left: 4px;
        margin-right: 4px;
    }

    /* Masquer le logo pour gagner de la place sur smartphone */
    .header .logo { display: none; }

    /* Mettre le compteur en première ligne et les actions en seconde */
    .yearly-release-counter-container { order: 1; margin: 6px auto 0; }
    .header-actions { order: 2; margin-top: 6px; }
} 
