/* ====================================
   🎨 HEADER SYSTEM - FMX 2025
   Styles centralisés et cohérents pour le header
==================================== */

/* === VARIABLES BOUTONS HEADER === */
:root {
    /* Hauteur du header (utilisée pour compenser le contenu) */
    --header-height: 60px;
  --btn-header-size: 44px;
  --btn-header-size-mobile: 40px;
  --btn-header-icon: 20px;
  --btn-header-icon-mobile: 18px;
  --btn-header-radius: var(--radius-lg);
  --btn-header-bg: var(--secondary-alpha-10);
  --btn-header-border: var(--secondary-alpha-20);
  --btn-header-hover-bg: var(--primary-alpha-20);
  --btn-header-hover-border: var(--primary-alpha-40);

    /* Branding variables for logo text */
        /* Couleur de remplissage du texte du logo (par défaut: couleur primaire du thème) */
        --brand-text-fill: var(--foreground-color);
    --brand-gradient: linear-gradient(45deg, var(--foreground-color), var(--secondary-color));
}

/* === HEADER PRINCIPAL === */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 11, 0.9);
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: var(--space-2) 0;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.site-header.scrolled {
    background: rgba(10, 10, 11, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
    border-bottom-color: rgba(255, 25, 131, 0.2);
}

/* Fix border-radius: isoler et clipper les effets de fond */
.site-header .header-bg-effects {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}

.site-header .header-bg-effects > * { border-radius: inherit; }

/* Le contenu réel du header passe au-dessus des effets */
.site-header > .container { position: relative; z-index: 1; }

/* Ligne décorative confinée dans les coins arrondis */
.site-header .header-decoration {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.site-header .header-decoration .decoration-line {
    height: 1px;
    width: 100%;
    background: linear-gradient(90deg, var(--secondary-alpha-08), var(--primary-alpha-25), var(--secondary-alpha-08));
}

/* Theme toggle simple */
.theme-toggle { margin-left: var(--space-3); }

/* === CONTENU HEADER === */
.header-content { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    gap: var(--space-4); 
    min-height: 60px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* === LOGO === */
.site-logo {
    font-family: var(--font-script);
    font-size: var(--font-size-3xl);
    font-weight: normal;
    color: var(--text-primary);
    text-decoration: none;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: var(--brand-text-fill);
    background-clip: text;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 8px var(--primary-alpha-30);
}

.site-logo:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo-icon {
    font-size: 1.5em;
    background: linear-gradient(45deg, var(--primary-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gentle-glow 3s ease-in-out infinite alternate;
}

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

.logo-tagline {
    font-family: var(--font-script);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: normal;
    opacity: 0.9;
    line-height: 1;
    font-style: italic;
    letter-spacing: 0.01em;
}

.custom-logo-wrapper {
    display: flex;
    align-items: center;
}

.custom-logo-wrapper img {
    max-height: 50px;
    width: auto;
    transition: all 0.3s ease;
}

/* === LIENS SOCIAUX HEADER === */
.header-social { 
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.header-social .social-link { 
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--btn-header-size);
    height: var(--btn-header-size);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--btn-header-radius);
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-social .social-link:hover { 
    background: rgba(255, 25, 131, 0.2);
    border-color: rgba(255, 25, 131, 0.4);
    transform: translateY(-2px);
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(255, 25, 131, 0.3);
}

.header-social .social-link svg {
    width: var(--btn-header-icon);
    height: var(--btn-header-icon);
    stroke: currentColor;
    fill: none;
}

/* === ACTIONS HEADER === */
.header-actions { 
    display: flex; 
    align-items: center; 
    gap: var(--space-2);
    position: relative; 
    z-index: 1001; 
}

/* === BOUTONS D'ACTION UNIFIÉS === */
.action-btn,
.search-toggle,
.mobile-drawer-toggle,
.mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--btn-header-size);
    height: var(--btn-header-size);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--btn-header-radius);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    z-index: 1001;
    padding: 0;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Par défaut, cacher les toggles mobile */
.mobile-drawer-toggle,
.mobile-menu-toggle {
    display: none;
}

.action-btn:hover,
.search-toggle:hover,
.mobile-drawer-toggle:hover,
.mobile-menu-toggle:hover {
    background: rgba(255, 25, 131, 0.2);
    border-color: rgba(255, 25, 131, 0.4);
    transform: translateY(-2px);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 25, 131, 0.3);
}

.action-btn svg,
.search-toggle svg,
.mobile-drawer-toggle svg,
.mobile-menu-toggle svg {
    width: var(--btn-header-icon);
    height: var(--btn-header-icon);
    stroke: currentColor;
    fill: none;
}

/* === HAMBURGER MENU === */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: var(--btn-header-icon);
    height: calc(var(--btn-header-icon) - 6px);
}

.hamburger .line {
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Animation hamburger vers X */
.mobile-drawer-toggle.active .hamburger .line:nth-child(1) {
    transform: rotate(45deg) translateY(5px);
}

.mobile-drawer-toggle.active .hamburger .line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-drawer-toggle.active .hamburger .line:nth-child(3) {
    transform: rotate(-45deg) translateY(-5px);
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    :root {
        --btn-header-size: var(--btn-header-size-mobile);
        --btn-header-icon: var(--btn-header-icon-mobile);
        --header-height: 56px; /* hauteur header mobile */
    }
    
    .header-social {
        display: none;
    }
    
    .header-actions {
        gap: var(--space-1);
    }
    
    .mobile-drawer-toggle,
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .logo-text {
        font-size: var(--font-size-xl);
    }
    
    .custom-logo-wrapper img {
        height: 32px;
    }

    /* Règles déplacées depuis style.css */
    .header-content { flex-wrap: nowrap; gap: var(--space-2); padding: 0 var(--space-3); }
}

@media (max-width: 480px) {
    .site-header {
        margin: var(--space-1) var(--space-2) 0;
        width: calc(100% - calc(var(--space-2) * 2));
        padding: var(--space-2) var(--space-3);
    }
    
    .header-content {
        gap: var(--space-2);
        padding: 0 var(--space-2);
    }
}

/* === RECHERCHE === */
.search-form-container { 
    max-width: 600px; 
    margin: 0 auto; 
    padding: 0 var(--space-4); 
}

.search-form-wrapper { 
    padding: var(--space-4); 
    margin: 0; 
}

.search-input-group .search-form { 
    margin-bottom: var(--space-3); 
}

.search-suggestions { 
    display: flex; 
    flex-direction: column; 
    gap: var(--space-2); 
}

.suggestion-label { 
    font-size: var(--font-size-sm); 
    color: var(--text-secondary); 
    font-weight: 500; 
}

.suggestion-tags { 
    display: flex; 
    flex-wrap: wrap; 
    gap: var(--space-1); 
}

.suggestion-tag { 
    padding: var(--space-1) var(--space-2); 
    background: var(--primary-alpha-10); 
    border: 1px solid var(--primary-alpha-20); 
    border-radius: var(--radius-full); 
    font-size: var(--font-size-xs); 
    color: var(--primary-color); 
    cursor: pointer; 
    transition: all 0.3s ease; 
}

.suggestion-tag:hover { 
    background: var(--primary-alpha-20); 
    transform: scale(1.05); 
}

/* === Migrated from assets/css/components.css: Premium header glass effects, CTA & search === */
/* Premium glass gradient overlay confined to header radius */
.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        var(--primary-alpha-08) 0%,
        rgba(99, 102, 241, 0.06) 30%,
        rgba(16, 185, 129, 0.04) 60%,
        var(--primary-alpha-08) 100%);
    border-radius: 20px;
    pointer-events: none;
    opacity: 0.6;
    z-index: 0; /* Assure que l'overlay reste derrière le contenu du header */
}

/* S'assurer que le branding/logo passe au-dessus des effets de fond */
.site-branding,
.custom-logo-wrapper,
.site-logo {
    position: relative;
    z-index: 2;
}

.site-header:hover {
    border-color: var(--secondary-alpha-15);
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.5),
        0 4px 16px rgba(0, 0, 0, 0.25),
        0 0 0 1px var(--primary-alpha-10),
        inset 0 1px 0 var(--secondary-alpha-08);
}

/* Background FX container (confined to radius) */
.header-bg-effects {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
    border-radius: 20px;
}

.header-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        var(--primary-alpha-12) 0%,
        rgba(99, 102, 241, 0.08) 25%,
        transparent 50%,
        rgba(16, 185, 129, 0.08) 75%,
        var(--primary-alpha-12) 100%);
    animation: headerGradientShift 12s ease-in-out infinite;
    border-radius: 20px;
}

.header-noise {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    border-radius: 20px;
}

/* Header decoration slim gradient line */
.header-decoration { position: absolute; bottom: 0; left: 0; right: 0; height: 1px; overflow: hidden; }
.decoration-line { width: 100%; height: 100%; background: var(--gradient-primary); opacity: 0.3; animation: decorationSlide 3s ease-in-out infinite; }

/* Header CTA shimmer */
.header-cta { margin-left: var(--spacing-sm); white-space: nowrap; position: relative; overflow: hidden; }
.header-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--secondary-alpha-30), transparent);
    transition: left 0.6s ease;
}
.header-cta:hover::before { left: 100%; }

/* Micro-interaction sur le CTA du header */
.header-cta .btn,
.header-cta .btn-primary,
.header-cta .button {
    will-change: transform;
}

.header-cta .btn:hover,
.header-cta .btn-primary:hover,
.header-cta .button:hover {
    animation: btnPulse 600ms ease-in-out;
}

/* Search toggle icon swap */
.search-toggle[aria-expanded="true"] .search-icon { display: none; }
.search-toggle[aria-expanded="true"] .close-icon { display: block !important; }

/* Header search dropdown (fixed under header) */
.header-search {
    position: fixed;
    top: calc(20px + 70px);
    left: 20px;
    right: 20px;
    background: rgba(10, 10, 11, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 20px 20px;
    padding: var(--spacing-xl) 0;
    transform: translateY(-20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 998;
    margin-top: 120px;
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.7),
        0 4px 16px rgba(0, 0, 0, 0.4);
}
.header-search.active { transform: translateY(0); opacity: 1; visibility: visible; animation: searchSlideDown 0.3s ease forwards; }