/* Page publique de réservation — couleurs du client injectées en variables CSS (voir views/layout.php).
   Police système : aucun appel à Google Fonts (pas de transfert d'IP vers un tiers). */

*, *::before, *::after { box-sizing: border-box; }
:root {
  --ink-900: #12233D; --ink-700: #34425A; --ink-500: #51607A;
  --line: #DCE3EE; --line-soft: #EDF1F6; --field: #C9D3E1;
  --ground: #F4F7FB; --white: #FFFFFF;
  --ok-bg: #E4F4EA; --ok-ink: #17602F; --warn-bg: #FFF6E5; --warn-ink: #6B4A00; --err-bg: #FDECEC; --err-ink: #9B1C1C;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink-900);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--ink); }
a:hover { color: var(--ink-900); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; background: var(--ground); }
@media (min-width: 600px) {
  body { padding: 32px 16px; }
  .app { min-height: auto; border-radius: 24px; overflow: hidden; box-shadow: 0 1px 2px rgba(18,35,61,.06), 0 12px 40px rgba(18,35,61,.08); }
}

/* En-tête */
.top { background: var(--white); border-bottom: 1px solid var(--line); padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; }
.brand .initials { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); color: var(--ink); font-weight: 800; }
.brand .names { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.brand .org { font-size: 13px; font-weight: 600; color: var(--ink-500); }
.brand .title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.brand-stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.brand-row { display: flex; align-items: center; gap: 12px; min-height: 44px; min-width: 0; }
.brand-row .logo { display: block; height: 56px; width: auto; max-width: min(240px, 62vw); object-fit: contain; object-position: left center; }
.brand-row .org-big { font-size: 15px; font-weight: 700; color: var(--ink-700); line-height: 1.3; }
.brand-stack .title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.icon-btn { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--white); cursor: pointer; padding: 0; }
.progress-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ink-500); }
.bar { height: 6px; border-radius: 6px; background: #E3E9F2; overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .25s ease; }

/* Contenu */
main { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
h1:focus { outline: none; }
.muted { color: var(--ink-500); font-size: 14px; margin: 0; }
.small { font-size: 13px; }

.summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); }
.summary b { display: block; font-size: 15px; }
.summary span { font-size: 13px; color: var(--ink-500); }
.link-btn { min-height: 44px; padding: 0 8px; border: none; background: none; color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; }

.cards { display: flex; flex-direction: column; gap: 12px; }
.card {
  display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left; cursor: pointer;
  padding: 16px; border-radius: calc(var(--radius) + 2px); border: 2px solid var(--line); background: var(--white);
}
.card[aria-pressed="true"] { border-color: var(--accent); background: var(--soft); }
.card .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card .name { font-size: 17px; font-weight: 700; }
.card .price { font-size: 15px; font-weight: 800; white-space: nowrap; }
.card .desc { font-size: 14px; color: var(--ink-500); line-height: 1.45; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; background: #EEF2F7; color: var(--ink-700); }

/* Jours */
.days-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.days-nav { display: flex; gap: 6px; }
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.day {
  flex: 0 0 64px; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: calc(var(--radius) + 2px); border: 2px solid var(--line); background: var(--white); cursor: pointer; scroll-snap-align: start; padding: 6px 0;
}
.day .dow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.day .num { font-size: 20px; font-weight: 800; line-height: 1.1; }
.day .cnt { font-size: 11px; font-weight: 600; color: var(--ink-500); }
.day[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.day[aria-pressed="true"] .cnt { color: inherit; }
.day:disabled { background: #EEF2F7; border-color: #E3E9F2; color: #6B7891; cursor: not-allowed; }
.period { display: flex; flex-direction: column; gap: 10px; }
.period-title { font-size: 14px; font-weight: 700; color: var(--ink-700); }
.times { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.time { min-height: 48px; border-radius: var(--radius); border: 1px solid var(--field); background: var(--white); font-weight: 700; cursor: pointer; }
.time[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent); color: var(--on-accent); }
.empty { padding: 18px; border-radius: var(--radius); background: var(--white); border: 1px dashed var(--field); color: var(--ink-500); font-size: 14px; text-align: center; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
.field .opt { font-weight: 500; color: var(--ink-500); }
.input, .textarea {
  min-height: 48px; padding: 0 14px; border: 1px solid var(--field); border-radius: var(--radius); background: var(--white); font-size: 16px; font-weight: 400; width: 100%;
}
.textarea { padding: 12px 14px; resize: vertical; min-height: 88px; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--err-ink); }
.hint { font-size: 13px; font-weight: 500; color: var(--ink-500); }
.field-error { font-size: 13px; font-weight: 600; color: var(--err-ink); }
.code-box { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: calc(var(--radius) + 2px); background: var(--white); border: 1px solid var(--line); }
.code-box .label { font-size: 15px; font-weight: 700; }
.code-input { min-height: 54px; text-align: center; font-size: 26px; font-weight: 700; letter-spacing: .4em; padding-left: .4em; font-variant-numeric: tabular-nums; background: #F8FAFD; }
.code-box.done { border-color: var(--ok-ink); }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; font-weight: 600; line-height: 1.45; }
.notice svg { flex-shrink: 0; margin-top: 1px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.err { background: var(--err-bg); color: var(--err-ink); }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }

/* Paiement et confirmation */
.box { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: calc(var(--radius) + 2px); background: var(--white); border: 1px solid var(--line); }
.line { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.line.total { font-size: 17px; font-weight: 800; }
.sep { height: 1px; background: #E3E9F2; }
.check { width: 64px; height: 64px; border-radius: 32px; background: var(--ok-bg); color: var(--ok-ink); display: grid; place-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ghost {
  min-height: 48px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 12px;
  border-radius: var(--radius); border: 1px solid var(--field); background: var(--white); color: var(--ink-900); font-weight: 700; text-decoration: none; cursor: pointer;
}
.ghost:hover { color: var(--ink-900); border-color: var(--ink-500); }

/* Pied de page / bouton principal */
.foot { position: sticky; bottom: 0; padding: 14px 20px calc(18px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--line); }
.primary {
  width: 100%; min-height: 54px; border: none; border-radius: calc(var(--radius) + 2px);
  background: var(--accent); color: var(--on-accent); font-size: 16px; font-weight: 800; cursor: pointer; padding: 0 16px;
}
.primary:disabled { background: var(--line); color: #5A6680; cursor: not-allowed; }
.primary.busy { opacity: .75; cursor: progress; }
a.primary { display: flex; align-items: center; justify-content: center; text-decoration: none; }
a.primary:hover { color: var(--on-accent); }

/* Pages simples (gestion, messages) */
.page { padding: 24px 20px 28px; display: flex; flex-direction: column; gap: 16px; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.danger { border-color: #E8B4B4; color: var(--err-ink); }
.danger:hover { color: var(--err-ink); border-color: var(--err-ink); }
.foot-note { text-align: center; font-size: 12px; color: #6B7891; padding: 14px 20px 18px; }

/* Intégration dans une iframe sur le site du client */
body.embed { padding: 0 !important; background: transparent; }
body.embed .app { box-shadow: none !important; border-radius: 0 !important; max-width: none; min-height: 100vh; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
