/* ============================================
   RETIREMENT CALCULATOR — PureTools
   All classes namespaced .rc-*
   ============================================ */

/* ===== Tab bar ===== */
.rc-tabs {
    display: flex;
    gap: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.3rem;
    margin-bottom: 1.5rem;
    width: fit-content;
}

.rc-tab-btn {
    padding: 0.65rem 1.25rem;
    min-height: 44px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 4px);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.rc-tab-btn:hover { color: var(--text); }

.rc-tab-btn.active {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 1px 4px rgba(var(--primary-rgb), 0.3);
}

/* ===== Layout ===== */
.rc-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 760px);
    gap: 1.5rem;
    align-items: start;
    max-width: 1200px;
}

/* ===== Input card ===== */
.rc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rc-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.25rem;
}

.rc-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.rc-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 0.15rem;
}

.rc-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 0.25rem;
}

.rc-calc-btn { flex: 1; min-width: 120px; min-height: 44px; }

.rc-copy-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 44px;
    padding: 0 1rem;
    font-size: 0.85rem;
}

.rc-error {
    font-size: 0.85rem;
    color: var(--danger);
    min-height: 1.2em;
    margin: 0;
}

/* ===== Panel / hidden ===== */
.rc-panel { animation: rc-fade 0.18s ease; }
.rc-hidden { display: none !important; }

@keyframes rc-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== Results column ===== */
.rc-results-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.rc-empty {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 8rem;
    padding: 1.75rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ===== Result card ===== */
.rc-result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.rc-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    gap: 0.75rem;
}

.rc-status-badge {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.3rem 0.75rem;
    border-radius: 2rem;
    white-space: nowrap;
}

.rc-status-badge--on-track   { background: rgba(16,185,129,.15); color: var(--success); }
.rc-status-badge--close      { background: rgba(245,158,11,.15);  color: var(--warning); }
.rc-status-badge--behind     { background: rgba(239,68,68,.15);   color: var(--danger); }
.rc-status-badge--sustainable { background: rgba(16,185,129,.15); color: var(--success); }
.rc-status-badge--monitor    { background: rgba(245,158,11,.15);  color: var(--warning); }
.rc-status-badge--risk       { background: rgba(239,68,68,.15);   color: var(--danger); }

.rc-readiness-pct {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

/* ===== Progress bar ===== */
.rc-progress-bar {
    height: 6px;
    background: var(--border);
    margin: 0 1.25rem 1rem;
    border-radius: 3px;
    overflow: hidden;
}

.rc-progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.4s ease;
    max-width: 100%;
}

/* ===== Metrics ===== */
.rc-metrics {
    padding: 0 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.rc-metric {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.rc-metric-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.35;
    flex: 1;
}

.rc-metric-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.rc-metric-value.rc-highlight {
    font-size: 1.2rem;
    color: var(--primary);
}

.rc-metric-value.rc-surplus { color: var(--success); }
.rc-metric-value.rc-deficit { color: var(--danger); }

.rc-separator {
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
    margin-top: 0.2rem;
}

/* ===== Breakdown table ===== */
.rc-breakdown {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.rc-breakdown h3 {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.9rem 1.25rem 0.5rem;
    margin: 0;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.rc-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rc-table,
.rc-scenario-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.rc-table th,
.rc-scenario-table th {
    padding: 0.55rem 0.85rem;
    text-align: right;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.rc-table th:first-child,
.rc-scenario-table th:first-child { text-align: left; }

.rc-table td,
.rc-scenario-table td {
    padding: 0.5rem 0.85rem;
    text-align: right;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.rc-table td:first-child,
.rc-scenario-table td:first-child { text-align: left; font-weight: 500; }

.rc-table tr:last-child td,
.rc-scenario-table tr:last-child td { border-bottom: none; }

.rc-table tr:hover td,
.rc-scenario-table tr:hover td { background: var(--bg); }

/* Scenario table assessment colors */
.rc-assess-good { color: var(--success); font-weight: 600; }
.rc-assess-warn { color: var(--warning); font-weight: 600; }
.rc-assess-risk { color: var(--danger);  font-weight: 600; }

/* Scenario section title */
.rc-scenario-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 1rem 1.25rem 0.5rem;
    color: var(--text);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .rc-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .rc-tabs { width: 100%; }
    .rc-tab-btn { flex: 1; text-align: center; padding: 0.65rem 0.5rem; }
    .rc-row-2 { grid-template-columns: 1fr; }
    .rc-actions { flex-direction: column; }
    .rc-calc-btn, .rc-copy-btn { width: 100%; justify-content: center; }
    .rc-readiness-pct { font-size: 1.4rem; }
}
