/* ==========================================================================
   PreopHQ public-form theme ("preop") — an additive layer over bootstrap + style.css + public.css
   for the PATIENT-FACING pages: clinic hub · practice booking form · patient questionnaire.
   Loaded ONLY when the clinic's ui_theme is 'preop' (same switch as the dashboard — a clinic is
   either fully new or fully classic). The clinic's own accent (--accent from tenant_accent_css)
   stays the single colour; PreopHQ branding is limited to the footer credit.
   Decisions: DECISIONS.md 2026-09-06 "Public forms v2".
   ========================================================================== */

.theme-preop{
  --phq-ground:#f6f4ef; --phq-card:#ffffff; --phq-ink:#0f2430; --phq-ink-2:#31454f; --phq-muted:#6b7a82;
  --phq-line:#e6e1d8; --phq-line-2:#d3cdc1; --phq-radius:12px;
  --phq-shadow:0 1px 2px rgba(15,36,48,.05),0 10px 30px -18px rgba(15,36,48,.22);
  --phq-accent:var(--accent,#0e9c85);
  --phq-accent-deep:#0b7d6b; --phq-accent-tint:#e2f1ec; --phq-accent-ring:#bfe3da;
  --phq-danger:#b3402f; --phq-danger-soft:#f9e5e1; --phq-ok:#2f7d5b;
}
@supports (color: color-mix(in srgb, red 50%, white)){
  .theme-preop{
    --phq-accent-deep:color-mix(in srgb, var(--phq-accent) 80%, #0f2430);
    --phq-accent-tint:color-mix(in srgb, var(--phq-accent) 12%, #ffffff);
    --phq-accent-ring:color-mix(in srgb, var(--phq-accent) 35%, #ffffff);
  }
}

/* ---- ground & type ------------------------------------------------------ */
body.theme-preop{background:var(--phq-ground)!important;color:var(--phq-ink);font-size:16px;line-height:1.55}
.theme-preop h1,.theme-preop h2,.theme-preop h3,.theme-preop h4,.theme-preop h5{color:var(--phq-ink)}
.theme-preop .site-main{padding-bottom:40px}
.theme-preop .main-wrapper{max-width:860px;margin-left:auto;margin-right:auto}
.theme-preop .form-head h1,.theme-preop .qn-head h3{font-family:"Schibsted Grotesk","Instrument Sans",sans-serif;font-weight:800;font-size:clamp(26px,4vw,36px);letter-spacing:-.02em;margin:0 0 6px}
.theme-preop .form-head{text-align:center;padding:8px 0 4px}
.theme-preop .form-head::after{content:"Takes about five minutes.";display:block;color:var(--phq-muted);font-size:15px;margin-top:6px}
.theme-preop.form-page .booking-form{margin:0 0 60px}

/* ---- cards: booking .panel + questionnaire .module-card ------------------ */
.theme-preop .panel,.theme-preop .module-card{background:var(--phq-card)!important;border:1px solid var(--phq-line)!important;border-radius:var(--phq-radius)!important;box-shadow:var(--phq-shadow)!important;margin-bottom:18px;overflow:visible}
.theme-preop .panel.shadow{box-shadow:var(--phq-shadow)!important}
.theme-preop .panel-heading{padding:18px 22px 0!important;margin:0!important}
.theme-preop .panel-title,.theme-preop .module-card > .card-header{font-family:"Schibsted Grotesk","Instrument Sans",sans-serif;font-weight:700;font-size:1.15rem;letter-spacing:-.01em;color:var(--phq-ink);margin:0}
.theme-preop .module-card > .card-header{background:transparent!important;border-bottom:1px solid var(--phq-line)!important;padding:16px 22px}
.theme-preop .panel-body{padding:6px 10px 14px}
.theme-preop .module-card > .card-body{padding:18px 22px 8px}

/* ---- fields ------------------------------------------------------------- */
.theme-preop label{font-weight:600;color:var(--phq-ink-2);font-size:.95rem;margin-bottom:5px}
.theme-preop .form-group{margin-bottom:1.1rem}
.theme-preop .form-control{border:1px solid var(--phq-line-2);border-radius:9px;padding:.7rem .9rem;font-size:1rem;height:auto;color:var(--phq-ink);background:var(--phq-card);box-shadow:none;transition:border-color .12s ease,box-shadow .12s ease}
.theme-preop .form-control::placeholder{color:#a3adb3}
.theme-preop select.form-control{appearance:none;-webkit-appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7a82' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");background-repeat:no-repeat;background-position:right .9rem center;padding-right:2.4rem}
.theme-preop .form-control[readonly]{background:var(--phq-card);cursor:pointer;color:var(--phq-ink)}
.theme-preop #date_booking{background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7a82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>");background-repeat:no-repeat;background-position:right .9rem center;padding-right:2.6rem}
/* the focus ring: two-tone in the clinic accent, no glow (replaces style.css's lime shadow) */
.theme-preop.form-page input:focus,.theme-preop.form-page select:focus,.theme-preop.form-page textarea:focus,
.theme-preop .form-control:focus,.theme-preop input:focus,.theme-preop select:focus,.theme-preop textarea:focus{
  outline:none!important;border-color:var(--phq-accent)!important;box-shadow:0 0 0 1px var(--phq-card),0 0 0 4px var(--phq-accent-ring)!important}
.theme-preop input[type="checkbox"],.theme-preop input[type="radio"]{accent-color:var(--phq-accent);width:1.1em;height:1.1em;vertical-align:-2px}
.theme-preop .form-check{padding-left:1.8em;margin-bottom:.35rem}
.theme-preop .form-check-input{margin-left:-1.8em;margin-top:.3em}
.theme-preop .form-check-label{font-weight:500;color:var(--phq-ink)}
.theme-preop label .text-danger,.theme-preop .panel-title .text-danger,.theme-preop .req{color:var(--phq-accent-deep)!important;font-weight:700;font-size:.85em;margin-left:1px}
.theme-preop .err-msg,.theme-preop p.text-danger{color:var(--phq-danger)!important;font-size:.9rem}
.theme-preop p.text-muted,.theme-preop .help{color:var(--phq-muted)!important;font-size:.86rem;margin:4px 0 0}
.theme-preop textarea.form-control{min-height:96px}
.theme-preop .is-invalid,.theme-preop .qn-invalid .form-control{border-color:var(--phq-danger)!important}
.theme-preop .qn-invalid label.q-label{color:var(--phq-danger)}
/* jquery-ui datepicker + typeahead */
.theme-preop .ui-datepicker{border:1px solid var(--phq-line);border-radius:12px;box-shadow:0 18px 40px -20px rgba(15,36,48,.35);padding:10px;font-family:inherit}
.theme-preop .ui-datepicker .ui-datepicker-header{background:transparent;border:0}
.theme-preop .ui-datepicker .ui-state-default{border:0;background:transparent;text-align:center;border-radius:7px;color:var(--phq-ink)}
.theme-preop .ui-datepicker .ui-state-hover{background:var(--phq-accent-tint)}
.theme-preop .ui-datepicker .ui-state-active{background:var(--phq-accent);color:#fff}
.theme-preop .tt-menu{border:1px solid var(--phq-line);border-radius:10px;box-shadow:0 12px 30px -14px rgba(15,36,48,.3);padding:4px}
.theme-preop .tt-suggestion{border-radius:6px;padding:8px 12px}
.theme-preop .tt-suggestion:hover,.theme-preop .tt-suggestion.tt-cursor{background:var(--phq-accent-tint)}

/* ---- buttons ------------------------------------------------------------ */
.theme-preop .btn{border-radius:10px;font-weight:600;padding:.6rem 1.15rem}
.theme-preop .btn-lg{padding:.8rem 1.6rem;font-size:1.05rem}
.theme-preop .btn-primary,.theme-preop .btn-primary.bg-primary{background-color:var(--phq-accent)!important;border-color:var(--phq-accent)!important;color:#fff!important}
.theme-preop .btn-primary:hover{background-color:var(--phq-accent-deep)!important;border-color:var(--phq-accent-deep)!important}
.theme-preop .btn-outline-secondary{color:var(--phq-ink-2);border-color:var(--phq-line-2);background:var(--phq-card)}
.theme-preop .btn-outline-secondary:hover{background:var(--phq-ground);color:var(--phq-ink);border-color:var(--phq-line-2)}
.theme-preop .btn-link{color:var(--phq-accent-deep)}
@media (max-width:640px){.theme-preop .btn-lg,.theme-preop #qn-submit{width:100%}}

/* ---- booking form: patient cards ---------------------------------------- */
.theme-preop .booking-form{counter-reset:patient}
.theme-preop .patient{counter-increment:patient;position:relative;background:var(--phq-ground);border:1px solid var(--phq-line);border-radius:10px;padding:8px 8px 4px;margin:10px 4px 14px}
.theme-preop .patient::before{content:"Patient " counter(patient);display:block;font-family:"Schibsted Grotesk","Instrument Sans",sans-serif;font-weight:700;font-size:.8rem;letter-spacing:.08em;text-transform:uppercase;color:var(--phq-accent-deep);padding:10px 12px 0}
.theme-preop .patient > hr{display:none}
/* 2026-11-18: the cross sits in the corner of the patient card, beside its heading, ABOVE the fields. It was positioned
   against the inner column and drawn under the Total Duration field, so a click never reached it (no test clicked it). */
.theme-preop .patient > .row > .col-md-12{position:static}
.theme-preop .patient .remove_link{position:absolute;top:2px;right:4px;margin:0!important;z-index:5}
.theme-preop .patient .remove_link .btn-link{color:var(--phq-muted);font-size:1.3rem;line-height:1;padding:.5rem .7rem}
.theme-preop .patient .remove_link .btn-link:hover{color:var(--phq-danger)}
.theme-preop .patient .row.mt-3{margin-top:0!important}
.theme-preop .more-patient{display:inline-flex;align-items:center;gap:6px;border:1px dashed var(--phq-line-2);border-radius:10px;padding:.55rem 1rem;color:var(--phq-accent-deep);text-decoration:none;background:var(--phq-card);margin:0 12px 10px!important}
.theme-preop .more-patient::before{content:"+";font-weight:700;font-size:1.1em}
.theme-preop .more-patient:hover{border-color:var(--phq-accent);background:var(--phq-accent-tint);text-decoration:none}
/* the "before you submit" note becomes a quiet callout */
.theme-preop .booking-form h3.text-center{font-family:"Schibsted Grotesk","Instrument Sans",sans-serif;font-size:1.05rem;font-weight:700;letter-spacing:.02em;text-transform:none;margin:8px 0 6px}
.theme-preop .booking-form h3.text-center + p{color:var(--phq-muted);font-size:.95rem;line-height:1.6!important;margin:0 auto 6px!important;max-width:62ch}

/* ---- questionnaire: cards, steps, progress ------------------------------ */
.theme-preop .qn-wrap{max-width:820px;margin:26px auto;padding:0 16px}
.theme-preop .qn-head{margin-bottom:14px}
.theme-preop .qn-head p{color:var(--phq-muted)}
.theme-preop .qn-q{margin-bottom:20px}
.theme-preop .qn-q label.q-label{font-weight:600;font-size:1rem;color:var(--phq-ink);margin-bottom:6px}
.theme-preop .qn-content{background:var(--phq-ground);border-left:3px solid var(--phq-accent);border-radius:8px;padding:14px 16px;font-size:.95rem;line-height:1.6}
.theme-preop #qn-saved{color:var(--phq-ok)}
.theme-preop .qn-progress{background:var(--phq-card);border:1px solid var(--phq-line);border-radius:var(--phq-radius);padding:12px 16px;margin-bottom:16px;box-shadow:var(--phq-shadow)}
.theme-preop .qn-progress-text{display:flex;justify-content:space-between;gap:12px;font-size:.88rem;color:var(--phq-muted);margin-bottom:8px}
.theme-preop .qn-progress-text b{color:var(--phq-ink);font-weight:700}
/* 2026-11-21: Back beside the step count, so going back several pages needs no scrolling to the bottom */
.theme-preop .qn-progress-text{align-items:center}
.theme-preop .qn-progress-left{display:inline-flex;align-items:center;gap:10px;flex:0 0 auto}
.theme-preop .qn-back-top{border:1px solid var(--phq-line);background:var(--phq-card);color:var(--phq-ink);border-radius:8px;padding:6px 12px;min-height:38px;font-weight:600;font-size:.88rem;line-height:1.2;cursor:pointer}
.theme-preop .qn-back-top:hover,.theme-preop .qn-back-top:focus{border-color:var(--phq-accent);outline:0}
.theme-preop .qn-progress-text b{text-align:right;min-width:0;overflow-wrap:anywhere}
.theme-preop .qn-progress-bar{height:6px;border-radius:999px;background:var(--phq-line);overflow:hidden}
.theme-preop .qn-progress-bar span{display:block;height:100%;width:0;background:var(--phq-accent);border-radius:999px;transition:width .25s ease}
.theme-preop #questionnaire-form.qn-stepped .module-card:not(.qn-step-on){display:none!important}
.theme-preop #questionnaire-form.qn-stepped #qn-submit{display:none}
.theme-preop #questionnaire-form.qn-stepped.qn-last #qn-submit{display:inline-block}
.theme-preop .qn-stepnav{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:6px 0 10px}
.theme-preop .qn-stepnav .btn{min-width:130px}
.theme-preop #questionnaire-form.qn-last #qn-next{display:none}
.theme-preop #qn-steperr{display:none;background:var(--phq-danger-soft);color:var(--phq-danger);border:1px solid #eccfc8;border-radius:10px;padding:10px 14px;margin:0 0 12px;font-size:.95rem}
@media (prefers-reduced-motion: reduce){.theme-preop .qn-progress-bar span{transition:none}}

/* ---- alerts, hub, footer ------------------------------------------------ */
.theme-preop .alert{border-radius:var(--phq-radius);border-width:1px}
.theme-preop .alert-success{background:#e2f2e8;border-color:#cfe6d8;color:var(--phq-ok)}
.theme-preop .alert-danger{background:var(--phq-danger-soft);border-color:#eccfc8;color:var(--phq-danger)}
.theme-preop .alert-info{background:var(--phq-accent-tint);border-color:var(--phq-accent-ring);color:var(--phq-accent-deep)}
.theme-preop .phq-header{background:var(--phq-card)}
.theme-preop .phq-nav a.on{color:var(--phq-accent-deep);background:var(--phq-accent-tint)}
.theme-preop .phq-nav a.phq-cta{background:var(--phq-accent);color:#fff}   /* white on the booking form too: there it is also the page you are on, and that rule's dark text won (2026-11-22) */
.theme-preop .phq-nav a.phq-cta:hover{background:var(--phq-accent-deep)}
.theme-preop .phq-door:hover{border-color:var(--phq-accent)}
.theme-preop .phq-door .phq-door-icn{background:var(--phq-accent-tint);color:var(--phq-accent-deep)}
.theme-preop .phq-footer{background:transparent;margin-top:40px}
/* 2026-11-22: on a short page (the clinic's front page on a tall screen) the footer sat in the middle of the screen with
   empty page under it. The page is at least the height of the screen and the footer keeps to its foot; a long page is
   unchanged. No flex on the body: a flex column would shrink the centred boxes that use auto side margins. */
body.theme-preop{min-height:100vh}
.theme-preop .phq-footer{position:sticky;top:100vh}
.theme-preop .qn-stepnav{flex-wrap:wrap}
.theme-preop .qn-stepnav #qn-next,.theme-preop .qn-stepnav #qn-submit{margin-left:auto}
