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

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    position: relative;
}

#map {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: 400px;
    width: calc(100% - 400px);
    height: 100vh;
}

#info-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 450px;
    height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    color: white;
    overflow-y: auto;
    padding: 20px;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
}

#info-panel::-webkit-scrollbar {
    width: 8px;
}

#info-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

#info-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

#info-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header .subtitle {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 300;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 25px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    font-size: 32px;
    color: #fbbf24;
}

.stat-icon.injury {
    color: #f97316;
}

.stat-icon.fatal {
    color: #dc2626;
}

.stat-icon.pedestrian {
    color: #60a5fa;
}

.stat-content h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-content p {
    font-size: 11px;
    opacity: 0.9;
    font-weight: 300;
}

.chart-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chart-section h2 {
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: 600;
    color: #fbbf24;
}

#hourly-chart, #type-chart {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 10px;
    width: 100%;
}

#hourly-chart {
    min-height: 230px;
    max-height: 230px;
    overflow: hidden;
}

#type-chart {
    min-height: 300px;
}

.c3-tooltip-container {
    z-index: 10000;
}

.c3-tooltip {
    background: rgba(30, 58, 95, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    padding: 8px 12px !important;
    opacity: 1 !important;
}

.c3-tooltip th {
    background: transparent !important;
    color: #fbbf24 !important;
    font-weight: 600 !important;
    padding: 4px 8px !important;
    border: none !important;
}

.c3-tooltip td {
    background: transparent !important;
    color: white !important;
    padding: 4px 8px !important;
    border: none !important;
}

.c3-tooltip td.name {
    color: #60a5fa !important;
}

.c3-tooltip td.value {
    font-weight: 600 !important;
}

.c3 svg {
    font-family: 'Segoe UI', sans-serif;
    font-size: 11px;
}

.c3-chart-arc text {
    fill: #1e3a5f;
    font-size: 13px;
    font-weight: 600;
}

.c3-legend-item text {
    fill: #1e3a5f;
    font-size: 11px;
}

.c3 line, .c3 path {
    stroke: #94a3b8;
}

.c3-axis text {
    fill: #1e3a5f;
}

.legend-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.legend-section h2 {
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #fbbf24;
}

#legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.reset-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #1e3a5f;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.reset-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(251, 191, 36, 0.4);
}

.reset-button i {
    margin-right: 8px;
}

/* Footer */
.footer {
    text-align: center;
    font-size: 11px;
    opacity: 0.8;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer p {
    margin: 5px 0;
}

.mapboxgl-popup-content {
    background: #1e3a5f;
    color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.mapboxgl-popup-close-button {
    color: white;
    font-size: 20px;
}

.popup-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #fbbf24;
}

.popup-info {
    font-size: 12px;
    line-height: 1.6;
}

.popup-info strong {
    color: #60a5fa;
}

@media (max-width: 768px) {
    #map {
        right: 0;
        bottom: 50%;
    }
    
    #info-panel {
        top: 50%;
        width: 100%;
        max-height: 50%;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}