/* Scoped styles for Semi-Retirement Cashflow Modeller (.src- prefix) */

.src-root-wrapper {
    margin: 2rem auto;
    width: 100%;
    max-width: 1400px;
}

.src-root {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #083141;
    background: #ffffff;
    border: 1px solid #e0eaef;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.src-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: #083141;
    letter-spacing: -0.02em;
}

.src-intro {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: #355766;
}

.src-steps {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.src-step {
    border: 1px solid #d5e4eb;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.src-step-title {
    margin: 0 0 0.5rem;
    font-size: 1.3rem;
    font-weight: 800;
    color: #083141;
    letter-spacing: -0.01em;
}

.src-step-help {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: #526b75;
    line-height: 1.5;
}

.src-grid {
    display: grid;
    gap: 0.75rem 1rem;
}

.src-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.src-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.src-field-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0f172a;
}

.src-input {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 0.4rem 0.55rem;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    min-height: 32px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.src-input:focus {
    outline: none;
    border-color: #59747c;
    box-shadow: 0 0 0 2px rgba(89, 116, 124, 0.2);
    background: #f8fafc;
}

.src-help {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
    margin-top: 0.25rem;
}

.src-money-input,
.src-percent-input {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.src-money-prefix,
.src-percent-suffix {
    padding: 0.3rem 0.4rem;
    background: #ebf2f4;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #425a64;
}

.src-toggle-input {
    margin-right: 0.35rem;
}

.src-toggle-label {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

.src-toggle-text {
    font-weight: 500;
}

.src-field-toggle {
    margin-top: 0.5rem;
}

/* Buttons */

.src-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #59747c;
    background: #f5fafc;
    color: #083141;
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    gap: 0.25rem;
}

.src-btn:hover {
    background: #e3f0f5;
}

.src-btn-secondary {
    background: #59747c;
    color: #ffffff;
    border-color: #59747c;
}

.src-btn-secondary:hover {
    background: #425861;
}

.src-btn-ghost {
    background: transparent;
    border-color: transparent;
    color: #8a1b1b;
}

.src-btn-ghost:hover {
    background: #fbe9e9;
}

.src-btn-small {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
}

/* Presets */

.src-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.src-presets-label {
    font-size: 0.8rem;
    color: #496774;
}

/* Subsections (incomes) */

.src-subsection {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.src-subtitle {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: #083141;
    letter-spacing: -0.01em;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.src-subhelp {
    margin: 0 0 0.75rem;
    font-size: 0.86rem;
    color: #64748b;
    line-height: 1.5;
}

.src-income-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
    align-items: flex-end;
    margin-bottom: 0.5rem;
}

.src-income-remove {
    justify-self: flex-start;
}

/* Results */

.src-results-host {
    margin-top: 1rem;
}

.src-results {
    border-top: 2px solid #083141;
    padding-top: 1rem;
}

.src-results-title {
    margin: 0 0 1rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: #083141;
    letter-spacing: -0.02em;
    border-bottom: 3px solid #083141;
    padding-bottom: 0.75rem;
}

.src-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.src-badge {
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.src-badge-success {
    background: linear-gradient(135deg, #e6f4ea 0%, #d1fae5 100%);
    border-color: #86efac;
    color: #114b26;
    box-shadow: 0 2px 8px rgba(21, 128, 61, 0.15);
}

.src-badge-fail {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
    color: #991b1b;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.src-badge-neutral {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-color: #e2e8f0;
    color: #0f172a;
}

.src-summary {
    font-size: 0.9rem;
    margin: 0 0 0.75rem;
}

/* Tables */

.src-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.src-table thead {
    background: #ebf2f4;
    position: sticky;
    top: 0;
    z-index: 1;
}

.src-table thead th {
    font-weight: 700;
    color: #083141;
}

.src-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.src-table tbody tr:hover {
    background: #f1f5f9;
}

.src-table th,
.src-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: right;
}

.src-table th:first-child,
.src-table td:first-child {
    text-align: left;
}

.src-row-fail {
    background: #fff3f0;
}

/* Utility */

.src-returns-wrap {
    margin-top: 0.25rem;
}

/* Summary Box */

.src-summary-box {
    background: #f8fbfc;
    border: 1px solid #d5e4eb;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.src-summary-title {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    font-weight: 800;
    color: #083141;
    letter-spacing: -0.01em;
}

.src-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.src-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.src-summary-label {
    font-size: 0.8rem;
    color: #496774;
    font-weight: 500;
}

.src-summary-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #083141;
}

.src-asset-breakdown {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #d5e4eb;
}

/* Charts */

.src-charts-section {
    margin: 1.5rem 0;
    padding-top: 1rem;
    border-top: 2px solid #d5e4eb;
}

.src-chart-title {
    margin: 2rem 0 1rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: #083141;
    letter-spacing: -0.01em;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.src-chart-wrapper {
    position: relative;
    height: 300px;
    margin-bottom: 2rem;
}

.src-chart-wrapper canvas {
    max-height: 300px;
}

/* Insights Section */

.src-insights-section {
    margin: 1.5rem 0;
    padding-top: 1rem;
    border-top: 2px solid #d5e4eb;
}

.src-insights-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.src-insight {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #d5e4eb;
    background: #f8fbfc;
}

.src-insight-warning {
    background: #fff3f0;
    border-color: #f39482;
}

.src-insight-success {
    background: #e1f5e6;
    border-color: #7ec38e;
}

.src-insight-info {
    background: #eef5f8;
    border-color: #c5d5de;
}

.src-insight-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.src-insight-content {
    flex: 1;
}

.src-insight-title {
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
    color: #083141;
    letter-spacing: -0.01em;
}

.src-insight-text {
    font-size: 0.9rem;
    color: #355766;
    line-height: 1.5;
}

.src-next-steps {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fbfc;
    border: 1px solid #d5e4eb;
    border-radius: 8px;
}

.src-next-steps-title {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: #083141;
    letter-spacing: -0.01em;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.src-steps-list {
    margin: 0;
    padding-left: 1.5rem;
    color: #355766;
    font-size: 0.9rem;
    line-height: 1.8;
}

.src-steps-list li {
    margin-bottom: 0.5rem;
}


@media (max-width: 768px) {
    .src-root {
        padding: 1.1rem;
    }

    .src-step {
        padding: 0.85rem;
    }

    .src-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .src-summary-grid {
        grid-template-columns: 1fr;
    }

    .src-chart-wrapper {
        height: 250px;
    }
}

/* Print styles */

@media print {
    .src-root {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .src-btn,
    .src-presets {
        display: none !important;
    }

    .src-root-wrapper {
        margin: 0;
    }
}
