* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #0f1419;
    font-family: Arial, sans-serif;
}

header {
    background: linear-gradient(135deg, #1a2332 0%, #162233 100%);
    border-bottom: 2px solid #3d5a80;
    padding: 20px 30px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

header h1 {
    color: #5b7fa6;
    font-size: 32px;
}

.stats-bar {
    background: linear-gradient(90deg, #1a2332 0%, #162233 100%);
    border-bottom: 2px solid #3d5a80;
    padding: 20px 30px;
    display: flex;
    justify-content: flex-start;
    gap: 50px;
    overflow-x: auto;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 130px;
    padding: 8px 12px;
    background: rgba(93, 127, 166, 0.05);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.stat-item:hover {
    background: rgba(93, 127, 166, 0.12);
    transform: translateY(-2px);
}

.stat-label {
    color: #7a92b2;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 6px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: #5b7fa6;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
}

.main-wrapper {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #1a2332 0%, #0f1419 100%);
    border-right: 2px solid #3d5a80;
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}
.sidebar-title {
    color: #5b7fa6;
    font-size: 14px;
    font-weight: bold;
    margin-top: 15px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-section {
    margin-bottom: 15px;
}

.sidebar-section label {
    display: block;
    color: #7a92b2;
    font-size: 12px;
    margin-bottom: 6px;
    font-weight: bold;
}

.sidebar-section select {
    width: 100%;
    padding: 8px;
    background-color: #263445;
    color: #e0e8f0;
    border: 1px solid #3d5a80;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-bottom: 8px;
}

.sidebar-section select:hover,
.sidebar-section select:focus {
    border-color: #5b7fa6;
    background-color: #2a3a4c;
}

.sidebar-btn {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #3d5a80 0%, #4a6b94 100%);
    color: #e0e8f0;
    border: 1px solid #5b7fa6;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.3s ease;
}

.sidebar-btn:hover {
    background: linear-gradient(135deg, #4a6b94 0%, #5b7fa6 100%);
    box-shadow: 0 2px 6px rgba(91, 127, 166, 0.3);
    transform: translateY(-1px);
}

.sidebar-divider {
    height: 1px;
    background-color: #3d5a80;
    margin: 20px 0;
}

main {
    flex: 1;
    padding: 20px;
    background-color: #0f1419;
    overflow-y: auto;
}

.dashboard-content {
    background: linear-gradient(135deg, #1a2332 0%, #162233 100%);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #3d5a80;
    color: #e0e8f0;
    min-height: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dashboard-content h2 {
    color: #5b7fa6;
    margin-bottom: 15px;
}

.chart-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 0;
}

.chart-wrapper {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #263445 0%, #1a2332 100%);
    border: 1px solid #3d5a80;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.chart-wrapper:hover {
    border-color: #5b7fa6;
    box-shadow: 0 4px 12px rgba(91, 127, 166, 0.2);
}

.chart-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.chart-title-row h3 {
    color: #5b7fa6;
    font-size: 16px;
    margin: 0;
    flex: 0 0 auto;
}

#chart2YearDisplay, #chart3YearDisplay {
    color: #7a92b2;
    font-weight: normal;
    font-size: 14px;
    opacity: 0.9;
}

.maximize-btn {
    background: linear-gradient(135deg, #3d5a80 0%, #4a6b94 100%);
    color: #e0e8f0;
    border: 1px solid #5b7fa6;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
}

.maximize-btn:hover {
    background: linear-gradient(135deg, #4a6b94 0%, #5b7fa6 100%);
    box-shadow: 0 2px 6px rgba(91, 127, 166, 0.3);
}

/* Chart Maximize Logic */
.chart-container.maximized {
    grid-template-columns: 1fr;
}

.chart-wrapper.hidden {
    display: none;
}

.chart-wrapper.maximized {
    grid-column: 1 / -1;
}

.chart-wrapper.maximized .chart {
    min-height: 550px;
    max-height: none;
    height: 550px;
}

.chart-wrapper.maximized #chartdiv1,
.chart-wrapper.maximized #chartdiv2,
.chart-wrapper.maximized #chartdiv3,
.chart-wrapper.maximized #chartdiv,
.chart-wrapper.maximized #chartdiv5-inner,
.chart-wrapper.maximized #chartdiv6 {
    height: 520px !important;
}

.minimize-btn {
    background: linear-gradient(135deg, #3d5a80 0%, #4a6b94 100%);
    color: #e0e8f0;
    border: 1px solid #5b7fa6;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.minimize-btn:hover {
    background: linear-gradient(135deg, #4a6b94 0%, #5b7fa6 100%);
    box-shadow: 0 2px 6px rgba(91, 127, 166, 0.3);
}

.chart {
    background: linear-gradient(135deg, #1a2332 0%, #0f1419 100%);
    border: 1px solid #3d5a80;
    border-radius: 4px;
    padding: 10px;
    min-height: 310px;
    max-height: 310px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-body {
    flex: 1;
    overflow: hidden;
}

footer {
    background-color: #0a0d12;
    border-top: 2px solid #3d5a80;
    padding: 18px 20px;
    text-align: center;
    color: #5a6f8c;
    font-size: 11px;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2);
}

.chart-filters-header {
    background-color: #2d2d2d;
    border-bottom: 2px solid #ff8c00;
    padding: 15px 30px;
    display: none;
    gap: 40px;
    align-items: center;
    flex-wrap: wrap;
    animation: slideDown 0.3s ease-out;
}

.chart-filters-header.show {
    display: flex;
    animation: slideDown 0.3s ease-out;
}

.chart-filters-header.hide {
    animation: slideUp 0.3s ease-in;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
    }
    to {
        opacity: 1;
        max-height: 100px;
        overflow: visible;
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        max-height: 100px;
        overflow: hidden;
    }
    to {
        opacity: 0;
        max-height: 0;
        overflow: hidden;
    }
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    color: #ff8c00;
    font-weight: bold;
    font-size: 14px;
    margin: 0;
    white-space: nowrap;
}

.filter-group select {
    padding: 6px 10px;
    background-color: #3a3a3a;
    color: #ffffff;
    border: 1px solid #ff8c00;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.filter-group select:hover {
    background-color: #4a4a4a;
}

/* Filter Toggle Button */
#filterToggleBtn {
    display: inline-block;
    padding: 10px 15px;
    background-color: #ff8c00;
    color: #1a1a1a;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    transition: transform 0.3s;
}

#filterToggleBtn:hover {
    background-color: #ffaa33;
}

/* Checkbox Styling */
.filter-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ff8c00;
    border-radius: 3px;
    cursor: pointer;
    accent-color: #ff8c00;
    background-color: #2d2d2d;
    position: relative;
    vertical-align: middle;
    transition: background-color 0.2s;
}

.filter-checkbox:checked {
    background-color: #ff8c00;
}

.filter-checkbox-label {
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
}

/* Filter Button */
.filter-button {
    margin-left: 10px;
    padding: 5px 12px;
    cursor: pointer;
    background-color: #ff8c00;
    color: white;
    border: none;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.filter-button:hover {
    background-color: #ffaa33;
}

/* Dataset View */
.dataset-view-container {
    padding: 0;
    width: 100%;
}

.dataset-view-title {
    color: #5b7fa6;
    margin-bottom: 20px;
    font-size: 22px;
    padding: 0 30px;
    padding-top: 30px;
}

.back-to-graphs-btn {
    padding: 8px 15px;
    background-color: #3d5a80;
    color: #e0e8f0;
    border: 1px solid #5b7fa6;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.2s;
}

.back-to-graphs-btn:hover {
    background-color: #4a6b94;
    border-color: #748cff;
}

.export-dataset-btn {
    padding: 8px 15px;
    background-color: #3d5a80;
    color: #e0e8f0;
    border: 1px solid #5b7fa6;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.2s;
}

.export-dataset-btn:hover {
    background-color: #4a6b94;
    border-color: #748cff;
}

.dataset-selector-container {
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    justify-content: flex-start;
    flex-wrap: wrap;
    padding: 0 30px;
}

.dataset-button {
    padding: 10px 20px;
    border: 1px solid #3d5a80;
    background-color: transparent;
    color: #7a92b2;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 12px;
}

.dataset-button:hover {
    background: linear-gradient(135deg, #263445 0%, #2a3a4c 100%);
    border-color: #5b7fa6;
    color: #5b7fa6;
    transform: translateY(-1px);
}

.dataset-button.active {
    background: linear-gradient(135deg, #3d5a80 0%, #4a6b94 100%);
    color: #e0e8f0;
    border-color: #5b7fa6;
    box-shadow: 0 2px 6px rgba(91, 127, 166, 0.3);
}

/* Dataset Container */
.dataset-container {
    overflow-x: auto;
    margin-top: 20px;
    width: 100%;
    padding: 0 30px 30px 30px;
}

/* Table Styling */
.dataset-table {
    width: 100%;
    border-collapse: collapse;
    color: #e0e8f0;
}

.dataset-table thead tr {
    background-color: #3d5a80;
}

.dataset-table th,
.dataset-table td {
    padding: 12px;
    border: 1px solid #263445;
    text-align: left;
    font-size: 12px;
}

.dataset-table tbody tr {
    border-bottom: 1px solid #1a2332;
}

.dataset-table tbody tr:hover {
    background-color: #1a2332;
}

.filter-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.filter-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #3d5a80;
    border-radius: 3px;
    cursor: pointer;
    background-color: #263445;
    transition: all 0.2s;
}

.filter-checkbox:checked {
    background-color: #3d5a80;
    border-color: #5b7fa6;
}

.filter-apply-btn {
    padding: 4px 8px;
    background-color: #3d5a80;
    color: #e0e8f0;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    transition: background-color 0.2s;
    display: none;
}

.filter-apply-btn:hover {
    background-color: #4a6b94;
}

.apply-filters-btn {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: linear-gradient(135deg, #3d5a80 0%, #4a6b94 100%);
    color: #e0e8f0;
    border: 1px solid #5b7fa6;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.apply-filters-btn:hover {
    background: linear-gradient(135deg, #4a6b94 0%, #5b7fa6 100%);
    box-shadow: 0 4px 12px rgba(91, 127, 166, 0.3);
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .chart-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .chart-container {
        grid-template-columns: 1fr;
    }

    .stats-bar {
        gap: 20px;
    }

    .sidebar {
        width: 200px;
    }
}

@media (max-width: 700px) {
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #3d5a80;
        padding: 15px;
    }

    .main-wrapper {
        flex-direction: column;
    }

    header {
        padding: 15px 20px;
    }

    header h1 {
        font-size: 24px;
    }

    .stats-bar {
        padding: 10px 20px;
        gap: 15px;
    }

    .stat-item {
        min-width: 100px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-value {
        font-size: 16px;
    }

    main {
        padding: 15px;
    }

    .dashboard-content {
        padding: 15px;
    }
}
