/* Custom styles for the Rent vs. Delayed Buy Calculator */
body {
    margin: 0;
    padding: 0;
}

/* Smooth transitions for interactive elements */
button, input {
    transition: all 0.2s ease-in-out;
}

/* Disabled inputs should read as inert rather than merely unfocused */
input:disabled, select:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Table striping for the detailed results by purchase delay B */
#results-body tr:hover {
    background-color: #f9fafb;
}

canvas {
    max-width: 100%;
}

/* ---- Wealth-chart series controls (the tick-box tree beside the chart) ---- */
.series-controls {
    /* Fills whatever the title row leaves, so this panel ends level with the
       chart beside it. The max-height only bites when the columns stack and the
       parent has no fixed height of its own. */
    flex: 1 1 auto;
    min-height: 0;
    max-height: 34rem;
    overflow-y: auto;
    padding: 0.5rem 0.75rem 0.5rem 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #fcfdff;
}

.series-section + .series-section {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid #eef2f7;
}

.series-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.series-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
}

.series-section-note {
    margin: 0.15rem 0 0.25rem 1.6rem;
    font-size: 0.7rem;
    color: #6b7280;
    line-height: 1.35;
}

/* One row per plottable line: tick box, colour swatch, name. */
.series-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
    padding: 0.15rem 0.25rem;
    border-radius: 0.35rem;
    cursor: pointer;
}

.series-row:hover {
    background: #f1f5f9;
}

.series-swatch {
    flex: none;
    width: 18px;
    height: 3px;
    border-radius: 2px;
}

.series-label {
    font-size: 0.72rem;
    color: #374151;
    line-height: 1.3;
}

/* A line that means nothing under the current strategy, e.g. a fixed deposit
   when the ETF-only strategy is selected. */
.series-row-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.series-row-disabled:hover {
    background: transparent;
}

/* The row whose line is under the pointer, or whose row is being hovered.
   Set from both directions: see the hover wiring in app.js. */
.series-row-active {
    background: #e0f2fe;
    box-shadow: inset 2px 0 0 #0284c7;
}

/* Colour only. A weight change would re-measure the text and push long labels
   onto a second line as the pointer moves, so the highlight must never touch
   any property that affects layout. */
.series-row-active .series-label {
    color: #0c4a6e;
}

/* ---- What the focused chart is and how it is worked out ------------------ */
/* Filled in from either hover direction; see setActive in series-controls.js.
   min-height is set from the tallest description measured down to a 900px
   viewport, so swapping between descriptions never resizes the panel and the
   heatmap below it does not shift. Re-measure if the wording grows. */
.series-description {
    margin-top: 0.75rem;
    padding: 0.7rem 0.85rem;
    min-height: 8rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #f8fafc;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #334155;
}

.series-description strong {
    color: #0f172a;
}

.series-description-body {
    display: block;
    margin-top: 0.2rem;
}

.series-description-swatch {
    vertical-align: middle;
    margin-right: 0.5rem;
}

.series-description-hint {
    color: #64748b;
    font-style: italic;
}

/* The headline answer at the top of the Analysis section. Plain CSS rather than
   utility classes, because the colour state is switched from JavaScript. */
.verdict {
  margin-bottom: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  text-align: center;
}

.verdict-headline {
  font-size: 1.5rem;
  line-height: 1.9rem;
  font-weight: 800;
}

.verdict-detail {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
}

/* Buying wins. */
.verdict-buy {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.verdict-buy .verdict-headline {
  color: #065f46;
}

.verdict-buy .verdict-detail {
  color: #047857;
}

/* Renting wins at every month. */
.verdict-rent {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.verdict-rent .verdict-headline {
  color: #334155;
}

.verdict-rent .verdict-detail {
  color: #475569;
}

/* Save/load/delete controls beside the Inputs title. Quiet by design: they only
   appear once there is something to save or something saved, and they borrow the
   same small grey button look as the chart's Plot all / Plot none. */
.saved-inputs {
  display: none;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.saved-inputs.is-visible {
  display: flex;
}

.saved-input-button,
.saved-input-load,
.saved-input-remove {
  font-size: 0.75rem;
  line-height: 1rem;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  cursor: pointer;
}

.saved-input-button {
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
}

.saved-input-button:hover,
.saved-input-load:hover,
.saved-input-remove:hover {
  background: #e5e7eb;
}

/* A saved set: its timestamp loads it, the x deletes it. */
.saved-input-chip {
  display: inline-flex;
  align-items: stretch;
}

.saved-input-load {
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem 0 0 0.375rem;
  border-right: none;
  font-variant-numeric: tabular-nums;
}

.saved-input-remove {
  padding: 0.25rem 0.4rem;
  border-radius: 0 0.375rem 0.375rem 0;
  color: #6b7280;
  font-size: 0.8125rem;
  line-height: 1rem;
}

.saved-input-remove:hover {
  color: #b91c1c;
}

/* Collapsible subsection: the default triangle is replaced by one that matches
   the page's own greys, and the summary carries the current setting so the
   section can stay shut without hiding what it is set to. */
.collapsible-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.collapsible-summary::-webkit-details-marker {
  display: none;
}

.collapsible-summary::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 5px solid #64748b;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}

details[open] > .collapsible-summary::before {
  transform: rotate(90deg);
}

.collapsible-state {
  font-weight: 400;
  font-size: 0.75rem;
  color: #6b7280;
}

details[open] > .collapsible-summary .collapsible-state {
  display: none;
}

/* The verdict when the numbers cannot support the scenario: neither a
   recommendation nor a defeat, so neither green nor grey. */
.verdict-warn {
  background: #fffbeb;
  border-color: #fcd34d;
}

.verdict-warn .verdict-headline {
  color: #92400e;
}

.verdict-warn .verdict-detail {
  color: #b45309;
}
