/* FANALio — thème sombre, charte issue du logo (vert fanal, rouge, or). */

:root {
  --fond: #14181b;
  --surface: #1c2226;
  --surface-haute: #232b30;
  --surface-survol: #2b333a;
  --bordure: rgba(255, 255, 255, 0.08);
  --bordure-forte: rgba(255, 255, 255, 0.16);

  --texte: #e7ebec;
  --texte-attenue: #93a2a8;
  --texte-discret: #5f6d72;

  --vert: #2fa368;
  --vert-fonce: #227a4e;
  --vert-vif: #45c17e;
  --vert-teinte: rgba(47, 163, 104, 0.16);

  --or: #e8b93a;
  --or-teinte: rgba(232, 185, 58, 0.14);

  --rouge: #e0594d;
  --rouge-teinte: rgba(224, 89, 77, 0.15);

  --radius: 10px;
  --ombre: 0 2px 10px rgba(0, 0, 0, 0.35);
  --ombre-haute: 0 16px 40px rgba(0, 0, 0, 0.45);
  --police: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --largeur-sidebar: 240px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--police);
  font-size: 15px;
  line-height: 1.55;
  color: var(--texte);
  background: var(--fond);
}

a { color: var(--vert-vif); }
a:hover { color: var(--vert); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--fond); }
::-webkit-scrollbar-thumb { background: #333d42; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #404b51; }

/* -- barre latérale ------------------------------------------------------ */

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--largeur-sidebar);
  background: var(--surface);
  border-right: 1px solid var(--bordure);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1rem;
  z-index: 40;
  transition: transform 0.25s ease;
}

.marque {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--texte);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.4rem 0.3rem 1.3rem;
}
.marque img { height: 34px; border-radius: 6px; }

.nav-principale { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.nav-principale a {
  color: var(--texte-attenue);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
}
.nav-principale a:hover { background: var(--surface-haute); color: var(--texte); }
.nav-principale a.actif { background: var(--vert-teinte); color: var(--vert-vif); }

.sidebar-pied {
  border-top: 1px solid var(--bordure);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.compte { display: flex; flex-direction: column; gap: 0.35rem; }
.compte-nom { font-weight: 600; font-size: 0.9rem; }
.sidebar-pied > a { color: var(--texte-attenue); font-size: 0.85rem; text-decoration: none; }
.sidebar-pied > a:hover { color: var(--texte); }

.badge-role {
  display: inline-block;
  width: fit-content;
  background: var(--vert-teinte);
  color: var(--vert-vif);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
}

/* -- barre mobile --------------------------------------------------------- */

.barre-mobile {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  z-index: 20;
}
.logo-mobile { height: 28px; border-radius: 6px; }
.bouton-menu {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 28px; height: 28px; cursor: pointer;
}
.bouton-menu span { display: block; height: 2px; background: var(--texte); border-radius: 2px; }

.case-menu { position: absolute; }
.fond-mobile { display: none; }

/* -- disposition générale -------------------------------------------------- */

body.avec-navigation main { margin-left: var(--largeur-sidebar); }
body.avec-navigation .pied { margin-left: var(--largeur-sidebar); }

@media (max-width: 880px) {
  .sidebar { transform: translateX(-100%); }
  .case-menu:checked ~ .sidebar { transform: translateX(0); box-shadow: var(--ombre-haute); }
  .fond-mobile {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 30;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .case-menu:checked ~ .fond-mobile { opacity: 1; pointer-events: auto; }
  .barre-mobile { display: flex; }
  body.avec-navigation main,
  body.avec-navigation .pied { margin-left: 0; }
  body.avec-navigation main { padding-top: calc(1.5rem + 56px); }
}

.conteneur { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

.entete-page { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.entete-page h1 { margin: 0; }
.entete-page .bouton { margin-left: auto; }

/* -- cartes et grilles -------------------------------------------------- */

.grille { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--ombre);
}

.carte h2 { margin: 0 0 0.6rem; font-size: 1rem; color: var(--texte-attenue); font-weight: 600; }
.chiffre { font-size: 2.2rem; font-weight: 700; line-height: 1; color: var(--vert-vif); }
.chiffre.attente { color: var(--or); }
.chiffre.alerte { color: var(--rouge); }

a.carte { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s, transform 0.15s; }
a.carte:hover { border-color: var(--vert); transform: translateY(-2px); box-shadow: var(--ombre-haute); }

/* -- état des écrans ---------------------------------------------------- */

.ecran-ligne {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--bordure);
}
.ecran-ligne:last-child { border-bottom: none; }
.pastille { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pastille.en-ligne { background: var(--vert-vif); box-shadow: 0 0 0 3px var(--vert-teinte); }
.pastille.hors-ligne { background: var(--texte-discret); }
.pastille.non-appaire { background: var(--or); box-shadow: 0 0 0 3px var(--or-teinte); }
.ecran-lieu { color: var(--texte-attenue); font-size: 0.85rem; margin-left: auto; }

/* -- formulaires -------------------------------------------------------- */

label { display: block; font-weight: 600; margin-bottom: 0.3rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--bordure-forte);
  border-radius: 8px;
  font: inherit;
  background: var(--surface-haute);
  color: var(--texte);
}

input::placeholder, textarea::placeholder { color: var(--texte-discret); }

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--vert);
  outline-offset: 1px;
  border-color: var(--vert);
}

.champ { margin-bottom: 1rem; }
.champ small { display: block; color: var(--texte-attenue); font-size: 0.8rem; margin-top: 0.3rem; }
.champ-case { display: flex; align-items: center; gap: 0.5rem; }
.champ-case label { margin: 0; font-weight: 400; }
.champ-case input { width: auto; }

.bouton {
  display: inline-block;
  background: var(--vert);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.bouton:hover { background: var(--vert-fonce); color: #ffffff; }
.bouton.secondaire { background: var(--surface-haute); color: var(--texte); border: 1px solid var(--bordure-forte); }
.bouton.secondaire:hover { background: var(--surface-survol); color: var(--texte); }
.bouton.danger { background: var(--rouge); }
.bouton.danger:hover { background: #c24539; }
.bouton-pleine-largeur { width: 100%; text-align: center; }

/* -- messages ----------------------------------------------------------- */

.messages { margin-bottom: 1rem; }
.message {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--texte-discret);
  background: var(--surface-haute);
  margin-bottom: 0.5rem;
}
.message.success { border-color: var(--vert); background: var(--vert-teinte); }
.message.error { border-color: var(--rouge); background: var(--rouge-teinte); }
.message.warning { border-color: var(--or); background: var(--or-teinte); }

.banniere-alerte {
  background: var(--rouge);
  color: #ffffff;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-weight: 600;
}
.banniere-alerte.ppms { background: #7d150c; }
.banniere-alerte.info { background: var(--or); color: #2a2106; }

/* -- page de connexion -------------------------------------------------- */

.page-connexion {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(47, 163, 104, 0.12), transparent 60%),
    var(--fond);
}
.boite-connexion {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: var(--ombre-haute);
  border-top: 4px solid var(--vert);
}
.boite-connexion img { display: block; width: 150px; margin: 0 auto 0.5rem; border-radius: 8px; }
.baseline { text-align: center; color: var(--texte-attenue); font-size: 0.85rem; margin-bottom: 1.5rem; }

/* -- divers ------------------------------------------------------------- */

.vide { color: var(--texte-attenue); font-style: italic; }
.sous-texte { color: var(--texte-attenue); font-size: 0.85rem; display: block; }
.pied { text-align: center; color: var(--texte-discret); font-size: 0.8rem; padding: 2rem 1rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--bordure); }
th { color: var(--texte-attenue); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
table tr:hover td { background: var(--surface-haute); }

.liste-simple { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }

/* -- ressources : filtres, états, vignettes ------------------------------ */

.filtres { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.puce {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--surface-haute);
  color: var(--texte);
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid var(--bordure);
}
.puce:hover { background: var(--surface-survol); }
.puce.active { background: var(--vert); color: #ffffff; border-color: var(--vert); }

.etat {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface-haute);
  color: var(--texte);
  white-space: nowrap;
}
.etat.published { background: var(--vert-teinte); color: var(--vert-vif); }
.etat.pending { background: var(--or-teinte); color: #f0cf74; }
.etat.rejected { background: var(--rouge-teinte); color: #f29088; }
.etat.archived { color: var(--texte-attenue); }

.grille-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}

.vignettes { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.vignettes figure { margin: 0; max-width: 220px; }
.vignettes img {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--bordure);
  background: #ffffff;
}
.vignettes figcaption { color: var(--texte-attenue); font-size: 0.75rem; margin-top: 0.25rem; }

/* -- formulaires composés ------------------------------------------------ */

.champ-ligne { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.champ-ligne .champ { flex: 1 1 130px; margin-bottom: 0.5rem; }

fieldset {
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0 0;
}
fieldset legend {
  padding: 0 0.4rem;
  color: var(--texte-attenue);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.choix-type { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.option-type {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--bordure-forte);
  border-radius: 999px;
  cursor: pointer;
}
.option-type:has(input:checked) { border-color: var(--vert); background: var(--vert-teinte); }

textarea {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--bordure-forte);
  border-radius: 8px;
  background: var(--surface-haute);
  color: var(--texte);
  resize: vertical;
}
input[type="file"] { font: inherit; color: var(--texte-attenue); }

/* Les compteurs du tableau de bord mènent à la liste filtrée. */
a.carte { display: block; color: inherit; text-decoration: none; }
