/*
 * Form component.
 *
 * Every number here was measured off the live Elementor forms before they were replaced, so the
 * visitor sees the same form: control 52px tall with 14/16 padding and a 10px radius, 1px border
 * in --cb-line, rows 10px apart, submit 15/28 with the same radius.
 *
 * Two tones, because the panel on a provider page sits on ink and the other two sit on light:
 *   .cb-form--ink    labels 14px/700 uppercase in #B9C4DE, white submit with ink text
 *   .cb-form--light  labels 16px/400 in body colour, blue submit with white text
 *
 * Selectors carry two classes throughout. That is not style, it is the lesson of this project:
 * a single-class rule loses to `.elementor-kit-15 button` and to Astra's `:where()` selectors,
 * and the site spent weeks with headings and buttons it never asked for. The theme that replaced
 * them adds no such rules, but a form is markup that may yet be pasted somewhere that does.
 */

.cb-form {
  --cb-f-line: var(--cb-line, #E2E7F0);
  --cb-f-ink: var(--cb-ink, #141E38);
  --cb-f-body: var(--cb-body, #3A4560);
  --cb-f-blue: var(--cb-blue, #1747A6);
  --cb-f-blue-d: var(--cb-blue-d, #0F3580);
  --cb-f-sec: #B9C4DE;
  display: block;
}

.cb-form .cb-form__row { margin: 0 0 10px; }
.cb-form .cb-form__row:last-of-type { margin-bottom: 0; }

.cb-form .cb-form__label {
  display: block;
  margin: 0 0 8px;
}

.cb-form .cb-form__control {
  display: block;
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--cb-f-ink);
  background: #FFFFFF;
  border: 1px solid var(--cb-f-line);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.cb-form .cb-form__control::placeholder { color: #7A879F; opacity: 1; }
.cb-form .cb-form__control:hover { border-color: #CBD6EA; }
.cb-form .cb-form__control:focus {
  outline: none;
  border-color: var(--cb-f-blue);
  box-shadow: 0 0 0 3px rgba(23, 71, 166, .18);
}
.cb-form textarea.cb-form__control { min-height: 120px; resize: vertical; }

/* The arrow is drawn here because appearance:none removes the native one, and a select without
   an affordance reads as a disabled text field. */
.cb-form .cb-form__selectwrap { position: relative; }
.cb-form .cb-form__selectwrap::after {
  content: '';
  position: absolute; right: 18px; top: 50%; width: 10px; height: 10px;
  margin-top: -6px; pointer-events: none;
  border-right: 2px solid var(--cb-f-body);
  border-bottom: 2px solid var(--cb-f-body);
  transform: rotate(45deg);
}
.cb-form select.cb-form__control { padding-right: 44px; cursor: pointer; }

/* Consent: the tick target is the whole line, and it is at least 44px tall so a thumb can hit it. */
.cb-form .cb-form__row--consent { margin-top: 16px; }
.cb-form .cb-form__consent {
  display: flex; align-items: flex-start; gap: 10px;
  min-height: 44px; cursor: pointer;
}
.cb-form .cb-form__consent input[type="checkbox"] {
  flex: 0 0 20px; width: 20px; height: 20px; margin: 2px 0 0;
  border: 1.5px solid var(--cb-f-sec); border-radius: 4px; background: #fff;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.cb-form .cb-form__consent input[type="checkbox"]:checked {
  background-color: var(--cb-f-blue); border-color: var(--cb-f-blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.5 3.5L13 5'/%3E%3C/svg%3E");
  background-size: 14px; background-position: center; background-repeat: no-repeat;
}
.cb-form .cb-form__consent input[type="checkbox"]:focus-visible {
  outline: 3px solid rgba(23, 71, 166, .35); outline-offset: 2px;
}

.cb-form .cb-form__actions { margin-top: 16px; }
.cb-form .cb-form__submit {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; padding: 15px 28px;
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.6;
  border: 0; border-radius: 10px; cursor: pointer;
  transition: background .18s ease, opacity .18s ease;
}
.cb-form .cb-form__submit[disabled] { opacity: .6; cursor: progress; }

/* Off-screen rather than display:none: some bots skip what is not rendered. */
.cb-form .cb-form__trap {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}

.cb-form .cb-form__error {
  display: block; margin-top: 6px; font-size: 14px; line-height: 1.4; color: #B3261E;
}
.cb-form .cb-form__error[hidden] { display: none; }

.cb-form .cb-form__message {
  margin: 16px 0 0; padding: 14px 16px; border-radius: 10px;
  font-size: 15.5px; line-height: 1.5;
}
.cb-form .cb-form__message[hidden] { display: none; }
.cb-form .cb-form__message--ok { background: rgba(30, 127, 73, .12); color: #14532B; }
.cb-form .cb-form__message--bad { background: rgba(179, 38, 30, .10); color: #7F1D1B; }

/* ---------- Light ground ---------- */
.cb-form--light .cb-form__label { font-size: 16px; font-weight: 400; color: var(--cb-f-body); }
.cb-form--light .cb-form__consent span { font-size: 16px; line-height: 1.5; color: var(--cb-f-body); }
.cb-form--light .cb-form__submit { background: var(--cb-f-blue); color: #FFFFFF; }
.cb-form--light .cb-form__submit:hover,
.cb-form--light .cb-form__submit:focus,
.cb-form--light .cb-form__submit:active { background: var(--cb-f-blue-d); color: #FFFFFF; }

/* ---------- Ink ground ---------- */
.cb-form--ink .cb-form__label {
  font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cb-f-sec);
}
.cb-form--ink .cb-form__consent span { font-size: 14px; line-height: 1.45; color: var(--cb-f-sec); }
.cb-form--ink .cb-form__submit { background: #FFFFFF; color: var(--cb-f-ink); }
.cb-form--ink .cb-form__submit:hover,
.cb-form--ink .cb-form__submit:focus,
.cb-form--ink .cb-form__submit:active {
  background: var(--cb-tint, #EDF2FB); color: var(--cb-f-ink);
}
.cb-form--ink .cb-form__submit:focus-visible {
  outline: 3px solid rgba(255, 255, 255, .45); outline-offset: 2px;
}
.cb-form--ink .cb-form__error { color: #FFB4AB; }
.cb-form--ink .cb-form__message--ok { background: rgba(255, 255, 255, .12); color: #FFFFFF; }
.cb-form--ink .cb-form__message--bad { background: rgba(255, 180, 171, .14); color: #FFD8D4; }

/* ---------- Two-up rows ----------
   Only the application form pairs fields, and only it carries `cb-form--two`. The modifier is on
   the form rather than on a media query alone because a media query asks about the window, not
   about the box: the provider panel is 315px wide inside its card on the widest desktop, and a
   viewport-only rule would have split it into two columns of 150px.
   The honeypot is absolutely positioned and hidden inputs are display:none by UA rule, so neither
   takes a grid slot. */
@media (min-width: 700px) {
  .cb-form.cb-form--two {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start;
  }
  .cb-form.cb-form--two > .cb-form__row { grid-column: 1 / -1; margin: 0; min-width: 0; }
  .cb-form.cb-form--two > .cb-form__row--half { grid-column: auto; }
  .cb-form.cb-form--two > .cb-form__actions,
  .cb-form.cb-form--two > .cb-form__message { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .cb-form .cb-form__control,
  .cb-form .cb-form__submit { transition: none; }
}
