/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* Header */
header {
    background-color: #003366;
    color: white;
    padding: 2rem;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

header h2 {
    font-size: 1.2rem;
    font-weight: 300;
}

/* Main content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Tab Navigation */
.tab-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #003366;
    background-color: #e8f4f8;
    border: 2px solid #003366;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-button:hover {
    background-color: #d0e8f0;
}

.tab-button.active {
    background-color: #003366;
    color: white;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Controls */
.controls {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.controls label {
    font-weight: 600;
    margin-right: 1rem;
}

.controls select {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

/* Content container */
.content-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Table section */
.table-section,
.map-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-section h3,
.map-section h3 {
    margin-bottom: 1rem;
    color: #003366;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: #003366;
    color: white;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    font-weight: 600;
}

tbody tr:hover {
    background-color: #f5f5f5;
}

tbody tr.totals {
    font-weight: 600;
    background-color: #e8f4f8;
    border-top: 2px solid #003366;
}

/* Utilization color coding */
.utilization-low {
    color: #28a745;
    font-weight: 600;
}

.utilization-medium {
    color: #ffc107;
    font-weight: 600;
}

.utilization-high {
    color: #dc3545;
    font-weight: 600;
}

/* Map */
#map {
    width: 100%;
    height: 600px;
    border-radius: 4px;
}

/* Chart Container */
.chart-container {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.chart-wrapper {
    position: relative;
    height: 500px;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Legend Container */
.legend-container {
    border-left: 1px solid #e0e0e0;
    padding-left: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.legend-container h4 {
    color: #003366;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.legend-group {
    margin-bottom: 1.5rem;
}

.legend-group-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e0e0e0;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-radius: 4px;
    padding-left: 0.25rem;
}

.legend-item:hover {
    background-color: #f5f5f5;
}

.legend-item input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.legend-label {
    font-size: 0.9rem;
    color: #333;
}

/* Historical Notes Section */
.notes-section {
    background: #fff8e6;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-top: 2rem;
}

.notes-section h3 {
    color: #856404;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.notes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notes-list li {
    padding: 0.4rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: #856404;
    font-size: 0.9rem;
}

.notes-list li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    color: #ffc107;
    font-weight: bold;
}

.notes-list li:last-child {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e0c56c;
}

/* Geographic Clusters Section */
.clusters-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
}

.clusters-section h3 {
    color: #003366;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.clusters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.cluster-card {
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid;
}

.cluster-card h4 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.cluster-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cluster-card li {
    font-size: 0.85rem;
    padding: 0.25rem 0;
    color: #555;
}

.cluster-north {
    background-color: #e8f5e9;
    border-color: #4CAF50;
}

.cluster-north h4 {
    color: #2e7d32;
}

.cluster-central {
    background-color: #fff3e0;
    border-color: #FF9800;
}

.cluster-central h4 {
    color: #e65100;
}

.cluster-south {
    background-color: #e3f2fd;
    border-color: #2196F3;
}

.cluster-south h4 {
    color: #1565c0;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 968px) {
    .content-container {
        grid-template-columns: 1fr;
    }

    .chart-container {
        grid-template-columns: 1fr;
    }

    .legend-container {
        border-left: none;
        border-top: 1px solid #e0e0e0;
        padding-left: 0;
        padding-top: 1rem;
        max-height: none;
    }

    #map {
        height: 400px;
    }

    .chart-wrapper {
        height: 350px;
    }

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

@media (max-width: 640px) {
    header h1 {
        font-size: 1.5rem;
    }

    header h2 {
        font-size: 1rem;
    }

    main {
        padding: 1rem;
    }

    .tab-container {
        flex-direction: column;
    }

    .tab-button {
        border-radius: 8px;
    }

    th, td {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}
