/* seasonalityAnalysis.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;

    /* Chart Colors */
    --chart-trend: #059669;
    --chart-seasonal: #D97706;
    --chart-residual: #878E9F;
}

/* ===== CONTAINER AND LAYOUT ===== */
.seasonality-analysis-container {
    padding: 0;
    background: var(--bg);
    font-family: var(--font-body);
}

/* ===== HEADER ===== */
.seasonality-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;
}

.seasonality-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) ===== */
.seasonality-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-context {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
}

.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;
}

/* ===== SECTION HEADERS ===== */
.section-header {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 3rem 3rem 1.5rem 3rem;
}

/* ===== METRIC SELECTOR ===== */
.seasonality-metric-selector-container {
    margin: 2rem 3rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(to bottom, #F8F9FA 0%, #FFFFFF 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
}

.seasonality-metric-selector-container label {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.metric-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.seasonality-metric-selector-container select {
    padding: 0.625rem 2.5rem 0.625rem 0.9375rem;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    min-width: 220px;
    background: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23334155' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    color: #1f2937;
}

.seasonality-metric-selector-container select:hover {
    border-color: #9ca3af;
}

.seasonality-metric-selector-container select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-color: #3b82f6;
}

/* ===== ANALYSIS TYPE TABS ===== */
.seasonality-view-tabs {
    display: flex;
    gap: 2px;
    background: #f9fafb;
    padding: 4px;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    border: 1px solid #e5e7eb;
}

.view-tab {
    flex: 1;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.view-tab:hover {
    background: rgba(255, 255, 255, 0.5);
}

.view-tab.active {
    background: white;
    color: #1f2937;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.view-tab-icon {
    font-size: 1rem;
}

/* ===== SEASONALITY METRICS ===== */
.seasonality-metrics {
    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);
    }
}

.seasonality-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);
}

.seasonality-metric-card:nth-child(1) {
    animation-delay: 0.1s;
    border-left-color: var(--accent);
}

.seasonality-metric-card:nth-child(2) {
    animation-delay: 0.2s;
    border-left-color: var(--positive);
}

.seasonality-metric-card:nth-child(3) {
    animation-delay: 0.3s;
    border-left-color: var(--negative);
}

.seasonality-metric-card:nth-child(4) {
    animation-delay: 0.4s;
    border-left-color: var(--warning);
}

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

.seasonality-metric-card h4 {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.seasonality-metric-card .metric-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.seasonality-metric-card .metric-label {
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.metric-card-icon {
    width: 32px;
    height: 32px;
    background: #eff6ff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.metric-card-value {
    font-size: 1.75rem;
    font-weight: 400;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
    color: #1f2937;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.metric-card-detail {
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.5;
}

.metric-card-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.metric-card-trend.positive {
    color: #10b981;
    background: #d1fae5;
}

.metric-card-trend.negative {
    color: #ef4444;
    background: #fee2e2;
}

/* ===== CHARTS AREA ===== */
.seasonality-charts-area {
    margin-top: 1.5rem;
    display: grid;
    gap: 1.5rem;
}

.seasonality-chart-wrapper {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.seasonality-chart-wrapper:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.seasonality-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 400;
}

.chart-actions {
    display: flex;
    gap: 0.5rem;
}

.chart-action-btn {
    padding: 0.375rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
}

.chart-action-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* ===== VISUALIZATION CONTAINERS ===== */
.polar-chart-container {
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heatmap-container {
    height: 300px;
    margin: 1.25rem 0;
}

.seasonality-heatmap {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: auto repeat(12, 1fr);
    gap: 2px;
    font-size: 0.75rem;
}

.heatmap-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: box-shadow 0.2s ease;
    position: relative;
}

.heatmap-cell:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.heatmap-year-label {
    font-weight: 600;
    color: #374151;
    padding-right: 0.625rem;
    text-align: right;
}

.heatmap-month-label {
    font-weight: 500;
    color: #6b7280;
    padding-bottom: 0.375rem;
}

/* ===== DECOMPOSITION VIEW ===== */
.decomposition-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9375rem;
}

.decomposition-component {
    height: 150px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.9375rem;
    background: #fafbfc;
}

.component-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== INSIGHTS AND RECOMMENDATIONS ===== */
.seasonality-insights-panel {
    margin-top: 2rem;
    padding: 1.75rem;
    background: #fef3c7;
    border-radius: 6px;
    border: 1px solid #fbbf24;
}

.seasonality-insights-panel h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.seasonal-insight-card {
    background: white;
    border-radius: 6px;
    padding: 1.125rem;
    border-left: 3px solid #f59e0b;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.seasonal-insight-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.seasonal-insight-card h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.seasonal-insight-card p {
    font-size: 0.8125rem;
    color: #374151;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.insight-action-items {
    list-style: none;
    padding: 0;
}

.insight-action-items li {
    font-size: 0.75rem;
    color: #0891b2;
    padding: 0.25rem 0;
    padding-left: 1.25rem;
    position: relative;
}

.insight-action-items li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: #0891b2;
}

/* ===== INTERACTIVE ELEMENTS ===== */
.seasonality-comparison-toggle {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.9375rem;
    padding: 0.625rem 0.9375rem;
    background: #eff6ff;
    border-radius: 6px;
    border: 1px solid #bae6fd;
}

.comparison-toggle-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #075985;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: #3b82f6;
}

.toggle-switch-handle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-switch-handle {
    transform: translateX(24px);
}

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

.seasonality-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* ===== TOOLTIPS ===== */
.seasonality-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
    max-width: 280px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

/* ===== FORECAST NOTES ===== */
.forecast-warning-note {
    width: 100%;
    text-align: center;
    font-style: italic;
    color: #d97706;
    background-color: #fef3c7;
    padding: 0.75rem 1rem;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    justify-content: center;
}

.forecast-note {
    font-size: 0.8125rem;
    text-align: center;
    margin-top: 1.25rem;
    color: #6b7280;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 6px;
    line-height: 1.6;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .seasonality-metrics {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    .insight-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .seasonality-analysis-container {
        padding: 1.25rem;
    }

    .seasonality-metric-selector-container {
        flex-direction: column;
        align-items: stretch;
    }

    .seasonality-metric-selector-container select {
        width: 100%;
    }

    .seasonality-view-tabs {
        flex-wrap: wrap;
    }

    .view-tab {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .seasonality-metrics {
        grid-template-columns: 1fr;
    }

    .seasonality-charts-area {
        grid-template-columns: 1fr;
    }

    .polar-chart-container {
        height: 300px;
    }

    .seasonality-chart-wrapper {
        padding: 1.25rem;
    }

    .seasonality-insights-panel {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .seasonality-analysis-container {
        padding: 1rem;
    }

    .seasonality-metric-selector-container {
        padding: 0.75rem;
    }

    .seasonality-metric-card {
        padding: 1rem;
    }

    .metric-card-value {
        font-size: 1.5rem;
    }

    .seasonality-chart-wrapper {
        padding: 1rem;
    }

    .seasonality-chart-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .polar-chart-container {
        height: 250px;
    }

    .heatmap-container {
        height: 250px;
    }

    .seasonality-insights-panel {
        padding: 1rem;
    }

    .seasonal-insight-card {
        padding: 1rem;
    }
}

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

    .seasonality-metric-selector-container {
        page-break-inside: avoid;
    }

    .seasonality-view-tabs {
        display: none;
    }

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

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

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

    .seasonality-charts-area {
        page-break-inside: avoid;
    }

    .seasonality-chart-wrapper {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #d1d5db;
    }

    .seasonality-chart-wrapper:hover {
        box-shadow: none;
    }

    .chart-actions,
    .chart-action-btn {
        display: none;
    }

    .seasonality-insights-panel {
        page-break-inside: avoid;
        border: 1px solid #d1d5db;
    }

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

    .seasonal-insight-card:hover {
        box-shadow: none;
    }

    .seasonality-comparison-toggle {
        display: none;
    }

    .metric-card-trend {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== ACCESSIBILITY ===== */
.seasonality-metric-selector-container:focus-within,
.view-tab:focus,
.seasonality-metric-card:focus-within,
.seasonality-chart-wrapper:focus-within,
.seasonal-insight-card:focus-within,
.chart-action-btn:focus,
.toggle-switch:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
