/* ==========================================================================
   Ambassador for Success (AFS) Scheduler
   Conditional lead form + Friday/Saturday training calendar.
   Builds on shared form styles in ApplicationForm.css (.crmWebToEntityForm,
   .afs / .afs-field, .hidden). Brand tokens come from App.css :root.
   ========================================================================== */

/* Hidden Zoho submission target. */
.afs-scheduler__sink {
  display: none;
}

.afs-scheduler {
  position: relative;
}

/* Hero header — centred from tablet up. This stylesheet only loads on the
   scheduler page (/ambassador-for-success-new), so the rule stays scoped here
   and does not affect the shared HeroVideo on other pages. */
@media (min-width: 900px) {
  .hero-video__header {
    text-align: center;
  }

  .hero-video__header h1,
  .hero-video__header .description {
    margin-left: auto;
    margin-right: auto;
  }
}

/* A tighter, more elegant width than the shared 1200px application-form card,
   softly elevated off the hero photo. */
.crmWebToEntityForm.afs-scheduler {
  max-width: 1040px;
  box-shadow: 0 1px 2px rgba(16, 42, 56, 0.04), 0 32px 64px -48px rgba(16, 42, 56, 0.55);
}

/* Refined lead-field labels. */
.crmWebToEntityForm.afs-scheduler .afs-field label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--dark-gray);
  margin-bottom: 0.55rem;
}

/* Refined inputs: hairline border, comfortable size, clear focus ring. */
.crmWebToEntityForm.afs-scheduler input[type="text"],
.crmWebToEntityForm.afs-scheduler input[type="tel"],
.crmWebToEntityForm.afs-scheduler input[type="email"] {
  padding: 12px 16px;
  font-size: 16px;
  color: var(--black);
  background-color: var(--white);
  border: 1px solid rgba(21, 94, 124, 0.20);
  border-radius: 8px;
}

.crmWebToEntityForm.afs-scheduler input::placeholder {
  color: var(--light-gray);
}

.crmWebToEntityForm.afs-scheduler input[type="text"]:focus,
.crmWebToEntityForm.afs-scheduler input[type="tel"]:focus,
.crmWebToEntityForm.afs-scheduler input[type="email"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(21, 94, 124, 0.14);
}

.crmWebToEntityForm.afs-scheduler input[aria-invalid="true"],
.crmWebToEntityForm.afs-scheduler input[aria-invalid="true"]:focus {
  border-color: #8a1f1f;
  box-shadow: 0 0 0 3px rgba(138, 31, 31, 0.12);
}

.afs-scheduler .afs-req {
  color: var(--secondary-color-darkened);
}

/* First / Last name sit side by side; contact + email stay full width.
   Scoped here so it does not depend on the shared ApplicationForm grid. */
.afs-scheduler .afs-name-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  margin-bottom: 2rem;
}

/* Tablet Landscape Up - Min 900px */
/* From 900px the shared ApplicationForm rule drops the lead fields to a 1rem
   bottom margin. Match it here so First Name -> Contact Number reads the same
   as Contact Number -> Email (EFI request, DL-3027). */
@media (min-width: 900px) {
  .afs-scheduler .afs-name-row {
    margin-bottom: 1rem;
  }
}

.afs-scheduler .afs-name-row .afs-field {
  width: 100%;
  margin-bottom: 0;
}

.afs-scheduler .crmWebToEntityForm__personal.afs .afs-field-full {
  width: 100%;
}

@media (min-width: 560px) {
  .afs-scheduler .afs-name-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Questions, toggle and branch panels stack full width below the lead fields. */
.afs-scheduler .afs-questions,
.afs-scheduler .afs-toggle,
.afs-scheduler .afs-branch,
.afs-scheduler .afs-scheduler__action {
  width: 100%;
}

/* The qualifying questions sit between the lead fields and the scheduling
   choice; a hairline rule separates each zone. */
.afs-scheduler .afs-questions {
  padding-top: 1.75rem;
  padding-bottom: 1.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid rgba(21, 94, 124, 0.12);
}

/* Each zone carries its own top rule, so whatever follows the toggle — the
   calendar on the self-scheduling path, the Submit row on the assisted one —
   is separated by a single hairline rather than two stacked ones. */
.afs-scheduler .afs-toggle {
  border: 0;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(21, 94, 124, 0.12);
}

/* Breathing room between the chosen branch and the submit row. */
.afs-scheduler .afs-branch {
  padding-bottom: 2.5rem;
}

.afs-scheduler legend {
  padding: 0;
  font-family: var(--body-font-family);
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-color-darkened);
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   Pill-style Yes/No controls
   -------------------------------------------------------------------------- */
.afs-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.afs-pill {
  position: relative;
  display: inline-flex;
}

.afs-pill input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.afs-pill span {
  display: inline-block;
  min-width: 96px;
  padding: 10px 28px;
  text-align: center;
  font-family: var(--body-font-family);
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
  background-color: var(--white);
  border: 1.5px solid rgba(21, 94, 124, 0.35);
  border-radius: 8px;
}

.afs-pill:hover span {
  border-color: var(--primary-color);
  background-color: rgba(21, 94, 124, 0.05);
}

.afs-pill input:checked + span {
  color: var(--white);
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  box-shadow: 0 4px 10px -2px rgba(21, 94, 124, 0.45);
}

.afs-pill input:focus-visible + span {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

.afs-pills--sm span {
  min-width: 76px;
  padding: 7px 20px;
}

/* --------------------------------------------------------------------------
   Qualifying questions, presented one at a time (stepped) with a progress
   indicator. Asked of everyone before the scheduling choice; stepping is
   driven by AmbassadorForSuccessScheduler.js.
   -------------------------------------------------------------------------- */

/* Progress indicator: "Step X of 5" + a fill bar. */
.afs-steps {
  margin-bottom: 2rem;
}

.afs-steps__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 34px;
  margin-bottom: 0.65rem;
}

.afs-steps__count {
  font-family: var(--body-font-family);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--primary-color);
}

.afs-steps__count strong {
  font-weight: 700;
}

/* Back chevron on the Step X of 5 line, right-aligned; hidden on step 1. */
.afs-steps__back {
  flex: none;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  background-color: transparent;
  border: 1.5px solid rgba(21, 94, 124, 0.35);
  border-radius: 50%;
  cursor: pointer;
}

.afs-steps__back svg {
  width: 16px;
  height: 16px;
  display: block;
}

.afs-steps__back:hover {
  border-color: var(--primary-color);
  background-color: rgba(21, 94, 124, 0.08);
}

.afs-steps__back:focus-visible {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

.afs-steps__track {
  position: relative;
  width: 100%;
  height: 6px;
  background-color: rgba(21, 94, 124, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.afs-steps__fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 20%;
  background-color: var(--primary-color);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* One question visible at a time; a min-height keeps the card from jumping as
   questions of different lengths swap in. */
.afs-steps__viewport {
  position: relative;
  min-height: 118px;
}

.afs-question {
  border: 0;
  padding: 0;
}

.afs-question.hidden {
  display: none;
}

.afs-question.is-active {
  animation: afs-step-in 0.35s ease-out;
}

.afs-question legend {
  font-weight: normal;
  font-size: 16px;
  line-height: 1.55;
  color: var(--dark-gray);
  margin-bottom: 1.25rem;
}

@keyframes afs-step-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .afs-question.is-active {
    animation: none;
  }

  .afs-steps__fill {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   No path: referral copy + calendar
   -------------------------------------------------------------------------- */
.afs-branch--no {
  padding-top: 1.25rem;
  border-top: 1px solid rgba(21, 94, 124, 0.12);
}

/* Mobile: copy -> calendar -> summary (order props keep the chosen-date summary
   directly under the calendar, where the selection happens). */
.afs-branch--no:not(.hidden) {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.afs-no__info {
  display: contents;
}

.afs-referral { order: 1; }
.afs-calendar { order: 2; }
.afs-selected { order: 3; }

/* Desktop: copy + summary form a left column; calendar sits on the right;
   the pair is centred so the card never looks half-empty. */
@media (min-width: 900px) {
  .afs-branch--no:not(.hidden) {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    column-gap: clamp(2.5rem, 5vw, 4.5rem);
  }

  .afs-no__info {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex: 0 1 460px;
    order: 0;
  }

  .afs-calendar {
    flex: 0 0 auto;
    width: 392px;
  }
}

.afs-referral {
  max-width: 52ch;
}

.afs-referral p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--dark-gray);
}

.afs-referral p + p {
  margin-top: 0.6rem;
}

/* Calendar: white card, soft elevation + hairline navy ring (no solid-gray border). */
.afs-calendar {
  width: 100%;
  max-width: 392px;
  padding: 18px;
  background-color: var(--white);
  border: 1px solid rgba(21, 94, 124, 0.10);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(16, 42, 56, 0.05), 0 22px 40px -28px rgba(16, 42, 56, 0.35);
}

.afs-calendar__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.afs-calendar__title {
  flex: 1;
  text-align: center;
  font-family: var(--header-font-family);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--primary-color);
}

.afs-calendar__nav {
  flex: none;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  background-color: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.afs-calendar__nav svg {
  width: 18px;
  height: 18px;
  display: block;
}

.afs-calendar__nav:hover:not(:disabled) {
  background-color: rgba(21, 94, 124, 0.08);
}

.afs-calendar__nav:focus-visible {
  outline: 2px solid var(--secondary-color);
  outline-offset: 2px;
}

.afs-calendar__nav:disabled {
  color: rgba(21, 94, 124, 0.25);
  cursor: not-allowed;
}

.afs-calendar__weekdays,
.afs-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.afs-calendar__weekdays {
  margin-bottom: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(21, 94, 124, 0.08);
}

.afs-calendar__weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--light-gray);
}

/* Square cells; non-session days are muted so the Fri/Sat options lead the eye. */
.afs-calendar__cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--body-font-family);
  font-size: 15px;
  line-height: 1;
  color: rgba(16, 42, 56, 0.26);
}

.afs-calendar__cell--empty {
  background: transparent;
}

/* Holiday / post-holiday block-outs. */
.afs-calendar__cell.is-blocked {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* Selectable session days — borderless, circular highlight on hover/select. */
button.afs-calendar__cell--day {
  appearance: none;
  background-color: transparent;
  color: var(--primary-color);
  font-family: var(--body-font-family);
  font-size: 15px;
  font-weight: 600;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

button.afs-calendar__cell--day:hover {
  background-color: rgba(21, 94, 124, 0.10);
}

button.afs-calendar__cell--day:focus-visible {
  outline: 2px solid var(--secondary-color);
  outline-offset: -2px;
}

button.afs-calendar__cell--day.is-selected {
  background-color: var(--primary-color);
  color: var(--white);
  box-shadow: 0 6px 14px -4px rgba(21, 94, 124, 0.55);
}

.afs-calendar__legend {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(21, 94, 124, 0.08);
  font-size: 13px;
  color: var(--gray);
  line-height: 1.45;
}

.afs-calendar__legend::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 0.4em;
  border-radius: 50%;
  background-color: var(--secondary-color);
}

/* Selected-session summary — quiet navy-tinted well with a gold accent. */
.afs-selected {
  width: 100%;
  max-width: 392px;
  padding: 1rem 1.15rem;
  background-color: rgba(21, 94, 124, 0.05);
  border: 1px solid rgba(21, 94, 124, 0.12);
  border-radius: 14px;
}

.afs-selected__label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary-color-lighter);
  margin-bottom: 0.4rem;
}

.afs-selected__label::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--secondary-color);
}

.afs-selected__date {
  font-family: var(--header-font-family);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--primary-color);
}

.afs-selected__time {
  font-size: 14px;
  color: var(--dark-gray);
  margin-top: 0.25rem;
}

/* --------------------------------------------------------------------------
   Action row + inline error
   -------------------------------------------------------------------------- */
.crmWebToEntityForm__action.afs-scheduler__action {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-top: 1px solid rgba(21, 94, 124, 0.12);
}

.crmWebToEntityForm__action.afs-scheduler__action .button {
  box-shadow: 0 8px 18px -6px rgba(16, 42, 56, 0.35);
}

/* The shared __action rule sets display:flex, which outranks the .hidden
   utility — hide the Submit row explicitly while the questions are running. */
.crmWebToEntityForm__action.afs-scheduler__action.hidden {
  display: none;
}

.afs-error {
  width: 100%;
  margin: 0;
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  font-size: 13px;
  color: #8a1f1f;
  background-color: #fbeaea;
  border: 1px solid #e3b4b4;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   Confirmation step
   -------------------------------------------------------------------------- */
.afs-confirm {
  text-align: center;
  padding: 3.5rem 1.5rem 4rem;
}

/* Animated success checkmark: gold ring + navy tick that draw on. */
.afs-confirm__check {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 1.5rem;
}

.afs-confirm__check-ring {
  stroke: var(--secondary-color);
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: afs-confirm-ring 0.6s ease-out forwards;
}

.afs-confirm__check-mark {
  stroke: var(--primary-color);
  stroke-dasharray: 34;
  stroke-dashoffset: 34;
  animation: afs-confirm-mark 0.4s 0.45s ease-out forwards;
}

@keyframes afs-confirm-ring {
  to { stroke-dashoffset: 0; }
}

@keyframes afs-confirm-mark {
  to { stroke-dashoffset: 0; }
}

.afs-confirm__lead {
  font-family: var(--header-font-family);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.afs-confirm__sub {
  max-width: 42ch;
  margin: 0 auto 2rem;
  font-size: 16px;
  line-height: 1.5;
  color: var(--dark-gray);
}

/* Gentle staggered entrance for the message + action. */
.afs-confirm__lead,
.afs-confirm__sub,
.afs-confirm [data-afs-goback] {
  opacity: 0;
  animation: afs-confirm-rise 0.5s ease-out forwards;
}

.afs-confirm__lead { animation-delay: 0.5s; }
.afs-confirm__sub { animation-delay: 0.62s; }
.afs-confirm [data-afs-goback] { animation-delay: 0.74s; }

@keyframes afs-confirm-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Respect reduced-motion: show everything immediately, no animation. */
@media (prefers-reduced-motion: reduce) {
  .afs-confirm__check-ring,
  .afs-confirm__check-mark,
  .afs-confirm__lead,
  .afs-confirm__sub,
  .afs-confirm [data-afs-goback] {
    animation: none;
    opacity: 1;
    stroke-dashoffset: 0;
  }
}

/* Phones: tighten the calendar so day cells stay comfortably tappable. */
@media (max-width: 480px) {
  .afs-calendar {
    padding: 14px;
  }

  .afs-calendar__weekdays,
  .afs-calendar__grid {
    gap: 3px;
  }
}
