/**
 * Book an Appointment — frontend styles
 *
 * These are starter tokens matching the approved design (cream/brown/green, Rolex-style
 * reference). Milestone 4 replaces the placeholder markup this ships against with the full
 * Purpose > Notice > Date & Time > Contact > Confirmation flow from the demo; the class names
 * below (.apptbk-*) are the hooks that flow will use, and are also where the admin's
 * "Element style classes" setting (Milestone 6+) attaches additional classes at runtime.
 */

:root {
  --apptbk-cream: #F9F7F4;
  --apptbk-brown: #4A2E20;
  --apptbk-brown-soft: #8a7666;
  --apptbk-text: #2b2620;
  --apptbk-text-soft: #7a7268;
  --apptbk-rule: #ddd6c8;
  --apptbk-green: #1F6F43;
  --apptbk-green-dark: #175A36;
}

/* No page-wide (body) background on purpose: only the component's own area is cream; the rest of
   the site's template, its modules and other sections keep their own backgrounds. */

.com-bookanappointment-booking {
  /* Fills the whole area the template gives the component (not a narrower centred box), while the
     content itself stays within 1320px: the side padding grows on wide screens. */
  max-width: none;
  margin: 0;
  padding: 7vh max(24px, calc((100% - 1272px) / 2));
  box-sizing: border-box;
  text-align: center;
  background: var(--apptbk-cream);
  color: var(--apptbk-text);
  font-family: inherit;
}

.apptbk-eyebrow {
  font-size: 13px;
  font-weight: 700;
  color: var(--apptbk-brown);
  margin-bottom: 10px;
  text-align: center !important;
}

.apptbk-headline {
  font-weight: 800;
  font-size: 32px;
  line-height: 1.15;
  color: var(--apptbk-brown);
  margin: 0 0 24px;
  text-align: center !important;
}

.apptbk-purpose-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  text-align: left;
}

.apptbk-purpose-card {
  background: #fff;
  border: 1px solid var(--apptbk-rule);
  padding: 20px 18px;
}

.apptbk-purpose-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.apptbk-purpose-desc {
  font-size: 13px;
  color: var(--apptbk-text-soft);
  line-height: 1.4;
}

.apptbk-empty,
.apptbk-milestone-note {
  font-size: 13px;
  color: var(--apptbk-text-soft);
  margin-top: 20px;
}

/* ---- Semantic typography hooks matching the client's own global stylesheet class names.
   Fallback values only — once wired to the real global CSS file, these should just inherit
   the actual tokens and these declarations can be deleted. ---- */
.body24 { font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.headline50 { font-weight: 800; letter-spacing: -0.01em; }
.body20 { font-size: 14px; line-height: 1.55; }
.navigation16 { font-size: 13px; font-weight: 600; }
.legend16 { font-size: 12px; font-weight: 600; color: var(--apptbk-text-soft); }
.legend14 { font-size: 12.5px; color: var(--apptbk-text-soft); }

.apptbk-topbar { display: flex; justify-content: flex-start; margin-bottom: 10px; min-height: 26px; }
.apptbk-back-btn {
  background: none; border: none; color: var(--apptbk-text); font-family: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0;
  text-decoration: none;
}
.apptbk-back-btn:hover { color: var(--apptbk-green-dark); }

.apptbk-stepper { display: flex; justify-content: center; gap: 8px; margin-bottom: 28px; }
.apptbk-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--apptbk-rule); }
.apptbk-dot.is-active { background: var(--apptbk-green); width: 20px; border-radius: 4px; }
.apptbk-dot.is-done { background: var(--apptbk-brown-soft); }

/* text-align: center is explicit here, not inherited from .com-bookanappointment-booking —
   inheritance is fragile: a host page's own CSS (a global "p { text-align: left }" reset, or
   any descendant selector with higher specificity than a bare class) can directly target these
   <p> elements and win regardless of source order. !important because a plain declaration
   already proved not to be enough on at least one real host page — same reasoning as the
   `body { background-color ... !important }` rule above. */
.apptbk-sub { color: var(--apptbk-text-soft); font-size: 15px; margin: 0 auto 26px; max-width: 440px; line-height: 1.5; text-align: center !important; }
.apptbk-intro { color: var(--apptbk-text-soft); font-size: 15px; margin: 0 auto 18px; max-width: 440px; line-height: 1.5; text-align: center !important; }

/* Administrator-authored HTML from the Page Content admin screen (see PageContentService).
   Unstyled admin markup — a plain <h1>/<p>/<a> — should still look reasonably on-brand out of
   the box, without requiring the admin to hand-write every style themselves. Scoped to this
   wrapper class so it never bleeds into the rest of the flow's own elements. */
.apptbk-page-custom-html { max-width: 620px; margin: 0 auto 24px; text-align: center; }
.apptbk-page-custom-html h1, .apptbk-page-custom-html h2 {
  font-weight: 800; color: var(--apptbk-brown); line-height: 1.2; margin: 0 0 14px; text-align: center !important;
}
.apptbk-page-custom-html h1 { font-size: 32px; }
.apptbk-page-custom-html h2 { font-size: 22px; }
.apptbk-page-custom-html p { color: var(--apptbk-text-soft); font-size: 15px; line-height: 1.6; margin: 0 0 14px; text-align: center !important; }
.apptbk-page-custom-html a { color: var(--apptbk-green-dark); font-weight: 600; }
.apptbk-page-custom-html img { max-width: 100%; height: auto; }

.apptbk-purpose-photo {
  width: calc(100% + 36px); margin: -20px -18px 0; aspect-ratio: 16/11;
  background: linear-gradient(135deg,#e7e0cf,#cfc2a3); display: flex; align-items: center; justify-content: center;
  color: var(--apptbk-brown-soft); font-size: 11px; text-align: center; padding: 10px;
}
/* Once an admin uploads an image, this switches from the gradient placeholder above to the
   actual photo. Desktop/landscape uses --apptbk-photo-landscape; narrow/mobile viewports (see
   the media query below) switch to --apptbk-photo-portrait if one was uploaded, otherwise they
   just keep using the landscape photo (the var() fallback handles that automatically). */
.apptbk-purpose-photo.has-photo {
  background-image: var(--apptbk-photo-landscape);
  background-size: cover;
  background-position: center;
}
@media (max-width: 480px) {
  .apptbk-purpose-photo.has-photo {
    aspect-ratio: 3/4;
    background-image: var(--apptbk-photo-portrait, var(--apptbk-photo-landscape));
  }
}
.apptbk-purpose-card { cursor: pointer; text-align: left; width: 100%; font-family: inherit; }
.apptbk-purpose-card:hover { border-color: var(--apptbk-green); }
.apptbk-purpose-name { font-size: 13px; font-weight: 600; color: var(--apptbk-text-soft); margin: 12px 0 4px; }
.apptbk-purpose-title { font-weight: 700; font-size: 16px; line-height: 1.35; }
/* Both classes above are yours to freely restyle via Admin -> Settings -> Appearance ->
   Custom CSS (loaded after this file, so anything written there always wins) — no code
   changes or redeployment needed to adjust how the purpose cards look. */

.apptbk-notice-box { background: #fff; border: 1px solid var(--apptbk-rule); padding: 26px 24px; text-align: left; margin-bottom: 26px; }
.apptbk-notice-text { font-weight: 600; margin: 0; }
.apptbk-confirm-heading { font-size: 19px; margin: 0 0 18px; }
.apptbk-mandatory-note { margin-bottom: 8px; }

.apptbk-cal-head { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 22px; }
.apptbk-cal-head button { background: none; border: none; cursor: pointer; padding: 0; font-family: inherit; font-size: 20px; color: var(--apptbk-text); text-decoration: none; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; }
.apptbk-cal-head button.is-disabled, .apptbk-cal-head button:disabled { opacity: .25; cursor: not-allowed; }
.apptbk-cal-range { font-weight: 700; font-size: 15px; min-width: 150px; }
.apptbk-date-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 34px; }
.apptbk-date-cell {
  background: #fff; border: 1px solid transparent; padding: 16px 4px; cursor: pointer; font-family: inherit;
  text-align: center; color: inherit;
}
.apptbk-date-cell .dnum { display: block; font-size: 18px; font-weight: 700; }
.apptbk-date-cell .dname { display: block; font-size: 12px; color: var(--apptbk-text-soft); margin-top: 2px; }
.apptbk-date-cell.is-disabled { cursor: not-allowed; }
.apptbk-date-cell.is-disabled .dnum, .apptbk-date-cell.is-disabled .dname { color: #c3bcac; }
.apptbk-date-cell.is-bookable:hover { border-color: var(--apptbk-green); }
.apptbk-date-cell.is-selected { border-color: var(--apptbk-brown); }
.apptbk-date-cell.is-selected .dnum { color: var(--apptbk-green-dark); }

.apptbk-time-label { font-size: 14px; font-weight: 700; margin-bottom: 16px; }
.apptbk-time-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 36px; min-height: 44px; }
.apptbk-time-pill {
  border: 1px solid var(--apptbk-rule); background: #fff; border-radius: 999px; padding: 11px 22px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.apptbk-time-pill:hover { border-color: var(--apptbk-green); }
.apptbk-time-pill.is-selected { background: var(--apptbk-green); border-color: var(--apptbk-green); color: #fff; }
.apptbk-time-pill.is-taken { color: #c3bcac; background: #f1efe8; border-color: #f1efe8; cursor: not-allowed; }

.apptbk-btn-pill {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center; background: var(--apptbk-green);
  color: #fff; border: none; border-radius: 999px; padding: 14px 30px; font-size: 15px; font-weight: 700;
  font-family: inherit; cursor: pointer; min-width: 170px; text-decoration: none;
}
.apptbk-btn-pill:hover { background: var(--apptbk-green-dark); color: #fff; }
.apptbk-btn-pill:disabled { opacity: .4; cursor: not-allowed; }
.apptbk-btn-text-secondary { background: none; border: none; color: var(--apptbk-green-dark); font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; padding: 14px 8px; text-decoration: none; }
.apptbk-btn-text-secondary:hover { text-decoration: underline; }

.apptbk-form { text-align: left; }
.apptbk-form-submit-row { text-align: center; margin-top: 6px; }
.apptbk-form-row { display: flex; flex-wrap: wrap; gap: 20px; }
.apptbk-field { margin-bottom: 22px; flex: 1; }
/* On narrow/mobile screens, Last Name drops to its own row below Title + First Name
   (matching the reference design); on wider screens it rejoins the same row. */
.apptbk-field-lastname { flex-basis: 100%; }
.apptbk-field-code { flex-basis: 100%; }
/* Combined selector (.apptbk-field.apptbk-field-title) so this always outranks the plain
   .apptbk-field flex:1 above on specificity, regardless of source order — previously this
   was a same-specificity, single-class rule placed *before* .apptbk-field, so .apptbk-field's
   flex:1 silently won and stretched Title to fill the row on every screen size. Same fixed
   width on mobile and desktop; the title options ("Mr", "Dr", ...) are short enough not to
   need a breakpoint-specific size the way Last Name/Code do. */
.apptbk-field.apptbk-field-title { flex: 0 0 72px; }
@media (min-width: 481px) {
  .apptbk-field-lastname { flex-basis: 0; }
  .apptbk-field-code { flex-basis: 160px; flex-grow: 0; }
}
.apptbk-field label { display: block; margin-bottom: 6px; }
.com-bookanappointment-booking .apptbk-field input,
.com-bookanappointment-booking .apptbk-field select {
  width: 100% !important; border: none !important; border-bottom: 1px solid var(--apptbk-rule) !important;
  background-color: transparent !important; box-shadow: none !important;
  padding: 6px 2px 10px; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--apptbk-text);
  border-radius: 0 !important; -webkit-appearance: none; appearance: none;
}
.com-bookanappointment-booking .apptbk-field select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%232b2620' d='M6 8 0 0h12z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 2px center !important;
  background-size: 11px 7px !important;
  padding-right: 20px;
}
.apptbk-field input:focus, .apptbk-field select:focus { outline: none; border-bottom-color: var(--apptbk-green); }
.apptbk-helper { margin: 26px 0 14px; }
.apptbk-readonly-value { padding: 6px 2px 10px; font-size: 15px; font-weight: 600; border-bottom: 1px solid transparent; }
.apptbk-consent { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; text-align: left; }
.com-bookanappointment-booking .apptbk-consent input {
  margin-top: 3px; width: 18px !important; height: 18px !important; min-width: 18px;
  -webkit-appearance: none !important; appearance: none !important; border: 1.5px solid var(--apptbk-rule) !important;
  border-radius: 50% !important; background: transparent !important; cursor: pointer; position: relative;
  box-shadow: none !important;
}
.com-bookanappointment-booking .apptbk-consent input:checked {
  border-color: var(--apptbk-green) !important; background: var(--apptbk-green) !important;
}
.com-bookanappointment-booking .apptbk-consent input:checked::after {
  content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.apptbk-consent a { color: var(--apptbk-green-dark); font-weight: 600; }
.apptbk-honeypot { position: absolute; left: -9999px; top: -9999px; opacity: 0; height: 0; overflow: hidden; }

.apptbk-confirm-card { background: #fff; padding: 28px 26px; text-align: left; margin: 26px 0; }
.apptbk-confirm-row { margin-bottom: 16px; }
.apptbk-confirm-row b { display: block; margin-bottom: 2px; }
/* The appointment reference is wrapped in a bare <code> in three places: inside
   .apptbk-confirm-row (step_confirm.php, state_confirm_cancel.php, state_modified.php) and
   inside .apptbk-note (step_confirm.php's reference note below the confirm card). <code> has
   no rule of its own anywhere in this stylesheet, so without this it falls through to the site
   template's/Bootstrap's default `code` styling — typically a pink, monospace look that
   clashes with the rest of the page. This makes it read as plain text, matching whichever
   element it's inside instead. */
.com-bookanappointment-booking code {
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
}
.apptbk-conf-links a { display: flex; align-items: center; gap: 8px; color: var(--apptbk-green-dark); font-weight: 600; font-size: 14px; text-decoration: none; margin-bottom: 10px; cursor: pointer; }
.apptbk-conf-links a:hover { text-decoration: underline; }

.apptbk-notify-earlier { text-align: left; margin-bottom: 16px; }
.apptbk-notify-earlier label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.com-bookanappointment-booking .apptbk-notify-earlier input[type="checkbox"] {
  width: 18px !important; height: 18px !important; min-width: 18px; margin: 0;
  -webkit-appearance: none !important; appearance: none !important; border: 1.5px solid var(--apptbk-rule) !important;
  border-radius: 50% !important; background: transparent !important; cursor: pointer; position: relative;
  box-shadow: none !important;
}
.com-bookanappointment-booking .apptbk-notify-earlier input[type="checkbox"]:checked {
  border-color: var(--apptbk-green) !important; background: var(--apptbk-green) !important;
}
.com-bookanappointment-booking .apptbk-notify-earlier input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 50%; top: 45%; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: translate(-50%, -50%) rotate(45deg);
}
.apptbk-notify-confirmed-message { text-align: left; font-size: 14px; color: var(--apptbk-green-dark); font-weight: 600; margin-bottom: 16px; }

.apptbk-modal-overlay {
  position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  background: rgba(43, 38, 32, 0.5);
  z-index: 999999 !important;
  align-items: center; justify-content: center;
  padding: 20px;
}
.apptbk-modal {
  background: var(--apptbk-cream); border-radius: 8px; padding: 28px 26px;
  max-width: 420px; width: 100%; text-align: left;
}
.apptbk-modal p { margin: 0 0 20px; font-size: 15px; line-height: 1.5; color: var(--apptbk-text); }
.apptbk-modal-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.apptbk-cta-row { display: flex; gap: 14px; justify-content: center; align-items: center; margin-top: 24px; flex-wrap: wrap; }
.apptbk-note { font-size: 12px; color: var(--apptbk-text-soft); margin-top: 26px; }
.apptbk-error-message { background: #f6e9e5; color: #a6412c; padding: 12px 16px; margin-bottom: 20px; text-align: left; font-size: 14px; }
