/*
 * The website's forms: one field design for all of them, and the live preview beside them
 * (frontend/assets/js/form-preview.js, which wraps a form in .fp-wrap > .fp-layout and adds the .fp-preview card).
 * The careers application form uses the same field design (careers.css, "Fields") and has its own preview.
 * Loaded after site-theme.css (layouts/styles.blade.php). The theme sets 1rem = 10px, so sizes are in px.
 */
.fp-wrap,
.fp-layout {
  --fp-red: var(--mrt-red, #AB1A2D);
  --fp-red-dark: var(--mrt-red-dark, #8E1526);
  --fp-red-soft: var(--mrt-red-soft, #FBF0F2);
  --fp-navy: var(--mrt-navy, #06205C);
  --fp-text: #4B5563;
  --fp-muted: #6B7280;
  --fp-faint: #9CA3AF;
  --fp-line: #E5E7EB;
  --fp-field-line: #D5DAE1;
  --fp-soft: #F8F9FB;
  --fp-ok: #047857;
  --fp-ok-bright: #10B981;
  --fp-field-h: 52px;
  --fp-radius: 12px;
  --fp-gap: 20px;
  --fp-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236B7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5.5 7.75 4.5 4.5 4.5-4.5'/%3E%3C/svg%3E");
  --fp-chevron-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23AB1A2D' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5.5 7.75 4.5 4.5 4.5-4.5'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------------------------------------------------------
 * Layout: the form and the preview side by side; one column (preview first, folded) where it is narrow.
 * ------------------------------------------------------------------------------------------------------------- */
.fp-wrap { width: 100%; container-type: inline-size; }
.fp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 32px;
  align-items: start;
  text-align: start;
}
.fp-layout > :first-child { min-width: 0; margin: 0; }
.fp-layout > .qf { max-width: none; }

/* The theme clips its page blocks (overflow: hidden), which stops a sticky card; clip keeps the clipping. */
.fp-unclip { overflow: clip !important; }
.fp-unclip--block { display: flow-root; }

/* ---------------------------------------------------------------------------------------------------------------
 * The theme's forms (.contact-form-wrapper: contact, complaints, medical approval, form builder, member area):
 * the same card, spacing, labels and fields everywhere.
 * ------------------------------------------------------------------------------------------------------------- */
.fp-wrap .fp-layout form.fp-form {
  margin: 0;
  padding: 32px;
  border: 1px solid #EEF0F3;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 60px -34px rgba(6, 32, 92, .35), 0 2px 8px rgba(6, 32, 92, .04);
}
.fp-wrap .fp-layout form.fp-form .row { --bs-gutter-x: var(--fp-gap); --bs-gutter-y: 0; margin-top: 0; }
.fp-wrap .fp-layout form.fp-form .row > * { margin-top: 0 !important; margin-bottom: var(--fp-gap); }
.fp-wrap .fp-layout form.fp-form .row > .form-group { margin: 0 0 var(--fp-gap) !important; }
.fp-wrap .fp-layout form.fp-form .row > :last-child { margin-bottom: 0; }
.fp-wrap .fp-layout form.fp-form .form-group:not(.row > *) { margin: 0 !important; }

.fp-wrap .fp-layout form.fp-form label.fp-label,
.fp-wrap .fp-layout form.fp-form .row > * > label {
  display: block;
  margin: 0 0 8px;
  color: var(--fp-navy);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: start;
}
.fp-req { color: var(--fp-red); font-weight: 700; }

/* Fields: one height, one corner, one border, one focus ring. .fp-wrap .fp-layout form.fp-form.fp-form (0,4,1) is just above the theme's
   ".main-content .contact-form .form-group .form-control" (0,4,0); :where() adds nothing, so the select, textarea and
   file rules below can be one step stronger. */
.fp-wrap .fp-layout form.fp-form.fp-form :where(.form-control, .form-select, select, textarea,
  input:not([type=checkbox], [type=radio], [type=file], [type=submit], [type=button], [type=hidden])) {
  display: block;
  width: 100%;
  height: auto;
  min-height: var(--fp-field-h);
  margin: 0;
  padding: 13px 16px;
  border: 1px solid var(--fp-field-line);
  border-radius: var(--fp-radius);
  background-color: #fff;
  color: var(--fp-navy);
  font-size: 15px;
  line-height: 1.6;
  box-shadow: 0 1px 2px rgba(6, 32, 92, .04);
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.fp-wrap .fp-layout form.fp-form.fp-form :where(.form-control, .form-select, select, textarea, input):not([type=file]):hover:not(:focus) { border-color: #AEB6C2; }
.fp-wrap .fp-layout form.fp-form.fp-form :where(.form-control, .form-select, select, textarea, input):focus {
  border-color: var(--fp-red);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(171, 26, 45, .12);
}
.fp-wrap .fp-layout form.fp-form ::placeholder { color: var(--fp-faint); opacity: 1; }
.fp-wrap .fp-layout form.fp-form.fp-form textarea { min-height: 140px; resize: vertical; }

/* Selects: no browser arrow, a clean chevron with room around it (it turns red with the focus ring). */
.fp-wrap .fp-layout form.fp-form.fp-form :is(select, .form-select) {
  -webkit-appearance: none;
  appearance: none;
  padding-inline-end: 46px;
  background-image: var(--fp-chevron);
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 18px 18px;
  cursor: pointer;
}
[dir=rtl] .fp-wrap .fp-layout form.fp-form.fp-form :is(select, .form-select) { background-position: left 16px center; }
.fp-wrap .fp-layout form.fp-form.fp-form :is(select, .form-select):focus { background-image: var(--fp-chevron-on); }
.fp-wrap .fp-layout form.fp-form .select2-container { width: 100% !important; }

/* Files: a dashed drop area with a red "choose" button. */
.fp-wrap .fp-layout form.fp-form.fp-form input[type=file] {
  display: block;
  width: 100%;
  min-height: var(--fp-field-h);
  padding: 9px 10px;
  border: 1.5px dashed #CDD3DC;
  border-radius: var(--fp-radius);
  background: var(--fp-soft);
  color: var(--fp-muted);
  font-size: 14px;
  line-height: 1.6;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.fp-wrap .fp-layout form.fp-form.fp-form input[type=file]:hover { border-color: var(--fp-red); background: var(--fp-red-soft); }
.fp-wrap .fp-layout form.fp-form.fp-form input[type=file]::file-selector-button {
  margin-inline-end: 12px;
  padding: 7px 14px;
  border: 1px solid rgba(171, 26, 45, .3);
  border-radius: 9px;
  background: #fff;
  color: var(--fp-red-dark);
  font-weight: 700;
  cursor: pointer;
}

/* Errors from jQuery Validate. */
.fp-wrap .fp-layout form.fp-form .is-invalid { border-color: var(--fp-red) !important; box-shadow: 0 0 0 4px rgba(171, 26, 45, .1) !important; }
.fp-wrap .fp-layout form.fp-form :is(.invalid-feedback, label.error, span.error) {
  display: block;
  margin: 6px 0 0;
  color: var(--fp-red);
  font-size: 13px;
  font-weight: 500;
  text-align: start;
}
.fp-wrap .fp-layout form.fp-form.fp-form .is-valid:not(:focus) { border-color: var(--fp-field-line); background-image: none; }
.fp-wrap .fp-layout form.fp-form.fp-form select.is-valid { background-image: var(--fp-chevron); }

/* The form's own button: full width under the fields. */
.fp-wrap .fp-layout form.fp-form [type=submit] {
  display: flex;
  float: none !important;
  width: 100%;
  min-height: 54px;
  margin: 4px 0 0 !important;
  border-radius: 14px;
  font-size: 15px;
}

/* ---------------------------------------------------------------------------------------------------------------
 * The preview card (as on the careers application form).
 * ------------------------------------------------------------------------------------------------------------- */
.fp-preview { position: sticky; top: 108px; }
.fp-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 132px);
  padding: 22px;
  border: 1px solid #EEF0F3;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 60px -34px rgba(6, 32, 92, .4), 0 2px 8px rgba(6, 32, 92, .04);
  text-align: start;
}
.fp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fp-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  color: var(--fp-ok);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.4;
  text-transform: uppercase;
}
[dir=rtl] .fp-eyebrow { letter-spacing: 0; }
.fp-live { width: 8px; height: 8px; border-radius: 50%; background: var(--fp-ok-bright); animation: fpLive 2s infinite; }
@keyframes fpLive {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
/* !important: some pages size every h2 on phones with !important (style.css, e.g. .complaints-page h2 at 32px). */
.fp-preview .fp-title {
  margin: 0 !important;
  color: var(--fp-navy) !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  line-height: 1.3 !important;
  letter-spacing: -.2px;
  text-transform: none !important;
}
@media (max-width: 575.98px) {
  .fp-preview .fp-title { font-size: 20px !important; }
}
.fp-toggle {
  display: none;
  flex: none;
  padding: 8px 14px;
  border: 1px solid rgba(171, 26, 45, .35);
  border-radius: 10px;
  background: var(--fp-red-soft);
  color: var(--fp-red-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

.fp-progress { margin: 16px 0 18px; }
.fp-progress__row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--fp-muted); font-size: 13px; line-height: 1.4; }
.fp-progress__row b { color: var(--fp-red); }
.fp-progress__bar { height: 8px; overflow: hidden; border-radius: 999px; background: #F1F2F5; }
.fp-progress__bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--fp-red), var(--fp-red-dark));
  transition: width .4s cubic-bezier(.22, 1, .36, 1);
}
[dir=rtl] .fp-progress__bar span { background: linear-gradient(270deg, var(--fp-red), var(--fp-red-dark)); }
.fp-preview.is-ready .fp-progress__row,
.fp-preview.is-ready .fp-progress__row b { color: var(--fp-ok); font-weight: 600; }
.fp-preview.is-ready .fp-progress__bar span { background: var(--fp-ok-bright); }

.fp-body {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 -22px;
  padding: 0 22px 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.fp-group + .fp-group { margin-top: 16px; }
.fp-preview .fp-group__title {
  margin: 0 0 8px;
  color: var(--fp-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.4;
  text-transform: uppercase;
}
[dir=rtl] .fp-preview .fp-group__title { letter-spacing: 0; }
.fp-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 8px; margin: 0; }
.fp-item.is-long, .fp-item.is-files, .fp-item.is-wide { grid-column: 1 / -1; }
.fp-item {
  position: relative;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--fp-soft);
  transition: background-color .2s, border-color .2s;
}
.fp-item dt { margin: 0 0 2px; padding-inline-end: 22px; color: var(--fp-muted); font-size: 12px; font-weight: 600; line-height: 1.4; }
.fp-item dd { margin: 0; color: var(--fp-navy); font-size: 14px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; }
.fp-item.is-long dd { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; font-weight: 500; }
.fp-item.is-empty dd { color: var(--fp-faint); font-weight: 500; }
.fp-item.is-missing { border-color: rgba(171, 26, 45, .14); background: #fff; }
.fp-item:not(.is-empty) { border-color: rgba(16, 185, 129, .22); background: #F3FBF7; }
.fp-item__tick {
  position: absolute;
  top: 10px;
  inset-inline-end: 12px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fp-ok-bright);
  color: #fff;
}
.fp-files { display: grid; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.fp-files li {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--fp-line);
  border-radius: 10px;
  background: #fff;
  font-weight: 600;
}
.fp-files li svg { color: var(--fp-muted); }
.fp-files__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-files small { color: var(--fp-faint); font-size: 12px; font-weight: 500; }
.fp-files__count { display: block; font-weight: 700; }
.fp-files__more { justify-content: center; color: var(--fp-muted); }

.fp-send {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  padding: 12px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--fp-red);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  box-shadow: 0 12px 24px -12px rgba(171, 26, 45, .6);
  cursor: pointer;
  transition: background-color .2s, transform .2s, box-shadow .2s;
}
.fp-send:hover,
.fp-send:focus-visible { background: var(--fp-red-dark); transform: translateY(-2px); box-shadow: 0 16px 28px -12px rgba(171, 26, 45, .65); }
.fp-send:focus-visible { outline: 3px solid rgba(171, 26, 45, .35); outline-offset: 2px; }
.fp-send:disabled { opacity: .7; cursor: progress; transform: none; }
[dir=rtl] .fp-flip { transform: scaleX(-1); }
.fp-note { display: flex; gap: 8px; margin: 12px 0 0; color: var(--fp-muted); font-size: 12px; line-height: 1.5; }
.fp-note svg { flex: none; margin-top: 2px; color: var(--fp-red); }

/* ---------------------------------------------------------------------------------------------------------------
 * Narrow: one column, the card first and folded, the form's own button sends.
 * Twice: by the page width, and by the room the form has (the member area's narrower content).
 * ------------------------------------------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
  .fp-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
}
@media (max-width: 991.98px) {
  .fp-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .fp-preview { position: static; order: -1; }
  .fp-card { max-height: none; padding: 18px; border-radius: 20px; }
  .fp-toggle { display: inline-flex; }
  .fp-body { display: none; margin: 0; padding: 0; overflow: visible; }
  .fp-preview.is-open .fp-body { display: block; }
  .fp-progress { margin-bottom: 0; }
  .fp-preview.is-open .fp-progress { margin-bottom: 16px; }
  .fp-send, .fp-note { display: none; }
}
@container (max-width: 820px) {
  .fp-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .fp-preview { position: static; order: -1; }
  .fp-card { max-height: none; padding: 18px; border-radius: 20px; }
  .fp-toggle { display: inline-flex; }
  .fp-body { display: none; margin: 0; padding: 0; overflow: visible; }
  .fp-preview.is-open .fp-body { display: block; }
  .fp-progress { margin-bottom: 0; }
  .fp-preview.is-open .fp-progress { margin-bottom: 16px; }
  .fp-send, .fp-note { display: none; }
}
@media (max-width: 575.98px) {
  .fp-list { grid-template-columns: minmax(0, 1fr); }
  .fp-wrap .fp-layout form.fp-form { padding: 22px 18px; border-radius: 20px; }
  .fp-wrap .fp-layout form.fp-form .row { --bs-gutter-x: 0; }
  .fp-wrap .fp-layout form.fp-form .row > * { margin-bottom: 16px; }
  .fp-wrap .fp-layout form.fp-form .row > .form-group { margin-bottom: 16px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .fp-live { animation: none; }
  .fp-progress__bar span, .fp-send, .fp-item { transition: none; }
}
