/* annuaire.css - pages de l'annuaire (liste, recherche, fiche)
   Même univers visuel que la connexion de l'intranet (login.css) :
   dégradé violet, cartes sombres translucides, accent rose. */

:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --accent: #f093fb;
    --text: #ffffff;
    --muted: rgba(255, 255, 255, 0.74);
    --glass: rgba(0, 0, 0, 0.45);
    --glass-strong: rgba(0, 0, 0, 0.62);
    --line: rgba(255, 255, 255, 0.18);
    --radius: 16px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    background: #4b3f8f;
}

/* Fond fixe : dégradé + halos (un calque fixe évite les défauts de background-attachment sur mobile) */
body::before {
    content: '';
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.35) 0%, transparent 50%),
        radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 45% 45%, rgba(240, 147, 251, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

a { color: inherit; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 20px 64px; }
.wrap.narrow { max-width: 760px; }

/* ------------------------------------------------------------ barre du haut */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(24, 18, 56, 0.72);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar-in {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: 700; text-decoration: none; letter-spacing: 0.01em; }
.brand span { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.who { font-size: 14px; color: var(--muted); }
.tag-admin {
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: #2d1b4e;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ------------------------------------------------------------------ boutons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover, .btn:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(240, 147, 251, 0.35); outline: none; }
.btn-ghost { background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line); }
.btn-ghost:hover, .btn-ghost:focus-visible { box-shadow: none; background: rgba(255, 255, 255, 0.2); }

/* ------------------------------------------------------------------- titres */
.page-title { margin: 6px 0 6px; font-size: 28px; line-height: 1.25; }
.page-sub { margin: 0 0 22px; color: var(--muted); }

.notice {
    margin: 0 0 24px;
    padding: 16px 20px;
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--muted);
}

/* ---------------------------------------------------------------- recherche */
.search {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    margin: 0 0 18px;
    padding: 16px;
    background: var(--glass-strong);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.field label { display: block; margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.field input,
.field select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
}
.field input::placeholder { color: rgba(255, 255, 255, 0.55); }
.field select option { color: #1a1a2e; background: #ffffff; }
.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(240, 147, 251, 0.25);
}
.search .actions { display: flex; }
.search .actions .btn { height: 44px; }

.count { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.count a { color: var(--accent); }

/* ------------------------------------------------------------------- liste */
.letter {
    margin: 26px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    color: var(--accent);
    font-size: 14px;
    letter-spacing: 0.14em;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 14px;
}
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* Pas de flou sur les cartes : la liste peut compter des centaines de fiches */
.person {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 18px 16px;
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
a.person:hover,
a.person:focus-visible {
    transform: translateY(-3px);
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.6);
    outline: none;
}
.pname { padding-right: 86px; font-size: 17px; font-weight: 700; line-height: 1.3; }
.pjob { font-size: 14px; }
.pmeta { font-size: 13px; color: var(--muted); }

.person-public { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; }
.person-public .pname { padding-right: 0; font-size: 16px; }

/* ------------------------------------------------------------ pastilles */
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 12px;
}
.badge {
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ACTIF / RETRAITÉ : coin supérieur droit */
.statut { position: absolute; top: 14px; right: 14px; }
.s-actif    { background: rgba(74, 222, 128, 0.18); border-color: rgba(74, 222, 128, 0.5); color: #86efac; }
.s-retraite { background: rgba(251, 191, 36, 0.16); border-color: rgba(251, 191, 36, 0.5); color: #fcd34d; }

/* Promotion : une teinte par type */
.p-fi           { background: rgba(96, 165, 250, 0.2);  border-color: rgba(96, 165, 250, 0.5);  color: #bfdbfe; }
.p-fae          { background: rgba(240, 147, 251, 0.2); border-color: rgba(240, 147, 251, 0.5); color: #f8c8fd; }
.p-integration  { background: rgba(45, 212, 191, 0.2);  border-color: rgba(45, 212, 191, 0.5);  color: #99f6e4; }
.p-contractuel  { background: rgba(251, 146, 60, 0.2);  border-color: rgba(251, 146, 60, 0.5);  color: #fed7aa; }
.p-detachement  { background: rgba(167, 139, 250, 0.22); border-color: rgba(167, 139, 250, 0.5); color: #ddd6fe; }
.p-autre        { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.35); color: #e5e7eb; }

/* -------------------------------------------------------------------- fiche */
.back { display: inline-block; margin: 0 0 14px; color: var(--muted); text-decoration: none; }
.back:hover, .back:focus-visible { color: var(--text); outline: none; }

.fiche {
    position: relative;
    padding: 36px 32px;
    background: var(--glass-strong);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
.fiche .statut { top: 26px; right: 26px; padding: 5px 14px; font-size: 12px; }
.fiche h1 { margin: 0 96px 12px 0; font-size: 30px; line-height: 1.2; }
.fiche h2 {
    margin: 30px 0 10px;
    color: var(--accent);
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.fiche a { text-decoration-color: var(--accent); text-underline-offset: 3px; }
.poste { margin: 0; font-size: 19px; font-weight: 600; }
.muted { margin: 2px 0 0; color: var(--muted); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.timeline { margin: 0; padding: 0 0 0 18px; list-style: none; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 18px 18px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: '';
    position: absolute;
    top: 7px;
    left: -24px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
}
.t-title { font-weight: 600; }
.t-meta { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------- barre d'outils, bandeaux */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.toolbar .back { margin: 0; }

.alert { margin: 0 0 18px; padding: 14px 18px; border: 1px solid transparent; border-radius: 12px; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert-ok    { background: rgba(74, 222, 128, 0.15); border-color: rgba(74, 222, 128, 0.5); color: #bbf7d0; }
.alert-error { background: rgba(248, 113, 113, 0.16); border-color: rgba(248, 113, 113, 0.55); color: #fecaca; }

/* ---------------------------------------------------------------- formulaire */
.form-card {
    margin: 0 0 18px;
    padding: 22px 24px;
    background: var(--glass-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.form-card h2 {
    margin: 0 0 14px;
    color: var(--accent);
    font-size: 13px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
input[type=hidden] { display: none; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; cursor: pointer; }
.check input[type=checkbox] { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }

.poste-block {
    margin: 0 0 12px;
    padding: 14px;
    border: 1px dashed var(--line);
    border-radius: 12px;
}
.poste-block:last-child { margin-bottom: 0; }
.poste-block .poste-num { margin: 0 0 10px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 900px) {
    .search { grid-template-columns: 1fr 1fr; }
    .search .field-q,
    .search .actions { grid-column: span 2; }
    .search .actions .btn { width: 100%; }
}
@media (max-width: 560px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2,
    .search .field-q,
    .search .actions { grid-column: auto; }
    .form-card { padding: 18px 16px; }
    .form-actions .btn { width: 100%; }
    .wrap { padding: 20px 14px 48px; }
    .page-title { font-size: 23px; }
    .search { grid-template-columns: 1fr; }
    .grid, .grid.compact { grid-template-columns: 1fr; }
    .fiche { padding: 28px 20px; }
    .fiche h1 { margin-right: 0; padding-top: 30px; font-size: 25px; }
    .fiche .statut { top: 18px; right: 18px; }
    .kv { grid-template-columns: 1fr; gap: 0; }
    .kv dt { margin-top: 8px; font-size: 13px; }
    .topbar-in { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
