/**
 * Booking form.
 * Inherits the theme's tokens. Falls back to safe values if the plugin is
 * used with a different theme.
 */

.khb-form {
  --khb-blue:  var(--kh-blue,  #17557F);
  --khb-ink:   var(--kh-ink,   #10222E);
  --khb-slate: var(--kh-slate, #4C6373);
  --khb-mist:  var(--kh-mist,  #C7D5DD);
  --khb-wash:  var(--kh-wash,  #E9F2F8);
  --khb-error: var(--kh-error, #B4443A);
  max-width: 640px;
}

/* Progress */
.khb-progress { margin-bottom: 2rem; }
.khb-progress__label { font-size: .9375rem; font-weight: 600; color: var(--khb-slate); margin: 0 0 .5rem; }
.khb-progress__track { height: 6px; background: var(--khb-mist); border-radius: 3px; overflow: hidden; }
.khb-progress__bar { height: 100%; background: var(--khb-blue); width: 25%; transition: width .2s ease; }

/* Steps */
.khb-step { border: 0; padding: 0; margin: 0 0 2rem; }
.khb-step legend {
  font-family: var(--kh-font-head, Georgia, serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--khb-blue);
  padding: 0;
  margin-bottom: 1.25rem;
}
.khb-step legend:focus-visible { outline: 3px solid var(--khb-blue); outline-offset: 4px; }

/* Big tappable choices */
.khb-bigchoice {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border: 2px solid var(--khb-mist);
  border-radius: 10px;
  cursor: pointer;
  min-height: 48px;
  font-weight: 400;
}
.khb-bigchoice input { width: 24px; height: 24px; flex-shrink: 0; margin-top: .25rem; accent-color: var(--khb-blue); }
.khb-bigchoice > span { display: flex; flex-direction: column; gap: .35rem; }
.khb-bigchoice strong { font-size: 1.0625rem; }
.khb-bigchoice span span { font-size: .9375rem; color: var(--khb-slate); line-height: 1.55; }
.khb-bigchoice:has(input:checked) { border-color: var(--khb-blue); background: var(--khb-wash); }
.khb-bigchoice:focus-within { outline: 3px solid var(--khb-blue); outline-offset: 2px; }

.khb-bigchoice.is-unavailable { opacity: .75; cursor: not-allowed; background: #F1F5F7; }
.khb-bigchoice.is-low [data-khb-tokens] { color: #B87C33; font-weight: 600; }

.khb-warn { color: var(--khb-error) !important; font-weight: 600; }

.khb-explain {
  background: var(--khb-wash);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: .9375rem;
  margin-bottom: 1.25rem;
}

.khb-optional { font-weight: 400; color: var(--khb-slate); font-size: .9375rem; }

.khb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .khb-row { grid-template-columns: 1fr; } }

/* Notices */
.khb-urgent, .khb-error, .khb-notice {
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.khb-urgent, .khb-error { border: 2px solid var(--khb-error); background: #FAEBE9; }
.khb-urgent strong, .khb-error p { color: var(--khb-error); }
.khb-urgent p, .khb-error p { margin: .35rem 0 0; }
.khb-notice { border: 2px solid var(--khb-mist); background: var(--khb-wash); }
.khb-notice p { margin: 0 0 .5rem; }
.khb-notice p:last-child { margin: 0; }

.khb-datemsg { font-weight: 600; color: var(--khb-error); margin: 0 0 .75rem; }

/* Navigation */
.khb-nav { display: flex; gap: .75rem; }
.khb-nav .kh-btn { flex: 1; }

/* Result */
.khb-result { max-width: 640px; }
.khb-result__foot { font-size: .9375rem; color: var(--khb-slate); border-top: 1px solid var(--khb-mist); padding-top: 1.25rem; margin-top: 2rem; }

.khb-token {
  text-align: center;
  padding: 2rem 1rem;
  background: var(--khb-wash);
  border-radius: 12px;
  margin-bottom: 2rem;
}
.khb-token__label { display: block; font-size: .8125rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--khb-slate); margin-bottom: .5rem; }
.khb-token__no { display: block; font-family: var(--kh-font-head, Georgia, serif); font-size: 5rem; line-height: 1; font-weight: 700; color: var(--khb-blue); }

.khb-summary { margin: 0 0 2rem; }
.khb-summary > div { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--khb-mist); }
.khb-summary dt { font-weight: 600; margin: 0; }
.khb-summary dd { margin: 0; text-align: right; color: var(--khb-slate); }

/* Payment choice, shown only for a clinic visit */
.khb-paychoice { margin: 2rem 0 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--khb-mist); }
.khb-paychoice__title {
  font-family: var(--kh-font-head, Georgia, serif);
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--khb-blue);
  margin: 0 0 1rem;
}

.khb-token__hint {
  display: block;
  margin-top: .75rem;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--khb-slate);
}

/* ==========================================================================
   HIDING — must beat author styles
   The browser's own [hidden] rule loses to any author rule that sets
   display, and several elements here are display:flex. Without this block
   the hidden attribute silently stops working and the form shows every
   step at once. Do not remove.
   ========================================================================== */

.khb-form [hidden],
.khb-form [hidden].kh-check,
.khb-nav[hidden],
.khb-progress[hidden],
.khb-step[hidden],
.khb-paychoice[hidden],
[data-khb-city-only][hidden],
[data-khb-online-only][hidden] {
  display: none !important;
}

/* Belt and braces: while the stepper is running, only the current step
   is on screen. This works even if the hidden attribute is interfered
   with by a caching or optimisation plugin. */
.khb-form.is-stepped .khb-step { display: none; }
.khb-form.is-stepped .khb-step.is-current { display: block; }

/* Before the stepper engages — and if it never does — the form is one
   plain page with its own submit button, and the stepper controls stay
   out of the way. */
.khb-form:not(.is-stepped) .khb-nav,
.khb-form:not(.is-stepped) .khb-progress { display: none; }

/* The error box has to be impossible to miss on a long form. */
.khb-error:focus { outline: 3px solid var(--khb-error); outline-offset: 3px; }
