/* revenueForecasting.css - Editorial Financial Intelligence Design */

/* ===== DESIGN SYSTEM FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ===== CSS VARIABLES (Design System) ===== */
:root {
    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

    /* Neutrals */
    --text-primary: #1A1D29;
    --text-secondary: #4E5668;
    --text-tertiary: #878E9F;
    --surface: #FFFFFF;
    --bg: #FAFBFC;
    --border: #E5E9F0;
    --shadow: rgba(0, 0, 0, 0.04);

    /* Contextual Colors */
    --positive: #0A6E4E;
    --negative: #C7383E;
    --warning: #D97706;
    --accent: #3B5A9D;

    /* Model Colors */
    --model-linear: #3B5A9D;
    --model-sma: #059669;
    --model-ema: #D97706;
    --model-hw: #1E40AF;
    --model-ar: #DC2626;
    --model-ensemble: #0A6E4E;
}

/* ===== MAIN CONTAINER ===== */
.revenue-forecast-container {
    padding: 0;
    background: var(--bg);
    font-family: var(--font-body);
}

/* ===== HEADER ===== */
.revenue-forecast-header {
    background: linear-gradient(to bottom, #FFFFFF 0%, #FAFAF9 100%);
    border-bottom: 1px solid var(--border);
    padding: 2rem 3rem 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.revenue-forecast-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin: 0;
}

/* ===== HERO BANNER (Dark Gradient) ===== */
.forecast-hero {
    background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
    padding: 2.5rem 3rem;
    margin: 0;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

.hero-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 3rem;
}

.hero-main {
    flex: 0 0 auto;
}

.hero-label {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.hero-value {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #FFFFFF;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.hero-growth-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 600;
}

.hero-growth-indicator.positive {
    background: rgba(16, 185, 129, 0.15);
    color: #6EE7B7;
}

.hero-growth-indicator.negative {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
}

.hero-growth-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
}

.hero-growth-icon svg {
    width: 100%;
    height: 100%;
}

.hero-stats {
    display: flex;
    gap: 3rem;
    flex: 1;
    justify-content: flex-end;
}

.hero-stat {
    text-align: right;
}

.hero-stat-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.hero-stat-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #FFFFFF;
    line-height: 1.2;
}

/* ===== FORECAST MODEL SELECTOR ===== */
.forecast-model-selector {
    display: flex;
    gap: 1.5rem;
    margin: 2rem 3rem;
    padding: 1.75rem 2rem;
    background: linear-gradient(to bottom, #F8F9FA 0%, #FFFFFF 100%);
    border-radius: 12px;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.forecast-model-selector:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.forecast-model-selector label {
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 0.75rem;
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.model-tabs {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.model-tab {
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
}

.model-tab:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(59, 90, 157, 0.15);
    transform: translateY(-2px);
}

.model-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(59, 90, 157, 0.3);
}

.model-tab .confidence-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--positive);
    color: white;
    font-size: 0.6875rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

/* ===== FORECAST CONTROLS ===== */
.forecast-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin: 0 3rem 2rem 3rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.control-group input,
.control-group select {
    font-family: var(--font-body);
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--surface);
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.control-group input:focus,
.control-group select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 90, 157, 0.1);
}

/* ===== MODEL COMPARISON GRID ===== */
.model-comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 0 3rem 2rem 3rem;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

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

.model-metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 8px var(--shadow);
}

.model-metric-card:nth-child(1) { animation-delay: 0.1s; border-left-color: var(--model-linear); }
.model-metric-card:nth-child(2) { animation-delay: 0.2s; border-left-color: var(--model-sma); }
.model-metric-card:nth-child(3) { animation-delay: 0.3s; border-left-color: var(--model-ema); }
.model-metric-card:nth-child(4) { animation-delay: 0.4s; border-left-color: var(--model-hw); }
.model-metric-card:nth-child(5) { animation-delay: 0.5s; border-left-color: var(--model-ar); }
.model-metric-card:nth-child(6) { animation-delay: 0.6s; border-left-color: var(--model-ensemble); }

.model-metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.model-metric-card.best-model {
    border-left-color: var(--positive);
    border-left-width: 5px;
    background: linear-gradient(135deg, #E6F4EF 0%, #FFFFFF 100%);
}

.model-metric-card h4 {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.model-metric-card .metrics {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
}

.metric-label {
    font-family: var(--font-body);
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-value {
    font-family: var(--font-mono);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.metric-value.good {
    color: var(--positive);
}

.metric-value.warning {
    color: var(--warning);
}

.metric-value.poor {
    color: var(--negative);
}

/* ===== CHART CONTAINERS ===== */
.revenue-forecast-chart-container {
    width: 100%;
    height: 520px;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 2px 8px var(--shadow);
    margin: 2rem 3rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.revenue-forecast-chart-container:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ===== FORECAST INSIGHTS PANEL ===== */
.forecast-insights-panel {
    margin: 2rem 3rem;
    padding: 0;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
    overflow: hidden;
}

.forecast-insights-panel h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.02em;
    margin: 0;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #3B5A9D 0%, #4B6AAD 100%);
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 2rem;
    margin: 0;
    background: var(--surface);
    border-radius: 0;
    border-left: 4px solid var(--accent);
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.insight-item:last-child {
    border-bottom: none;
}

.insight-item:hover {
    background: linear-gradient(to right, rgba(59, 90, 157, 0.03) 0%, transparent 100%);
}

.insight-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.insight-icon.trend {
    background: rgba(59, 90, 157, 0.1);
    color: var(--accent);
}

.insight-icon.warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning);
}

.insight-icon.success {
    background: rgba(10, 110, 78, 0.1);
    color: var(--positive);
}

.insight-content {
    flex: 1;
}

.insight-title {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.insight-description {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== MODEL PERFORMANCE CHART ===== */
.model-performance-chart {
    height: 300px;
    margin-top: 1.25rem;
}

/* ===== INTERACTIVE FORECAST CONTROLS ===== */
.interactive-forecast-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.forecast-action-btn {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px var(--shadow);
}

.forecast-action-btn:hover {
    background: var(--bg);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.forecast-action-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(59, 90, 157, 0.3);
}

/* ===== LOADING STATES ===== */
.forecast-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #6b7280;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== FORECAST NOTES ===== */
.forecast-note {
    font-size: 0.8125rem;
    text-align: center;
    margin-top: 0.9375rem;
    color: #6b7280;
    padding: 0 0.625rem;
}

.forecast-warning-note {
    width: 100%;
    text-align: center;
    font-style: italic;
    color: #d97706;
    background-color: #fef3c7;
    padding: 0.75rem;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    margin-bottom: 0.9375rem;
    font-size: 0.875rem;
}

/* ===== CONFIDENCE INTERVAL LEGEND ===== */
.confidence-interval-legend {
    position: absolute;
    bottom: 25px;
    right: 25px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 10;
    border: 1px solid #e5e7eb;
}

.confidence-swatch {
    width: 20px;
    height: 10px;
    background-color: rgba(255, 99, 132, 0.2);
    border: 1px solid rgba(255, 99, 132, 0.5);
    margin-right: 0.5rem;
}

/* ===== ERROR MESSAGE ===== */
.error-message {
    padding: 0.9375rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    margin: 0.9375rem 0;
}

.error-message pre {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
    font-size: 0.875rem;
    margin: 0.625rem 0 0;
    padding: 0.625rem;
    background-color: #f9fafb;
    border-radius: 4px;
    overflow: auto;
    color: #dc2626;
}

/* ===== TOOLTIPS ===== */
.forecast-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 0.625rem 0.875rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    max-width: 250px;
    line-height: 1.4;
}

.forecast-tooltip.show {
    opacity: 1;
}

.forecast-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(15, 23, 42, 0.95);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .model-comparison-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        margin: 0 2rem 2rem 2rem;
    }

    .revenue-forecast-chart-container {
        height: 450px;
        margin: 2rem 2rem;
    }

    .forecast-insights-panel {
        margin: 2rem 2rem;
    }
}

@media (max-width: 768px) {
    .revenue-forecast-header {
        padding: 1.5rem 2rem 1rem 2rem;
    }

    .revenue-forecast-title {
        font-size: 1.75rem;
    }

    .forecast-hero {
        padding: 2rem;
    }

    .hero-value {
        font-size: 2.5rem;
    }

    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-stat {
        align-items: flex-start;
    }

    .forecast-model-selector {
        flex-direction: column;
        align-items: stretch;
        padding: 1.5rem 2rem;
        margin: 0 2rem 2rem 2rem;
    }

    .model-tabs {
        flex-direction: column;
        gap: 0.75rem;
    }

    .model-tab {
        width: 100%;
        text-align: center;
    }

    .forecast-controls {
        grid-template-columns: 1fr;
        margin: 0 2rem 2rem 2rem;
    }

    .model-comparison-grid {
        grid-template-columns: 1fr;
        margin: 0 2rem 2rem 2rem;
    }

    .revenue-forecast-chart-container {
        height: 400px;
        padding: 1.5rem;
        margin: 2rem 2rem;
    }

    .forecast-insights-panel {
        margin: 2rem 2rem;
    }

    .forecast-insights-panel h3 {
        font-size: 1.25rem;
        padding: 1.25rem 1.5rem;
    }

    .insight-item {
        padding: 1.25rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .revenue-forecast-header {
        padding: 1rem 1.5rem 0.75rem 1.5rem;
    }

    .revenue-forecast-title {
        font-size: 1.5rem;
    }

    .forecast-hero {
        padding: 1.5rem;
    }

    .hero-label {
        font-size: 0.75rem;
    }

    .hero-value {
        font-size: 2rem;
    }

    .hero-growth-value {
        font-size: 0.875rem;
    }

    .hero-stat-label {
        font-size: 0.6875rem;
    }

    .hero-stat-value {
        font-size: 0.9375rem;
    }

    .forecast-model-selector {
        padding: 1rem 1.5rem;
        margin: 0 1.5rem 1.5rem 1.5rem;
    }

    .forecast-controls {
        padding: 1.5rem;
        margin: 0 1.5rem 1.5rem 1.5rem;
    }

    .model-metric-card {
        padding: 1.25rem;
    }

    .model-comparison-grid {
        margin: 0 1.5rem 1.5rem 1.5rem;
    }

    .revenue-forecast-chart-container {
        height: 350px;
        padding: 1rem;
        margin: 1.5rem 1.5rem;
    }

    .forecast-insights-panel {
        margin: 1.5rem 1.5rem;
    }

    .forecast-insights-panel h3 {
        font-size: 1.125rem;
        padding: 1rem 1.25rem;
    }

    .insight-item {
        flex-direction: column;
        padding: 1rem 1.25rem;
        gap: 0.75rem;
    }

    .insight-icon {
        align-self: flex-start;
    }

    .interactive-forecast-controls {
        top: 8px;
        right: 8px;
        flex-direction: column;
        gap: 0.375rem;
    }

    .forecast-action-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .revenue-forecast-container {
        background: white;
        box-shadow: none;
        border: 1px solid #d1d5db;
        padding: 1rem;
    }

    .forecast-model-selector {
        page-break-inside: avoid;
        box-shadow: none;
    }

    .forecast-controls {
        page-break-inside: avoid;
    }

    .model-comparison-grid {
        page-break-inside: avoid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .model-metric-card {
        page-break-inside: avoid;
        box-shadow: none;
    }

    .model-metric-card:hover {
        box-shadow: none;
    }

    .revenue-forecast-chart-container {
        page-break-inside: avoid;
        height: 400px;
        box-shadow: none;
        border: 1px solid #d1d5db;
    }

    .revenue-forecast-chart-container:hover {
        box-shadow: none;
    }

    .forecast-insights-panel {
        page-break-inside: avoid;
    }

    .insight-item {
        page-break-inside: avoid;
        box-shadow: none;
    }

    .insight-item:hover {
        box-shadow: none;
    }

    .interactive-forecast-controls,
    .forecast-action-btn {
        display: none;
    }

    .model-tab .confidence-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== ACCESSIBILITY ===== */
.forecast-model-selector:focus-within,
.control-group:focus-within,
.model-metric-card:focus-within,
.revenue-forecast-chart-container:focus-within,
.insight-item:focus-within,
.forecast-action-btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
