/* Monkey Optometry - Web Bookings wizard.
   Restyled to sit alongside PMW (Optomate.NET) so the online booking journey
   reads as the same product as the O.Net / Pre-Rego pages. The visual tokens are
   lifted from PMW: brand blue #1e589e, the #ebeff6 panel, lightgrey 4px inputs,
   the Bootstrap "form-floating" label behaviour, and the vanilla ticked stepper
   (grey track + blue fill + white-tick circles) used on the appointments board.
   PMW ships Segoe UI, so we use a Segoe UI / system stack here rather than a web
   font - it matches the host product and drops an external request from the embed.
   The teal "available" accent is retained; it is the one place the widget is
   allowed its own voice, on slot availability and the booked-in confirmation. */

:root {
  --ink:      #1f2a3d;
  --ink-2:    #55617a;
  --ink-3:    #8a90a8;
  --label:    #9aa0b8;               /* floating-label rest colour (PMW uses #c3c3c3; nudged darker for contrast) */

  --paper:    #ebeff6;               /* PMW panel background */
  --surface:  #ffffff;
  --surface-2:#f7f9fc;
  --line:     #d3d7e0;               /* input border - PMW "lightgrey" */
  --line-2:   #e6e9f1;

  --brand:    #1e589e;
  --brand-600:#17497f;
  --brand-bright:#0e72b6;
  --brand-050:#e8eff8;
  --brand-100:#c6d8ed;
  --focus:    0 0 0 .25rem rgba(13,110,253,.25);   /* PMW focus glow */

  --go:       #0fb5a6;
  --go-050:   #e4faf6;

  --amber:    #c0392b;               /* validation text - PMW leans red for errors */

  --track:    #e0e0e0;               /* ticked-stepper empty line, from PMW */

  --shadow-1: 0 1px 2px rgba(30,88,158,.06);
  --shadow-2: 0 2px 6px rgba(30,88,158,.08), 0 12px 28px -14px rgba(30,88,158,.22);
  --shadow-3: 0 8px 40px -12px rgba(30,88,158,.30);

  --r-lg: 10px;                      /* cards - PMW appointment-card is 10px */
  --r-md: 8px;
  --r-sm: 4px;                       /* inputs - PMW is 4px */

  --display: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(.4,.05,.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--body);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---- shell ---------------------------------------------------------------- */
.wiz {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 840px;
  margin: 0 auto;
}

.wiz__head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  margin: 12px 10px 0;
  padding: 15px 14px 15px 12px;
  border-radius: var(--r-md);
  background: var(--brand);
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand__mark { width: 34px; height: 34px; flex: 0 0 34px; }
.brand__logo { height: 100px; width: auto; max-width: 220px; object-fit: contain; display: block; }
.brand__name {
  font-family: var(--display); font-weight: 700; font-size: 17px;
  letter-spacing: -.01em; color: #fff; line-height: 1.05;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand__loc {
  font-size: 13px; color: rgba(255,255,255,.82); font-weight: 600;
  display: flex; align-items: center; gap: 4px; margin-top: 1px;
}
.brand__loc svg { width: 18px; height: 18px; flex: none; }
.head__spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 15px; font-weight: 600; color: var(--ink-2);
  box-shadow: var(--shadow-1);
  /* embed.js overlays a 34px close button at the panel's top-right (right:14px),
     outside this iframe, so reserve clearance to keep the chip from sitting under it. */
  margin-right: 50px;
}
.chip svg { width: 13px; height: 13px; color: var(--go); }

/* ---- ticked stepper ------------------------------------------------------- */
/* Ported from PMW (Views/Home/_Patients.cshtml): a grey track (::before), a blue
   fill whose width tracks progress, circular steps that turn solid-blue with a
   white tick once complete, and the current step marked with a "you are here"
   ring + inner dot. */
.stepper { padding: 6px 22px 26px; }
.progress-container {
  position: relative;
  display: flex; justify-content: space-between;
  max-width: 100%;
}
.progress-container::before {
  content: "";
  position: absolute; top: 15px; left: 0; right: 0;
  height: 4px; background: var(--track); z-index: 0;
}
.progress-bar {
  position: absolute; top: 15px; left: 0;
  height: 4px; width: 0%;
  background: var(--brand); z-index: 0;
  transition: width .4s var(--ease);
}
.step-outer {
  position: relative; z-index: 1;
  flex: 0 0 30px; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
}
.step {
  /* flex: none keeps the dot a fixed 30px; without it a shrink quirk collapses
     completed dots (which carry a tick background-image) to their border width. */
  flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  transition: border-color .4s var(--ease), background-color .4s var(--ease), box-shadow .2s var(--ease);
}
.step.completed {
  border-color: var(--brand);
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: center;
}
.step.active {
  border-color: var(--brand);
  box-shadow: none;
}
.step.active::after {
  content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--brand);
}
.step-label {
  position: absolute; top: 38px; left: 50%; transform: translateX(-50%);
  width: 96px; text-align: center;
  font-size: 15px; font-weight: 600; line-height: 1.2;
  color: var(--ink-3);
}
.step-outer.step-done .step-label,
.step-outer.step-current .step-label { color: var(--ink); }
/* The end circles sit hard against the stepper's left/right padding, so a
   centred fixed-width label would spill past the widget edge (that overflow is
   what raised the horizontal scrollbar, which in turn forced a vertical one).
   Anchor the first label to the left and the last to the right instead; this
   also lines the first label up with the header and form's left margin. */
.progress-container .step-outer.edge-first .step-label {
  left: 0; right: auto; transform: none; text-align: left;
}
.progress-container .step-outer.edge-last .step-label {
  left: auto; right: 0; transform: none; text-align: right;
}

/* ---- body ----------------------------------------------------------------- */
.wiz__body { flex: 1; padding: 6px 22px 24px; }
.step-view { animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-size: 15px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 8px;
}
.h {
  font-family: var(--display); font-weight: 700; letter-spacing: -.01em;
  font-size: 28px; line-height: 1.15; color: var(--ink);
}
.sub { color: var(--ink-2); font-size: 15px; margin-top: 7px; line-height: 1.5; }
.stack { margin-top: 20px; display: grid; gap: 11px; }
.branch-search { margin-top: 18px; }

/* selectable option card (branch / type) */
.opt {
  position: relative; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 16px 16px 17px;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease);
  box-shadow: var(--shadow-1);
}
.opt:hover { border-color: var(--brand-100); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.opt:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.opt.sel { border-color: var(--brand); box-shadow: var(--focus), var(--shadow-2); }
.opt__t { font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.opt__d { color: var(--ink-2); font-size: 15px; line-height: 1.45; margin-top: 4px; }
.opt__meta { display: inline-flex; align-items: center; gap: 5px; margin-top: 9px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.opt__meta svg { width: 13px; height: 13px; }
.opt__go {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 26px;
  border: 1px solid var(--line); display: grid; place-items: center;
  color: transparent; transition: all .2s var(--ease);
}
.opt.sel .opt__go { background: var(--brand); border-color: var(--brand); color: #fff; }
.opt__go svg { width: 14px; height: 14px; }

/* practitioner selector */
.pick { margin-top: 18px; }
.pick__label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 9px; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
.doc {
  cursor: pointer; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px; display: flex; align-items: center; gap: 10px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .15s var(--ease);
}
.doc:hover { border-color: var(--brand-100); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.doc.sel { border-color: var(--brand); box-shadow: var(--focus); }
.doc__av { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; }
.doc__n { font-weight: 600; font-size: 15px; line-height: 1.15; }
.doc__r { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.doc--any .doc__av { display: grid; place-items: center; background: var(--brand-050); color: var(--brand); }
.doc--any .doc__av svg { width: 19px; height: 19px; }
/* uploaded practitioner head shot; initials svg underneath is the load-failure fallback */
.doc__av--photo { position: relative; overflow: hidden; background: var(--brand-050); }
.doc__av--photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.doc__av--photo svg { width: 100%; height: 100%; }

/* slot grid */
.day { margin-top: 20px; }
.day__h {
  display: flex; align-items: center; gap: 9px; margin-bottom: 11px;
  font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--ink);
  position: sticky; top: 0;
}
.day__h .rule { flex: 1; height: 1px; background: var(--line); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.slot {
  cursor: pointer; font-family: var(--body); font-variant-numeric: tabular-nums;
  font-weight: 600; font-size: 15px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 6px; text-align: center;
  transition: border-color .18s var(--ease), background .18s var(--ease), transform .12s var(--ease), color .18s var(--ease);
}
.slot:hover { border-color: var(--brand); transform: translateY(-1px); }
.slot:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--brand); }
.slot.sel { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-2); }

/* next available banner */
.next {
  margin-top: 18px; display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; border-radius: var(--r-md);
  background: #B2CAE6; border: 1px solid color-mix(in srgb, var(--brand) 40%, white);
}
.next__ring { width: 30px; height: 30px; flex: 0 0 30px; }
.next__t { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.next__v { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--ink); margin-top: 1px; }
.next button {
  margin-left: auto; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  color: #000; background: none; border: none; padding: 6px 4px;
}

/* ---- form: floating-label fields ------------------------------------------ */
/* Mirrors PMW's Bootstrap form-floating: the label overlays the input at rest and
   floats up (scaled) once the field is focused or filled. Selects float their label
   permanently, since a select is never in the ":placeholder-shown" state. */
.form { margin-top: 20px; display: grid; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.ff { position: relative; }
.ff > .inp {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  height: 56px; padding: 22px 13px 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.ff > .inp::placeholder { color: transparent; }          /* placeholder space only drives :placeholder-shown */
.ff > .inp:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.ff > label {
  position: absolute; top: 0; left: 0;
  padding: 17px 14px; color: var(--label);
  pointer-events: none; transform-origin: 0 0; line-height: 1.1;
  transition: transform .12s var(--ease), color .12s var(--ease);
}
.ff > .inp:focus ~ label,
.ff > .inp:not(:placeholder-shown) ~ label {
  transform: scale(.82) translateY(-11px) translateX(3px);
}
.ff > .inp:focus ~ label { color: var(--brand); }
.ff .opt-tag { color: var(--ink-3); font-weight: 500; }

/* select variant: chevron + always-floated label */
.ff--select > label { transform: scale(.82) translateY(-11px) translateX(3px); }
.ff--select > select.inp {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231e589e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M4 6l4 4l4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 16px;
  padding-right: 38px;
}
.ff--select > select.inp:required:invalid { color: var(--label); }   /* placeholder option reads as unfilled */

.hint { font-size: 13px; color: var(--ink-3); margin-top: 6px; line-height: 1.4; }
.err-txt { font-size: 13px; color: var(--amber); margin-top: 6px; font-weight: 600; }

/* standalone input (branch search) keeps the base look without a floating label */
.inp.branch-search {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  padding: 12px 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.inp.branch-search::placeholder { color: var(--ink-3); }
.inp.branch-search:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }

/* review */
.review { margin-top: 20px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-1); }
.review__row { display: flex; align-items: flex-start; gap: 14px; padding: 15px 16px; }
.review__row + .review__row { border-top: 1px solid var(--line-2); }
.review__k { font-size: 15px; font-weight: 600; color: var(--ink-3); width: 116px; flex: 0 0 116px; padding-top: 1px; }
.review__v { font-weight: 600; font-size: 15px; color: var(--ink); line-height: 1.35; }
.review__v small { display: block; font-weight: 500; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.review__edit {
  margin-left: auto; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: none; background: none; cursor: pointer; line-height: 0;
}
.review__edit:hover img { opacity: .85; }
.review__edit:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 50%; }
.review__edit img { width: 26px; height: 26px; display: block; }
.consent { margin-top: 14px; font-size: 13px; color: var(--ink-3); line-height: 1.5; text-align: center; }

/* footer / actions */
.wiz__foot {
  position: sticky; bottom: 0; z-index: 5;
  padding: 14px 22px calc(16px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 12px;
}
.foot__sum { min-width: 0; }
.foot__sum b { font-family: var(--display); font-size: 15px; display: block; letter-spacing: -.01em; }
.foot__sum span { font-size: 13px; color: var(--ink-3); }
.btn {
  font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  border-radius: var(--r-sm); padding: 13px 20px; border: 1px solid transparent;
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.btn--primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-2); margin-left: auto; }
.btn--primary:hover { background: var(--brand-600); transform: translateY(-1px); }
.btn--primary:disabled { background: var(--line); color: var(--ink-3); box-shadow: none; cursor: not-allowed; transform: none; }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.btn--wide { width: 100%; margin: 0; }
.btn__spin { display: inline-block; width: 16px; height: 16px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* states */
.loading, .empty { padding: 60px 20px; text-align: center; color: var(--ink-3); }
.loading__lens { width: 44px; height: 44px; margin: 0 auto 16px; animation: focus 1.6s var(--ease) infinite; }
@keyframes focus { 0%,100% { transform: scale(.9); opacity: .6; } 50% { transform: scale(1); opacity: 1; } }
.empty__t { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink); margin-bottom: 6px; }

/* success */
.done { text-align: center; padding: 40px 24px 20px; animation: rise .5s var(--ease) both; }
.done__lens { width: 92px; height: 92px; margin: 0 auto 22px; }
.done__h { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -.01em; }
.done__p { color: var(--ink-2); font-size: 15px; margin-top: 10px; line-height: 1.55; }
.done__card { margin-top: 24px; text-align: left; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-1); }
.done__ref { padding: 15px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; }
.done__ref span { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.done__ref b { font-family: var(--display); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.done__list { padding: 6px 16px 14px; }
.done__list li { list-style: none; display: flex; gap: 10px; padding: 9px 0; font-size: 15px; color: var(--ink-2); align-items: flex-start; }
.done__list svg { width: 16px; height: 16px; color: var(--go); flex: 0 0 16px; margin-top: 1px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 600;
  padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none; transition: all .3s var(--ease); z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 15px stepper labels crowd in the narrow band just above the phone
   break; step them down there so the end labels keep clear air. */
@media (max-width: 560px) and (min-width: 481px) {
  .step-label { font-size: 13px; }
}

@media (max-width: 480px) {
  .h { font-size: 24px; }
  .wiz__head, .stepper, .wiz__body, .wiz__foot { padding-left: 16px; padding-right: 16px; }
  .row2 { grid-template-columns: 1fr; }
  .step-label { font-size: 11.5px; width: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
