/* La Gracia by Wefa - Web Booking Form
   Theme lifted from the WhatsApp receipt (src/receipts/renderReceiptHtml.ts): the same
   warm paper/burgundy/gold palette and Playfair Display + Jost pairing, so a customer who's
   seen a receipt recognizes this as the same salon. */

:root {
  --bg: #F3E7DC;
  --card: #FBF4EE;
  --burgundy: #7B2D36;
  --burgundy-soft: #F1DED8;
  --ink: #2B2320;
  --ink-soft: #5C534E;
  --rose: #B76E79;
  --gold: #9A7A1E;
  --ok: #4F7A5B;
  --ok-soft: #E3EDE3;
  --line: #E6D7C7;
  --danger: #A23B3B;
  --danger-soft: #F6E3E0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C1512;
    --card: #27201B;
    --burgundy: #D98C96;
    --burgundy-soft: #3A2420;
    --ink: #F3E9DE;
    --ink-soft: #AB9A8D;
    --rose: #D9A3AC;
    --gold: #D9B56B;
    --ok: #8FC49B;
    --ok-soft: #22302A;
    --line: #3C312A;
    --danger: #E08A8A;
    --danger-soft: #3A2424;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1C1512;
  --card: #27201B;
  --burgundy: #D98C96;
  --burgundy-soft: #3A2420;
  --ink: #F3E9DE;
  --ink-soft: #AB9A8D;
  --rose: #D9A3AC;
  --gold: #D9B56B;
  --ok: #8FC49B;
  --ok-soft: #22302A;
  --line: #3C312A;
  --danger: #E08A8A;
  --danger-soft: #3A2424;
  color-scheme: dark;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
button { font-family: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.frame {
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
@media (min-width: 640px) {
  body { display: flex; align-items: center; justify-content: center; padding-block: 2rem; }
  .frame {
    height: min(860px, 94vh);
    border-radius: 28px;
    box-shadow: 0 30px 70px -20px rgba(43, 35, 32, 0.35), 0 0 0 1px var(--line);
  }
}

.brandbar {
  flex: 0 0 auto;
  padding: 1.1rem max(16px, env(safe-area-inset-left, 0px)) 0.75rem max(16px, env(safe-area-inset-right, 0px));
}
.brand h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  font-size: 1.3rem;
  margin: 0;
  line-height: 1.1;
  color: var(--burgundy);
}
.brand p {
  margin: 0.15rem 0 0;
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.stepper {
  flex: 0 0 auto;
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem max(16px, env(safe-area-inset-left, 0px)) 0.9rem max(16px, env(safe-area-inset-right, 0px));
}
.stepper .seg { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; align-items: center; }
.stepper .bar { height: 3px; width: 100%; border-radius: 3px; background: var(--line); }
.stepper .seg[data-state="done"] .bar { background: var(--gold); }
.stepper .seg[data-state="active"] .bar { background: var(--burgundy); }
.stepper .label { font-size: 0.6rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-soft); }
.stepper .seg[data-state="active"] .label { color: var(--burgundy); font-weight: 600; }
.stepper .seg[data-state="done"] .label { color: var(--gold); }

.error-banner {
  flex: 0 0 auto;
  margin: 0 max(16px, env(safe-area-inset-left, 0px));
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.error-banner button {
  border: none; background: none; color: inherit; font-size: 1rem; line-height: 1; cursor: pointer; padding: 0 0.2rem;
}

main {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.25rem max(16px, env(safe-area-inset-left, 0px)) 1.5rem max(16px, env(safe-area-inset-right, 0px));
}
.step { display: flex; flex-direction: column; gap: 1rem; animation: rise 0.28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

h2 { font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: 1.4rem; margin: 0.25rem 0 0; text-wrap: balance; }
.sub { margin: -0.4rem 0 0; color: var(--ink-soft); font-size: 0.9rem; }

.loading-wrap { align-items: center; text-align: center; padding-top: 2.5rem; gap: 0.75rem; }
.spinner-lg { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--burgundy); animation: spin 0.8s linear infinite; margin: 0 auto; }

.svc-group + .svc-group { margin-top: 1.1rem; }
.svc-group .glabel { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gold); margin: 0 0 0.5rem; font-weight: 600; }
.svc-list { display: flex; flex-direction: column; gap: 0.6rem; }
.svc-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.svc-card:has(input:checked) { border-color: var(--burgundy); background: var(--burgundy-soft); }
.svc-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.svc-check {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}
.svc-card input:checked + .svc-check { background: var(--burgundy); border-color: var(--burgundy); }
.svc-check svg { width: 13px; height: 13px; opacity: 0; transition: opacity 0.1s; }
.svc-card input:checked + .svc-check svg { opacity: 1; }
.svc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.svc-name { font-weight: 600; font-size: 0.95rem; }
.svc-meta { font-size: 0.78rem; color: var(--ink-soft); }
.svc-price { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }

.hours-note { font-size: 0.78rem; color: var(--ink-soft); text-align: center; margin-top: 0.1rem; }

.date-strip { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.15rem 0.1rem 0.5rem; scroll-snap-type: x proximity; }
.date-chip {
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: 64px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 0.65rem 0.3rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  cursor: pointer;
}
.date-chip .dow { font-size: 0.68rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.date-chip .num { font-family: "Playfair Display", Georgia, serif; font-size: 1.3rem; font-weight: 600; }
.date-chip[aria-pressed="true"] { background: var(--burgundy); border-color: var(--burgundy); }
.date-chip[aria-pressed="true"] .dow, .date-chip[aria-pressed="true"] .num { color: #fff; }

.time-group + .time-group { margin-top: 0.9rem; }
.time-group .glabel { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gold); margin: 0 0 0.5rem; font-weight: 600; }
.time-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 0.5rem; }
.time-chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 0.55rem 0.3rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  color: var(--ink);
}
.time-chip[aria-pressed="true"] { background: var(--burgundy); border-color: var(--burgundy); color: #fff; }
.time-chip[disabled] { color: var(--ink-soft); opacity: 0.45; text-decoration: line-through; cursor: not-allowed; }

.empty-note { font-size: 0.85rem; color: var(--ink-soft); text-align: center; padding: 1rem 0; }

.summary-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.sum-row { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.92rem; }
.sum-row .name { min-width: 0; }
.sum-row .meta { color: var(--ink-soft); font-size: 0.78rem; }
.sum-div { border: none; border-top: 1.5px dashed var(--rose); opacity: 0.7; margin: 0.1rem 0; }
.sum-total { font-weight: 700; font-size: 1.02rem; color: var(--burgundy); }
.sum-when { background: var(--burgundy-soft); border-radius: 12px; padding: 0.7rem 0.85rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.sum-when .lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); }
.sum-when .val { font-weight: 600; font-family: "Playfair Display", Georgia, serif; font-size: 1.05rem; color: var(--burgundy); }
.link-btn { border: none; background: none; color: var(--burgundy); font-weight: 600; font-size: 0.8rem; cursor: pointer; padding: 0; }

.who-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.who-caption { font-size: 0.78rem; color: var(--ink-soft); }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field textarea {
  font-family: inherit; font-size: 0.95rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 0.6rem 0.75rem; resize: none;
}
.field textarea { min-height: 4.2rem; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--burgundy); outline-offset: 1px; }
.optional-tag { font-weight: 400; color: var(--ink-soft); text-transform: none; letter-spacing: 0; }

footer.actionbar {
  flex: 0 0 auto;
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem max(16px, env(safe-area-inset-left, 0px)) max(0.9rem, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-right, 0px));
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.btn {
  flex: 1;
  border: none; border-radius: 14px; padding: 0.8rem 1rem;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.btn-primary { background: var(--burgundy); color: #fff; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); flex: 0 0 auto; width: 3.1rem; }
.btn-text {
  flex: 0 0 auto;
  background: var(--card);
  color: var(--ink-soft);
  font-weight: 500;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 1rem;
}
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.success-wrap { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.4rem; padding-top: 1.5rem; }
.check-circle { width: 76px; height: 76px; }
.check-circle circle { fill: none; stroke: var(--ok); stroke-width: 5; stroke-dasharray: 220; stroke-dashoffset: 220; animation: draw 0.6s ease forwards; }
.check-circle path { fill: none; stroke: var(--ok); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.4s ease 0.5s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.success-wrap h2 { margin-top: 0.5rem; color: var(--burgundy); }
.ref-chip { background: var(--gold); color: #fff; font-weight: 700; letter-spacing: 0.04em; border-radius: 999px; padding: 0.35rem 0.9rem; font-size: 0.85rem; }
.success-recap {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 1.5px dashed var(--rose);
  border-radius: 16px;
  padding: 0.9rem 1.1rem;
  width: 100%;
  text-align: left;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.5rem;
  position: relative;
}
.success-recap::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -11px; height: 22px;
  background: radial-gradient(circle at 10px 22px, transparent 11px, var(--bg) 11.5px) top left / 22px 22px repeat-x;
}
.success-note {
  font-family: "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.3rem;
}
.wa-link { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ok); font-weight: 600; text-decoration: none; margin-top: 0.9rem; font-size: 0.9rem; }
.again-link { border: none; background: none; color: var(--ink-soft); font-size: 0.82rem; margin-top: 0.6rem; cursor: pointer; text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
