/* =============================================================
   Cost Effectiveness Tool – design polish layer
   Overrides / extends popsim.css for the cost-calculator pages
   ============================================================= */

/* --- Override fs-toc_sidebar when it contains ce-sidebar --- */
.fs-toc_sidebar:has(.ce-sidebar) {
  padding-top: 0;
}

/* --- Sidebar back button --- */
.ce-sidebar-back {
  padding-bottom: 0.75rem;
}

.ce-sidebar-back .btn-small {
  width: auto;
  display: inline-block;
}

/* --- Step sidebar navigation --- */
.ce-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ce-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--stroke);
  cursor: pointer;
  text-decoration: none;
  color: var(--unc-black);
  transition: background-color 0.15s;
}

.ce-step:last-child {
  border-bottom: 1px solid var(--stroke);
}

.ce-step:hover {
  background-color: rgba(123, 175, 212, 0.06);
}

.ce-step.is-active {
  background-color: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
}

.ce-step-info {
  flex: 1;
  min-width: 0;
}

.ce-step-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 0.125rem;
}

.ce-step-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--unc-black);
}

.ce-step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  flex-shrink: 0;
}

.ce-step-circle {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid #d1d5db;
}

.ce-step-check {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--unc-black);
}

/* Locked / future steps */
.ce-step.is-locked {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* Hidden step sections */
.ce-section-hidden {
  display: none;
}

/* --- Page content area --- */
.ce-content {
  flex: 1;
  min-width: 0;
  max-width: 53rem;
}

.ce-content .results_section {
  width: 100%;
}

/* --- Section headings (DM Serif Display) --- */
.ce-content .results_section > .text-rich-text h1,
.ce-content > .text-rich-text h1 {
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: 2.5rem;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}

.ce-content .results_section > .text-rich-text > p:first-of-type,
.ce-content > .text-rich-text > p:first-of-type {
  color: #4b5563;
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0;
}

/* --- Note bar --- */
.ce-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: rgba(123, 175, 212, 0.06);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: #4b5563;
  line-height: 1.5;
  margin-top: 0.5rem;
}

.ce-note-icon {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  color: #6b7280;
  margin-top: 0.125rem;
}

/* --- Input rows polish --- */
.ce-content .tool_row {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--stroke);
  margin: 0;
  gap: 2rem;
}

.ce-content .tool_row:first-child {
  padding-top: 0;
}

.ce-content .tool_rows-wrapper {
  gap: 0;
}

/* Input boxes — Figma-matched: navy border, bold text, edit icon */
.ce-content .tool_input-wrapper {
  width: auto;
  min-width: 10rem;
  gap: 0;
  border: 2px solid var(--unc-navy);
  border-radius: 10px;
  background: var(--white);
  padding: 0.75rem 1rem;
  align-items: center;
}

.ce-content .tool_input-box {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--unc-black);
  width: 6rem;
  text-align: left;
  transition: none;
}

.ce-content .tool_input-box:focus {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.ce-content .tool_input-box::placeholder {
  color: var(--unc-black);
  font-weight: 600;
}

.ce-content .tool_input-box.is-percent {
  width: 3rem;
}

.ce-content .tool_input-wrapper > div:first-child {
  font-weight: 600;
  color: var(--unc-black);
  font-size: 1.25rem;
  margin-right: 0.125rem;
}

.ce-content .tool_input-wrapper.is-percent > div:nth-child(2) {
  font-weight: 600;
  color: var(--unc-black);
  font-size: 1.25rem;
  margin-left: 0.125rem;
  order: 0;
}

/* Edit icon */
.ce-edit-icon {
  width: 1.125rem;
  height: 1.125rem;
  color: #9ca3af;
  flex-shrink: 0;
  margin-left: auto;
  cursor: pointer;
  transition: color 0.15s;
}

.ce-edit-icon:hover {
  color: var(--unc-navy);
}

/* --- Insurance section row --- */
.ce-insurance-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--stroke);
}

.ce-insurance-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ce-insurance-item label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--unc-black);
}

.ce-insurance-item .tool_input-wrapper {
  min-width: 0;
  width: 100%;
}

/* --- Results callout box (Step 1 bottom) --- */
.ce-content .tool_3results-wrapper {
  border: 1px solid #cbdae4;
  background: var(--white);
  border-radius: 12px;
  padding: 2rem;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.ce-content .tool_3results-wrapper > div:first-child {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--unc-black);
}

.ce-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.ce-results-grid .tool_3results-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 1.5rem;
  border-left: 1px solid #cbdae4;
}

.ce-results-grid .tool_3results-item:first-child {
  border-left: none;
  padding-left: 0;
}

.ce-content .tool_3results-result {
  font-family: "DM Serif Display", serif;
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1;
  color: var(--unc-navy);
  font-style: italic;
}

.ce-content .tool_3results-item em {
  font-size: 0.8125rem;
  color: #6b7280;
  font-style: normal;
  line-height: 1.45;
}

/* --- Error wrapper --- */
.ce-content .tool_error-wrapper {
  border-radius: 8px;
  font-size: 0.8125rem;
  padding: 0.75rem 1rem;
}

/* --- Section explanation text --- */
.ce-content .tool_rows-wrapper > div:not(.tool_row):not(.tool_3results-wrapper):not(.tool_error-wrapper):not(.accordion1_component):not(.ce-insurance-grid):not(.ce-results-grid) {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--unc-black);
  padding-top: 1.25rem;
  border-bottom: none;
}

/* --- Dropdown selects (Step 3) --- */
.ce-content .tools_dropdown-wrapper {
  gap: 2rem;
}

.ce-content .tools_dropdown-content {
  gap: 0.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--stroke);
}

.ce-content .tools_dropdown-content:last-child {
  border-bottom: none;
}

.ce-content .tools_dropdown-content strong {
  font-size: 0.9375rem;
}

/* Custom select polish */
.ce-content .fs-select_toggle-1 {
  background-color: var(--white);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 0.875rem 3rem 0.875rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--unc-black);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ce-content .fs-select_toggle-1:hover {
  border-color: var(--unc-blue);
}

.ce-content .fs-select_toggle-1:focus {
  border-color: var(--unc-blue);
  box-shadow: 0 0 0 2px rgba(123, 175, 212, 0.25);
}

.ce-content .fs-select_list-1.w--open {
  background-color: var(--white);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  margin-top: 0.375rem;
  overflow: hidden;
}

.ce-content .fs-select_link-1 {
  background-color: var(--white);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  color: var(--unc-black);
  border-bottom: 1px solid var(--stroke);
  transition: background-color 0.1s;
}

.ce-content .fs-select_link-1:last-child {
  border-bottom: none;
}

.ce-content .fs-select_link-1:hover {
  opacity: 1;
  background-color: rgba(123, 175, 212, 0.06);
}

.ce-content .fs-select_link-1.w--current {
  background-color: rgba(123, 175, 212, 0.08);
  color: var(--unc-navy);
  font-weight: 500;
}

/* --- Step navigation buttons (bottom) --- */
.ce-nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  /* Parent .results_section already provides 2rem flex gap */
}

.ce-btn-back {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--unc-black);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0;
  text-decoration: none;
  transition: color 0.15s;
}

.ce-btn-back:hover {
  color: var(--unc-blue);
}

.ce-btn-continue {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--white);
  background-color: var(--unc-blue);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0.875rem 1.5rem;
  text-decoration: none;
  transition: background-color 0.15s;
}

.ce-btn-continue:hover {
  background-color: var(--unc-navy);
}

/* --- Tab pill container (Step 4) --- */
.ce-tab-container {
  display: inline-flex;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
}

.ce-tab {
  padding: 0.625rem 1.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--unc-black);
  background: var(--white);
  border: none;
  border-right: 1px solid var(--stroke);
  cursor: pointer;
  transition: all 0.15s;
}

.ce-tab:last-child {
  border-right: none;
}

.ce-tab:hover:not(.is-active) {
  background-color: rgba(123, 175, 212, 0.06);
}

.ce-tab.is-active {
  background-color: var(--unc-navy);
  color: var(--white);
}

/* --- Results card (Step 4) --- */
.ce-results-card {
  border: 1px dashed var(--stroke);
  border-radius: 10px;
  padding: 2rem;
  background: var(--white);
}

.ce-results-card h2 {
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: 1.75rem;
  margin: 0 0 0.75rem;
}

.ce-results-card p {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #4b5563;
  margin: 0 0 0.75rem;
}

.ce-results-card .ce-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--unc-black);
}

.ce-legend-dot {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  margin-right: 0.375rem;
  vertical-align: middle;
}

.ce-legend-dot.is-orange { background-color: #f97316; }
.ce-legend-dot.is-plum { background-color: #9333ea; }

/* --- Results table inside card --- */
.ce-results-card .results-tab-wrapper {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow: hidden;
  background: var(--white);
  padding: 0;
}

.ce-results-card .table {
  width: 100%;
}

.ce-results-card .table_row {
  border-top: 1px solid var(--stroke);
}

.ce-results-card .table_row:first-child {
  border-top: none;
  background: rgba(123, 175, 212, 0.06);
}

.ce-results-card .table_column {
  padding: 1rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

.ce-results-card .table_column.is-col1 {
  background-color: transparent;
  font-weight: 700;
  color: #f97316;
  text-align: right;
}

.ce-results-card .table_column.is-row1 {
  background-color: transparent;
  font-weight: 700;
  color: #9333ea;
  text-align: center;
}

.ce-results-card .table_row:first-child .table_column.is-col1 {
  color: transparent;
}

/* --- Copy link button --- */
.ce-copy-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--unc-black);
  cursor: pointer;
  background: var(--white);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  transition: border-color 0.15s, color 0.15s;
}

.ce-copy-link:hover {
  border-color: var(--unc-blue);
  color: var(--unc-blue);
}

/* --- Hide original form submit button (replaced by NavButtons) --- */
.ce-content .tool_bottom-btns-wrapper {
  display: none;
}

/* --- Accordion polish --- */
.ce-content .accordion1_component.is-calculator {
  margin-top: 0.5rem;
  max-width: 100%;
  overflow: hidden;
}

.ce-content .accordion1_component.is-calculator .accordion1_top {
  align-items: flex-start;
}

.ce-content .accordion1_component.is-calculator .accordion1_bottom {
  max-width: 100%;
  overflow: hidden;
}

.ce-content .accordion1_component.is-calculator img {
  max-width: 100%;
  height: auto;
}

.ce-content .accordion1_component.is-calculator .content-stack-sm {
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* --- Overview page sidebar --- */
.ce-overview-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 7rem;
  flex-shrink: 0;
  width: 17rem;
}

/* --- Overview page: rich text polish --- */
.ce-content .text-rich-text h2 {
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.ce-content .text-rich-text p {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #4b5563;
}

.ce-content .text-rich-text ul {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #4b5563;
}

/* --- Responsive --- */

/* Tablet: sidebar stacks above content */
@media (max-width: 991px) {
  /* Override popsim.css display:none on sidebar */
  .fs-toc_sidebar:has(.ce-sidebar) {
    display: flex !important;
    position: static;
    width: 100%;
    padding-top: 0;
    padding-bottom: 0;
  }

  .ce-sidebar,
  .ce-overview-sidebar {
    position: static;
    width: 100%;
  }

  /* Sidebar becomes a horizontal strip */
  .ce-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
    border: 1px solid var(--stroke);
    border-radius: 10px;
    overflow: hidden;
  }

  .ce-step {
    flex: 1 1 auto;
    min-width: 0;
    border-top: none;
    border-right: 1px solid var(--stroke);
    padding: 0.625rem 0.75rem;
  }

  .ce-step:last-child {
    border-bottom: none;
    border-right: none;
  }

  .ce-step-label {
    font-size: 0.5625rem;
  }

  .ce-step-title {
    font-size: 0.75rem;
  }

  .ce-step-icon {
    width: 1rem;
    height: 1rem;
  }

  .ce-step-circle {
    width: 1rem;
    height: 1rem;
  }

  .ce-step-check {
    width: 1rem;
    height: 1rem;
  }

  .fs-toc_example {
    flex-direction: column;
    gap: 2rem;
  }

  .ce-content {
    max-width: 100%;
  }

  .ce-content .results_section {
    width: 100%;
  }

  .ce-insurance-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .ce-results-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .ce-results-grid .tool_3results-item {
    border-left: none;
    padding: 0;
    border-top: 1px solid #cbdae4;
    padding-top: 1.25rem;
  }

  .ce-results-grid .tool_3results-item:first-child {
    border-top: none;
    padding-top: 0;
  }

  /* Results table: horizontal scroll */
  .ce-content .results-tab-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ce-content .table {
    min-width: 28rem;
  }

  /* Tab buttons wrap */
  .ce-content .w-tab-menu {
    flex-wrap: wrap;
  }
}

/* Small tablet / large phone */
@media (max-width: 767px) {
  .ce-content .results_section > .text-rich-text h1,
  .ce-content > .text-rich-text h1 {
    font-size: 2rem;
  }

  .ce-content .tool_row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .ce-nav-buttons {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .ce-btn-continue {
    justify-content: center;
  }

  .ce-btn-back {
    justify-content: center;
  }

  /* Sidebar: stack vertically on small screens */
  .ce-sidebar {
    flex-direction: column;
  }

  .ce-step {
    border-right: none;
    border-top: 1px solid var(--stroke);
  }

  .ce-step:last-child {
    border-bottom: 1px solid var(--stroke);
  }

  .ce-step-title {
    font-size: 0.8125rem;
  }

  /* Tool results calculated values */
  .ce-content .tool_3results-wrapper {
    padding: 1rem;
  }

  .ce-content .tool_3results-result {
    font-size: 1.5rem;
  }
}

/* Mobile */
@media (max-width: 479px) {
  .ce-content .results_section > .text-rich-text h1,
  .ce-content > .text-rich-text h1 {
    font-size: 1.75rem;
  }

  .ce-content .text-rich-text h2 {
    font-size: 1.25rem;
  }

  .ce-content .tool_input-wrapper {
    min-width: 6rem;
  }

  .ce-content .tool_input-box {
    width: 5.5rem;
  }

  .ce-note {
    font-size: 0.75rem;
  }
}
