/*
 * Delivro · pages publiques — le site www.delivro-dz.com (site/index.html), le suivi de commande /o/<resto>/<n>
 * (order_track.html) et les pages légales (/privacy, /terms).
 *
 * Charte Delivro choisie par COMPOS le 2026-10-16 (« use Delivro APK logo and color ») : les couleurs, la typographie,
 * les boutons, les cartes et le pied de page de l'administration (delivro-admin.css, look « console pro »).
 * Barre du haut blanche avec le logo de l'application, fond #F6F5FA, cartes blanches bordées d'un trait, violet profond
 * pour les bandeaux, orange en accent rare (jamais de texte orange sur fond blanc), icônes SVG au trait (jamais d'emoji),
 * chiffres tabulaires, pied de page COMPOS (logo officiel, www.compos-dz.com, 0550 20 02 72).
 *
 * Feuille AUTONOME : ces pages ne chargent plus la charte commune compos-ui.css (look « Salle des opérations », refusé
 * pour Delivro : « pas la même charte de Delivro, pas professionnel »). compos-ui.css reste celle d'Activation, de Resto
 * et des pages de connexion unique (app/routers/passage.py). Les classes cx-* (cx-top, cx-brand, cx-nav, cx-btn,
 * cx-main, cx-foot…) gardent leurs noms : la mise en page des pages ne change pas, seul le look change.
 *
 * Servie à /admin/ui/delivro-public.css (liste blanche _UI_FILES de app/main.py). Changer le ?v= des pages à chaque
 * modification (les navigateurs gardent la feuille une heure).
 */
:root {
  color-scheme: light;
  /* Delivro — violets du logo (mêmes valeurs que delivro-admin.css) */
  --v900: #21005D; --v700: #473180; --v600: #5B45A0; --v500: #6C54B4; --v400: #7960C5;
  --v300: #A99BDB; --v200: #D8D0F1; --v100: #EEEAFA; --v50: #F7F5FD;
  /* texte sur le violet profond */
  --on-v: #D6CFF0; --on-v-2: #B3A8DD;
  /* accent orange (boîte du logo) — rare */
  --or: #F8B14F; --or-l: #FDC16B; --or-bg: #FEF3E1;
  /* neutres */
  --page: #F6F5FA; --surf: #FFFFFF; --line: #E6E3F0; --line2: #EFEDF5; --line3: #D9D4E8;
  --head: #FAF9FC; --hover: #F9F8FD; --text: #1E1B2E; --muted: #6B6680; --faint: #B6B0C8;
  /* états */
  --ok: #15803D; --ok-bg: #EAF6EE; --ok-line: #BFE3CB;
  --warn: #B45309; --warn-bg: #FDF3E6;
  --bad: #B42318; --bad-bg: #FDEDEB;
  --neu-bg: #F1F0F5;
  --r: 10px; --r-sm: 8px; --r-lg: 12px;
  --font: "Segoe UI", Inter, Roboto, system-ui, -apple-system, "Noto Sans Arabic", "Helvetica Neue", Arial, sans-serif;
  --font-ar: "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --ring: 0 0 0 3px rgba(108, 84, 180, .25);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body.cx {
  margin: 0; min-height: 100%; display: flex; flex-direction: column;
  background: var(--page); color: var(--text); font: 15px/1.55 var(--font);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
[dir="rtl"] body.cx { font-family: var(--font-ar); }
:where(body.cx) :where(button, input, select, textarea) { font-family: inherit; }
:where(body.cx a) { color: var(--v600); }
:where(body.cx a:hover) { color: var(--v700); }
body.cx :focus-visible { outline: 2px solid var(--v500); outline-offset: 2px; }
h1, h2, h3, h4 { color: var(--text); }
/* icônes au trait : <svg class="cx-i"><use href="#i-…"/></svg> */
.cx-i {
  width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px;
}
.cx-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- barre du haut (blanche, logo de l'application) ---------- */
body.cx .cx-top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; flex-wrap: nowrap; gap: 8px 20px;
  min-height: 64px; padding: 0 24px; background: #fff; color: var(--text); border-bottom: 1px solid var(--line);
}
.cx-brand { display: flex; align-items: center; gap: 10px; flex: none; min-width: 0; color: var(--text) !important; text-decoration: none !important; }
.cx-brand img { width: 36px; height: 36px; display: block; flex: none; }
.cx-module { display: block; min-width: 0; font-size: 16px; font-weight: 600; line-height: 1.2; color: var(--text); white-space: nowrap; }
.cx-module small { display: block; font-size: 12px; font-weight: 400; line-height: 1.3; color: var(--muted); }
.cx-nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.cx-nav a {
  display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: var(--r-sm);
  color: var(--muted) !important; font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.cx-nav a:hover { background: var(--hover); color: var(--text) !important; }
.cx-nav a.on { background: var(--v100); color: var(--v700) !important; font-weight: 600; }
.cx-user { display: flex; align-items: center; gap: 8px; flex: none; margin-inline-start: auto; }

/* ---------- boutons (ceux de l'administration) ---------- */
.cx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 1px solid var(--v500); border-radius: var(--r-sm); background: var(--v500); color: #fff !important;
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap; text-decoration: none !important; cursor: pointer;
}
.cx-btn:hover { background: var(--v600); border-color: var(--v600); }
.cx-btn .cx-i { width: 16px; height: 16px; }
.cx-btn.cx-ghost { background: #fff; border-color: var(--line); color: var(--text) !important; font-weight: 500; }
.cx-btn.cx-ghost:hover { background: var(--hover); border-color: var(--line3); }
.cx-btn.cx-ghost .cx-i { color: var(--v500); }
.cx-btn.cx-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }

/* ---------- contenu ---------- */
.cx-main { flex: 1 0 auto; width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 24px 48px; }
.cx-main.cx-narrow { max-width: 820px; }

/* ---------- pages légales (/privacy, /terms) : une feuille blanche sur le fond de page ---------- */
.cx-main.legal {
  width: calc(100% - 48px); max-width: 860px; margin: 32px auto 48px; padding: 40px 48px 44px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); line-height: 1.65;
}
.legal h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.legal .meta { margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line2); color: var(--muted); font-size: 13px; line-height: 1.55; }
.legal h2 { margin: 34px 0 10px; font-size: 17px; line-height: 1.35; font-weight: 600; color: var(--v700); }
.legal p { margin: 0 0 12px; }
.legal .box { margin: 16px 0; padding: 14px 18px; background: var(--v50); border: 1px solid var(--v200); border-radius: var(--r); }
.legal .box p { margin: 0; }
.legal b { font-weight: 600; }
.legal ul, .legal ol { margin: 0 0 12px; padding-inline-start: 22px; }
.legal li { margin: 6px 0; }
.legal li::marker { color: var(--v400); }
.legal table { width: 100%; margin: 4px 0 12px; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; font-size: 14px; line-height: 1.5; }
.legal th, .legal td { padding: 10px 12px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line2); overflow-wrap: break-word; }
.legal td + td, .legal th + th { border-inline-start: 1px solid var(--line2); }
.legal tr:last-child td { border-bottom: 0; }
.legal th { background: var(--head); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.legal .ar { direction: rtl; text-align: right; font-family: var(--font-ar); }
.legal h2.ar { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line2); }

/* ---------- pied de page COMPOS (celui de l'administration) ---------- */
body.cx .cx-foot {
  flex: none; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 24px;
  padding: 16px 24px; background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; text-align: start;
}
.foot-l, .foot-r { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
body.cx .cx-foot img { height: 24px; width: auto; display: block; }
body.cx .cx-foot a { color: var(--v600) !important; font-weight: 500; text-decoration: none; white-space: nowrap; }
body.cx .cx-foot a:hover { color: var(--v700) !important; text-decoration: underline; }
/* le site et le téléphone se lisent de gauche à droite, même sur une page en arabe (« 0550 20 02 72 », pas « 72 02 20 0550 ») */
body.cx .cx-foot a { direction: ltr; unicode-bidi: isolate; }

/* ---------- téléphone : logo et compte sur la 1re ligne, le menu sur sa propre ligne, qui défile ---------- */
@media (max-width: 760px) {
  body.cx { font-size: 15px; }
  body.cx .cx-top { position: static; flex-wrap: wrap; min-height: 56px; padding: 10px 16px; gap: 6px 12px; }
  .cx-brand img { width: 32px; height: 32px; }
  .cx-module { font-size: 15px; }
  .cx-nav {
    order: 3; flex: 0 0 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    padding-top: 6px; border-top: 1px solid var(--line2);
  }
  .cx-nav::-webkit-scrollbar { display: none; }
  /* le menu défile : un fondu au bord indique la suite */
  .cx-nav { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .cx-nav a { height: 34px; padding: 0 10px; font-size: 13.5px; }
  .cx-main { padding: 20px 16px 36px; }
  .cx-main.legal { width: auto; margin: 0; padding: 24px 16px 32px; border-width: 0 0 1px; border-radius: 0; }
  .legal h1 { font-size: 22px; }
  .legal h2 { margin-top: 28px; font-size: 16.5px; }
  .legal th, .legal td { padding: 8px 9px; hyphens: auto; }
  .legal table { font-size: 13.5px; }
  body.cx .cx-foot { padding: 16px; gap: 10px 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print {
  .cx-top, .cx-nav { display: none !important; }
  body.cx { display: block; background: #fff; }
  .cx-main.legal { width: auto; max-width: none; margin: 0; padding: 0; border: 0; }
}
