/**
 * WI Split Placement Support Calculator — styles.
 * All selectors scoped under .wi-sh-calc to avoid Divi collisions.
 * Conventions copied from wi-high-income-calculator.css (approved by user):
 * Divi neutralization, $ overlay, ::picker-icon hide, stacked-card table.
 * Split-specific: payer-row highlight, per-child rate line.
 * Specificity guards + !important on form controls: Divi ships aggressive
 * input/select styling on .et_pb_* pages; these overrides are intentional
 * and proven necessary (visual regression on dev, 2026-08-28).
 */

.wi-sh-calc {
  max-width: 720px;
  margin: 2em auto;
  padding: 1.75em;
  background: #fff;
  border: 1px solid #dfe3e6;
  border-radius: 8px;
  font-family: Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #293e4d;
  box-sizing: border-box;
}

.wi-sh-calc *,
.wi-sh-calc *::before,
.wi-sh-calc *::after {
  box-sizing: border-box;
}

.wi-sh-calc__title {
  margin-top: 0;
  font-family: 'Roboto Slab', Roboto, serif;
  color: #293e4d;
}

/* ---------- Fields: identical geometry for every control ---------- */

.wi-sh-calc__field {
  margin: 0 0 1.25em;
}

.wi-sh-calc__field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4em;
}

/* One shared control style: same width, height, border, radius.
   Divi resets neutralized via explicit properties + !important.
   NOTE: background-COLOR (not shorthand `background`) so the select's
   chevron background-image below isn't clobbered, and so Divi's own
   select background-image (its double-caret) stays overridden. */
.wi-sh-calc__field input,
.wi-sh-calc__field select {
  display: block !important;
  width: 100% !important;
  height: 48px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border: 1px solid #c9c9c9 !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: #222 !important;
  font-family: inherit !important;
  font-size: 1em !important;
  line-height: 46px !important;
  box-shadow: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: textfield !important;
}

/* Custom chevron for selects — drawn AFTER the background reset above.
   `background` shorthand (not background-color) fully clears any Divi
   select background-image (the source of the double-caret bug). */
.wi-sh-calc__field select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23555' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-color: #fff !important;
  padding-right: 36px !important;
}

/* Chrome 135+ renders the native select arrow as a ::picker-icon
   pseudo-element that appearance:none no longer hides — it stacked on
   top of our custom chevron (user-visible double caret). Hide it. */
.wi-sh-calc__field select::picker-icon {
  display: none !important;
}

/* Legacy Edge/IE select arrow */
.wi-sh-calc__field select::-ms-expand {
  display: none !important;
}

.wi-sh-calc__field input:focus,
.wi-sh-calc__field select:focus {
  outline: none !important;
  border-color: #0071e3 !important;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15) !important;
}

.wi-sh-calc__field input::placeholder {
  color: #9a9a9a;
  opacity: 1;
}

/* ---------- Currency fields: $ overlaid INSIDE the input ----------
   No attached prefix component = no seams, no height mismatch, no
   width difference. The input spans the full row exactly like a select;
   the symbol is absolutely positioned over the padding area. */
.wi-sh-calc__money {
  position: relative;
  display: block;
}

.wi-sh-calc__symbol {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  font-size: 1em;
  color: #9a9a9a;
  pointer-events: none;
  line-height: 1;
}

.wi-sh-calc__money input {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-left: 28px !important;
}

/* ---------- Required / optional markers ---------- */

.wi-sh-calc__required {
  color: #c0392b;
  font-weight: 700;
}

.wi-sh-calc__legend {
  font-size: 0.88em;
  color: #555;
  margin: 0.25em 0 1.25em;
}

.wi-sh-calc__hint {
  font-size: 0.88em;
  color: #576f81;
  margin: 0.45em 0 0;
  line-height: 1.45;
}

.wi-sh-calc__optional {
  font-weight: 400;
  color: #777;
}

/* ---------- Submit ---------- */

.wi-sh-calc__submit {
  display: inline-block !important;
  width: auto !important;
  height: auto !important;
  background: #0071e3 !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: 6px !important;
  padding: 0.75em 1.6em !important;
  font-family: Roboto, Arial, sans-serif !important;
  font-size: 1em !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  cursor: pointer;
  box-shadow: none !important;
}

.wi-sh-calc__submit:hover,
.wi-sh-calc__submit:focus {
  background: #005bbf !important;
}

.wi-sh-calc__submit:focus {
  outline: 2px solid #0071e3;
  outline-offset: 2px;
}

/* ---------- Result area ---------- */

.wi-sh-calc__result {
  margin-top: 1em;
}

.wi-sh-calc__error {
  background: #fdecea;
  border-left: 4px solid #c0392b;
  padding: 0.8em 1em;
  border-radius: 4px;
  margin: 1em 0;
}

.wi-sh-calc__warning {
  background: #fff8e1;
  border: 1px solid #f0c36d;
  border-radius: 6px;
  padding: 1em 1.25em;
  margin: 1em 0;
}

.wi-sh-calc__basis {
  background: #eef4fb;
  border-left: 4px solid #0071e3;
  padding: 0.6em 1em;
  border-radius: 4px;
  margin: 0 0 1em;
}

.wi-sh-calc__table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

.wi-sh-calc__table-title {
  font-weight: 700;
  font-size: 1.05em;
  margin: 0 0 0.5em;
  line-height: 1.4;
}

.wi-sh-calc__table th,
.wi-sh-calc__table td {
  border: 1px solid #dcdcdc;
  /* !important: Divi .entry-content tr td (6px 24px, higher specificity)
     overrides em padding and squeezes columns into wrapping */
  padding: 0.5em 0.6em !important;
  text-align: left;
}

.wi-sh-calc__table thead th {
  white-space: nowrap;
  background: #f5f5f5;
}

.wi-sh-calc__table tfoot th,
.wi-sh-calc__table tfoot td {
  font-weight: 700;
  background: #f9f9f9;
}

.wi-sh-calc__source {
  font-size: 0.9em;
  color: #555;
  margin-top: 1em;
}

.wi-sh-calc__route-link {
  display: inline-block;
  margin-top: 0.5em;
  font-weight: 600;
  /* styled as a link (it's a <button> that opens the consult modal) */
  background: none;
  border: none;
  padding: 0;
  color: #0071e3;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
}
.wi-sh-calc__route-link:hover {
  color: #293e4d;
}

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  .wi-sh-calc {
    padding: 1.1em;
  }
}

/* ---------- Results table on mobile ----------
   Standard responsive-table pattern: each row becomes a stacked
   card. Column headers hide; every cell shows its data-label as an
   inline caption. Table headers (scope=row) act as the card title. */
@media (max-width: 768px) {
  .wi-sh-calc__table,
  .wi-sh-calc__table tbody,
  .wi-sh-calc__table tr,
  .wi-sh-calc__table th,
  .wi-sh-calc__table td {
    display: block;
    width: 100%;
  }

  .wi-sh-calc__table {
    border: 0;
  }

  .wi-sh-calc__table thead {
    /* Visually hidden but kept for screen readers */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .wi-sh-calc__table-title {
    font-size: 1.05em;
    margin-bottom: 0.6em;
  }

  .wi-sh-calc__table tr {
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    margin-bottom: 0.75em;
    padding: 0.25em 0;
    background: #fff;
  }

  .wi-sh-calc__table tbody th {
    background: #f5f5f5;
    font-weight: 700;
    padding: 0.55em 0.75em;
    border-bottom: 1px solid #dcdcdc;
  }

  .wi-sh-calc__table td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
    padding: 0.45em 0.75em;
    border: 0;
  }

  .wi-sh-calc__table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #576f81;
    text-align: left;
  }

  .wi-sh-calc__table td {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  /* Totals: label + value on one line (flex row) */
  .wi-sh-calc__table tfoot tr {
    display: flex;
    align-items: baseline;
    gap: 0.75em;
    border: 0;
    border-top: 1px solid #dcdcdc;
    border-radius: 0;
    margin-bottom: 0;
  }
  .wi-sh-calc__table tfoot th,
  .wi-sh-calc__table tfoot td {
    width: auto !important;
    border: 0;
    background: transparent !important;
  }
  .wi-sh-calc__table tfoot th {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.45em 0.5em;
    text-align: left;
  }
  .wi-sh-calc__table tfoot td {
    flex: 0 0 auto;
    min-width: 0;
    padding: 0.45em 0.5em 0.55em;
    text-align: right;
    white-space: nowrap;
  }
  .wi-sh-calc__table tfoot th[colspan] {
    border-bottom: 0;
    padding-bottom: 0.1em;
  }
}
/* ---------- Shared-placement specifics ---------- */

.wi-sh-calc__days-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75em;
  /* Both columns share the same shape (label + input + hint), so the
     inputs land on the same line. align-items:start prevents the grid
     from stretching either column to match the other's hint height. */
  align-items: start;
}

.wi-sh-calc__days-note {
  font-size: 0.88em;
  color: #576f81;
  margin: 0.45em 0 0;
  line-height: 1.45;
}

/* Sub-labels inside the days row: smaller than field labels so the
   parent-level label stays dominant; fixed height keeps both columns'
   inputs on the same line even if one label wraps. */
.wi-sh-calc__days-label {
  display: block;
  font-weight: 600;
  font-size: 0.9em;
  margin-bottom: 0.3em;
  height: 2.7em;          /* fixed: two-line budget so both columns match */
  line-height: 1.35;
  overflow: hidden;
}

.wi-sh-calc__placement-badges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75em;
  margin: 0.75em 0 1em;
}

/* Parent labels pair: two side-by-side inputs with the same 0.75em gap
   used across the form. (Was missing entirely — inputs stacked with
   borders touching.) */
.wi-sh-calc__field--labels .wi-sh-calc__label-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75em;
}

@media (max-width: 480px) {
  .wi-sh-calc__field--labels .wi-sh-calc__label-pair {
    grid-template-columns: 1fr;
    row-gap: 0.75em;
  }
}

.wi-sh-calc__placement-badge {
  background: #eef4fb;
  border: 1px solid #c7ddf5;
  border-radius: 6px;
  padding: 0.6em 0.8em;
  text-align: center;
}

.wi-sh-calc__placement-badge .wi-sh-calc__badge-name {
  font-weight: 600;
  font-size: 0.9em;
  color: #576f81;
  display: block;
}

.wi-sh-calc__placement-badge .wi-sh-calc__badge-value {
  font-weight: 700;
  color: #293e4d;
  font-size: 1.05em;
  font-variant-numeric: tabular-nums;
}

.wi-sh-calc__payer-row th,
.wi-sh-calc__payer-row td {
  background: #eef7ee !important;
}

.wi-sh-calc__payer-line {
  margin: 0.75em 0 0;
  font-size: 1.02em;
}

.wi-sh-calc__variable-note {
  background: #fff8e1;
  border: 1px solid #f0c36d;
  border-radius: 6px;
  padding: 0.6em 1em;
  margin: 1em 0 0;
  font-size: 0.92em;
}

@media (max-width: 480px) {
  .wi-sh-calc__days-row,
  .wi-sh-calc__placement-badges {
    grid-template-columns: 1fr;
  }
}
