/* ══════════════════════════════════════════════
   FORUM INNOVALO
══════════════════════════════════════════════ */
:root {
    --bg:          #f6f6f7;
    --surface:     #ffffff;
    --surface-2:   #f1f1f3;
    --border:      #e4e4e7;
    --text:        #18181b;
    --muted:       #71717a;
    --accent:      #CC0303;
    --accent-2:    #e83333;
    --accent-dim:  rgba(204,3,3,0.08);
    --bureau:      #CC0303;
    --responsable: #1d4ed8;
    --membre:      #15803d;
    --invite:      #71717a;
    --public:      #b45309;
    --radius:      14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Manrope", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); font-weight: 400; }

/* ── Barre du haut ─────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand img { height: 34px; width: auto; }
.brand span {
    font-weight: 800;
    font-size: 1.05rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--accent);
    letter-spacing: -0.01em;
}

.topbar-droite { display: flex; align-items: center; gap: 1rem; }
.moi { display: flex; align-items: center; gap: 0.5rem; }
.moi-nom { font-weight: 600; font-size: 0.9rem; }

/* ── Page ──────────────────────────────────────── */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.75rem clamp(1rem, 4vw, 2.5rem) 4rem;
}

.fil-ariane {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 1.25rem;
}
.fil-ariane a:hover { color: var(--accent); }
.fil-ariane strong { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.hero h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); margin-top: 0.4rem; max-width: 60ch; }
.hero-petit h1 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
.hero-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.titre-section {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

/* ── Cartes ────────────────────────────────────── */
.carte {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.vide { padding: 2rem 1.5rem; text-align: center; color: var(--muted); }

.grille-accueil {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.75rem;
    align-items: start;
}

/* Thématiques */
.liste-themes { display: flex; flex-direction: column; gap: 0.75rem; }
.theme {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.theme:hover { border-color: rgba(204,3,3,0.35); box-shadow: 0 6px 24px rgba(0,0,0,0.06); transform: translateY(-1px); }
.theme-icone {
    flex-shrink: 0;
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--accent-dim);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.15rem;
}
.theme-corps { flex: 1; min-width: 0; }
.theme-corps h3 { font-size: 1rem; font-weight: 700; }
.theme-corps p { color: var(--muted); font-size: 0.88rem; margin-top: 0.15rem; }
.theme-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.8rem;
    white-space: nowrap;
    gap: 0.05rem;
}

/* Activité récente */
.liste-recents { overflow: hidden; }
.recent {
    display: flex;
    flex-direction: column;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.recent:last-child { border-bottom: none; }
.recent:hover { background: var(--surface-2); }
.recent-titre { font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.recent-meta { font-size: 0.78rem; color: var(--muted); }

/* Liste des sujets */
.liste-sujets { overflow: hidden; }
.sujet-ligne {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 150px;
    align-items: center;
    gap: 1rem;
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.sujet-ligne:last-child { border-bottom: none; }
.sujet-ligne:hover { background: var(--surface-2); }
.sujet-principal { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.sujet-titre { font-weight: 700; overflow-wrap: anywhere; }
.sujet-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.8rem; }
.sujet-compteur { display: flex; flex-direction: column; align-items: center; font-size: 0.75rem; color: var(--muted); }
.sujet-compteur strong { font-size: 1.1rem; color: var(--text); }
.sujet-dernier { display: flex; flex-direction: column; align-items: flex-end; font-size: 0.8rem; text-align: right; }

/* Fil de discussion */
.fil { display: flex; flex-direction: column; gap: 0.9rem; }
.message { padding: 1.1rem 1.25rem; }
.message-initial { border-left: 3px solid var(--accent); }
.message-entete {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.message-date { margin-left: auto; font-size: 0.8rem; color: var(--muted); }
.message-texte { overflow-wrap: anywhere; }

/* Auteur */
.auteur { display: inline-flex; align-items: center; gap: 0.6rem; min-width: 0; }
.auteur-infos { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
.auteur-nom { font-weight: 700; font-size: 0.9rem; }
.auteur-pft { font-size: 0.78rem; color: var(--muted); }
.avatar {
    flex-shrink: 0;
    width: 38px; height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
}
.avatar-bureau      { background: var(--bureau); }
.avatar-responsable { background: var(--responsable); }
.avatar-membre      { background: var(--membre); }
.avatar-invite      { background: var(--invite); }
.avatar-public      { background: var(--public); }

.badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}
.badge-bureau      { background: rgba(204,3,3,0.1);   color: var(--bureau); }
.badge-responsable { background: rgba(29,78,216,0.1); color: var(--responsable); }
.badge-membre      { background: rgba(21,128,61,0.1); color: var(--membre); }
.badge-invite      { background: var(--surface-2);    color: var(--invite); }
.badge-public      { background: rgba(180,83,9,0.1);  color: var(--public); }

/* ── Formulaires ───────────────────────────────── */
.carte-form { margin-bottom: 1.5rem; padding: 0 1.25rem; }
.carte-form summary {
    cursor: pointer;
    font-weight: 700;
    padding: 1rem 0;
    list-style: none;
}
.carte-form summary::-webkit-details-marker { display: none; }
.carte-form summary::before { content: '+ '; color: var(--accent); }
.carte-form[open] summary::before { content: '− '; }
.carte-form form { padding-bottom: 1.25rem; }

form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.9rem;
}
input[type="text"], textarea {
    font: inherit;
    font-weight: 400;
    font-size: 0.93rem;
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
textarea { resize: vertical; min-height: 110px; }
input[type="text"]:focus, textarea:focus {
    border-color: rgba(204,3,3,0.45);
    box-shadow: 0 0 0 3px rgba(204,3,3,0.08);
    background: var(--surface);
}
.repondre { padding: 1.1rem 1.25rem; }
.actions-form { display: flex; justify-content: flex-end; }

/* ── Boutons ───────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font: inherit;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 0.62rem 1.15rem;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 0.42rem 0.8rem; font-size: 0.8rem; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 16px rgba(204,3,3,0.22); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); border-color: rgba(204,3,3,0.35); color: var(--accent); }
.btn-danger:hover { background: var(--accent-dim); }
.lien-danger {
    background: none;
    border: none;
    font: inherit;
    font-size: 0.78rem;
    color: var(--muted);
    cursor: pointer;
}
.lien-danger:hover { color: var(--accent); text-decoration: underline; }

/* ── Messages / pagination ─────────────────────── */
.alert { padding: 0.8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 600; font-size: 0.9rem; }
.alert-success { background: rgba(21,128,61,0.08); color: var(--membre); border: 1px solid rgba(21,128,61,0.25); }
.alert-error   { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(204,3,3,0.25); }

.pagination { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; margin-top: 1.25rem; }
.pagination a {
    min-width: 36px;
    padding: 0.4rem 0.6rem;
    text-align: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-weight: 600;
    font-size: 0.85rem;
}
.pagination a.actif { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 860px) {
    .grille-accueil { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .moi-nom { display: none; }
    .brand img { height: 28px; }
    .theme { flex-wrap: wrap; }
    .theme-stats { flex-direction: row; gap: 0.75rem; width: 100%; justify-content: flex-start; padding-left: 60px; }
    .sujet-ligne { grid-template-columns: minmax(0, 1fr) auto; }
    .sujet-dernier { display: none; }
    .message-date { margin-left: 0; }
}
@media (max-width: 420px) {
    .moi { display: none; }
}

/* ── Connexion comptes publics ─────────────────── */
.page-connexion { display: flex; justify-content: center; padding-top: clamp(2rem, 8vh, 5rem); }
.connexion { width: 100%; max-width: 440px; padding: 2rem clamp(1.25rem, 5vw, 2.25rem); }
.connexion h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
.connexion h1 span { color: var(--accent); }
.connexion > p { margin-bottom: 1.5rem; font-size: 0.92rem; }
.connexion input[type="email"] {
    font: inherit; font-weight: 400; font-size: 0.93rem; width: 100%;
    padding: 0.65rem 0.85rem; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-2); color: var(--text); outline: none;
}
.connexion input[type="email"]:focus { border-color: rgba(204,3,3,0.45); box-shadow: 0 0 0 3px rgba(204,3,3,0.08); background: var(--surface); }
.champ-code { font-family: "Courier New", monospace !important; font-size: 1.6rem !important; letter-spacing: 0.4em; text-align: center; font-weight: 700 !important; }
.btn-large { width: 100%; justify-content: center; padding: 0.8rem; font-size: 0.95rem; }
.connexion-pied { margin-top: 1.5rem; font-size: 0.85rem; color: var(--muted); text-align: center; }
.connexion-pied a { color: var(--accent); font-weight: 600; }
.connexion-liens { display: flex; justify-content: space-between; margin-top: 1rem; }
.connexion-liens form label { margin: 0; }
.lien { background: none; border: none; font: inherit; font-size: 0.85rem; color: var(--muted); cursor: pointer; }
.lien:hover { color: var(--accent); text-decoration: underline; }
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ── Cloche de notifications ───────────────────── */
.cloche { position: relative; }
.cloche summary {
    list-style: none;
    cursor: pointer;
    position: relative;
    width: 38px; height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}
.cloche summary::-webkit-details-marker { display: none; }
.cloche summary:hover, .cloche[open] summary { background: var(--surface-2); }
.cloche summary svg { width: 19px; height: 19px; }
.cloche-nb {
    position: absolute;
    top: -6px; right: -6px;
    min-width: 19px; height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
}
.cloche-panneau {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(360px, calc(100vw - 2rem));
    max-height: 70vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(0,0,0,0.14);
    z-index: 20;
}
.cloche-entete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
}
.cloche-entete form label { margin: 0; }
.notif {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.86rem;
    transition: background 0.15s;
}
.notif:last-child { border-bottom: none; }
.notif:hover { background: var(--surface-2); }
.notif-non-lue { background: rgba(204,3,3,0.04); box-shadow: inset 3px 0 0 var(--accent); }
.notif-alerte { background: #fff7ed; box-shadow: inset 3px 0 0 #ea580c; }
.notif-date { font-size: 0.74rem; color: var(--muted); }

/* ── Invitation à créer un compte / encart d'attente ── */
.invitation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-color: rgba(204,3,3,0.25);
    background: linear-gradient(135deg, #fff, #fdf2f2);
}
.invitation > div { display: flex; flex-direction: column; gap: 0.2rem; flex: 1 1 260px; min-width: 0; }
.invitation .btn { flex-shrink: 0; padding: 0.7rem 1.4rem; }
.fil .invitation { margin-bottom: 0; }
.invitation-attente { border-color: rgba(234,88,12,0.35); background: #fff7ed; }

/* ── Thématiques à valider ─────────────────────── */
.a-valider { padding: 1.1rem 1.25rem; margin-bottom: 1.5rem; border-color: rgba(234,88,12,0.35); }
.a-valider .titre-section { color: #c2410c; display: flex; align-items: center; gap: 0.5rem; }
.compteur { background: #ea580c; color: #fff; border-radius: 999px; padding: 0 0.5rem; font-size: 0.7rem; }
.a-valider-ligne {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.85rem 0;
    border-top: 1px solid var(--border);
}
.a-valider-infos { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; flex: 1 1 280px; }
.a-valider-actions { display: flex; gap: 0.5rem; align-items: flex-start; flex-wrap: wrap; }
.refus summary { list-style: none; }
.refus summary::-webkit-details-marker { display: none; }
.refus-form { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.refus-form input { min-width: 220px; flex: 1; }
.badge-attente { background: #ffedd5; color: #c2410c; margin-left: 0.4rem; vertical-align: middle; }
.aide-form { font-size: 0.85rem; margin: -0.25rem 0 1rem; }

.btn-contour { background: var(--surface); border-color: var(--accent); color: var(--accent); }
.btn-contour:hover { background: var(--accent-dim); }
.brand { min-width: 0; }
.topbar-droite { flex-shrink: 0; }

@media (max-width: 640px) {
    .btn-retour { display: none; }
    .topbar-droite { gap: 0.5rem; }
    .invitation { flex-direction: column; align-items: stretch; }
    .invitation > div { flex-basis: auto; }
    .invitation .btn { justify-content: center; }
}
