/* ==========================================================================
   site-header.css — header du site (logo, recherche, menu connexion/profil)
   PARTAGÉ par toutes les pages publiques (index.html, article.html,
   tous-les-articles.html, confidentialite.html, conditions-utilisation.html).

   Injecté avec site-header.js (markup + logique) : les deux fichiers vont
   toujours ensemble, ne pas les charger séparément.
   ========================================================================== */

/* ── Header : logo à gauche, recherche + menu à droite ──────────
   Le bas se fond dans le reste de la page via un dégradé plutôt
   qu'une bordure nette (::after). */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(5, 5, 5, 0.82);
    backdrop-filter: blur(10px);
}

.site-header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 100%;
    height: 72px;
    background: linear-gradient(to bottom, rgba(5, 5, 5, 0.55), transparent);
    pointer-events: none;
}

.site-logo {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--article-text, #fff);
}

.site-logo img {
    height: 28px;
    width: auto;
    display: block;
}

.site-logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.26em;
    text-transform: uppercase;
}

.site-header-left {
    display: flex;
    align-items: center;
    gap: 1.6rem;
}

.site-nav-link {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    transition: color 0.2s;
}

.site-nav-link:hover {
    color: #ffffff;
}

.header-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.header-icon-btn.has-avatar { padding: 0; overflow: hidden; }
.header-icon-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.header-icon-btn img[hidden] { display: none !important; }

/* ── Recherche ──────────────────────────────────────────────── */
#search-overlay {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 1.5rem 0;
}
#search-overlay[hidden] { display: none; }

.search-box {
    width: min(92vw, 560px);
    background: rgba(6, 6, 6, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 1.1rem;
}

#search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    padding: 0.7rem 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}
#search-input:focus { border-color: rgba(255, 255, 255, 0.35); }

.search-results { margin-top: 0.8rem; max-height: 50vh; overflow-y: auto; }

.search-result {
    display: block;
    padding: 0.7rem 0.3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
}
.search-result:hover { color: #fff; }
.search-results p {
    padding: 1rem 0.3rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85rem;
    text-align: center;
}

/* ── Menu (connexion/profil, applications, liens légaux) ───────────── */
.site-menu {
    position: fixed;
    top: 4.2rem;
    right: 1.5rem;
    z-index: 25;
    background: rgba(6, 6, 6, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    min-width: 210px;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
}
.site-menu[hidden] { display: none; }

.site-menu-sep {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.35rem 0.2rem;
}

.site-menu a.profile-menu-item {
    display: block;
    text-decoration: none;
}

/* === Bannière compte en attente === */
#access-pending-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 30;
    background: rgba(255, 200, 60, 0.14);
    border-bottom: 1px solid rgba(255, 200, 60, 0.35);
    color: rgba(255, 220, 130, 0.95);
    font-family: 'Space Grotesk', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-align: center;
    padding: 0.6rem 1rem;
}
#access-pending-banner[hidden] { display: none !important; }

/* Avatar rond affiché dans le bouton menu du header quand connecté
   (remplit le bouton rond de 38px, voir .header-icon-btn.has-avatar) */
#top-auth-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
/* Le sélecteur #id a une spécificité plus forte que [hidden] (attribut) :
   sans ce override, l'attribut hidden posé en JS était ignoré et
   l'avatar/l'image restaient visibles en permanence (icône ou image
   cassée à côté de "CONNEXION"). Même piège déjà rencontré ailleurs
   dans ce repo (voir .app-view[hidden] dans team.html). */
#top-auth-avatar[hidden] { display: none !important; }
#top-auth-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
#top-auth-avatar img[hidden] { display: none !important; }

.profile-menu-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.7rem 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.3rem;
}
.profile-menu-user .pm-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.profile-menu-user .pm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-menu-user .pm-name {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-item {
    background: none;
    border: none;
    text-align: left;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Space Grotesk', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.6rem 0.7rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.profile-menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}
.profile-menu-item.danger:hover {
    background: rgba(255, 70, 70, 0.1);
    color: rgba(255, 90, 90, 0.95);
}

/* === Modale d'édition de profil ─────────────────────────────── */
#profile-avatar-picker {
    align-self: center;
    width: 72px; height: 72px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    transition: border-color 0.2s;
}
#profile-avatar-picker:hover { border-color: rgba(255, 255, 255, 0.45); }
#profile-avatar-picker img { width: 100%; height: 100%; object-fit: cover; display: block; }
#profile-avatar-picker img[hidden] { display: none !important; }
#profile-avatar-picker .pap-placeholder { font-size: 1.6rem; color: rgba(255, 255, 255, 0.35); pointer-events: none; }
.profile-avatar-hint {
    text-align: center;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.32);
    margin-top: -0.4rem;
}
#profile-username, #profile-link {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.11);
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Space Grotesk', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    padding: 0.52rem 0.65rem;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
}
#profile-bio {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.11);
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Manrope', sans-serif;
    font-size: 0.82rem;
    line-height: 1.4;
    padding: 0.6rem 0.65rem;
    outline: none;
    width: 100%;
    resize: vertical;
    min-height: 70px;
    transition: border-color 0.2s;
}
#profile-username:focus, #profile-link:focus, #profile-bio:focus {
    border-color: rgba(255, 255, 255, 0.28);
}
.profile-field-label {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 0.35rem;
    display: block;
}

#auth-overlay, #profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}
#auth-overlay[hidden], #profile-overlay[hidden] { display: none; }

#auth-box, #profile-box {
    background: rgba(6, 6, 6, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.13);
    padding: 2rem 2.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: min(90vw, 320px);
}
.auth-header-tabs {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.2rem;
}
.auth-tab-btn {
    background: none;
    border: none;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    color: rgba(255, 255, 255, 0.32);
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}
.auth-tab-btn.active {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
}
.auth-tab-btn:hover:not(.active) {
    color: rgba(255, 255, 255, 0.65);
}
.auth-tab-sep {
    color: rgba(255, 255, 255, 0.18);
    font-size: 0.72rem;
}
#auth-login, #auth-pass {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.11);
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Space Grotesk', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    padding: 0.52rem 0.65rem;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
}
#auth-login:focus, #auth-pass:focus { border-color: rgba(255, 255, 255, 0.28); }
#auth-submit, #profile-submit {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Space Grotesk', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    padding: 0.58rem;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s, border-color 0.2s;
}
#auth-submit:hover:not(:disabled), #profile-submit:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
}
#auth-submit:disabled, #profile-submit:disabled { opacity: 0.4; cursor: default; }
.auth-switch-note {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.38);
    text-align: center;
    letter-spacing: 0.05em;
}
.auth-switch-note button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
}
.auth-switch-note button:hover {
    color: #ffffff;
}
.auth-google-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Space Grotesk', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 0.58rem;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: background 0.2s, border-color 0.2s;
}
.auth-google-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: rgba(255, 255, 255, 0.22);
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin: 0.1rem 0;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}
#auth-msg, #profile-msg {
    font-family: 'Space Grotesk', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 70, 70, 0.85);
    min-height: 1em;
    text-align: center;
}
#profile-msg.ok { color: rgba(100, 255, 140, 0.85); }
