/* CSS Variables */
:root {
    --primary-color: #728e9e;
    --primary-dark: #5276d6;
    --secondary-color: #64748b;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --success-color: #16a34a;
    --fatal-color: #7f1d1d;
    --serious-color: #dc2626;
    --moderate-color: #f59e0b;
    --minor-color: #22c55e;
    --none-color: #94a3b8;
    --bg-color: #f8fafc;
    --bg-alt: #f1f5f9;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --panel-bg: rgba(255, 255, 255, 0.92);
    --panel-bg-solid: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --panel-radius: 12px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

/* ================================
   FULLSCREEN MAP
   ================================ */
.fullscreen-map {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* ================================
   SPLASH OVERLAY
   ================================ */
.splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.97) 0%, rgba(30, 64, 175, 0.98) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    max-width: 900px;
    text-align: center;
    color: white;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.splash-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.splash-icon {
    font-size: 3rem;
}

.splash-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

.splash-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 2rem;
}

.splash-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.splash-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: left;
    flex: 0 1 280px;
    max-width: 280px;
}

.splash-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    opacity: 0.95;
}

.splash-card p,
.splash-card li {
    font-size: 0.875rem;
    opacity: 0.85;
    line-height: 1.5;
}

.splash-card ul {
    padding-left: 1.25rem;
    margin: 0;
}

.splash-card li {
    margin-bottom: 0.25rem;
}

.splash-stats {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.splash-stat {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    min-width: 130px;
}

.splash-stat.fatal {
    background: rgba(220, 38, 38, 0.35);
}

.splash-stat.serious {
    background: rgba(245, 158, 11, 0.35);
}

.splash-stat-number {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
}

.splash-stat-label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.splash-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.splash-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.splash-btn svg {
    transition: transform 0.2s;
}

.splash-btn:hover svg {
    transform: translateX(4px);
}

.splash-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.splash-btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

.splash-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
}

.splash-btn-secondary svg {
    transform: none;
}

.splash-btn-secondary:hover svg {
    transform: none;
}

.splash-footer {
    margin-top: 2rem;
    font-size: 0.875rem;
    opacity: 0.7;
}

.splash-footer a {
    color: white;
    text-decoration: underline;
}

/* ================================
   MAP CONTROLS OVERLAY
   ================================ */
.map-controls {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.map-controls.hidden {
    opacity: 0;
    visibility: hidden;
}

.map-controls > * {
    pointer-events: auto;
}

/* ================================
   TOP BAR
   ================================ */
.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.brand:hover {
    background: rgba(0, 0, 0, 0.05);
}

.brand-icon {
    font-size: 1.5rem;
}

/* Search Container */
.search-container {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.search-container .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-container input {
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(114, 142, 158, 0.15);
}

.clear-search {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    line-height: 1;
}

.clear-search:hover {
    color: var(--text-color);
}

/* Year Filter */
.year-filter {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.year-filter select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    background: white;
    cursor: pointer;
}

.year-filter span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Location Search */
.location-search-container {
    position: relative;
    flex: 1;
    max-width: 300px;
    margin: 0 1rem;
}

.location-search-container .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.location-search-container input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.2s;
}

.location-search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.location-search-container input::placeholder {
    color: var(--text-muted);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.visible {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    line-height: 1.3;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(37, 99, 235, 0.05);
}

.search-result-item svg {
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: var(--primary-color);
}

.search-result-item.no-results {
    color: var(--text-muted);
    cursor: default;
}

.search-result-item.no-results:hover {
    background: transparent;
}

/* Search marker on map */
.search-marker-pin {
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    border: 3px solid white;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: search-marker-pulse 1s ease-out infinite;
}

@keyframes search-marker-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    100% { box-shadow: 0 0 0 15px rgba(37, 99, 235, 0); }
}

.stats-bar {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: auto;
}

.stat-pill {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.35rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.stat-pill.fatal {
    background: rgba(127, 29, 29, 0.15);
    color: var(--fatal-color);
}

.stat-pill.serious {
    background: rgba(220, 38, 38, 0.12);
    color: var(--serious-color);
}

/* ================================
   MAP CONTROLS PANEL (unified)
   ================================ */
.map-controls-panel {
    position: absolute;
    top: 64px;
    left: 1rem;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border-radius: var(--panel-radius);
    box-shadow: var(--card-shadow-lg);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 5;
    max-width: 200px;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.control-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.severity-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.severity-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.4;
}

.severity-btn.active {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

.severity-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ================================
   PANELS - Base Styles
   ================================ */
.panel {
    position: absolute;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border-radius: var(--panel-radius);
    box-shadow: var(--card-shadow-lg);
    overflow: hidden;
    transition: transform var(--transition-normal), width var(--transition-normal), height var(--transition-normal);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    user-select: none;
}

.panel-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.panel-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
    margin-right: 1rem;
}

.panel-toggle {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
}

.panel.collapsed .panel-toggle {
    transform: rotate(180deg);
}

.panel-content {
    padding: 1rem;
    overflow-y: auto;
    transition: max-height var(--transition-normal), padding var(--transition-normal);
}

.panel.collapsed .panel-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

/* Legacy filter styles removed - filters now in top bar */

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.marker-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.marker-dot.fatal { background: var(--fatal-color); }
.marker-dot.serious { background: var(--serious-color); }
.marker-dot.moderate { background: var(--moderate-color); }
.marker-dot.minor { background: var(--minor-color); }
.marker-dot.none { background: var(--none-color); }

/* ================================
   UNIFIED SIDEBAR
   ================================ */
.sidebar {
    position: absolute;
    top: 64px;
    right: 1rem;
    width: 340px;
    max-height: calc(100vh - 80px);
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border-radius: var(--panel-radius);
    box-shadow: var(--card-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 5;
}

.sidebar.collapsed {
    width: 48px;
}

.sidebar.collapsed .sidebar-tabs {
    flex-direction: column;
    padding: 0.25rem;
}

.sidebar.collapsed .sidebar-tab {
    padding: 0.5rem;
    flex: 0;
}

.sidebar.collapsed .sidebar-tab span {
    display: none;
}

.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar.collapsed .sidebar-collapse {
    width: 100%;
    padding: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar.collapsed .sidebar-collapse svg {
    transform: rotate(180deg);
}

/* Tab Navigation */
.sidebar-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.sidebar-tab:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.02);
}

.sidebar-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.04);
}

.sidebar-tab svg {
    flex-shrink: 0;
}

.sidebar-collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sidebar-collapse:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.sidebar-collapse svg {
    transition: transform 0.3s ease;
}

/* Tab Content */
.sidebar-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tab-pane {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
}

/* Analytics tab specific */
#tab-analytics {
    padding: 0;
}

#tab-analytics .charts-scroll {
    padding: 0.75rem;
    overflow-y: auto;
    flex: 1;
}

/* Report tab specific */
#tab-report {
    gap: 0.75rem;
}

/* Report Form Styles */
.report-scroll {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    flex: 1;
}

.report-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.report-card-header {
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.report-card-header h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.report-card-content {
    padding: 0.75rem;
}

.report-section.hidden {
    display: none;
}

/* Report Type Selector */
.report-type-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
}

.report-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.report-type-btn:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.02);
}

.report-type-btn.active {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.06);
}

.report-type-btn svg {
    color: var(--primary-color);
}

.report-type-btn span {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

.report-type-btn small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Location Display in Report */
.location-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem 0;
}

#tab-report .location-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-color);
}

#tab-report .location-display svg {
    color: var(--primary-color);
    flex-shrink: 0;
}

/* Button Select Groups */
.button-select {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.button-select.compact {
    grid-template-columns: repeat(2, 1fr);
}

.button-select.severity-select {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
}

.select-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.6rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-color);
    text-align: center;
    min-height: 2.5rem;
}

.select-btn:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.02);
}

.select-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.select-btn small {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.7;
}

.select-btn.active small {
    opacity: 0.9;
}

/* Form Row */
.form-row {
    display: flex;
    gap: 0.75rem;
}

.form-row .form-group {
    flex: 1;
}

/* Form Actions in Report */
#tab-report .form-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
}

#tab-report .form-actions .btn {
    flex: 1;
}

#tab-report .form-actions .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#tab-report .form-message {
    padding: 0 0.75rem 0.75rem;
}

.charts-scroll {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Hide carousel indicators on desktop by default */
.carousel-indicators {
    display: none;
}

/* Chart Cards */
.chart-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    flex-shrink: 0;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.chart-header h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
}

.chart-expand {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-expand:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--primary-color);
}

.chart-wrapper {
    height: 180px;
    padding: 0.5rem;
}

.chart-wrapper-tall {
    height: 260px;
}

/* Legacy bottom panel styles removed - report form now in sidebar */

/* Form Styles */
.incident-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 50px;
}

.form-row-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.location-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.location-label {
    font-weight: 500;
    color: var(--text-muted);
}

#selected-location {
    color: var(--primary-color);
    font-weight: 500;
}

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

.form-message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    display: none;
}

.form-message.success {
    display: block;
    background: #dcfce7;
    color: #166534;
}

.form-message.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
}

/* Card Subtitle */
.card-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0.15rem 0 0 0;
    font-weight: 400;
}

/* Conditional Fields */
.conditional-field {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}

.conditional-field.hidden {
    display: none;
}

/* Text Input Reveal */
.text-input-reveal {
    margin-top: 0.5rem;
}

.text-input-reveal.hidden {
    display: none;
}

.text-input-reveal input {
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input-reveal input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Time Select with Icons */
.button-select.time-select {
    grid-template-columns: repeat(3, 1fr);
}

.button-select.time-select .select-btn {
    padding: 0.5rem 0.25rem;
}

.btn-icon {
    font-size: 1rem;
    line-height: 1;
}

.btn-label {
    font-size: 0.7rem;
    font-weight: 500;
}

/* Impact Select */
.button-select.impact-select {
    grid-template-columns: 1fr;
}

.button-select.impact-select .select-btn {
    flex-direction: row;
    justify-content: flex-start;
    padding: 0.75rem;
    gap: 0.5rem;
}

.button-select.impact-select .select-btn small {
    margin-left: auto;
}

/* Category Select with Icons */
.button-select.category-select {
    grid-template-columns: repeat(2, 1fr);
}

.button-select.category-select .select-btn {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 0.5rem;
}

.button-select.category-select .btn-icon {
    font-size: 1.25rem;
}

/* Severity Select Improvements */
.button-select.severity-select {
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

.button-select.severity-select .select-btn {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    padding: 0.6rem 0.75rem;
    gap: 0.75rem;
    min-height: auto;
}

.button-select.severity-select .select-btn .btn-label {
    font-size: 0.8rem;
    font-weight: 600;
}

.button-select.severity-select .select-btn small {
    margin-left: auto;
    text-align: right;
    font-size: 0.7rem;
}

/* Injury Severity Colors */
.select-btn.severity-unhurt {
    border-left: 3px solid #4caf50;
}
.select-btn.severity-unhurt.active {
    background: #4caf50;
    border-color: #4caf50;
}

.select-btn.severity-gravel {
    border-left: 3px solid #8bc34a;
}
.select-btn.severity-gravel.active {
    background: #8bc34a;
    border-color: #8bc34a;
}

.select-btn.severity-firstaid {
    border-left: 3px solid #ffeb3b;
}
.select-btn.severity-firstaid.active {
    background: #f0d000;
    border-color: #f0d000;
    color: #333;
}
.select-btn.severity-firstaid.active small {
    color: #333;
}

.select-btn.severity-hospital {
    border-left: 3px solid #ff9800;
}
.select-btn.severity-hospital.active {
    background: #ff9800;
    border-color: #ff9800;
}

.select-btn.severity-hospitalized {
    border-left: 3px solid #f44336;
}
.select-btn.severity-hospitalized.active {
    background: #f44336;
    border-color: #f44336;
}

.select-btn.severity-fatal {
    border-left: 3px solid #212121;
}
.select-btn.severity-fatal.active {
    background: #212121;
    border-color: #212121;
}

/* Danger Level Colors */
.select-btn.danger-low {
    border-left: 3px solid #4caf50;
}
.select-btn.danger-low.active {
    background: #4caf50;
    border-color: #4caf50;
}

.select-btn.danger-moderate {
    border-left: 3px solid #ffeb3b;
}
.select-btn.danger-moderate.active {
    background: #f0d000;
    border-color: #f0d000;
    color: #333;
}
.select-btn.danger-moderate.active small {
    color: #333;
}

.select-btn.danger-high {
    border-left: 3px solid #ff9800;
}
.select-btn.danger-high.active {
    background: #ff9800;
    border-color: #ff9800;
}

.select-btn.danger-critical {
    border-left: 3px solid #f44336;
}
.select-btn.danger-critical.active {
    background: #f44336;
    border-color: #f44336;
}

.select-btn.danger-crash-history {
    border-left: 3px solid #7b1fa2;
}
.select-btn.danger-crash-history.active {
    background: #7b1fa2;
    border-color: #7b1fa2;
}

/* Report Section Container */
.report-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Compact Button Select for sub-options */
.button-select.compact {
    grid-template-columns: repeat(2, 1fr);
}

.button-select.compact .select-btn {
    padding: 0.5rem;
    font-size: 0.7rem;
    min-height: auto;
}

/* ================================
   BUTTONS
   ================================ */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-alt);
    color: var(--text-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* ================================
   FAB BUTTON - Locate
   ================================ */
#locate-fab {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
}

.fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--panel-bg-solid);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: var(--card-shadow-lg);
    background: var(--primary-color);
    color: white;
}

/* ================================
   VIEW TOGGLE BUTTONS (in controls panel)
   ================================ */

.view-toggle-buttons {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 0.2rem;
}

.view-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.6rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.view-label {
    white-space: nowrap;
}

.view-toggle:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.05);
}

.view-toggle.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-toggle svg {
    flex-shrink: 0;
}

/* Layer Toggle Controls */
.layer-toggle-buttons {
    display: flex;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 0.2rem;
}

.layer-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.5rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.layer-toggle:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.05);
}

.layer-toggle.active {
    background: white;
    color: var(--text-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.layer-toggle:not(.active) {
    opacity: 0.6;
}

.layer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.layer-dot.official {
    background: var(--primary-color);
}

.layer-dot.reported-crash {
    background: #6366f1;
    border-radius: 2px;
}

.layer-dot.hazard {
    background: #f97316;
    border-radius: 2px;
}

.layer-label {
    white-space: nowrap;
}

/* Floating Layer Control */
.layer-control-container {
    position: fixed;
    bottom: 120px;
    right: 12px;
    z-index: 800;
}

.layer-control-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.layer-control-btn:hover {
    color: var(--primary-color);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.layer-control-btn.active {
    background: var(--primary-color);
    color: white;
}

.layer-control-dropdown {
    position: absolute;
    bottom: 44px;
    right: 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    min-width: 180px;
    display: none;
    animation: fadeInUp 0.2s ease;
}

.layer-control-dropdown.visible {
    display: block;
}

.layer-control-header {
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
}

.layer-control-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-color);
    transition: background 0.15s;
}

.layer-control-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.layer-control-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.layer-control-item .layer-dot {
    width: 10px;
    height: 10px;
}

@media (max-width: 768px) {
    .layer-control-container {
        bottom: 80px;
        right: 10px;
    }

    .layer-control-btn {
        width: 32px;
        height: 32px;
    }

    .layer-control-btn svg {
        width: 16px;
        height: 16px;
    }
}

.selection-buttons {
    display: flex;
    gap: 0.25rem;
}

.selection-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.selection-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.selection-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.selection-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Basemap buttons */
.basemap-buttons {
    display: flex;
    gap: 0.25rem;
}

.basemap-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.basemap-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.basemap-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Selection area indicator */
.selection-active-indicator {
    position: absolute;
    top: 130px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--card-shadow);
    z-index: 5;
}

.selection-active-indicator button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
}

.selection-active-indicator button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Heatmap gradient legend (in controls panel) */
.heatmap-legend {
    display: none;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
}

.heatmap-legend.visible {
    display: block;
}

.heatmap-gradient {
    width: 120px;
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(to right,
        rgba(0, 0, 255, 0.4),
        rgba(0, 255, 0, 0.6),
        rgba(255, 255, 0, 0.8),
        rgba(255, 0, 0, 1)
    );
}

.heatmap-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Leaflet Draw overrides */
.leaflet-draw-toolbar a {
    background-color: white !important;
}

.leaflet-draw-actions a {
    background-color: var(--primary-color) !important;
}

/* ================================
   CHART MODAL
   ================================ */
.chart-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.chart-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.chart-modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.chart-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.chart-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.chart-modal-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-modal-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-color);
}

.chart-modal-body {
    padding: 1.5rem;
    height: 400px;
}

.chart-modal-info {
    padding: 0.75rem 1.5rem;
    background: var(--bg-alt);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ================================
   LOADING OVERLAY
   ================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 1rem;
}

/* ================================
   LEAFLET CUSTOMIZATION
   ================================ */

/* Move zoom controls below header and legend */
.leaflet-top.leaflet-left {
    top: 120px;
    left: 1rem;
}

.leaflet-top.leaflet-right {
    top: 70px;
    right: 360px; /* Account for sidebar width */
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--card-shadow) !important;
}

.leaflet-control-zoom a {
    background: var(--panel-bg-solid) !important;
    color: var(--text-color) !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-alt) !important;
}

.leaflet-control-zoom-in {
    border-radius: 8px 8px 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 8px 8px !important;
}

/* Attribution styling */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(4px);
    font-size: 10px !important;
    padding: 2px 6px !important;
}

.crash-popup {
    min-width: 260px;
}

.crash-popup h4 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.popup-header-bar {
    margin: -13px -20px 0.75rem -20px;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    color: white;
    border-radius: 12px 12px 0 0;
}

.popup-header-bar.fatal { background: var(--fatal-color); }
.popup-header-bar.serious { background: var(--serious-color); }
.popup-header-bar.moderate { background: var(--moderate-color); }
.popup-header-bar.minor { background: var(--minor-color); }
.popup-header-bar.none { background: var(--none-color); }

.crash-popup .popup-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    font-size: 0.8rem;
}

.crash-popup .popup-label {
    color: var(--text-muted);
}

.crash-popup .popup-value {
    font-weight: 500;
}

.crash-popup .popup-filter {
    cursor: pointer;
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    transition: all 0.15s ease;
}

.crash-popup .popup-filter:hover {
    color: var(--primary-dark, #1d4ed8);
    text-decoration-style: solid;
    background: rgba(37, 99, 235, 0.1);
    padding: 0.1rem 0.3rem;
    margin: -0.1rem -0.3rem;
    border-radius: 3px;
}

.crash-popup .popup-streetview {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.crash-popup .popup-streetview a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.crash-popup .popup-streetview a:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-dark, #1d4ed8);
}

.crash-popup .popup-streetview a::before {
    content: '🛣️';
    font-size: 1rem;
}

.crash-popup .severity-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.severity-badge.fatal { background: var(--fatal-color); color: white; }
.severity-badge.serious { background: var(--serious-color); color: white; }
.severity-badge.moderate { background: var(--moderate-color); color: white; }
.severity-badge.minor { background: var(--minor-color); color: white; }
.severity-badge.none { background: var(--none-color); color: white; }

/* Report marker on map */
.report-marker-icon {
    background: var(--primary-color);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Marker cluster styles */
.marker-cluster-small {
    background-color: rgba(181, 226, 140, 0.7);
}
.marker-cluster-small div {
    background-color: rgba(110, 204, 57, 0.7);
}

.marker-cluster-medium {
    background-color: rgba(241, 211, 87, 0.7);
}
.marker-cluster-medium div {
    background-color: rgba(240, 194, 12, 0.7);
}

.marker-cluster-large {
    background-color: rgba(253, 156, 115, 0.7);
}
.marker-cluster-large div {
    background-color: rgba(241, 128, 23, 0.7);
}

.marker-cluster {
    background-clip: padding-box;
    border-radius: 20px;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 15px;
    font: 12px "Inter", sans-serif;
    font-weight: 600;
}

.marker-cluster span {
    line-height: 30px;
}

/* Active filter indicator */
.chart-card.active-filter {
    box-shadow: 0 0 0 2px var(--primary-color);
}

.chart-card.active-filter .chart-header {
    background: rgba(37, 99, 235, 0.08);
}

/* Clear filter badge */
.clear-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-left: 0.5rem;
    cursor: pointer;
}

.clear-filter-badge:hover {
    background: var(--primary-dark);
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */
@media (max-width: 1200px) {
    .sidebar {
        width: 300px;
    }

    .chart-wrapper {
        height: 160px;
    }

    .chart-wrapper-tall {
        height: 220px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }

    .search-container {
        max-width: 200px;
    }
}

@media (max-width: 768px) {
    /* Fix splash overlay top cutoff on mobile */
    .splash-overlay {
        align-items: flex-start;
        padding: 1rem;
        padding-top: max(1rem, env(safe-area-inset-top));
    }

    .splash-content {
        margin-top: 0;
        padding-bottom: 2rem;
    }

    .splash-info {
        flex-direction: column;
        align-items: center;
    }

    .splash-card {
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
    }

    .splash-header h1 {
        font-size: 1.75rem;
    }

    .splash-stats {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .splash-stat {
        min-width: 100px;
        padding: 0.75rem 1rem;
    }

    .splash-stat-number {
        font-size: 1.5rem;
    }

    .top-bar {
        height: auto;
        min-height: 50px;
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: space-between;
    }

    .brand {
        flex-shrink: 1;
        min-width: 0;
    }

    .brand-title {
        display: block;
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
    }

    .location-search-container {
        order: 10;
        flex-basis: 100%;
        max-width: 100%;
        margin: 0;
    }

    .search-container {
        order: 10;
        max-width: 100%;
        flex-basis: 100%;
    }

    .year-filter {
        display: none;
    }

    .stats-bar {
        gap: 0.35rem;
    }

    .stat-pill {
        padding: 0.25rem 0.4rem;
        font-size: 0.65rem;
    }

    /* Controls panel adjustments */
    .map-controls-panel {
        top: auto;
        bottom: 60px;
        left: 0.5rem;
        flex-direction: row;
        flex-wrap: wrap;
        max-width: calc(100% - 1rem);
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .control-section {
        flex-direction: row;
        align-items: center;
        gap: 0.35rem;
    }

    .control-label {
        display: none;
    }

    .heatmap-legend {
        border-top: none;
        border-left: 1px solid var(--border-color);
        padding-left: 0.5rem;
        padding-top: 0;
        margin-top: 0;
        margin-left: 0.25rem;
    }

    .heatmap-legend .control-label {
        display: none;
    }

    /* Leaflet controls adjustment for mobile */
    .leaflet-top.leaflet-left {
        top: 60px;
        left: 0.5rem;
    }

    .leaflet-top.leaflet-right {
        top: 60px;
        right: 0.5rem;
    }

    /* Sidebar becomes bottom drawer */
    .sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 60vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(calc(100% - 48px));
        transition: transform 0.3s ease;
        z-index: 15;
    }

    .sidebar.expanded {
        transform: translateY(0);
    }

    .sidebar.collapsed {
        width: 100%;
        transform: translateY(calc(100% - 48px));
    }

    .sidebar-tabs {
        cursor: grab;
    }

    .sidebar-collapse {
        display: none;
    }

    .sidebar-tab span {
        display: inline;
    }

    .sidebar-content {
        max-height: calc(60vh - 48px);
    }

    /* Horizontal chart carousel for analytics */
    #tab-analytics .charts-scroll {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    #tab-analytics .chart-card {
        flex: 0 0 280px;
        scroll-snap-align: center;
        min-width: 280px;
    }

    #tab-analytics .chart-wrapper {
        height: 180px;
    }

    #tab-analytics .chart-wrapper-tall {
        height: 220px;
    }

    /* Carousel indicators visible on mobile */
    .carousel-indicators {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.75rem;
        background: rgba(0, 0, 0, 0.02);
    }

    .carousel-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--border-color);
        border: none;
        padding: 0;
        cursor: pointer;
        transition: background 0.2s, transform 0.2s;
    }

    .carousel-dot.active {
        background: var(--primary-color);
        transform: scale(1.2);
    }

    /* Report form in sidebar */
    #tab-report .form-grid {
        grid-template-columns: 1fr;
    }

    #locate-fab {
        bottom: 1rem;
        right: 0.5rem;
        top: auto;
    }

    .fab {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .map-controls-panel {
        bottom: 55px;
        padding: 0.35rem;
    }

    .selection-btn {
        width: 28px;
        height: 28px;
    }

    .severity-btn {
        width: 24px;
        height: 24px;
    }

    .chart-modal-content {
        max-width: 100%;
        margin: 0.5rem;
        border-radius: 12px;
    }

    .chart-modal-body {
        height: 280px;
    }

    #tab-analytics .chart-card {
        flex: 0 0 calc(100vw - 2rem);
        min-width: calc(100vw - 2rem);
    }
}

/* Chart header buttons container */
.chart-header-buttons {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Chart search button */
.chart-search-btn {
    background: rgba(114, 142, 158, 0.15);
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chart-search-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Chart Search Modal */
.chart-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 1rem;
}

.chart-search-content {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-search-header {
    background: var(--bg-alt);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chart-search-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.chart-search-close {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.chart-search-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-color);
}

.chart-search-input-wrapper {
    background: var(--bg-alt);
    position: relative;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chart-search-icon {
    position: absolute;
    left: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

#chart-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-color);
    color: var(--text-color);
    transition: border-color 0.2s ease;
}

#chart-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chart-search-results {
    background: var(--bg-alt);
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    max-height: 400px;
}

.chart-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.chart-search-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.chart-search-item.active {
    background: rgba(37, 99, 235, 0.1);
}

.chart-search-item-label {
    font-size: 0.875rem;
    color: var(--text-color);
}

.chart-search-item-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.06);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}

.chart-search-item.active .chart-search-item-count {
    background: var(--primary-color);
    color: white;
}

.chart-search-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Exclusion badges (legend anti-filter) */
.exclusion-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    margin-left: 0.25rem;
    font-weight: 500;
}

.exclusion-label {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exclusion-clear {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0 0.125rem;
    font-size: 0.75rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.exclusion-clear:hover {
    opacity: 1;
}

.chart-card.has-exclusions .chart-header {
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* ================================
   COMMUNITY REPORT MARKERS
   ================================ */
.community-marker-icon {
    background: transparent;
    border: none;
}

.community-marker {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1.5px solid white;
}

.community-marker svg {
    width: 10px;
    height: 10px;
}

.crash-marker {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.community-marker-icon.crash {
    width: 14px;
    height: 14px;
}

.hazard-marker {
    border-radius: 4px;
    transform: rotate(0deg);
}

/* Community Report Popups */
.community-popup {
    min-width: 200px;
}

.community-popup .popup-header {
    padding: 0.5rem 0.75rem;
    margin: -1px -1px 0 -1px;
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.community-popup .popup-header.crash {
    background: #6366f1;
    color: white;
}

.community-popup .popup-header.hazard {
    background: #f97316;
    color: white;
}

.community-popup .popup-content {
    padding: 0.5rem 0;
}

.community-popup .popup-content p {
    margin: 0.25rem 0;
    font-size: 0.85rem;
}

.community-popup .submitted-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.pending-badge {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-weight: 500;
}

/* Hazard Popup Interactions */
.hazard-interactions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.upvote-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.upvote-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.upvote-btn:hover:not(:disabled) {
    background: #f0f9ff;
    border-color: #3b82f6;
}

.upvote-btn.upvoted {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.upvote-btn:disabled {
    cursor: default;
}

.upvote-icon {
    font-size: 1rem;
}

.upvote-count {
    font-weight: 600;
}

.upvote-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.comments-section {
    margin-top: 0.5rem;
}

.comments-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.comments-icon {
    font-size: 0.9rem;
}

.toggle-comments-btn {
    margin-left: auto;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    font-size: 0.75rem;
    cursor: pointer;
}

.toggle-comments-btn:hover {
    background: #f5f5f5;
}

.comments-list {
    margin-top: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
}

.comment-item {
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    border-left: 3px solid #e2e8f0;
}

.comment-item.new-comment {
    border-left-color: #22c55e;
    background: #f0fdf4;
}

.comment-text {
    font-size: 0.8rem;
    margin: 0 0 0.25rem 0;
    word-break: break-word;
}

.comment-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.loading-comments,
.no-comments {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.5rem;
}

.add-comment {
    margin-top: 0.5rem;
}

.comment-input {
    width: 100%;
    min-height: 60px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.8rem;
    resize: vertical;
    font-family: inherit;
}

.comment-input:focus {
    outline: none;
    border-color: #3b82f6;
}

.submit-comment-btn {
    margin-top: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}

.submit-comment-btn:hover:not(:disabled) {
    background: #2563eb;
}

.submit-comment-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* ================================
   USER GUIDE TOUR
   ================================ */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.tour-spotlight {
    position: absolute;
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    pointer-events: none;
}

.tour-tooltip {
    position: absolute;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 0;
    max-width: 320px;
    min-width: 280px;
    z-index: 10001;
    animation: tourFadeIn 0.3s ease;
}

@keyframes tourFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tour-tooltip-arrow {
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    z-index: -1;
}

.tour-tooltip-arrow.top {
    bottom: -8px;
    left: 50%;
    margin-left: -8px;
}

.tour-tooltip-arrow.bottom {
    top: -8px;
    left: 50%;
    margin-left: -8px;
}

.tour-tooltip-arrow.left {
    right: -8px;
    top: 50%;
    margin-top: -8px;
}

.tour-tooltip-arrow.right {
    left: -8px;
    top: 50%;
    margin-top: -8px;
}

.tour-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    border-radius: 12px 12px 0 0;
    color: white;
}

.tour-step-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.9;
}

.tour-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tour-close:hover {
    opacity: 1;
}

.tour-tooltip-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    padding: 1rem 1rem 0.5rem;
}

.tour-tooltip-content {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
    padding: 0 1rem 1rem;
}

.tour-tooltip-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0 1rem 1rem;
    justify-content: flex-end;
}

.tour-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.tour-btn-primary {
    background: var(--primary-color);
    color: white;
}

.tour-btn-primary:hover {
    background: var(--primary-dark);
}

.tour-btn-secondary {
    background: var(--bg-alt);
    color: var(--text-color);
}

.tour-btn-secondary:hover {
    background: var(--border-color);
}

.tour-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tour highlight pulse animation */
@keyframes tourPulse {
    0%, 100% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5), 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    50% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5), 0 0 0 8px rgba(37, 99, 235, 0);
    }
}

.tour-spotlight.pulse {
    animation: tourPulse 2s ease infinite;
}

/* Mobile adjustments for tour */
@media (max-width: 768px) {
    .tour-tooltip {
        max-width: calc(100vw - 2rem);
        min-width: 260px;
    }
}

/* ================================
   PRINT STYLES
   ================================ */
@media print {
    .map-controls,
    .splash-overlay,
    .loading-overlay,
    #locate-fab {
        display: none;
    }
}
