/* cashFlowForecast.css — Forward Cash Flow Forecast Module */

/* ── Editorial Hero Header ── */
.cf-forecast-hero {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 60%, #283548 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--liq-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    margin-bottom: 0.75rem;
}
.cf-forecast-hero::before {
    content: '';
    position: absolute;
    top: -40%; right: -5%; width: 40%; height: 180%;
    background: radial-gradient(ellipse at 80% 20%, rgba(74, 144, 128, 0.12) 0%, transparent 60%);
    pointer-events: none;
}
.cf-forecast-hero h3 {
    margin: 0 0 0.2rem 0;
    font-family: var(--liq-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    letter-spacing: -0.02em;
    position: relative; z-index: 1;
}
.cf-forecast-hero p {
    margin: 0;
    opacity: 0.6;
    font-family: var(--liq-font-body);
    font-size: 0.875rem;
    position: relative; z-index: 1;
}

/* ── Main Container ── */
.cf-forecast-wrapper {
    background: var(--liq-bg);
    border: 1px solid var(--liq-border-light);
    border-radius: 10px;
    padding: var(--liq-module-padding-y) var(--liq-module-padding-x);
    font-family: var(--liq-font-body);
    color: var(--liq-text);
}

/* ── Header ── */
.cf-forecast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.cf-forecast-header h2 {
    font-family: var(--liq-font-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--liq-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.cf-forecast-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cf-forecast-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--liq-border-light);
    border-radius: 6px;
    background: var(--liq-surface);
    color: var(--liq-text);
    font-family: var(--liq-font-body);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.cf-forecast-btn:hover {
    border-color: var(--liq-accent);
    background: var(--liq-border-lighter);
}

.cf-forecast-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* ── Tab Navigation ── */
.cf-forecast-tabs {
    display: flex;
    border-bottom: 1px solid var(--liq-border-light);
    margin-bottom: 24px;
    gap: 0;
    overflow-x: auto;
}

.cf-forecast-tab {
    padding: 10px 18px;
    font-family: var(--liq-font-body);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--liq-text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.cf-forecast-tab:hover {
    color: var(--liq-accent);
    background: rgba(74, 144, 128, 0.04);
}

.cf-forecast-tab.active {
    border-bottom: 2px solid var(--liq-accent);
    color: var(--liq-text);
    background: transparent;
    font-weight: 600;
}

/* ── Tab Content Panels ── */
.cf-forecast-panel {
    display: none;
}

.cf-forecast-panel.active {
    display: block;
}

/* ── Metric Cards Grid ── */
.cf-forecast-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.cf-forecast-metric {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.15s;
}

.cf-forecast-metric:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.09);
}

.cf-forecast-metric-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--liq-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cf-forecast-metric-label svg {
    width: 14px;
    height: 14px;
    opacity: 0.65;
}

.cf-forecast-metric-value {
    font-family: var(--liq-font-mono);
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--liq-text);
    line-height: 1.2;
}

.cf-forecast-metric-sub {
    font-size: 0.78rem;
    color: var(--liq-text-muted);
    margin-top: 4px;
}

/* Status color variants */
.cf-forecast-metric-value.good { color: var(--liq-profit); }
.cf-forecast-metric-value.warning { color: var(--liq-warning); }
.cf-forecast-metric-value.danger { color: var(--liq-loss); }

/* ── Chart Area ── */
.cf-forecast-chart-area {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    min-height: 400px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cf-forecast-chart-area .liq-apex-host,
.cf-forecast-chart-area canvas {
    width: 100% !important;
    max-height: 420px;
}

.cf-forecast-chart-title {
    font-family: var(--liq-font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--liq-text);
    margin-bottom: 16px;
}

/* ── Horizon Selector ── */
.cf-horizon-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.cf-horizon-selector label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--liq-text-muted);
}

.cf-horizon-btn {
    padding: 5px 14px;
    border: 1px solid var(--liq-border-light);
    border-radius: 5px;
    background: var(--liq-surface);
    color: var(--liq-text-muted);
    font-family: var(--liq-font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.cf-horizon-btn:hover {
    border-color: var(--liq-accent);
}

.cf-horizon-btn.active {
    background: var(--liq-text);
    color: var(--liq-surface);
    border-color: var(--liq-text);
}

/* ── Runway Gauge ── */
.cf-runway-gauge {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    margin: 24px auto;
    width: 200px;
    height: 200px;
    position: relative;
}

.cf-runway-gauge svg {
    width: 200px;
    height: 200px;
}

.cf-runway-gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.cf-runway-gauge-number {
    font-family: var(--liq-font-mono);
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
}

.cf-runway-gauge-unit {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--liq-text-muted);
    margin-top: 2px;
}

.cf-runway-gauge-number.good { color: var(--liq-profit); }
.cf-runway-gauge-number.warning { color: var(--liq-warning); }
.cf-runway-gauge-number.danger { color: var(--liq-loss); }

/* ── Runway Summary ── */
.cf-runway-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.cf-runway-scenario {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 8px;
    padding: 16px 18px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cf-runway-scenario-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--liq-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.cf-runway-scenario-value {
    font-family: var(--liq-font-mono);
    font-size: 1.3rem;
    font-weight: 600;
}

/* ── Scenario Layout (two-column) ── */
.cf-scenario-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}

.cf-scenario-controls {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 20px;
}

.cf-scenario-controls h3 {
    font-family: var(--liq-font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--liq-text);
    margin: 0 0 16px;
}

.cf-scenario-control {
    margin-bottom: 18px;
}

.cf-scenario-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--liq-text-muted);
    margin-bottom: 6px;
}

.cf-scenario-control-value {
    font-family: var(--liq-font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--liq-accent);
}

.cf-scenario-control input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--liq-border-light);
    border-radius: 3px;
    outline: none;
}

.cf-scenario-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--liq-accent);
    cursor: pointer;
    border: 2px solid var(--liq-surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.cf-scenario-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--liq-accent);
    cursor: pointer;
    border: 2px solid var(--liq-surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.cf-scenario-input-group {
    margin-bottom: 18px;
}

.cf-scenario-input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--liq-text-muted);
    margin-bottom: 6px;
}

.cf-scenario-input-group input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--liq-border-light);
    border-radius: 6px;
    font-family: var(--liq-font-mono);
    font-size: 0.85rem;
    color: var(--liq-text);
    background: var(--liq-bg);
    outline: none;
    transition: border-color 0.15s;
}

.cf-scenario-input-group input[type="number"]:focus {
    border-color: var(--liq-accent);
}

.cf-scenario-results {
    min-width: 0;
}

.cf-scenario-reset-btn {
    display: block;
    width: 100%;
    padding: 8px 0;
    margin-top: 8px;
    border: 1px solid var(--liq-border-light);
    border-radius: 6px;
    background: var(--liq-bg);
    color: var(--liq-text-muted);
    font-family: var(--liq-font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.cf-scenario-reset-btn:hover {
    border-color: var(--liq-loss);
    color: var(--liq-loss);
    background: #fff5f5;
}

/* ── Data Table ── */
.cf-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 8px;
    overflow: hidden;
}

.cf-data-table th {
    background: var(--liq-border-lighter);
    padding: 10px 14px;
    text-align: right;
    font-weight: 600;
    color: var(--liq-text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--liq-border-light);
}

.cf-data-table th:first-child {
    text-align: left;
}

.cf-data-table td {
    padding: 9px 14px;
    text-align: right;
    font-family: var(--liq-font-mono);
    font-size: 0.82rem;
    color: var(--liq-text);
    border-bottom: 1px solid var(--liq-border-lighter);
}

.cf-data-table td:first-child {
    text-align: left;
    font-family: var(--liq-font-body);
    font-weight: 500;
}

.cf-data-table tr:last-child td {
    border-bottom: none;
}

.cf-data-table tr.cf-forecast-row {
    background: rgba(74, 144, 128, 0.04);
}

.cf-forecast-panel[data-panel="projections"] .cf-data-table tr.cf-forecast-row td:first-child::after {
    content: ' (F)';
    font-size: 0.7rem;
    color: var(--liq-accent);
    font-weight: 600;
}

.cf-data-table .cf-negative {
    color: var(--liq-loss);
}

/* ── Summary Text ── */
.cf-summary-text {
    background: var(--liq-surface);
    border: 1px solid var(--liq-border-light);
    border-radius: 8px;
    padding: 18px 22px;
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--liq-text-muted);
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cf-summary-text strong {
    color: var(--liq-text);
}

/* ── Note / Warning ── */
.cf-forecast-note {
    background: #fffbeb;
    border: 1px solid #f5d06080;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.82rem;
    color: #92400e;
    margin-top: 20px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.cf-forecast-note svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .cf-forecast-wrapper {
        padding: 18px 16px 20px;
    }

    .cf-forecast-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cf-forecast-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .cf-scenario-layout {
        grid-template-columns: 1fr;
    }

    .cf-scenario-controls {
        position: static;
    }

    .cf-runway-summary {
        grid-template-columns: 1fr;
    }

    .cf-forecast-tabs {
        gap: 0;
    }

    .cf-forecast-tab {
        padding: 8px 12px;
        font-size: 0.82rem;
    }

    .cf-data-table {
        font-size: 0.78rem;
    }

    .cf-data-table th,
    .cf-data-table td {
        padding: 7px 8px;
    }
}

/* ── Print ── */
@media print {
    .cf-forecast-wrapper {
        border: none;
        box-shadow: none;
        padding: 0;
        break-inside: avoid;
    }

    .cf-forecast-tabs,
    .cf-forecast-header-actions,
    .cf-scenario-controls input[type="range"],
    .cf-scenario-reset-btn,
    .cf-horizon-selector {
        display: none;
    }

    .cf-forecast-panel {
        display: block !important;
        page-break-inside: avoid;
        margin-bottom: 24px;
    }

    .cf-forecast-metric,
    .cf-forecast-chart-area,
    .cf-runway-scenario {
        box-shadow: none;
        border: 1px solid var(--liq-border);
    }

    .cf-forecast-chart-area {
        min-height: 280px;
    }
}

/* ── Toast Notifications ── */
.cf-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-family: var(--liq-font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--liq-surface);
    z-index: 9999;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    max-width: 360px;
    pointer-events: none;
}

.cf-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.cf-toast.success {
    background: var(--liq-profit);
}

.cf-toast.info {
    background: var(--liq-accent);
}

.cf-toast.error {
    background: var(--liq-loss);
}
