/* =========================================================================
   TéléPAC pédagogique : feuille de style commune
   Thème institutionnel : bleu nuit + accent orange (rappel de TéléPAC).
   ========================================================================= */

/* Police Luciole (conçue pour la lisibilité, fichiers dans /telepac/font) */
@font-face {
  font-family: 'Luciole';
  src: url('../font/Luciole-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Luciole';
  src: url('../font/Luciole-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Luciole';
  src: url('../font/Luciole-Italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Luciole';
  src: url('../font/Luciole-BoldItalic.woff2') format('woff2');
  font-weight: 700; font-style: italic; font-display: swap;
}

:root {
  --tp-bleu: #13355e;
  --tp-bleu-clair: #1d4d86;
  --tp-orange: #e87b00;
  --tp-orange-fonce: #c96900;
  --tp-vert: #3fa34d;
  --tp-rouge: #c0392b;
  --tp-gris-fond: #eef1f4;
  --tp-gris-bord: #d4dae1;
  --tp-gris-txt: #475569;
  --tp-texte: #1f2933;
}

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

body {
  font-family: 'Luciole', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--tp-texte);
  background: var(--tp-gris-fond);
  font-size: 15px;
  line-height: 1.5;
}

/* La carte Leaflet impose sa propre police : on la force sur Luciole aussi */
.leaflet-container { font-family: inherit; }

/* Bandeau « site non officiel » (toutes les pages) */
.tp-officiel {
  background: var(--tp-rouge);
  color: #fff;
  text-align: center;
  font-size: 13.5px;
  padding: 9px 16px;
  border-bottom: 2px solid #8e2b21;
  line-height: 1.4;
}
.tp-officiel strong { text-transform: uppercase; letter-spacing: .4px; }
.tp-officiel a { color: #fff; text-decoration: underline; }

/* En-tête */
.tp-header {
  background: var(--tp-bleu);
  color: #fff;
  border-bottom: 4px solid var(--tp-orange);
}
.tp-header-in {
  max-width: 1280px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 20px;
}
.tp-logo {
  font-size: 26px; font-weight: 800; letter-spacing: -.5px;
  background: #fff; color: var(--tp-bleu);
  padding: 4px 12px; border-radius: 6px; line-height: 1;
}
.tp-logo span { color: var(--tp-orange); }
.tp-header-txt { flex: 1; }
.tp-campagne { font-size: 18px; font-weight: 700; }
.tp-soustitre { font-size: 13px; opacity: .85; }
.tp-superv-link {
  color: #fff; text-decoration: none; font-size: 13px;
  border: 1px solid rgba(255,255,255,.5); padding: 6px 12px; border-radius: 6px;
}
.tp-superv-link:hover { background: rgba(255,255,255,.15); }

/* Pied */
.tp-footer {
  text-align: center; color: var(--tp-gris-txt);
  font-size: 12px; padding: 18px; margin-top: 24px;
}

/* =========================================================================
   PAGE D'ACCUEIL
   ========================================================================= */
.tp-accueil-main { max-width: 1100px; margin: 0 auto; padding: 32px 20px; }
.tp-accueil-grid {
  display: grid; grid-template-columns: 1.2fr .9fr; gap: 28px; align-items: start;
}
.tp-bandeau h1 { color: var(--tp-bleu); font-size: 26px; margin-bottom: 14px; }
.tp-bandeau p { font-size: 16px; color: #334155; margin-bottom: 20px; }
.tp-etapes-liste { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.tp-etapes-liste li {
  display: flex; align-items: center; gap: 12px; font-weight: 600; color: var(--tp-bleu);
  background: #fff; border: 1px solid var(--tp-gris-bord); border-radius: 10px; padding: 12px 16px;
}
.tp-etapes-liste li span {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
  background: var(--tp-orange); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.tp-connexion {
  background: #fff; border: 1px solid var(--tp-gris-bord); border-radius: 14px;
  padding: 26px; box-shadow: 0 6px 22px rgba(19,53,94,.08);
}
.tp-connexion h2 { color: var(--tp-bleu); font-size: 20px; margin-bottom: 4px; }
.tp-aide { color: var(--tp-gris-txt); font-size: 14px; margin-bottom: 16px; }
.tp-connexion label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
.tp-connexion label .opt { font-weight: 400; color: var(--tp-gris-txt); }
.tp-connexion input {
  width: 100%; padding: 11px 13px; font-size: 15px; font-family: inherit;
  border: 1.5px solid var(--tp-gris-bord); border-radius: 8px;
}
.tp-connexion input:focus { outline: none; border-color: var(--tp-bleu-clair); box-shadow: 0 0 0 3px rgba(29,77,134,.15); }
.tp-note { font-size: 12px; color: var(--tp-gris-txt); margin-top: 14px; }

.tp-btn-primary {
  width: 100%; margin-top: 20px; background: var(--tp-orange); color: #fff;
  border: none; padding: 13px; font-size: 16px; font-weight: 700; border-radius: 8px; cursor: pointer;
}
.tp-btn-primary:hover { background: var(--tp-orange-fonce); }

/* =========================================================================
   PAGE DOSSIER (assistant + carte)
   ========================================================================= */
.app { display: flex; min-height: calc(100vh - 56px); }

/* Colonne d'étapes */
.tp-steps {
  width: 250px; flex: 0 0 250px; background: #fff;
  border-right: 1px solid var(--tp-gris-bord); padding: 16px 0;
}
.tp-steps .ident {
  padding: 0 18px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--tp-gris-bord);
}
.tp-steps .ident .who { font-weight: 700; color: var(--tp-bleu); }
.tp-steps .ident .meta { font-size: 12px; color: var(--tp-gris-txt); }
.tp-steps button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: none; padding: 13px 18px; cursor: pointer;
  font-size: 14px; font-family: inherit; color: #334155; border-left: 4px solid transparent;
}
.tp-steps button:hover { background: #f1f5f9; }
.tp-steps button.actif { background: #eaf1fb; border-left-color: var(--tp-orange); color: var(--tp-bleu); font-weight: 700; }
.tp-steps button .num {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
  background: var(--tp-gris-bord); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.tp-steps button.actif .num { background: var(--tp-orange); }
.tp-steps button.ok .num { background: var(--tp-vert); }
.tp-steps button.ok .num::after { content: "✓"; }
.tp-steps button.ok .num .n { display: none; }

/* Zone principale */
.tp-main { flex: 1; min-width: 0; padding: 22px 26px; overflow-x: hidden; }
.tp-main h2.titre-etape { color: var(--tp-bleu); font-size: 22px; margin-bottom: 4px; }
.tp-main .sous-etape { color: var(--tp-gris-txt); margin-bottom: 18px; }
.etape { display: none; }
.etape.actif { display: block; }

.tp-card {
  background: #fff; border: 1px solid var(--tp-gris-bord); border-radius: 12px;
  padding: 22px; margin-bottom: 18px;
}
.tp-card h3 { color: var(--tp-bleu); font-size: 16px; margin-bottom: 12px; }

.tp-info {
  background: #eaf1fb; border: 1px solid #b9d0ee; border-left: 4px solid var(--tp-bleu-clair);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; color: #1e3a5f;
}
.tp-warn {
  background: #fff4e5; border: 1px solid #f4c98a; border-left: 4px solid var(--tp-orange);
  border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; color: #8a4b00;
}

/* Formulaires */
.tp-form-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 4px; }
.tp-field { flex: 1; min-width: 200px; margin-bottom: 14px; }
.tp-field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.tp-field input, .tp-field select {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: inherit;
  border: 1.5px solid var(--tp-gris-bord); border-radius: 8px; background: #fff;
}
.tp-field input:focus, .tp-field select:focus {
  outline: none; border-color: var(--tp-bleu-clair); box-shadow: 0 0 0 3px rgba(29,77,134,.12);
}

/* Boutons */
.btn { border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px;
       font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-o  { background: var(--tp-orange); color: #fff; } .btn-o:hover { background: var(--tp-orange-fonce); }
.btn-b  { background: var(--tp-bleu); color: #fff; }   .btn-b:hover { background: var(--tp-bleu-clair); }
.btn-g  { background: #e2e8f0; color: #334155; }       .btn-g:hover { background: #cbd5e1; }
.btn-v  { background: var(--tp-vert); color: #fff; }
.btn-r  { background: var(--tp-rouge); color: #fff; }
.btn:disabled { background: #cbd5e1; color: #fff; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.barre-nav {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--tp-gris-bord);
}

/* Tableaux */
table.tp-tab { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tp-tab th, table.tp-tab td { padding: 9px 11px; border-bottom: 1px solid var(--tp-gris-bord); text-align: left; }
table.tp-tab th { background: #f1f5f9; color: var(--tp-bleu); font-size: 13px; }
table.tp-tab tr:hover td { background: #f8fafc; }
table.tp-tab .num { text-align: right; font-variant-numeric: tabular-nums; }
.pastille { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; margin-right: 6px; border: 1px solid rgba(0,0,0,.2); }

/* =========================================================================
   CARTE (RPG)
   ========================================================================= */
.rpg-layout { display: flex; gap: 16px; }
#carte { flex: 1; height: 620px; border-radius: 12px; border: 1px solid var(--tp-gris-bord); }
.rpg-panneau { width: 320px; flex: 0 0 320px; }
.rpg-outils {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
  background: #fff; border: 1px solid var(--tp-gris-bord); border-radius: 10px; padding: 10px;
}
.rpg-outils .btn { flex: 1 1 calc(50% - 8px); }
.btn-actif { outline: 3px solid rgba(232,123,0,.35); }
.rpg-detail {
  background: #fff; border: 1px solid var(--tp-gris-bord); border-radius: 10px; padding: 14px; margin-bottom: 12px;
}
.rpg-detail .vide { color: var(--tp-gris-txt); font-style: italic; font-size: 14px; }
.legende { background: #fff; border: 1px solid var(--tp-gris-bord); border-radius: 10px; padding: 12px; }
.legende h4 { font-size: 13px; color: var(--tp-bleu); margin-bottom: 8px; }
.legende .l-item { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }

.compteurs { display: flex; gap: 10px; margin-bottom: 12px; }
.compteurs .c {
  flex: 1; background: #fff; border: 1px solid var(--tp-gris-bord); border-radius: 10px;
  padding: 10px; text-align: center;
}
.compteurs .c .v { font-size: 22px; font-weight: 800; color: var(--tp-bleu); }
.compteurs .c .k { font-size: 12px; color: var(--tp-gris-txt); }

/* Étiquettes sur la carte */
.leaflet-tooltip.tt-ilot {
  background: rgba(232,123,0,.92); color: #fff; border: none; font-weight: 700;
  box-shadow: none; padding: 1px 6px; font-size: 12px;
}
.leaflet-tooltip.tt-ilot::before { display: none; }
.leaflet-tooltip.tt-parc {
  background: rgba(19,53,94,.82); color: #fff; border: none; font-weight: 600;
  box-shadow: none; padding: 1px 5px; font-size: 11px;
}
.leaflet-tooltip.tt-parc::before { display: none; }

/* Aides */
.aide-groupe { margin-bottom: 18px; }
.aide-groupe h3 { border-bottom: 2px solid var(--tp-gris-bord); padding-bottom: 6px; }
.aide-ligne {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid #eef1f4;
}
.aide-ligne input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; cursor: pointer; }
.aide-ligne .lib { font-weight: 600; }
.aide-ligne .info { font-size: 13px; color: var(--tp-gris-txt); }
.aide-ligne select, .aide-ligne input[type=number] {
  margin-top: 6px; padding: 6px 10px; border: 1.5px solid var(--tp-gris-bord); border-radius: 6px; font-family: inherit;
}

/* Contrôles */
.ctrl { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eef1f4; }
.ctrl .ico { font-size: 18px; line-height: 1.3; }
.ctrl.ok .ico { color: var(--tp-vert); }
.ctrl.err .ico { color: var(--tp-rouge); }
.ctrl.warn .ico { color: var(--tp-orange); }
.ctrl .txt b { display: block; }
.ctrl .txt span { font-size: 13px; color: var(--tp-gris-txt); }

/* Bandeau dépôt */
.bandeau-depose {
  background: #e6f4ea; border: 1.5px solid var(--tp-vert); color: #1e6b33;
  border-radius: 10px; padding: 14px 18px; margin-bottom: 16px; font-weight: 600;
}

/* Statut flottant */
.statut {
  position: fixed; bottom: 22px; right: 22px; background: var(--tp-bleu); color: #fff;
  padding: 10px 18px; border-radius: 22px; font-size: 14px; opacity: 0;
  transition: opacity .3s; box-shadow: 0 3px 12px rgba(0,0,0,.25); z-index: 1200;
}
.statut.show { opacity: 1; }
.statut.ok { background: var(--tp-vert); }
.statut.err { background: var(--tp-rouge); }

/* Modale */
.modale-fond {
  position: fixed; inset: 0; background: rgba(15,30,55,.55); display: none;
  align-items: center; justify-content: center; z-index: 1100; padding: 20px;
}
.modale-fond.show { display: flex; }
.modale {
  background: #fff; border-radius: 14px; padding: 24px; max-width: 460px; width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.modale h3 { color: var(--tp-bleu); margin-bottom: 12px; }
.modale .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

@media (max-width: 900px) {
  .tp-accueil-grid { grid-template-columns: 1fr; }
  .app { flex-direction: column; }
  .tp-steps { width: 100%; flex: none; display: flex; overflow-x: auto; }
  .rpg-layout { flex-direction: column; }
  .rpg-panneau { width: 100%; flex: none; }
  #carte { height: 420px; }
}

/* =========================================================================
   AIDE : contenu du guide (page imprimable + popup) et widget flottant
   ========================================================================= */
.aide-main { max-width: 860px; margin: 0 auto; padding: 22px 20px 40px; }

/* Contenu du guide (classe partagée par la page et la popup) */
.aide-doc h1 { color: var(--tp-bleu); font-size: 22px; margin-bottom: 4px; }
.aide-doc .intro { color: var(--tp-gris-txt); margin-bottom: 18px; }

.aide-doc .frise { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 20px; }
.aide-doc .frise span.etq {
  background: var(--tp-bleu); color: #fff; border-radius: 16px;
  padding: 5px 12px; font-size: 13px; font-weight: 600;
}
.aide-doc .frise span.etq.depart { background: var(--tp-orange); }
.aide-doc .frise span.fl { color: var(--tp-orange); font-weight: 700; font-size: 20px; line-height: 1; }

/* Dans la popup (étroite), la frise s'empile verticalement et les flèches pointent vers le bas */
.aide-pop .frise { flex-direction: column; align-items: center; gap: 4px; }
.aide-pop .frise span.etq { text-align: center; }
.aide-pop .frise span.fl { transform: rotate(90deg); }

.aide-doc .schema { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.aide-doc .ilot-demo { position: relative; border: 3px dashed var(--tp-orange); border-radius: 8px;
             padding: 22px 10px 10px; display: flex; gap: 8px; background: #fff; }
.aide-doc .ilot-demo .ilot-tag { position: absolute; top: -11px; left: 10px; background: var(--tp-orange);
             color: #fff; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 10px; }
.aide-doc .parc-box { width: 62px; height: 60px; border-radius: 4px; display: flex; align-items: flex-end;
            justify-content: center; color: #fff; font-size: 11px; font-weight: 700; padding: 4px; text-align: center; }
.aide-doc .schema .leg { font-size: 14px; max-width: 380px; }
.aide-doc .schema .leg p { margin-bottom: 6px; }
.aide-doc .sw { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }
.aide-doc .sw-ilot { border: 2px dashed var(--tp-orange); border-radius: 3px; background: transparent; }
.aide-doc .sw-parc { border-radius: 3px; background: linear-gradient(135deg, #7b2cbf 0 33%, #f4c430 33% 66%, #3fa34d 66% 100%); }
.aide-doc .defs p { margin-bottom: 8px; }

.aide-doc .flux .pas { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid #eef1f4; }
.aide-doc .flux .pas:last-child { border-bottom: none; }
.aide-doc .flux .pas .badge {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: var(--tp-orange);
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.aide-doc .flux .pas .corps { flex: 1; }
.aide-doc .flux .pas .corps h4 { color: var(--tp-bleu); font-size: 16px; margin-bottom: 6px; }
.aide-doc .flux .pas .corps ul { margin: 0 0 0 18px; }
.aide-doc .flux .pas .corps li { margin-bottom: 4px; }
.aide-doc .cle { background: #fff4e5; border-radius: 4px; padding: 1px 6px; font-weight: 600; color: #8a4b00; white-space: nowrap; }
.aide-doc .astuces li { margin-bottom: 6px; }

/* Pastille flottante (présente sur toutes les pages) */
.aide-fab {
  position: fixed; bottom: 22px; right: 22px; z-index: 1300;
  width: 56px; height: 56px; border-radius: 50%; background: var(--tp-orange); color: #fff;
  border: none; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.3);
  font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.aide-fab:hover { background: var(--tp-orange-fonce); }

/* Popup d'aide déplaçable et redimensionnable */
.aide-pop {
  position: fixed; z-index: 1310; display: none; flex-direction: column;
  width: 440px; height: 70vh; min-width: 300px; min-height: 240px;
  max-width: 96vw; max-height: 92vh;
  background: #fff; border-radius: 12px; box-shadow: 0 14px 44px rgba(0,0,0,.38);
  resize: both; overflow: hidden;
}
.aide-pop.show { display: flex; }
.aide-pop-head {
  flex: 0 0 auto; background: var(--tp-bleu); color: #fff; padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: move; user-select: none; border-radius: 12px 12px 0 0;
}
.aide-pop-head .t { font-weight: 700; font-size: 15px; }
.aide-pop-head button { background: none; border: none; color: #fff; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.aide-pop-body { flex: 1 1 auto; overflow: auto; padding: 16px; }
.aide-pop-body .tp-card { padding: 16px; }

@media print { .aide-fab, .aide-pop { display: none !important; } }
