/* ===== EPA – Mon permis : styles ===== */
:root {
  /* Couleurs EPA : noir, blanc et doré */
  --brand: #111111;        /* noir */
  --brand-2: #2b2b2b;      /* noir au survol */
  --gold: #dbb055;         /* doré du logo EPA */
  --gold-light: #e6c374;   /* doré clair (sur fond noir) */
  --gold-dark: #8a6d12;    /* doré foncé (texte sur fond blanc, bien lisible) */
  --brand-soft: #f6efd9;   /* fond doré très clair */
  --accent: #dbb055;
  --bg: #f7f6f2;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --info-soft: #e0f2fe;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: #000; color: #fff; /* noir pur, identique au fond du logo */
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 2px solid var(--gold);
}
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold); color: var(--brand);
  font-weight: 800; letter-spacing: .5px;
  border-radius: 10px; padding: 4px 10px; font-size: 1.05rem;
}
.logo-img { height: 40px; width: auto; display: block; flex: 0 0 auto; }
.topbar .title { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar button { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; font: inherit; font-size: .9rem; cursor: pointer; }
.topbar button:hover { background: rgba(255,255,255,.25); }

.demo-banner { background: var(--warn-soft); color: var(--warn); font-size: .85rem; text-align: center; padding: 6px 16px; }

.layout { max-width: 1100px; margin: 0 auto; }
main { padding: 16px; padding-bottom: calc(var(--nav-h) + 24px); }

/* Navigation : en bas sur téléphone, en haut sur ordinateur */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; color: var(--muted); font-size: .72rem; gap: 2px; min-width: 0;
}
.nav a .ico { font-size: 1.3rem; line-height: 1; }
.nav a.active { color: var(--gold-dark); font-weight: 700; }

@media (min-width: 820px) {
  .nav {
    position: sticky; top: 56px; bottom: auto; height: auto;
    border-top: 0; border-bottom: 1px solid var(--line);
    justify-content: center; gap: 4px; padding: 6px 16px;
  }
  .nav a { flex: 0 0 auto; flex-direction: row; gap: 8px; font-size: .95rem; padding: 8px 14px; border-radius: 10px; }
  .nav a.active { background: var(--brand); color: var(--gold-light); }
  .nav a .ico { font-size: 1.1rem; }
  main { padding: 24px; }
}

/* ---------- Cartes et grilles ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px;
}
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
@media (min-width: 820px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
}
.hero {
  background: linear-gradient(135deg, #000 0%, #1c1c1c 60%, #2a2416 100%);
  color: #fff; border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  border-left: 4px solid var(--gold);
}
.hero h1 { margin-bottom: 4px; color: var(--gold-light); }
.hero p { margin: 0; opacity: .9; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .big { font-size: 1.6rem; font-weight: 700; }

.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); border-radius: 99px; transition: width .3s; }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 180px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: #0369a1; }
.badge.grey { background: var(--line); color: var(--muted); }

/* ---------- Boutons et formulaires ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 10px 16px;
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer;
  background: var(--brand); color: #fff; text-decoration: none;
}
.btn:hover { background: var(--brand-2); }
.btn:not(.secondary):not(.ghost):not(.ok):not(.bad) { color: var(--gold-light); }
.btn.secondary { background: var(--gold); color: var(--brand); }
.btn.secondary:hover { background: var(--gold-light); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--gold); background: var(--brand-soft); }
.btn.ok { background: var(--ok); }
.btn.bad { background: var(--bad); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=url], input[type=tel], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.field { margin-bottom: 12px; }
.fields { display: grid; gap: 12px; }
@media (min-width: 600px) { .fields.two { grid-template-columns: 1fr 1fr; } .fields.four { grid-template-columns: repeat(4, 1fr); } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; }
.hint { font-size: .82rem; color: var(--muted); font-weight: 400; }

/* ---------- Documents ---------- */
.doc { display: flex; gap: 12px; align-items: flex-start; }
.doc .doc-ico { font-size: 1.5rem; line-height: 1; padding-top: 2px; }
.doc .doc-body { flex: 1; min-width: 0; }
.doc .doc-body p { margin: 2px 0 8px; font-size: .88rem; color: var(--muted); }
.doc .motif { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 6px 10px; font-size: .85rem; margin: 6px 0; }
.upload-btn { position: relative; overflow: hidden; }
.upload-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.preview { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f8fafc; max-width: 420px; }
.preview img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: contain; }
.preview iframe { width: 100%; height: 320px; border: 0; }
.preview.wide { max-width: 100%; }
.preview.wide img { max-height: none; }
.preview.wide iframe { height: 70vh; }
textarea { resize: vertical; line-height: 1.5; }
.preview .placeholder { padding: 24px; text-align: center; color: var(--muted); font-size: .9rem; }

/* ---------- Leçons ---------- */
.lesson { display: flex; gap: 14px; align-items: center; }
.lesson .date-box {
  flex: 0 0 auto; width: 58px; text-align: center; border-radius: 12px;
  background: var(--brand); color: var(--gold-light); padding: 6px 0;
}
.lesson .date-box .d { font-size: 1.35rem; font-weight: 800; line-height: 1.1; }
.lesson .date-box .m { font-size: .72rem; text-transform: uppercase; font-weight: 600; }
.lesson.past .date-box { background: var(--line); color: var(--muted); }
.lesson .lesson-body { flex: 1; min-width: 0; }

/* ---------- Fiches ---------- */
.fiche-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.fiche-tile {
  display: block; text-decoration: none; color: inherit; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border: 2px solid transparent;
}
.fiche-tile:hover { border-color: var(--gold-light); }
.fiche-tile.next { border-color: var(--accent); }
.fiche-tile .emoji { font-size: 1.8rem; }
.fiche-tile h3 { margin: 6px 0 4px; }
.fiche-tile p { margin: 0; font-size: .88rem; color: var(--muted); }
.fiche-content h2 { margin-top: 1.25rem; }
.fiche-content ul { padding-left: 1.2rem; margin: 0 0 .5rem; }
.fiche-content li { margin-bottom: 6px; }
/* Fiche aux couleurs EPA, protégée par un filigrane */
.fiche-protegee { position: relative; overflow: hidden; padding: 0; isolation: isolate; }
/* Logo EPA en grand, répété sur toute la hauteur de la fiche, derrière le texte */
.fiche-protegee::before {
  content: ''; position: absolute; inset: 70px 0 40px; z-index: -1; pointer-events: none;
  background: url('images/logo-filigrane.png') center top / 95% auto repeat-y;
  opacity: .09; filter: grayscale(1) invert(1);
}
.fiche-entete { background: #000; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 3px solid var(--gold); }
.fiche-entete img { height: 44px; width: auto; display: block; }
.fiche-entete span { color: var(--gold-light); font-weight: 700; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
.fiche-corps { padding: 18px 20px 8px; }
.fiche-corps h1 { color: #000; border-left: 5px solid var(--gold); padding-left: 12px; }
.fiche-corps h2 { color: var(--gold-dark); }
.fiche-corps strong { color: #000; }
.fiche-pied { background: #000; color: var(--gold-light); font-size: .75rem; text-align: center; padding: 10px 16px; margin-top: 16px; }
.etape { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 12px; }
.etape .num { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: #000; color: var(--gold-light); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: .9rem; margin-top: 1px; }
.etape p { margin: 0; }
.fiche-img { margin: 8px 0 18px; }
.fiche-img img { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; border-radius: 14px; }
.fiche-protegee, .fiche-protegee * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media print { .fiche-protegee::before, .fiche-protegee::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.retenir { background: var(--warn-soft); border-radius: 12px; padding: 14px 16px; margin-top: 16px; }
.retenir h2 { margin-top: 0 !important; color: var(--warn); }

/* ---------- Forfaits ---------- */
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.forfait-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); align-items: stretch; }
.forfait-card { display: flex; flex-direction: column; margin: 0; border: 2px solid transparent; }
.forfait-card.current { border-color: var(--gold); }
.forfait-card .prix { font-size: 1.8rem; font-weight: 800; color: var(--gold-dark); margin-top: 8px; line-height: 1.2; }
.forfait-card .inclus { list-style: none; padding: 0; margin: 10px 0 16px; flex: 1; }
.forfait-card .inclus li { position: relative; padding-left: 24px; margin-bottom: 6px; font-size: .92rem; }
.forfait-card .inclus li::before { content: '✓'; position: absolute; left: 0; color: var(--gold-dark); font-weight: 800; }
.forfait-card .btn { margin-top: auto; }

/* ---------- Avis ---------- */
.social { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.social a, .social .disabled {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius);
  background: var(--card); box-shadow: var(--shadow); text-decoration: none; color: var(--text); font-weight: 600;
}
.social .disabled { opacity: .55; cursor: not-allowed; }
.social .s-ico { font-size: 1.6rem; }
.stars { font-size: 2rem; letter-spacing: 4px; color: var(--accent); }

/* ---------- Connexion ---------- */
.login { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
.login .brand { text-align: center; margin: 16px 0 24px; }
.login .brand .brand-logo { background: #000; border-radius: 18px; padding: 20px 16px; border-bottom: 3px solid var(--gold); box-shadow: var(--shadow); }
.login .brand .brand-logo img { display: block; width: 100%; max-width: 380px; height: auto; margin: 0 auto; }
.login .brand h1 { margin-top: 12px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; margin-bottom: 8px; }
.choice:hover { border-color: var(--gold); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: var(--gold-light); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }

/* ---------- Tableaux (secrétariat) ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .3px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fafc; }

/* ---------- Divers ---------- */
.empty { text-align: center; color: var(--muted); padding: 20px 8px; }
.notice { background: var(--brand-soft); color: #3d3110; border-left: 3px solid var(--gold); border-radius: 12px; padding: 12px 14px; font-size: .9rem; margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; text-decoration: none; font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: .9rem;
  z-index: 50; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center;
}
.loading { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #000; color: var(--gold-light); min-height: 100vh; }
.loading img { width: 220px; max-width: 70%; }
body.busy { cursor: progress; }
body.busy .btn, body.busy button { pointer-events: none; opacity: .7; }
/* Fenêtre de confirmation */
.modal-fond { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 16px; max-width: 440px; width: 100%; padding: 20px; border-top: 4px solid var(--gold); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal-message { font-size: 1rem; font-weight: 600; margin: 0 0 16px; }
.modal-champ { margin-bottom: 16px; }
.modal-btns { justify-content: flex-end; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
