/* ============================================================
   STUDIO R by RUNGYM — Style (mobile d'abord)
   Ambiance « Sable et terracotta » (validée le 29/09) :
   fond sable clair, accent terracotta, Cormorant Garamond + DM Sans.
   Toutes les couleurs sont ici : changer l'ambiance = changer ce bloc.
   ============================================================ */

:root {
  --bg: #f6f1ea;          /* sable clair (fond de page) */
  --surface: #ffffff;     /* cartes */
  --surface-2: #efe5d8;   /* sable (zones secondaires) */
  --line: #e4d7c6;        /* filets */
  --text: #2b2522;        /* texte principal */
  --muted: #76685c;       /* texte secondaire (contraste AA sur fond sable) */
  --red: #a85a40;         /* accent terracotta (nom historique conservé) */
  --red-dark: #8f4a33;
  --accent-soft: #f3e3da; /* terracotta très clair */
  --on-accent: #ffffff;
  --ok: #4f7a4b;          /* sauge */
  --ok-soft: #e6eee1;
  --warn: #9a6a1c;        /* ocre */
  --warn-soft: #f6ead2;
  --danger: #a3392a;
  --danger-soft: #f7e1db;
  --shadow: 0 10px 30px rgba(74, 52, 38, .12);
  --radius: 16px;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

/* chiffres « modernes » alignés (Cormorant affiche sinon 18h00 comme « 18hoo ») */
/* !important : le raccourci « font: » utilisé plus bas réinitialiserait ce réglage */
* { font-variant-numeric: lining-nums !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a { color: inherit; }

/* ---------- En-tête ---------- */
.demo-banner {
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  padding: 6px 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }

.brand-r {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--red);
  color: var(--red);
  font: 500 22px var(--display);
  border-radius: 50%;
}

.brand-txt { font: 500 22px var(--display); letter-spacing: .03em; line-height: 1; }
.brand-txt small { display: block; font: 400 11px var(--body); color: var(--muted); letter-spacing: .06em; margin-top: 3px; }

.announce {
  background: var(--red);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  padding: 10px 16px;
  white-space: pre-line;
}

/* ---------- Mise en page ---------- */
main { max-width: 520px; margin: 0 auto; padding: 12px 20px 56px; }

.view { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero-title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(48px, 15vw, 68px);
  line-height: .95;
  margin: 18px 0 10px;
}
.red { color: var(--red); font-style: italic; }
.hero-sub { color: var(--muted); margin: 0 0 28px; }

.section-title { font: 500 34px var(--display); margin: 8px 0 12px; line-height: 1.1; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

/* ---------- Onglets + formulaires ---------- */
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; margin-bottom: 16px; }
.tab {
  flex: 1;
  background: none;
  border: 0;
  color: var(--muted);
  font: 500 15px var(--body);
  padding: 10px;
  border-radius: 999px;
  cursor: pointer;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(74, 52, 38, .1); }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.form input:not([type=checkbox]) {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: 16px var(--body);
  padding: 13px 14px;
  width: 100%;
}
.form input:focus { outline: none; border-color: var(--red); background: var(--surface); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.form .check { flex-direction: row; align-items: flex-start; gap: 12px; color: var(--text); font-size: 15px; font-weight: 400; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--red); flex-shrink: 0; }
.check small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  font: 500 16px var(--body);
  padding: 14px 22px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, background .15s, border-color .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-red { background: var(--red); color: var(--on-accent); }
.btn-red:hover { background: var(--red-dark); }
.btn-outline { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }
.btn-big { font-size: 18px; padding: 20px; }

.link-btn { background: none; border: 0; color: var(--muted); font: 500 14px var(--body); cursor: pointer; text-decoration: underline; padding: 4px; }

/* ---------- Accueil ---------- */
.hello { font-size: 15px; color: var(--muted); margin: 4px 0 14px; }
.hello strong { display: block; font: 500 32px var(--display); color: var(--text); line-height: 1.1; }

.credits-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 20px;
  text-align: center;
}
.credits-label { display: block; color: var(--muted); font-size: 14px; }
.credits-num { display: block; font: 500 80px var(--display); line-height: 1.05; color: var(--red); }
.credits-unit { display: block; font-size: 12px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

.lots { list-style: none; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); text-align: left; font-size: 13px; color: var(--muted); }
.lots:empty { display: none; }
.lots li { padding: 5px 0; }
.lots li b { color: var(--text); font-weight: 500; }
.lots li small { display: block; font-size: 12px; }

.notice {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  background: var(--warn-soft);
  color: var(--warn);
}
.notice.ok { background: var(--ok-soft); color: var(--ok); }

.big-actions { display: grid; gap: 10px; margin: 22px 0 18px; }

.link-row {
  display: flex;
  justify-content: space-between;
  padding: 16px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}
.link-row:hover { color: var(--text); }

.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 4px; }

/* ---------- Boutique ---------- */
.plans { display: grid; gap: 14px; margin: 14px 0 18px; }

.plan {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
}
.plan.featured { border: 1.5px solid var(--red); background: linear-gradient(160deg, var(--accent-soft), var(--surface) 65%); }
.plan-badge {
  position: absolute;
  top: -11px;
  left: 18px;
  background: var(--red);
  color: var(--on-accent);
  font: 500 11px var(--body);
  letter-spacing: .06em;
  padding: 4px 12px;
  border-radius: 20px;
}
.plan-name { font: 500 24px var(--display); line-height: 1.15; }
.plan-meta { color: var(--muted); font-size: 13px; grid-column: 1; }
.plan-price { font: 500 32px var(--display); grid-row: 1 / span 2; grid-column: 2; text-align: right; line-height: 1; }
.plan-price small { display: block; font: 400 12px var(--body); color: var(--muted); margin-top: 4px; }
.plan .btn { grid-column: 1 / -1; margin-top: 14px; font-size: 15px; padding: 12px; }

/* ---------- Planning / cours ---------- */
.sub-title { font: 500 22px var(--display); color: var(--text); margin: 26px 0 10px; }

.day-title {
  font: 500 20px var(--display);
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.day-title::first-letter { text-transform: uppercase; }
.day-title:first-child { margin-top: 8px; }

.classes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.class-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.class-card.mine { border-color: var(--ok); background: linear-gradient(160deg, var(--ok-soft), var(--surface) 70%); }
.class-card.full { opacity: .85; }
.class-card.waiting { border-color: var(--warn); border-style: dashed; }

.class-time { font: 500 26px var(--display); line-height: 1; min-width: 62px; }
.class-time small { display: block; font: 400 11px var(--body); color: var(--muted); margin-top: 4px; }
.class-info { min-width: 0; }
.class-title { font-weight: 500; font-size: 15px; }
.class-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.class-meta .ok { color: var(--ok); font-weight: 500; }
.class-meta .last { color: var(--warn); font-weight: 500; }

.btn-sm { font-size: 14px; padding: 9px 16px; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font: 500 13px var(--body); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.empty-card { text-align: center; color: var(--muted); padding: 28px 20px; }

/* ---------- Fenêtre de confirmation (dialog.js) ---------- */
.dlg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(43, 37, 34, .45);
  animation: fade .15s ease;
}
.dlg {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 20px;
  padding: 24px 22px 20px;
  box-shadow: var(--shadow);
}
.dlg-title { font: 500 26px var(--display); margin: 0 0 10px; line-height: 1.15; }
.dlg-msg { margin: 0; white-space: pre-line; font-size: 15px; line-height: 1.55; }
.dlg-input {
  width: 100%;
  margin-top: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: 16px var(--body);
  padding: 12px 14px;
}
.dlg-input:focus { outline: none; border-color: var(--red); }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dlg-actions .btn { font-size: 15px; }
.dlg-actions .btn-ghost { font-size: 14px; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #862e21; }

/* ---------- Historique ---------- */
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.history .h-txt { font-size: 15px; }
.history .h-date { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.history .h-delta { font: 500 24px var(--display); white-space: nowrap; }
.history .plus { color: var(--ok); }
.history .minus { color: var(--red); }
.history .empty { color: var(--muted); justify-content: center; border: 0; }

/* ---------- Divers ---------- */
.spinner {
  width: 34px;
  height: 34px;
  margin: 80px auto;
  border: 2px solid var(--line);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(20px, env(safe-area-inset-bottom));
  max-width: 488px;
  margin: 0 auto;
  background: var(--text);
  color: var(--bg);
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 15px;
  box-shadow: var(--shadow);
  z-index: 30;
}
.toast.ok { background: var(--ok); color: #fff; }

/* ---------- Mentions légales dans les formulaires ---------- */
.legal-note { margin: 2px 0 0; }
.legal-note a, #view-boutique .small a { color: var(--muted); }
