/**
 * WholeMind Referral Form Stylesheet
 * Styled to seamlessly match the Wholemind theme design system.
 */

/* Page Section Wrapper for Referral Form */
.site-main:has(.new-referral-form) {
  padding-top: 50px !important;
  padding-bottom: 80px !important;
  background-color: #FAF8F5 !important;
}

article:has(.new-referral-form) > .entry-header {
  display: none !important;
}

.new-referral-form {
  margin: 0 auto;
  max-width: 920px;
  background: #FAF8F5;
  color: var(--wm-heading, #2E3030);
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 14.5px;
  line-height: 1.55;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

.new-referral-form :focus-visible {
  outline: 2.5px solid var(--wm-primary, #72A59F);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Form Header */
.new-referral-form .formhead {
  padding: 30px 36px 0;
}

.new-referral-form .formhead h3 {
  font-family: var(--font-heading, 'Domine', serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--wm-heading, #2E3030);
  margin: 0 0 6px 0;
  line-height: 1.2;
}

.new-referral-form .formhead .sub {
  font-size: 14px;
  color: var(--wm-body, #60403E);
  margin: 0;
  opacity: 0.9;
}

/* Steps Progress Bar */
.new-referral-form .steps {
  display: flex;
  gap: 12px;
  padding: 22px 36px 0;
}

.new-referral-form .steps .s {
  flex: 1;
  border-top: 3px solid #E2E8F0;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s ease;
}

.new-referral-form .steps .s .k {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #949599;
}

.new-referral-form .steps .s .t {
  font-size: 13px;
  color: #949599;
  font-weight: 600;
  line-height: 1.3;
}

.new-referral-form .steps .s.done {
  border-color: var(--wm-primary, #72A59F);
}

.new-referral-form .steps .s.done .k,
.new-referral-form .steps .s.done .t {
  color: var(--wm-primary, #72A59F);
}

.new-referral-form .steps .s.now {
  border-color: #8C5550;
}

.new-referral-form .steps .s.now .k,
.new-referral-form .steps .s.now .t {
  color: #8C5550;
}

/* Step Content Pane */
.new-referral-form .pane {
  padding: 28px 36px 36px;
  background: #FFFFFF;
  margin-top: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

@media (max-width: 576px) {
  .new-referral-form .formhead,
  .new-referral-form .steps,
  .new-referral-form .pane {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* Fieldset & Section Legends */
.new-referral-form fieldset {
  border: 0;
  margin: 0 0 24px;
  padding: 0;
}

.new-referral-form legend {
  font-family: var(--font-heading, 'Domine', serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--wm-heading, #2E3030);
  padding: 0 0 8px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid #F0F0F0;
  width: 100%;
}

.new-referral-form .fs-note {
  font-size: 13.5px;
  color: var(--wm-body, #60403E);
  margin-bottom: 16px;
  opacity: 0.85;
}

/* Grid Layout */
.new-referral-form .grid {
  display: grid;
  gap: 14px 16px;
}

@media(min-width: 620px) {
  .new-referral-form .grid.two {
    grid-template-columns: 1fr 1fr;
  }

  .new-referral-form .span2 {
    grid-column: 1 / -1;
  }
}

/* --- REMOVE BR TAGS & USE FLEX COLUMN ON PARENT CONTAINERS --- */
.new-referral-form br {
  display: none !important;
}

.new-referral-form label.f,
.new-referral-form .span2,
.new-referral-form .grid > div,
.new-referral-form .wpcf7-form-control-wrap {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  margin-bottom: 0 !important;
  width: 100%;
}

.new-referral-form label.f > .lb,
.new-referral-form .lb {
  display: block !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--wm-heading, #2E3030) !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.3 !important;
}

.new-referral-form .opt {
  color: #8C8C8C;
  font-weight: 400;
  font-size: 12px;
}

/* Required Field Asterisk (Star) Red Color */
.new-referral-form .req,
.new-referral-form .lb .req {
  color: #DC2626 !important;
  font-weight: 700 !important;
  margin-left: 2px !important;
}

/* Form Inputs, Selects, Textareas */
.new-referral-form input[type=text],
.new-referral-form input[type=tel],
.new-referral-form input[type=email],
.new-referral-form input[type=date],
.new-referral-form select,
.new-referral-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #D2DCD7;
  border-radius: 8px;
  background: #FFFFFF;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 14px;
  color: var(--wm-heading, #2E3030);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  margin: 0 !important;
}

.new-referral-form textarea {
  min-height: 82px;
  resize: vertical;
  line-height: 1.5;
}

.new-referral-form input::placeholder,
.new-referral-form textarea::placeholder {
  color: #A0A5A3;
}

.new-referral-form input:focus,
.new-referral-form select:focus,
.new-referral-form textarea:focus {
  border-color: var(--wm-primary, #72A59F);
  outline: none;
  box-shadow: 0 0 0 3px rgba(114, 165, 159, 0.18);
}

.new-referral-form .hint {
  font-size: 11.5px;
  color: #7A7A7A;
  margin-top: 3px !important;
  display: block;
}

/* Inline Errors */
.new-referral-form .err {
  font-size: 11.5px;
  color: #8C2F1F;
  margin-top: 3px !important;
  font-weight: 600;
  display: none;
}

.new-referral-form .bad input,
.new-referral-form .bad select,
.new-referral-form .bad textarea,
.new-referral-form .bad .choices {
  border-color: #8C2F1F !important;
  background-color: #FFFBFA !important;
}

.new-referral-form .bad .err {
  display: block;
}

/* Choice Cards (Radio Buttons) */
.new-referral-form .choices {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

@media(min-width: 520px) {
  .new-referral-form .choices.row {
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
  }
}

.new-referral-form .wpcf7-radio {
  display: grid;
  gap: 8px;
  width: 100%;
}

.new-referral-form .choices.row .wpcf7-radio {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

.new-referral-form .wpcf7-list-item {
  margin: 0;
}

.new-referral-form .wpcf7-list-item label,
.new-referral-form .choice {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  background: #FFFFFF;
  margin: 0;
  width: 100%;
  transition: all 0.2s ease;
}

.new-referral-form .wpcf7-list-item label:hover,
.new-referral-form .choice:hover {
  border-color: var(--wm-primary, #72A59F);
  background: #F0F9F8;
}

.new-referral-form .wpcf7-list-item input[type="radio"],
.new-referral-form .choice input[type="radio"] {
  margin: 0;
  accent-color: var(--wm-primary, #72A59F);
  width: 16px;
  height: 16px;
  flex: none;
}

.new-referral-form .choice.sel,
.new-referral-form .wpcf7-list-item label:has(input:checked) {
  border-color: var(--wm-primary, #72A59F);
  background: #F0F9F8;
  box-shadow: inset 0 0 0 1px var(--wm-primary, #72A59F);
}

.new-referral-form .choice.sel .cl,
.new-referral-form .wpcf7-list-item input[type="radio"]:checked + .wpcf7-list-item-label {
  color: var(--wm-heading, #2E3030);
  font-weight: 600;
}

/* Checkbox Chips */
.new-referral-form .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.new-referral-form .chips .wpcf7-checkbox {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.new-referral-form .chips .wpcf7-list-item {
  margin: 0;
}

.new-referral-form .chips .wpcf7-list-item label,
.new-referral-form .chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13px;
  cursor: pointer;
  margin: 0;
  transition: all 0.2s ease;
}

.new-referral-form .chips input[type="checkbox"],
.new-referral-form .chip input {
  accent-color: var(--wm-primary, #72A59F);
  margin: 0;
  width: 14px;
  height: 14px;
}

.new-referral-form .chip.sel,
.new-referral-form .chips .wpcf7-list-item label:has(input:checked) {
  border-color: var(--wm-primary, #72A59F);
  background: #F0F9F8;
  font-weight: 600;
  color: #1F4B47;
}

/* Reveals & Callouts */
.new-referral-form .reveal {
  border-left: 3px solid var(--wm-primary, #72A59F);
  background: #F0F9F8;
  border-radius: 0 8px 8px 0;
  padding: 16px;
  margin-top: 14px;
}

.new-referral-form .reveal .rt {
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--wm-primary, #72A59F);
  margin-bottom: 12px;
}

/* Insurance Details Revealed Panel */
.new-referral-form #payIns.reveal {
  border-left: 4px solid #8C5550 !important;
  background-color: #F9F1EE !important;
  border-radius: 0 10px 10px 0 !important;
  padding: 22px 24px !important;
  margin-top: 16px !important;
}

.new-referral-form #payIns .rt {
  font-size: 11.5px !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
  color: #8C5550 !important;
  margin-bottom: 16px !important;
}

.new-referral-form .callout {
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  margin-top: 12px;
  border: 1px solid;
}

.new-referral-form .callout b {
  display: block;
  margin-bottom: 4px;
  font-size: 13.5px;
}

.new-referral-form .callout.info {
  background: #F0F9F8;
  border-color: #B2D8D4;
  color: #1F4B47;
}

.new-referral-form .callout.warn {
  background: #FEFAF0;
  border-color: #F2D36B;
  color: #7E5A0E;
}

/* Plain Radio List (for Urgency) */
.new-referral-form .choices.plain-list .wpcf7-radio {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.new-referral-form .choices.plain-list .wpcf7-list-item label {
  border: none !important;
  background: transparent !important;
  padding: 4px 0 !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.new-referral-form .choices.plain-list .wpcf7-list-item label:hover {
  background: transparent !important;
}

.new-referral-form .choices.plain-list .wpcf7-list-item input[type="radio"]:checked + .wpcf7-list-item-label {
  color: var(--wm-heading, #2E3030) !important;
  font-weight: 700 !important;
}

/* Emergency Alert Callout Box (#crisis) */
.new-referral-form .callout.stop,
.new-referral-form #crisis {
  background: #FAE7E2 !important;
  border: 1px solid #E9C3B9 !important;
  border-radius: 10px !important;
  padding: 18px 22px !important;
  margin-top: 14px !important;
  color: #8C2F1F !important;
}

.new-referral-form .callout.stop b,
.new-referral-form #crisis b {
  display: block !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  color: #8C2F1F !important;
  margin-bottom: 8px !important;
}

.new-referral-form .callout.stop p,
.new-referral-form #crisis p {
  font-size: 13.5px !important;
  line-height: 1.55 !important;
  color: #8C2F1F !important;
  margin: 0 0 14px 0 !important;
}

.new-referral-form .callout.stop .ack,
.new-referral-form #crisis .ack {
  display: flex !important;
  align-items: flex-start !important;
  gap: 10px !important;
  margin-top: 14px !important;
  padding-top: 14px !important;
  border-top: 1px solid #E9C3B9 !important;
  font-weight: 600 !important;
  font-size: 13.5px !important;
  color: #8C2F1F !important;
  cursor: pointer !important;
}

.new-referral-form .callout.stop .ack input[type="checkbox"],
.new-referral-form #crisis input[type="checkbox"] {
  accent-color: #8C2F1F !important;
  width: 16px !important;
  height: 16px !important;
  margin: 2px 0 0 0 !important;
  flex: none !important;
}

/* Upload & Attestation */
.new-referral-form .uploads {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin-top: 14px !important;
}

.new-referral-form .up {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  border: 1px dashed #D2C0BA !important;
  border-radius: 8px !important;
  padding: 12px 18px !important;
  background: #FFFFFF !important;
  transition: all 0.2s ease !important;
}

.new-referral-form .up:hover {
  border-color: #8C5550 !important;
  box-shadow: 0 2px 8px rgba(140, 85, 80, 0.08) !important;
}

.new-referral-form .up .un {
  font-size: 13.5px !important;
  font-weight: 500 !important;
  color: var(--wm-heading, #2E3030) !important;
}

.new-referral-form .ub-wrap {
  position: relative !important;
  display: inline-block !important;
  margin: 0 !important;
  padding: 0 !important;
}

.new-referral-form .ub-wrap .wpcf7-form-control-wrap {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  z-index: 2 !important;
  cursor: pointer !important;
}

.new-referral-form .ub-wrap input[type="file"] {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  cursor: pointer !important;
  z-index: 3 !important;
}

.new-referral-form .ub {
  border: 1px solid #8C5550 !important;
  color: #8C5550 !important;
  background: #FFFFFF !important;
  border-radius: 6px !important;
  padding: 6px 18px !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  cursor: pointer !important;
  display: inline-block !important;
  pointer-events: none !important;
  transition: all 0.2s ease !important;
  box-shadow: none !important;
}

.new-referral-form .up:hover .ub {
  background: #F9F1EE !important;
}

.new-referral-form .up.has-file {
  border-style: solid !important;
  border-color: #8C5550 !important;
  background: #FAF3F0 !important;
}

.new-referral-form .attest {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 18px;
  background: #FAFAFA;
}

.new-referral-form .attest p {
  font-size: 13px;
  color: var(--wm-body, #60403E);
  margin-bottom: 14px;
}

.new-referral-form .sig input {
  font-family: var(--font-heading, 'Domine', serif);
  font-size: 18px;
  font-style: italic;
  padding: 10px 14px;
}

/* Actions & Buttons */
.new-referral-form .actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid #F0F0F0;
  padding-top: 22px;
  margin-top: 10px;
}

@media(min-width: 560px) {
  .new-referral-form .actions {
    flex-direction: row;
    align-items: center;
  }

  .new-referral-form .actions .right {
    margin-left: auto;
    display: flex;
    gap: 10px;
  }
}

.new-referral-form .actions .right {
  display: flex;
  gap: 10px;
}

.new-referral-form .btn,
.new-referral-form input[type="submit"] {
  border: 1px solid var(--wm-primary, #72A59F);
  background: var(--wm-primary, #72A59F);
  color: #FFFFFF;
  border-radius: 8px;
  padding: 11px 24px;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(114, 165, 159, 0.2);
}

.new-referral-form .btn:hover,
.new-referral-form input[type="submit"]:hover {
  background: #5B8C86;
  border-color: #5B8C86;
  box-shadow: 0 4px 12px rgba(114, 165, 159, 0.3);
}

.new-referral-form .btn.ghost {
  background: #FFFFFF;
  color: var(--wm-primary, #72A59F);
  border: 1px solid var(--wm-primary, #72A59F);
  box-shadow: none;
}

.new-referral-form .btn.ghost:hover {
  background: #F0F9F8;
}

.new-referral-form .btn.quiet {
  background: transparent;
  border-color: transparent;
  color: #7A7A7A;
  text-decoration: underline;
  padding-left: 0;
  padding-right: 0;
  box-shadow: none;
}

.new-referral-form .btn.quiet:hover {
  color: var(--wm-heading, #2E3030);
  background: transparent;
}

/* Contact Form 7 Error Tips & Validation Overrides */
.wpcf7-not-valid-tip {
  color: #8C2F1F !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  margin-top: 3px !important;
  display: block !important;
}

.wpcf7-form-control.wpcf7-not-valid {
  border-color: #8C2F1F !important;
  background-color: #FFFBFA !important;
}

.wpcf7-response-output {
  margin: 18px 0 0 0 !important;
  padding: 12px 16px !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
}

.wpcf7-response-output.wpcf7-validation-errors {
  background: #FAE7E2 !important;
  border: 1px solid #E9C3B9 !important;
  color: #8C2F1F !important;
}

.wpcf7-response-output.wpcf7-mail-sent-ok {
  background: #F0F9F8 !important;
  border: 1px solid #72A59F !important;
  color: #1F4B47 !important;
}

.wpcf7-spinner {
  margin-left: 10px !important;
}
