/* Mirrors s3-survey/utils/scripted-forms.css (same tokens/look) but for this
   app's plain markup. Booking-scoped choices from that file are the defaults
   here (dark text, thick black underlines, DM Sans). */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Poppins:wght@400;500;600;700&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap");

:root {
  --sc-yellow: #ffc559;
  --sc-yellow-hover: #f1ab13;
  --sc-black: #0f0a0a;
  --sc-secondary: #fbf5ec;
  --sc-input-bg: #f8f1e7;
  --sc-input-bg-hover: #f2eadf;
  --sc-stroke: #cabba5;
  --sc-red: #d90429;
  --sc-test: #6c6ea0;
  --sc-test-hover: #5b5d8c;
  --sc-dark-tertiary: #a9a199;
  --sc-font-body: "DM Sans", sans-serif;
  --sc-question-gap: 48px;
  --sc-container-max: 800px;
  --sc-container-pad: 38px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background-color: #fef9ef;
  color: var(--sc-black);
  font-family: var(--sc-font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  max-width: var(--sc-container-max);
  margin: 0 auto;
  padding: 4px var(--sc-container-pad) 0;
}

/* Title — matches booking's 34px bold DM Sans */
.title {
  font-family: var(--sc-font-body);
  font-size: 34px;
  font-weight: 700;
  margin: 0 0 8px;
}

/* Intro/description — DM Sans Medium, black (booking) */
.intro {
  font-family: var(--sc-font-body);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  color: var(--sc-black);
  margin: 0 0 var(--sc-question-gap);
}

form {
  display: flex;
  flex-direction: column;
  gap: var(--sc-question-gap);
}

/* Side-by-side pairs — 16px column gap like .sd-page */
.row {
  display: flex;
  column-gap: 16px;
}

.row .field {
  flex: 0 0 calc(50% - 8px);
  max-width: calc(50% - 8px);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px; /* .sd-question__header padding-bottom */
}

/* Question labels — bold 700 (booking), 16px, black */
label {
  font-family: var(--sc-font-body);
  font-weight: 700;
  font-size: 16px;
  color: var(--sc-black);
}

.req {
  color: var(--sc-red);
  font-weight: 700;
}

/* Inputs — warm bg, 3px black bottom-border (booking), square corners */
input[type="text"],
input[type="tel"] {
  font-family: var(--sc-font-body);
  font-weight: 400;
  font-size: 15px;
  color: var(--sc-black);
  background-color: var(--sc-input-bg);
  border: 0 solid transparent;
  border-bottom: 3px solid var(--sc-black);
  border-radius: 0;
  padding: 10px;
  width: 100%;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

input[type="text"]:hover,
input[type="tel"]:hover {
  background-color: var(--sc-input-bg-hover);
}

input::placeholder {
  color: var(--sc-black);
  opacity: 1;
}

input:focus {
  outline: none;
  border-bottom: 3px solid var(--sc-black);
}

/* Searchable treatment dropdown (custom combobox — matches .sd-dropdown +
   .sv-dropdown-popup). Native <datalist> can't be styled, so this is hand-built. */
.combo {
  position: relative;
}

.combo-caret {
  position: absolute;
  right: 10px;
  top: 20px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--sc-dark-tertiary);
  pointer-events: none;
}

.combo-popup {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 2px);
  z-index: 1000;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 215px;
  overflow-y: auto;
  background-color: var(--sc-input-bg);
  border: 1px solid var(--sc-stroke);
  border-radius: 0;
  box-shadow: 0 -4px 12px rgba(15, 10, 10, 0.1);
}

.combo-popup li {
  font-family: var(--sc-font-body);
  font-size: 15px;
  color: var(--sc-black);
  padding: 8px 12px;
  cursor: pointer;
}

.combo-popup li:hover,
.combo-popup li.active {
  background-color: var(--sc-input-bg-hover);
}

.combo-popup li.selected {
  background-color: var(--sc-input-bg-hover);
  font-weight: 700;
}

.combo-popup li.selected::after {
  content: "✓";
  float: right;
  color: var(--sc-black);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sc-font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--sc-black);
  background-color: var(--sc-input-bg);
  border: 1px solid var(--sc-stroke);
  padding: 4px 8px 4px 12px;
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sc-font-body);
  font-size: 16px;
  line-height: 1;
  color: var(--sc-black);
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
}

.chip-remove:hover {
  color: var(--sc-red);
}

.combo-popup li.empty {
  color: var(--sc-dark-tertiary);
  cursor: default;
}

/* Date of birth field with calendar picker button at the end */
.dob {
  position: relative;
}

.dob input {
  padding-right: 40px; /* room for the calendar button */
}

.dob-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: none;
  border: none;
  color: var(--sc-black);
  cursor: pointer;
}

.dob-toggle:hover {
  color: var(--sc-yellow-hover);
}

/* flatpickr calendar — brand palette */
.flatpickr-calendar {
  font-family: var(--sc-font-body);
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(15, 10, 10, 0.12);
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--sc-yellow);
  border-color: var(--sc-yellow);
  color: var(--sc-black);
}

.flatpickr-day:hover {
  background: var(--sc-input-bg-hover);
}

/* Related checkboxes sit closer than the 48px question rhythm so revealing the
   test box adds as little iframe height as possible. */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Checkbox — custom square matching .sd-checkbox__control */
.checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-family: var(--sc-font-body);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.checkbox input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 0;
  cursor: pointer;
  background-color: var(--sc-input-bg);
  border: 1px solid var(--sc-stroke);
  border-radius: 0;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.checkbox input:checked {
  background-color: #bca583;
  border-color: var(--sc-stroke);
}

.checkbox input:checked::after {
  content: "";
  display: block;
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--sc-lightest, #fffdf9);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Test-patient mode (?showTest=true) — purple accents while the box is checked,
   mirroring the legacy Elementor form so a test submission is unmistakable. */
body.test-mode .test-check {
  padding: 10px;
  border: 2px solid var(--sc-test);
  border-radius: 3px;
  background-color: #f8f9fa;
  color: var(--sc-test);
}

body.test-mode .test-check input:checked {
  background-color: var(--sc-test);
  border-color: var(--sc-test);
}

body.test-mode button#submitBtn,
body.test-mode .status--success .back-btn {
  background-color: var(--sc-test);
  color: #fffdf9;
}

body.test-mode button#submitBtn:hover,
body.test-mode .status--success .back-btn:not(:disabled):hover {
  background-color: var(--sc-test-hover);
}

body.test-mode .btn-spinner {
  border-color: rgba(255, 253, 249, 0.35);
  border-top-color: #fffdf9;
}

/* Submit — matches .sd-navigation__complete-btn (hard offset shadow) */
.actions {
  display: flex;
  justify-content: flex-end;
}

button#submitBtn {
  font-family: var(--sc-font-body);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--sc-black);
  background-color: var(--sc-yellow);
  border: 1.5px solid var(--sc-black);
  box-shadow: 1px 1px 0 var(--sc-black);
  border-radius: 0;
  padding: 12px 40px;
  cursor: pointer;
  transition: all 0.15s ease;
}

button#submitBtn:hover {
  background-color: var(--sc-yellow-hover);
  box-shadow: 3px 3px 0 var(--sc-black);
}

button#submitBtn:active {
  box-shadow: 0 0 0 var(--sc-black);
  transform: translate(1px, 1px);
}

button#submitBtn:disabled {
  opacity: 0.6;
  cursor: default;
}

button#submitBtn {
  min-width: 140px;
  min-height: 46px;
}

.btn-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(15, 10, 10, 0.25);
  border-top-color: var(--sc-black);
  border-radius: 50%;
  vertical-align: -4px;
  animation: pf-spin 0.7s linear infinite;
}

@keyframes pf-spin {
  to {
    transform: rotate(360deg);
  }
}

.form-error {
  color: var(--sc-red);
  font-weight: 600;
  font-size: 14px;
}

.form-error--ok {
  color: #2d7a28;
}

.form-error--collapsing {
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition:
    width 0.4s ease,
    opacity 0.4s ease;
}

.form-error--entering {
  overflow: hidden;
  transition:
    height 0.3s ease,
    opacity 0.3s ease;
}

.status {
  font-family: var(--sc-font-body);
  font-weight: 600;
  font-size: 16px;
  padding: 16px 0;
}

.status--success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 340px;
  text-align: center;
  color: #2d7a28;
}

.status--success .status-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status--success .status-note {
  font-weight: 500;
  font-size: 14px;
  color: #57524f;
  max-width: 480px;
  margin-top: -12px;
}

.status--success .back-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.status--success .back-timer {
  font-family: var(--sc-font-body);
  font-weight: 500;
  font-size: 13px;
  color: #57524f;
}

.status--success .back-btn {
  font-family: var(--sc-font-body);
  font-weight: 500;
  font-size: 16px;
  color: var(--sc-black);
  background-color: var(--sc-yellow);
  border: 1.5px solid var(--sc-black);
  box-shadow: 1px 1px 0 var(--sc-black);
  border-radius: 0;
  padding: 12px 40px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.status--success .back-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: 1px 1px 0 var(--sc-black);
}

.status--success .back-btn:not(:disabled):hover {
  background-color: var(--sc-yellow-hover);
  box-shadow: 3px 3px 0 var(--sc-black);
}

.status--success .back-btn:not(:disabled):active {
  box-shadow: 0 0 0 var(--sc-black);
  transform: translate(1px, 1px);
}

.status--success .check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  background: #4eb748;
  color: #fffdf9;
  font-size: 14px;
  font-weight: 700;
}

/* Keep pairs two-per-row at all widths (form is embedded in a narrow iframe;
   stacking made it look like phone view). Only trim side padding on small widths. */
@media (max-width: 560px) {
  #app {
    padding: 4px 16px 0;
  }
}
