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

.app-shell {
    min-height: 100vh;
    padding-bottom: 0;
}

.page-title {
    margin: 0.75rem 0 0.25rem;
    text-align: center;
}

.page-subtitle {
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0 auto 0.75rem;
    max-width: 72ch;
    text-align: center;
}

.map-wrapper {
    position: relative;
}

.map-panel {
    width: 100%;
    height: min(72vh, 52rem);
    min-height: 24rem;
    border-radius: 0.5rem;
}

.map-loading {
    align-items: center;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 0.5rem;
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 1000;
}

.map-loading-inner {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.incident-table-panel {
    margin-top: 0.5rem;
}

.incident-table-toggle {
    color: #6c757d;
    cursor: pointer;
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.incident-table-toggle-hint {
    color: #6c757d;
}

.incident-table-wrapper {
    max-height: clamp(16rem, 34vh, 30rem);
    background-color: #fff;
    border-radius: 0.5rem;
    overflow: auto;
}

.incident-table {
    margin-bottom: 0;
}

.incident-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #f8f9fa;
}

.incident-row-fire {
    border-left: 4px solid #dc3545;
}

.incident-row-medical {
    border-left: 4px solid #0d6efd;
}

.incident-row-other {
    border-left: 4px solid #6c757d;
}

.incident-badge {
    font-weight: 600;
}

.incident-badge-fire {
    background-color: #dc3545;
}

.incident-badge-medical {
    background-color: #0d6efd;
}

.incident-badge-other {
    background-color: #6c757d;
}

.incident-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.incident-chip {
    border-radius: 1rem;
    color: #fff;
    display: inline-block;
    font-size: 0.85rem;
    padding: 0.25rem 0.65rem;
}

.filter-btn {
    border: none;
    cursor: pointer;
    opacity: 0.35;
    transition: opacity 0.15s;
}

.filter-btn.filter-btn-active {
    opacity: 1;
}

.incident-row-selected {
    outline: 2px solid #ffc107;
    outline-offset: -2px;
}

.refresh-badge {
    color: #6c757d;
    font-size: 0.8rem;
    margin-left: auto;
    padding: 0.25rem 0;
}

.site-footer {
    border-top: 1px solid #dee2e6;
    color: #6c757d;
    font-size: 0.85rem;
    margin-top: 1rem;
    padding: 0.75rem 0;
    text-align: center;
}

.site-footer a {
    color: #6c757d;
}

.site-footer-sep {
    margin: 0 0.4rem;
}

.incident-chip-fire {
    background-color: #dc3545;
}

.incident-chip-medical {
    background-color: #0d6efd;
}

.incident-chip-other {
    background-color: #6c757d;
}

/*
 * Always set the map height explicitly to define the size of the div element
 * that contains the map.
 */
#map {
    width: 100%;
}

/* ---- Settings panel ---- */

.map-settings-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1001;
}

.map-settings-btn {
    background: #fff;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 7px;
    transition: background 0.15s;
}

.map-settings-btn:hover {
    background: #f4f4f4;
}

.map-settings-panel {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    min-width: 230px;
    padding: 0.6rem 0.75rem;
    position: absolute;
    right: 0;
    top: calc(100% + 5px);
}

.map-settings-title {
    color: #6c757d;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.map-settings-item {
    align-items: center;
    cursor: pointer;
    display: flex;
    font-size: 0.875rem;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    user-select: none;
}

.map-settings-item:last-child {
    margin-bottom: 0;
}

.map-settings-item input[type="checkbox"] {
    cursor: pointer;
}

/* ---- Dark mode ---- */

html.dark-mode body {
    background-color: #1e2124;
    color: #dee2e6;
}

html.dark-mode .page-subtitle {
    color: #adb5bd;
}

html.dark-mode .map-loading {
    background: rgba(20, 20, 25, 0.85);
    color: #dee2e6;
}

html.dark-mode .incident-table-panel summary {
    color: #adb5bd;
}

html.dark-mode .incident-table-toggle-hint {
    color: #6c757d;
}

html.dark-mode .incident-table-wrapper {
    background-color: #2c2f33;
}

html.dark-mode .incident-table {
    --bs-table-bg: #2c2f33;
    --bs-table-color: #dee2e6;
    --bs-table-border-color: #3d4045;
    --bs-table-hover-bg: #343a40;
    --bs-table-hover-color: #dee2e6;
}

html.dark-mode .incident-table thead th {
    background-color: #343a40;
    color: #dee2e6;
}

html.dark-mode .refresh-badge {
    color: #adb5bd;
}

html.dark-mode .site-footer {
    border-color: #3d4045;
    color: #6c757d;
}

html.dark-mode .site-footer a {
    color: #6c757d;
}

html.dark-mode .alert-warning {
    background-color: #3d3000;
    border-color: #5c4800;
    color: #ffe066;
}

html.dark-mode .map-settings-btn {
    background: #2c2f33;
    border-color: #555;
    color: #dee2e6;
}

html.dark-mode .map-settings-btn:hover {
    background: #343a40;
}

html.dark-mode .map-settings-panel {
    background: #2c2f33;
    border-color: #4a4d52;
    color: #dee2e6;
}

html.dark-mode .map-settings-title {
    color: #adb5bd;
}

@media (min-width: 1200px) {
    .map-panel {
        height: min(74vh, 56rem);
    }

    .map-loading {
        border-radius: 0.5rem;
    }

    .incident-table-wrapper {
        max-height: clamp(18rem, 28vh, 24rem);
    }
}

@media (max-width: 767.98px) {
    .incident-table-wrapper {
        max-height: none;
        overflow: visible;
    }

    .incident-table thead {
        display: none;
    }

    .incident-table,
    .incident-table tbody,
    .incident-table tr,
    .incident-table td {
        display: block;
        width: 100%;
    }

    .incident-table tr {
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        margin-bottom: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .incident-table td {
        border: 0;
        border-bottom: 1px solid #f1f3f5;
        display: flex;
        gap: 0.5rem;
        justify-content: space-between;
        padding: 0.45rem 0;
        text-align: right;
    }

    .incident-table td:last-child {
        border-bottom: 0;
    }

    .incident-table td::before {
        color: #495057;
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
    }
}

