/* ============================================================
   AceFlow - focused step-by-step overlays (booking / checkout)
   True full-screen takeover: the site header is covered while a
   flow is open (its own back/close buttons are the only nav you
   need), so a multi-step flow never has to squeeze itself under
   a second header. html/body get .flow-open to lock background
   scroll for the same reason.
   ============================================================ */

html.flow-open,
body.flow-open {
  overflow: hidden !important;
}

.flow-root {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 210; /* above the sticky site header (--z-nav:100) - this IS the screen while it's open */
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 85% -10%, rgba(122, 99, 144, 0.16), transparent 60%),
    rgba(58, 34, 41, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: flow-in 240ms ease both;
}

@keyframes flow-in {
  from { opacity: 0; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Floating back / close (strip retired) ---------- */

.flow-float {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  z-index: 3;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(255, 253, 251, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--plum-900);
  box-shadow: 0 6px 16px -8px rgba(38, 20, 27, 0.35);
}

.flow-float:hover { background: #fff; }
.flow-float--back { left: 14px; }
.flow-float--close { right: 14px; }

.flow-float[hidden] { display: none; }

/* ---------- Body & popover card ---------- */

.flow-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  padding: 58px 16px 0;
}

.flow-inner {
  width: min(520px, 100%);
  /* max-height + the flex column below keep the Continue/Confirm button
     on screen on short viewports (laptops, browser chrome eating into
     window height): the step content scrolls internally instead of the
     whole card overflowing past the fold with no visible scroll cue. */
  max-height: calc(100vh - 90px);
  margin: auto auto calc(24px + env(safe-area-inset-bottom)); /* centers when short, scrolls naturally when tall */
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--color-border, #F0E4DA);
  border-radius: var(--radius-xl, 22px);
  box-shadow: 0 28px 70px -30px rgba(58, 34, 41, 0.6);
  padding: 24px clamp(18px, 4vw, 30px) 28px;
}

.flow-inner .flow-step {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

/* ---------- Desktop split-screen (2026-09-23) ----------
   Mobile/tablet keep the single full-screen wizard card above, untouched.
   From 1020px (matching pos.css's .pos-sale-layout breakpoint) the step
   card gets room to breathe and a persistent, always-rendered summary
   panel (flow.js's renderSummary()) sits beside it as a sticky glass card -
   the same "content + persistent context panel" shape as .pos-sale-layout/
   .pos-cart, so booking/checkout stop looking like a mobile sheet stretched
   wide on a desktop monitor. */
.flow-summary { display: none; }

@media (min-width: 1020px) {
  .flow-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: start;
    padding: 74px 32px 0;
    max-width: 1180px;
    margin: 0 auto;
  }
  .flow-inner {
    width: 100%;
    margin: 0 0 calc(24px + env(safe-area-inset-bottom));
  }
  .flow-summary {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 74px;
    padding: 26px 24px;
    border-radius: var(--radius-xl);
    border-top: 2px solid var(--terracotta-600);
    /* Stronger than the shared .glass--card default (62% white) - this
       panel carries real information (date/time/price), not just chrome,
       so it needs to stay legible over whatever photo is blurred behind
       the flow overlay. Also cancel .glass--card's hover lift - this is a
       static info panel, not a clickable card. */
    background: var(--glass-bg-strong);
  }
  .flow-summary:hover { transform: none; }
}

.flow-summary-eyebrow {
  font-size: var(--fs-2xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--terracotta-700);
}

.flow-summary-title {
  margin: 8px 0 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.25;
  color: var(--color-ink);
}

.flow-summary-empty {
  margin: 0;
  line-height: 1.6;
}

.flow-summary-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--color-border-strong);
}

.flow-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--color-ink);
}

.flow-summary-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-sm);
  color: var(--color-ink);
}

.flow-summary-line-name { min-width: 0; }

.flow-summary-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: 18px;
  font-family: var(--font-display);
}

.flow-summary-total span {
  font-size: var(--fs-sm);
  color: var(--color-ink-soft);
}

.flow-summary-total b {
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--color-ink);
}

.flow-step h2,
.flow-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.35rem, 4vw, 1.7rem);
  letter-spacing: 0.01em;
  margin: 0 0 6px;
  outline: none;
}

.flow-sub {
  color: var(--admin-ink-soft, #6E6672);
  font-size: var(--fs-sm);
  margin: 0 0 20px;
  line-height: 1.5;
}

.flow-step {
  animation: none;
}

.flow-step.step-enter-fwd { animation: step-fwd 260ms cubic-bezier(0.22, 0.9, 0.3, 1) both; }
.flow-step.step-enter-back { animation: step-back 260ms cubic-bezier(0.22, 0.9, 0.3, 1) both; }

@keyframes step-fwd {
  from { opacity: 0; transform: translateX(26px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes step-back {
  from { opacity: 0; transform: translateX(-26px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .flow-root,
  .flow-step.step-enter-fwd,
  .flow-step.step-enter-back { animation: none; }
}

/* ---------- Inline actions (small button inside the step card) ---------- */

.flow-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--color-border, #F0E4DA);
}

.flow-actions .flow-total-row {
  margin-right: auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.flow-actions .btn {
  min-height: 40px;
  padding-inline: 16px;
  font-size: var(--fs-sm);
}

.flow-total {
  font-family: var(--font-display);
  font-size: 1.05rem;
  white-space: nowrap;
}

/* ---------- Mobile fit: never scroll sideways ---------- */

@media (max-width: 480px) {
  .flow-body { padding: 54px 10px 0; overflow-x: hidden; }
  .flow-inner { padding: 18px 14px 22px; max-width: 100%; }
  .flow-actions { flex-wrap: wrap; justify-content: stretch; }
  .flow-actions .flow-total-row { width: 100%; justify-content: space-between; margin-bottom: 2px; }
  .flow-actions .btn { flex: 1 1 auto; }
  .flow-float { width: 40px; height: 40px; }
}

/* Hard guards against any horizontal overflow inside the card */
.flow-step { min-width: 0; }
.flow-step * { min-width: 0; }

.freview .summary-line,
.lipa-row,
.fbag-line,
.flow-actions { flex-wrap: wrap; }
.freview .summary-line b,
.summary-line span { overflow-wrap: anywhere; }
/* break-word, not anywhere: now that .fchoice-price can't be squeezed
   (flex-shrink:0 above), this column has room to wrap "Microdermabrasion
   Facial" etc. at the word boundary - break-word only splits a single
   word mid-way as a last resort, when it genuinely can't fit otherwise. */
.fchoice-body { overflow-wrap: break-word; }
.fnumber { overflow-wrap: anywhere; font-size: clamp(1.15rem, 5vw, 1.7rem); }
.fqr { max-width: 100%; }
.fslot { min-width: 0; }

/* ---------- Mini calendar ---------- */

.fcal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.fcal-month {
  font-weight: 600;
  font-size: var(--fs-sm);
}

.fcal-dow,
.fcal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.fcal-dow span {
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--admin-ink-soft, #6E6672);
  padding-bottom: 4px;
}

.fcal-cell {
  position: relative;
  aspect-ratio: 1;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.fcal-cell:hover:not(:disabled) { background: var(--blush-50); transform: translateY(-1px); }

.fcal-cell.today {
  border-color: var(--champagne-300);
}

.fcal-cell[aria-pressed="true"] {
  background: linear-gradient(160deg, var(--rose-600), var(--rose-700));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 18px -10px rgba(150, 57, 78, 0.55);
}

.fcal-cell:disabled {
  color: var(--admin-ink-soft, #6E6672);
  opacity: 0.45;
  cursor: not-allowed;
}

.fcal-pad { visibility: hidden; }

/* ---------- Time slots ---------- */

.fslots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.fslot {
  min-height: 48px;
  border: 1.5px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-card);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(26, 15, 19, 0.03);
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.fslot:hover:not(:disabled) {
  border-color: var(--rose-300);
  box-shadow: 0 8px 18px -12px rgba(150, 57, 78, 0.35);
  transform: translateY(-1px);
}

.fslot[aria-pressed="true"] {
  background: linear-gradient(160deg, var(--rose-600), var(--rose-700));
  border-color: var(--rose-700);
  color: #fff;
  box-shadow: 0 8px 18px -10px rgba(150, 57, 78, 0.5);
  transform: scale(0.98);
}

.fslot:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ---------- Choice cards (treatment / payment) ---------- */

.fchoice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  min-height: 64px;
  border: 1.5px solid var(--color-border);
  border-radius: 16px;
  background: var(--color-card);
  cursor: pointer;
  font: inherit;
  box-shadow: 0 1px 2px rgba(26, 15, 19, 0.03);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.fchoice:hover {
  border-color: var(--rose-300);
  box-shadow: 0 10px 24px -14px rgba(150, 57, 78, 0.35);
  transform: translateY(-1px);
}

.fchoice[aria-pressed="true"],
.fchoice.selected {
  border-color: var(--rose-600);
  background: linear-gradient(160deg, rgba(246, 226, 228, 0.55), rgba(255, 255, 255, 0.95));
  box-shadow: 0 0 0 3px rgba(150, 57, 78, 0.14), 0 10px 24px -14px rgba(150, 57, 78, 0.35);
}

.fchoice-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--rose-100), var(--champagne-200));
  color: var(--rose-700);
  flex-shrink: 0;
  transition: transform var(--dur-base) var(--ease-out);
}

.fchoice:hover .fchoice-icon { transform: scale(1.06); }

.fchoice-body { min-width: 0; }
.fchoice-body b { display: block; font-size: var(--fs-sm); }
.fchoice-body .muted { font-size: var(--fs-xs); }

.fchoice-price {
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--gold-600);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fchoice.is-disabled {
  cursor: default;
  opacity: 0.6;
  background: var(--color-card);
}
.fchoice.is-disabled:hover {
  border-color: var(--color-border);
  box-shadow: 0 1px 2px rgba(26, 15, 19, 0.03);
  transform: none;
}
.fchoice.is-disabled .fchoice-icon { background: var(--color-border); color: var(--color-ink-soft); }

.fchoice-tag {
  margin-left: auto;
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--color-border);
  color: var(--color-ink-soft);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .fchoice, .fchoice-icon { transition: none; }
}

/* ---------- Bag lines (checkout) ---------- */

.fbag-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--color-border);
}

.fbag-line img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--blush-50);
}

.fbag-info { flex: 1; min-width: 0; }
.fbag-info b { display: block; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fbag-qty {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.fbag-qty button {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-strong, #E4D9CE);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.fbag-qty button:disabled { opacity: 0.35; cursor: not-allowed; }
.fbag-qty .num { min-width: 22px; text-align: center; font-weight: 600; }

/* Cramming image + name + qty stepper + price into one row leaves almost
   no room for the product name on a phone — it was truncating to 2-3
   letters ("Aura...") on the exact screen where a customer confirms what
   they're about to pay for. Wrap the qty+price onto their own full-width
   row instead of shrinking the name further. */
@media (max-width: 480px) {
  .fbag-line { flex-wrap: wrap; row-gap: 10px; }
  .fbag-qty { flex-basis: 100%; margin-left: 64px; width: auto; }
  .fbag-line > b.num { margin-left: auto; }
}

/* ---------- Review summary ---------- */

.freview {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 6px 18px;
  background: var(--color-card);
}

.freview .summary-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  font-size: var(--fs-sm);
  border-bottom: 1px dashed var(--color-border);
}

.freview .summary-line:last-child { border-bottom: 0; }

/* ---------- Success ---------- */

.flow-success {
  text-align: center;
  padding-top: 12px;
}

.flow-success .success-check { margin-bottom: 14px; }

.flow-success .card {
  text-align: left;
  margin: 16px auto 0;
  max-width: 420px;
}

/* ---- LIPA scan / copy screen ---- */
.fnumber-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 24px 18px;
  border: 1px solid color-mix(in srgb, var(--rose-500) 16%, transparent);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--blush-50), #fff);
}
.fqr {
  width: 172px;
  height: 172px;
  border-radius: var(--radius-md);
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--rose-500) 12%, transparent);
}
.fnumber {
  font-size: clamp(1.35rem, 4.6vw, 1.85rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-top: 2px;
}
.fsteps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--color-ink-soft);
}
.fsteps li::marker { color: var(--rose-500); font-weight: 600; }

.lipa-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--rose-500) 14%, transparent);
  border-radius: var(--radius-lg);
  background: #fff;
}

/* ---------------- gift card apply (review step) ---------------- */

.gift-details {
  margin-top: 16px;
  padding: 13px 16px;
  border: 1px solid #E7DCE0;
  background: #FDFBF9;
}

.gift-details summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--plum-900, #3A2229);
  list-style: none;
}

.gift-details summary::-webkit-details-marker { display: none; }

.gift-apply-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.gift-apply-row .input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.06em; }

.linklike {
  background: none;
  border: none;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  color: inherit;
  opacity: 0.75;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.linklike:hover { opacity: 1; }

/* Post-checkout document summary — replaces embedding the full printable
   document (with its own toolbar) in a 560px iframe, which looked broken
   and cramped on anything narrower than a desktop. Just a compact row per
   document with a View and a Download PDF action. */
.doc-summary-list { margin-top: var(--space-6); }
.doc-summary-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
  flex-wrap: wrap;
}
.doc-summary-card + .doc-summary-card { margin-top: var(--space-3); }
.doc-summary-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--radius-md);
  background: var(--color-muted-surface);
  color: var(--color-ink-soft);
}
.doc-summary-card__body { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-summary-card__body b { font-size: .95rem; }
.doc-summary-card__body p { margin: 2px 0 0; }
.doc-summary-card__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
@media (max-width: 520px) {
  .doc-summary-card { flex-direction: column; align-items: stretch; text-align: center; }
  .doc-summary-card__icon { margin: 0 auto; }
  .doc-summary-card__actions { justify-content: center; }
  .doc-summary-card__actions .btn { flex: 1; }
}

/* No grey scroll bars with little arrows inside the booking frames: they still scroll, quietly. */
.flow-body, .flow-inner, .flow-inner .flow-step, .flow-float, .flow-card { scrollbar-width: none; -ms-overflow-style: none; }
.flow-body::-webkit-scrollbar, .flow-inner::-webkit-scrollbar, .flow-inner .flow-step::-webkit-scrollbar, .flow-float::-webkit-scrollbar, .flow-card::-webkit-scrollbar { display: none; }

/* The month arrows sit on the white dialog; the home-page rule that pales round icon buttons must not reach them. */
body.is-home:not(.header-solid) .fcal-head .icon-btn,
.fcal-head .icon-btn { color: #29221f; border: 1px solid rgba(41, 34, 31, .16); border-radius: 50%; width: 38px; height: 38px; background: #fff; }
.fcal-head .icon-btn:hover:not(:disabled) { background: rgba(41, 34, 31, .06); }
body.is-home:not(.header-solid) .fcal-head .icon-btn:disabled,
.fcal-head .icon-btn:disabled { color: rgba(41, 34, 31, .28); border-color: rgba(41, 34, 31, .08); cursor: default; }

/* Booking and checkout pages are only the header and the card: soft blush backdrop, no dark footer behind. */
body.is-booking { background: linear-gradient(165deg, #fbf1ee 0%, #f6e6df 48%, #efd9cd 100%) fixed; }
body.is-booking #site-footer, body.is-booking .site-footer { display: none; }
body.is-booking main { min-height: 100vh; }
body.is-booking .flow-root { background: rgba(250, 238, 233, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.is-booking .flow-inner { box-shadow: 0 24px 60px rgba(120, 70, 60, .18); }
/* The header stays crisp and usable (cart, wishlist, account) above the card: the overlay starts under it. */
body.is-booking .flow-root { top: var(--flow-top, 0px); }
/* While checking out only the bag is counted; the wishlist number would contradict it. While booking a treatment neither is shown. */
body.is-booking .wishlist-count { display: none !important; }
body.is-booking:not(.is-checkout) .cart-count { display: none !important; }
/* No black buttons in the booking, checkout and gift pop-ups: a soft gold with rosewood text. */
.flow-root .btn-primary, .flow-root .btn.btn-primary { background: linear-gradient(135deg, #f0d9a3 0%, #d4aa62 100%); color: #4a2a2f; border-color: transparent; box-shadow: 0 10px 24px -14px rgba(160, 110, 50, .7); }
.flow-root .btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #f4e0b0 0%, #dcb56f 100%); color: #3d2126; }
.flow-root .btn-primary:focus-visible { outline: 2px solid #9a5b63; outline-offset: 2px; }
/* outline buttons in the pop-ups read as buttons: a gold edge and rosewood text */
.flow-root .btn-outline, .flow-root .btn.btn-outline { background: #fff; color: #4a2a2f; border: 1.5px solid #d4aa62; }
.flow-root .btn-outline:hover { background: #fbf3df; }
/* On a wide screen the step card and its summary sit in the middle of the screen, not stuck under the top: when the content is
   shorter than the window it is centred up and down; when it is taller it simply starts at the top and scrolls. */
@media (min-width: 1020px) {
  .flow-body { align-content: safe center; padding-bottom: 48px; box-sizing: border-box; }
}
