/* General Body and Typography */
body {
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    padding: 30px;
}

.dashboard-title {
    text-align: center;
    color: #1E88E5;
    font-family: 'Roboto', sans-serif;
    font-size: 2.8em;
    margin-bottom: 40px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

h2 {
    color: #3f51b5;
    font-family: 'Roboto', sans-serif;
    font-size: 1.8em;
    margin-top: 30px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

h3 {
    color: #424242;
    font-family: 'Roboto', sans-serif;
    font-size: 1.3em;
    margin-bottom: 15px;
}

/* Card Sections */
.card-section {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.summary-cards .card {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.summary-cards .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.summary-cards .card h3 {
    color: #1E88E5;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.summary-cards .card .metric-value {
    font-size: 2.2em;
    font-weight: 700;
    color: #0d47a1;
    margin: 0;
}

/* Chart Containers */
.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
    margin-bottom: 20px;
}

.chart-container-mini {
    position: relative;
    height: 200px;
    width: 100%;
    margin-bottom: 10px;
}

/* Invoices & Payment Schedule */
.invoice-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.invoice-card {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease;
}

.invoice-card:hover {
    transform: translateY(-3px);
}

.invoice-card p {
    margin: 5px 0;
    font-size: 0.95em;
}

.invoice-card .status {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.85em;
}

.status.overdue { background-color: #ffebee; color: #c62828; } /* Red */
.status.pending { background-color: #fff3e0; color: #ef6c00; } /* Orange */
.status.paid { background-color: #e8f5e9; color: #2e7d32; } /* Green */

/* Scenario Simulations */
.scenario-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.scenario-charts .chart-container {
    height: 300px; /* Adjust height for scenario charts */
}

.ai-insight {
    font-style: italic;
    color: #546e7a;
    margin-top: 15px;
    padding: 10px 15px;
    background-color: #f0f4f7;
    border-left: 4px solid #90CAF9;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Liquidity Stress Test */
.liquidity-stress-test h2 {
    color: #d32f2f; /* Red for stress test section */
}

.stress-test-scenarios {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
}

.stress-test-card {
    background-color: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.stress-test-card h3 {
    color: #d32f2f;
    font-size: 1.1em;
    margin-bottom: 10px;
}

/* Risk Alerts */
.risk-alerts h2 {
    color: #ff6f00; /* Orange for risk alerts */
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.alert-item {
    background-color: #fff3e0;
    border-left: 5px solid #ff9800;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #e65100;
}

.alert-item .icon {
    font-size: 1.5em;
    margin-right: 10px;
}

.recommendation-item {
    background-color: #e8f5e9;
    border-left: 5px solid #4caf50;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    font-weight: 500;
    color: #2e7d32;
}

.recommendation-item .icon {
    font-size: 1.5em;
    margin-right: 10px;
}

/* Chart.js specific styling */
canvas {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 10px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .dashboard-container {
        padding: 20px;
    }
    .dashboard-title {
        font-size: 2.2em;
    }
    h2 {
        font-size: 1.6em;
    }
    .summary-cards, .scenario-charts, .stress-test-scenarios {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .dashboard-container {
        padding: 15px;
    }
    .dashboard-title {
        font-size: 1.8em;
        margin-bottom: 30px;
    }
    h2 {
        font-size: 1.4em;
    }
    .summary-cards, .scenario-charts, .stress-test-scenarios, .invoice-list {
        grid-template-columns: 1fr;
    }
    .chart-container {
        height: 300px;
    }
    .chart-container-mini {
        height: 180px;
    }
}

/* Print-specific styles for PDF conversion */
@media print {
    body {
        background-color: #ffffff;
        padding: 0;
        margin: 0;
        font-size: 10pt;
        color: #000;
    }
    .dashboard-container {
        box-shadow: none;
        border-radius: 0;
        padding: 15mm;
        max-width: none;
        width: auto;
    }
    .dashboard-title {
        font-size: 20pt;
        color: #000;
        margin-bottom: 20mm;
        page-break-after: avoid;
    }
    h2 {
        font-size: 14pt;
        border-bottom: 1px solid #ccc;
        padding-bottom: 5mm;
        margin-top: 15mm;
        page-break-after: avoid;
    }
    h3 {
        font-size: 12pt;
        page-break-after: avoid;
    }
    .card-section {
        box-shadow: none;
        border: 1px solid #eee;
        margin-bottom: 10mm;
        page-break-inside: avoid;
        padding: 10mm;
    }
    .summary-cards, .scenario-charts, .stress-test-scenarios, .invoice-list {
        display: block;
        width: 100%;
    }
    .summary-cards .card, .invoice-card, .stress-test-card {
        width: auto;
        margin-bottom: 5mm;
        page-break-inside: avoid;
        background: #f9f9f9 !important;
        border: 1px solid #ddd;
        box-shadow: none;
    }
    .chart-container, .chart-container-mini {
        height: auto !important;
        max-height: 150mm; /* Limit chart height for print */
        width: 100% !important;
        margin-bottom: 10mm;
        page-break-inside: avoid;
    }
    canvas {
        max-width: 100%;
        height: auto !important;
    }
    .ai-insight, .alert-item, .recommendation-item {
        background-color: #f0f0f0 !important;
        border-left: 3px solid #ccc !important;
        color: #000 !important;
        margin-bottom: 5mm;
        page-break-inside: avoid;
    }
    .status.overdue { background-color: #ffebee !important; color: #c62828 !important; }
    .status.pending { background-color: #fff3e0 !important; color: #ef6c00 !important; }
    .status.paid { background-color: #e8f5e9 !important; color: #2e7d32 !important; }
}