/* ── Investment Calculator Specific Styles ─────────────────────────────
   Styles specific to the investment/retirement optimizer.
   Loaded after shared/styles.css for overrides and additions.
   ──────────────────────────────────────────────────────────────────── */

/* ── Raise Input Row ──────────────────────────────────────────────── */

.raise-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.raise-toggle {
    display: flex !important;
    align-items: center;
    margin-bottom: 0 !important;
    white-space: nowrap;
    font-size: 0.9rem;
    cursor: pointer;
}

.raise-input {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.raise-input input[type="number"] {
    width: 50px;
    min-width: 50px;
    padding: 4px 6px;
    font-size: 0.85rem;
    text-align: center;
    border-width: 1px;
}

.raise-suffix {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    line-height: 1;
}

/* ── Allocation Items ─────────────────────────────────────────────── */

.allocation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--surface-elevated);
    border-radius: 8px;
    border-left: 4px solid;
    margin-bottom: 10px;
}

.allocation-item.match { border-left-color: #28a745; }
.allocation-item.hsa { border-left-color: #17a2b8; }
.allocation-item.ira { border-left-color: #ffc107; }
.allocation-item.k401-additional { border-left-color: #20c997; }
.allocation-item.brokerage { border-left-color: #6c757d; }

.allocation-label {
    font-weight: 600;
    color: var(--text-secondary);
    flex: 1;
}

.allocation-amounts {
    text-align: right;
}

.allocation-amount {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--color-primary);
}

.allocation-monthly {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.employer-match {
    font-size: 0.85rem;
    color: #28a745;
    margin-top: 3px;
}

/* ── Future Value Card ────────────────────────────────────────────── */

.future-value-card {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
}

.future-value-label {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.future-value-amount {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.future-value-subtitle {
    font-size: 0.95rem;
    opacity: 0.8;
}

/* ── Maxed Badge ──────────────────────────────────────────────────── */

.maxed-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #7c4a00;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(253, 160, 133, 0.4);
}

/* ── Future Value Rows ────────────────────────────────────────────── */

.fv-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--surface-elevated);
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid var(--color-primary);
}

.fv-row.employer { border-left-color: #28a745; }
.fv-row.combined {
    border-left-color: var(--color-gradient-dark);
    background: var(--color-investment-tint);
}
.fv-row.hsa { border-left-color: #17a2b8; }
.fv-row.ira { border-left-color: #ffc107; }
.fv-row.brokerage { border-left-color: #6c757d; }
.fv-row.grand-total {
    border-left: none;
    border-top: 2px solid var(--border-medium);
    margin-top: 12px;
    padding-top: 15px;
    background: var(--surface-card);
}

.fv-label {
    font-weight: 600;
    color: var(--text-secondary);
    flex: 1;
}

.fv-label .tax-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 600;
    vertical-align: middle;
}

.tax-badge.traditional {
    background: var(--badge-traditional-bg);
    color: var(--badge-traditional-text);
}

.tax-badge.roth {
    background: var(--badge-roth-bg);
    color: var(--badge-roth-text);
}

.tax-badge.tax-free {
    background: var(--badge-info-bg);
    color: var(--badge-info-text);
}

.tax-badge.taxable {
    background: var(--badge-neutral-bg);
    color: var(--badge-neutral-text);
}

.fv-values {
    text-align: right;
}

.fv-amount {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-primary);
}

.fv-percent {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.fv-section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 15px 0 8px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-light);
}

.fv-section-label:first-child {
    margin-top: 0;
}

/* ── Stacked Bar Chart ────────────────────────────────────────────── */

.fv-bar-container {
    margin-bottom: 20px;
}

.fv-stacked-bar {
    display: flex;
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.fv-bar-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    transition: width 0.4s ease;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.fv-bar-segment.seg-401k-employee { background: var(--color-primary); }
.fv-bar-segment.seg-401k-employer { background: #28a745; }
.fv-bar-segment.seg-hsa { background: #17a2b8; }
.fv-bar-segment.seg-ira { background: #ffc107; color: #333; }
.fv-bar-segment.seg-brokerage { background: #6c757d; }

.fv-bar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.fv-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.fv-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.fv-legend-dot.seg-401k-employee { background: var(--color-primary); }
.fv-legend-dot.seg-401k-employer { background: #28a745; }
.fv-legend-dot.seg-hsa { background: #17a2b8; }
.fv-legend-dot.seg-ira { background: #ffc107; }
.fv-legend-dot.seg-brokerage { background: #6c757d; }

/* ── Priority Order ───────────────────────────────────────────────── */

.priority-order {
    background: var(--surface-elevated);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.priority-order h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.priority-order ol {
    padding-left: 20px;
}

.priority-order li {
    margin-bottom: 8px;
    color: var(--text-muted);
}

/* ── Contribution Limits ──────────────────────────────────────────── */

.limits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.limits-item {
    background: var(--surface-elevated);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.limits-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.limits-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--color-primary);
}

/* ── Chart Breakdown ──────────────────────────────────────────────── */

.chart-breakdown {
    margin-top: 20px;
    text-align: center;
    max-width: 250px;
    margin-left: auto;
    margin-right: auto;
}

.chart-breakdown h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* ── Responsive Overrides ─────────────────────────────────────────── */

@media (max-width: 1024px) {
    .future-value-amount {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
}
