/* Investment Path – results
   Alerts, stat cards, charts, and the empty/loading/toast states.
   ========================================================================== */

/* ---------- Alerts ---------- */

/* Saved configurations menu */
.configs-anchor { position: relative; }
.configs-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 40;
    width: 290px;
    padding: 10px;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg, 0 16px 40px rgba(0, 0, 0, 0.35));
}
.configs-save { display: flex; gap: 6px; margin-bottom: 8px; }
.configs-save input {
    flex: 1;
    padding: 8px 10px;
    font-size: 12.5px;
}
.configs-save .ghost-btn { flex: none; }
.configs-list { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.configs-empty { font-size: 12px; color: var(--text-faint); padding: 4px 2px 2px; }

/* Nearby-plan menu. Keep it beside the pin action so the result remains the
   anchor for both deliberate comparison and quick what-ifs. */
.what-if-anchor { position: relative; }
.what-if-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    width: 250px;
    padding: 6px;
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg, 0 16px 40px rgba(0, 0, 0, 0.35));
}
.what-if-menu button {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
    .what-if-menu button:hover {
        background: var(--surface-hover);
        color: var(--text);
    }
}
.what-if-menu button:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: -2px;
}
.what-if-menu button:disabled {
    cursor: wait;
    opacity: 0.55;
}
.config-item {
    display: flex;
    align-items: center;
    gap: 4px;
    border-top: 1px dashed var(--border);
    padding: 2px 0;
}
.config-load {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 7px 8px;
    border: none;
    background: none;
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}
.config-load:hover { background: var(--surface-alt); }
.config-name {
    font-size: 12.5px;
    font-weight: 600;
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.config-meta { font-size: 10.5px; color: var(--text-faint); }

.alerts:empty { display: none; }
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.alerts-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-dim);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.alerts-toggle:hover { border-color: var(--border-strong); }
.alerts-toggle .alerts-hint {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-faint);
}
.alerts-toggle .chevron { flex: none; }
.alerts-toggle[aria-expanded="true"] .chevron { transform: rotate(225deg); }
.alerts-list { display: flex; flex-direction: column; gap: 8px; }

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    line-height: 1.5;
    border: 1px solid;
    animation: fadeUp 0.4s ease both;
}
.alert-warning { background: var(--amber-soft); border-color: rgba(251, 191, 36, 0.4); color: var(--amber); }
.alert-error   { background: var(--red-soft); border-color: rgba(248, 113, 113, 0.4); color: var(--red); }
.alert-info    { background: var(--accent-soft); border-color: rgba(99, 102, 241, 0.35); color: var(--text-dim); }

/* ---------- Results ---------- */

.results { display: flex; flex-direction: column; gap: 14px; }
.results.updating { opacity: 0.45; pointer-events: none; }
.results { transition: opacity 0.25s; }

.results > * { animation: fadeUp 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.results > *:nth-child(2) { animation-delay: 0.06s; }
.results > *:nth-child(3) { animation-delay: 0.12s; }
.results > *:nth-child(4) { animation-delay: 0.18s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Hero */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--border);
    background:
        radial-gradient(500px 220px at 0% 0%, var(--accent-soft), transparent 70%),
        color-mix(in srgb, var(--surface-solid) 88%, transparent);
    min-height: 164px;
    padding: 29px 31px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}
.hero-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--text-dim);
    margin-bottom: 6px;
}
.hero-value {
    font-size: clamp(43px, 5vw, 58px);
    font-weight: 780;
    letter-spacing: -0.045em;
    line-height: 1.05;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: 13px; color: var(--text-dim); margin-top: 8px; }
.hero-side { text-align: right; }
.hero-side .mini-label { font-size: 11px; color: var(--text-faint); font-weight: 600; }
.hero-side .mini-value { font-size: 19px; font-weight: 700; }

/* Plain-language reading of the headline result. The narrow accent rule ties
   it to the hero without making explanatory copy compete with the number. */
.result-explanation {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
    padding: 16px 19px 16px 22px;
}

.result-explanation::before {
    content: '';
    position: absolute;
    inset-block: 14px;
    inset-inline-start: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--gradient);
}

.result-explanation h2 {
    margin: 0 0 6px;
    color: var(--accent-2-text);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.result-explanation p {
    max-width: 86ch;
    margin: 0;
    color: var(--text-dim);
    font-size: 13.5px;
    line-height: 1.58;
}

.result-explanation p + p { margin-top: 5px; }

/* The phone-only result bar. Desktop keeps the sidebar and the results in two
   independently scrolling panes, so the chart is already beside the controls
   and this would be noise; below 900px the layout stacks and it is the only
   way to see the number react while editing. Shown by 08-responsive.css. */
.result-peek { display: none; }

/* Past dashboard (imported transactions) */
.section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-faint);
    margin: 6px 2px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
#historySection { display: flex; flex-direction: column; gap: 16px; }
#historySection[hidden] { display: none; }
.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.dash-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 15px;
    transition: transform 0.2s, border-color 0.2s;
}
.dash-stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.dash-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    margin-bottom: 5px;
}
.dash-value { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.dash-accent .dash-value { color: #9b93ff; }
.dash-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }
.dash-sub.up { color: var(--green); }
.dash-sub.down { color: var(--red); }

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 13px;
}
.card {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 48%),
        color-mix(in srgb, var(--surface-solid) 85%, transparent);
    border: 1px solid var(--border);
    min-height: 126px;
    border-radius: 18px;
    padding: 18px 19px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
}
.card-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    margin-bottom: 7px;
}
.card-value { font-size: 24px; font-weight: 740; letter-spacing: -0.025em; }
.card-value-sm { font-size: 16.5px; line-height: 1.4; }
.card-sub { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

.card-green .card-value { color: var(--green); }
.card-red .card-value { color: var(--red); }
.card-amber .card-value { color: var(--amber); }
.card-cyan .card-value { color: var(--accent-2-text); }
.card-accent .card-value { color: #9b93ff; }

.card-danger { border-color: rgba(248, 113, 113, 0.5); background: var(--red-soft); }
.card-danger .card-label { color: var(--red); }

/* "How is this calculated" */
.fx-btn {
    margin-left: auto;
    padding: 1px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--text-faint);
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 10.5px;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.fx-btn:hover, .fx-btn.active {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--surface-hover);
}

.card-math .reveal-body { min-width: 0; }
.card-math.open .reveal-body {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px dashed var(--border);
}
.mline {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    line-height: 1.8;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}
.mline span:last-child { text-align: right; }
.mline b { color: var(--text-dim); font-weight: 650; }
.mline sup { font-size: 8.5px; }

/* ---------- Charts ---------- */

.chart-card {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 42%),
        color-mix(in srgb, var(--surface-solid) 85%, transparent);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 20px 21px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}
.chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.chart-head h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 7px;
}
.chart-hint { font-size: 10.5px; color: var(--text-faint); }

.chart-wrap { position: relative; height: 230px; }
.chart-wrap-lg { height: 320px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.projection-data {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.projection-data summary {
    padding: 12px 16px;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.projection-data-wrap {
    max-height: 420px;
    overflow: auto;
    border-top: 1px solid var(--border);
}
.projection-data table { width: 100%; border-collapse: collapse; }
.projection-data th,
.projection-data td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    text-align: right;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.projection-data th:first-child { text-align: left; }
.projection-data thead th {
    position: sticky;
    top: 0;
    background: var(--surface-solid);
    color: var(--text-dim);
}

/* ---------- Empty / loading state ---------- */

.empty-state {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 14px;
}
.empty-icon { font-size: 44px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%) translateY(70px);
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 11px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.3s;
    z-index: 100;
    pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
