/* ==========================================================================
   OCD Live — système de design commun (site public + tableau de bord)
   Couleur de marque : orange du logo #EE6806.

   Composants disponibles (à réutiliser, ne pas redéfinir) :
   Mise en page  .container .container-narrow .section .section-dark .section-soft
                 .stack (espacement vertical) .cluster (ligne flexible) .grid-2 .grid-3 .grid-auto
   Texte         .eyebrow .lead .muted .small .text-center .accent
   Boutons       .btn + .btn-primary | .btn-dark | .btn-outline | .btn-ghost | .btn-danger
                 tailles .btn-sm .btn-lg ; .btn-block (pleine largeur)
   Cartes        .card .card-hover .card-selected
   Choix         .choice (label cliquable autour d'un input radio/checkbox, caché si :has() est géré) .choice-grid
   Badges        .badge .badge-en_attente .badge-confirmee .badge-annulee .badge-terminee
                 .badge-orange .badge-neutral
   Formulaires   .field (label + input) .field-row (2 colonnes ≥ 640px) .help .field-error
                 .required (astérisque) .form-errors
   Alertes       .alert .alert-success .alert-error .alert-info .alert-warning
   Tableaux      .table-wrap > table.table
   Divers        .divider .visually-hidden .tag .kbd .empty
   ========================================================================== */

:root {
  --orange: #ee6806;
  --orange-600: #d35a00;
  --orange-700: #b84d00; /* orange lisible sur blanc (contraste AA) */
  --orange-100: #ffe5d1;
  --orange-50: #fff4ec;
  --ink: #121212;
  --ink-2: #2b2b2b;
  --text: #1c1c1c;
  --muted: #646464;
  --line: #e8e2dc;
  --line-strong: #d6cdc4;
  --bg: #ffffff;
  --bg-soft: #faf7f4;
  --bg-dark: #0f0f0f;
  --success: #17803d;
  --success-bg: #e8f6ed;
  --danger: #c0262d;
  --danger-bg: #fdecec;
  --warning: #9a5b00;
  --warning-bg: #fff4dc;
  --info: #1d4f9c;
  --info-bg: #e9f0fb;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(18, 18, 18, 0.06);
  --shadow: 0 6px 24px rgba(18, 18, 18, 0.08);
  --shadow-lg: 0 18px 50px rgba(18, 18, 18, 0.14);
  --focus: 0 0 0 3px rgba(238, 104, 6, 0.35);

  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --container: 1160px;
  --gutter: 16px;
  --header-h: 64px;
}

@media (min-width: 768px) {
  :root { --gutter: 24px; --header-h: 72px; }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 0.5em; color: var(--ink); letter-spacing: -0.02em; font-weight: 800; }
h1 { font-size: clamp(2rem, 6vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h3 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
h4 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--orange-700); text-underline-offset: 3px; }
a:hover { color: var(--orange-600); }
/* Focus clavier : contour encre (contraste ≥ 3:1 sur blanc, sur l'orange de marque et autour des boutons),
   blanc sur les fonds sombres. Indépendant de box-shadow pour ne pas être écrasé par l'ombre d'un bouton. */
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.section-dark :focus-visible, .hero :focus-visible, .site-footer :focus-visible, .g-topbar :focus-visible { outline-color: #fff; }
button, input, select, textarea { font: inherit; color: inherit; }
hr, .divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---------- Mise en page ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: 56px 0; }
@media (min-width: 768px) { .section { padding: 88px 0; } }
.section-soft { background: var(--bg-soft); }
.section-dark { background: var(--bg-dark); color: #f3f3f3; }
.section-dark h1, .section-dark h2, .section-dark h3 { color: #fff; }
.section-dark .muted { color: #b9b9b9; }
.section-dark a:not(.btn) { color: var(--orange); }

.stack > * + * { margin-top: var(--stack-gap, 16px); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--cluster-gap, 12px); align-items: center; }
.grid-2, .grid-3, .grid-auto { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }

/* ---------- Texte ---------- */
.eyebrow { display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange-700); margin-bottom: 10px; }
.section-dark .eyebrow { color: var(--orange); }
.lead { font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--ink-2); }
.section-dark .lead { color: #dcdcdc; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.text-center { text-align: center; }
.accent { color: var(--orange); }

/* ---------- Boutons ---------- */
.btn {
  --btn-bg: var(--bg); --btn-fg: var(--ink); --btn-border: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  border: 1.5px solid var(--btn-border); border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 700; font-size: 0.975rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: transform .12s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { color: var(--btn-fg); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
/* Texte foncé sur orange : contraste 6,6:1 (le blanc sur cet orange ne passe pas AA). */
.btn-primary { --btn-bg: var(--orange); --btn-fg: #160b03; --btn-border: var(--orange); }
.btn-primary:hover { --btn-bg: #ff7a1a; --btn-border: #ff7a1a; }
.btn-dark { --btn-bg: var(--ink); --btn-fg: #fff; --btn-border: var(--ink); }
.btn-dark:hover { --btn-bg: #2a2a2a; }
.btn-outline { --btn-bg: transparent; --btn-fg: var(--ink); --btn-border: var(--ink); }
.section-dark .btn-outline { --btn-fg: #fff; --btn-border: rgba(255,255,255,.6); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--ink-2); }
.btn-ghost:hover { --btn-bg: var(--bg-soft); box-shadow: none; }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 0.875rem; }
.btn-lg { min-height: 54px; padding: 14px 28px; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- Cartes ---------- */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.card-hover { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card-selected { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange) inset, var(--shadow); }

/* ---------- Choix (radio / checkbox en carte) ---------- */
.choice-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .choice-grid { grid-template-columns: repeat(2, 1fr); } }
.choice { position: relative; display: block; cursor: pointer; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--bg); transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.choice:hover { border-color: var(--line-strong); }
/* Navigateurs sans :has() (iOS ≤ 15.3, Firefox < 121…) : l'état coché ne peut pas se voir sur la carte,
   on garde donc la case native visible. Elle n'est masquée que là où les règles :has() s'appliquent. */
.choice input { margin: 0 0 8px; }
@supports selector(:has(a)) {
  .choice input { position: absolute; opacity: 0; pointer-events: none; margin: 0; }
}
.choice:has(input:checked) { border-color: var(--orange); background: var(--orange-50); box-shadow: 0 0 0 1px var(--orange) inset; }
.choice:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.choice:has(input:disabled) { opacity: .5; cursor: not-allowed; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; line-height: 1.5; white-space: nowrap; background: var(--bg-soft); color: var(--ink-2); border: 1px solid var(--line); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-en_attente { background: var(--warning-bg); color: var(--warning); border-color: #f3dfb5; }
.badge-confirmee { background: var(--success-bg); color: var(--success); border-color: #c4e6d0; }
.badge-annulee { background: var(--danger-bg); color: var(--danger); border-color: #f5c9cb; }
.badge-terminee { background: #eeeeee; color: #4a4a4a; border-color: #dddddd; }
.badge-orange { background: var(--orange); color: #160b03; border-color: var(--orange); }
.badge-orange::before, .badge-neutral::before { display: none; }
.badge-neutral { background: var(--bg-soft); color: var(--ink-2); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--orange-50); color: var(--orange-700); font-size: 0.8rem; font-weight: 600; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .label { font-weight: 600; font-size: 0.925rem; color: var(--ink); }
.field-row { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }
.required { color: var(--orange-700); margin-left: 2px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"],
input[type="password"], input[type="date"], input[type="time"], input[type="datetime-local"], input[type="search"],
select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff;
  font-size: 16px; /* évite le zoom auto sur iOS */
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); box-shadow: var(--focus); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"], .field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--orange); width: 18px; height: 18px; }
.help { font-size: 0.85rem; color: var(--muted); margin: 0; }
.field-error, .errorlist { color: var(--danger); font-size: 0.875rem; font-weight: 600; margin: 0; padding: 0; list-style: none; }
.form-errors { margin-bottom: 16px; }

/* ---------- Alertes / messages ---------- */
.alert { padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: var(--success-bg); color: #0f5c2b; border-color: #c4e6d0; }
.alert-error { background: var(--danger-bg); color: #8f1c21; border-color: #f5c9cb; }
.alert-info { background: var(--info-bg); color: #163e7a; border-color: #cbdaf3; }
.alert-warning { background: var(--warning-bg); color: #6f4100; border-color: #f3dfb5; }

/* ---------- Tableaux ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--bg-soft); font-weight: 700; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fffaf6; }

/* ---------- Divers ---------- */
/* L'attribut hidden doit toujours masquer, même sur un élément stylé en flex/grid (.btn, .alert…). */
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; color: #fff; }

/* ---------- En-tête du site public ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; letter-spacing: -0.01em; }
.brand img { height: 30px; width: auto; }
.brand span { font-size: 1.05rem; }
.brand span b { color: var(--orange); font-weight: 800; }
@media (min-width: 768px) { .brand img { height: 34px; } }
.site-nav { display: none; align-items: center; gap: 4px; }
.site-nav a:not(.btn) { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 999px; }
.site-nav a:not(.btn):hover { background: var(--bg-soft); color: var(--ink); }
.nav-mobile { display: flex; align-items: center; gap: 8px; }
.nav-mobile details { position: relative; }
.nav-mobile summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; border: 1.5px solid var(--line-strong); }
.nav-mobile summary::-webkit-details-marker { display: none; }
.nav-mobile .menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; display: flex; flex-direction: column; }
.nav-mobile .menu a { padding: 12px 14px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.nav-mobile .menu a:hover { background: var(--bg-soft); }
/* Après les règles .nav-mobile, sinon « display: flex » l'emporterait sur grand écran. */
@media (min-width: 900px) { .site-nav { display: flex; } .nav-mobile { display: none; } }

/* ---------- Pied de page ---------- */
.site-footer { background: var(--bg-dark); color: #cfcfcf; padding: 48px 0 28px; margin-top: 0; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--orange); }
.site-footer .footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .site-footer .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer img { height: 34px; width: auto; margin-bottom: 14px; }
.site-footer h4 { color: #fff; font-size: .9rem; text-transform: uppercase; letter-spacing: .1em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: 8px; }
.site-footer .footer-bottom { border-top: 1px solid #2a2a2a; margin-top: 32px; padding-top: 20px; font-size: .85rem; color: #9a9a9a; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---------- Messages Django ---------- */
.messages { list-style: none; padding: 0; margin: 16px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
