html, body {
    height: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
}


/* =========================================================
   FILTER BAR
   ========================================================= */

#filter-container {
    min-height: 50px;
    height: auto;
    background-color: #f8f9fa;

    display: flex;
    align-items: center;

    padding: 8px 15px;

    border-bottom: 1px solid #dee2e6;
    box-sizing: border-box;

    width: 100%;

    position: relative;
    z-index: 2000;

    flex-wrap: wrap;
    gap: 8px;
}

.filter-group {
    margin-right: 12px;

    display: flex;
    align-items: center;

    flex-shrink: 0;
}

.filter-group label {
    margin-right: 8px;

    font-size: 14px;
    font-weight: 600;
}

.filter-group input[type="date"] {
    padding: 4px 8px;

    border: 1px solid #ced4da;
    border-radius: 4px;

    font-size: 14px;

    box-sizing: border-box;
    max-width: 150px;
}

.filter-group input[type="checkbox"] {
    margin-right: 4px;
}

.filter-group select {
    padding: 5px 8px;

    border: 1px solid #ced4da;
    border-radius: 4px;

    font-size: 14px;

    box-sizing: border-box;
    max-width: 180px;
}

.preset-group {
    display: flex;
    margin-right: 20px;
    gap: 8px;
}

.preset-btn {
    padding: 5px 10px;

    background-color: #007bff;
    color: #fff;

    border: none;
    border-radius: 4px;

    cursor: pointer;
    font-size: 13px;
}

.preset-btn:hover {
    background-color: #0056b3;
}

#reset-filter {
    padding: 5px 12px;

    background-color: #6c757d;
    color: #fff;

    border: none;
    border-radius: 4px;

    cursor: pointer;
    font-size: 14px;

    margin-left: auto;

    flex-shrink: 0;
}

#reset-filter:hover {
    background-color: #5a6268;
}


/* =========================================================
   MAP
   ========================================================= */

#map-wrapper {
    position: relative !important;

    height: calc(100vh - 50px) !important;
    width: 100vw !important;

    margin: 0 !important;
    padding: 0 !important;

    overflow: hidden;
}

#map {
    position: absolute !important;

    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;

    width: 100% !important;
    height: 100% !important;

    display: block !important;

    background-color: #e5e5e5 !important;

    z-index: 1 !important;
}

.leaflet-popup-content-wrapper {
    box-sizing: border-box;
}

.leaflet-popup-content {
    box-sizing: border-box;

    margin: 13px 19px;

    width: auto;
}


/*
 * Your actual popup content.
 */

.popup-scroll-container {
    box-sizing: border-box;

    width: 100%;

    max-width: 100%;

    max-height: 300px;

    overflow-x: hidden;
    overflow-y: auto;

    padding-right: 5px;
}

.kv-table {
    width: 100%;

    border-collapse: collapse;

    font-size: 12px;

    table-layout: fixed;
}

.kv-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.kv-table td {
    padding: 6px 4px;

    vertical-align: top;

    border-bottom: 1px solid #ddd;

    word-break: break-word;
    overflow-wrap: anywhere;
}

.kv-table td.key-cell {
    font-weight: bold;

    color: #333;

    width: 40%;
}

.kv-nested-table {
    width: 100%;

    margin: 0;

    border: none;
}

.kv-nested-table td {
    border: none;

    padding: 2px 0;
}


/* =========================================================
   LOADING
   ========================================================= */

#loading-overlay {
    position: fixed;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    z-index: 9999;
}


/* =========================================================
   MAP LAYERS
   ========================================================= */

.dark-contour-layer {
    filter: invert(80%) contrast(150%) brightness(40%);
}


/* =========================================================
   CLUSTER PIE
   ========================================================= */

.cluster-pie-wrapper {
    background: transparent !important;

    border: none !important;
}

.cluster-pie {
    position: relative;

    border-radius: 50%;

    box-sizing: border-box;

    border: 2px solid white;

    box-shadow:
        0 2px 5px rgba(0, 0, 0, 0.35);

    display: flex;

    align-items: center;
    justify-content: center;
}

.cluster-pie-center {
    position: absolute;

    left: 50%;
    top: 50%;

    transform: translate(-50%, -50%);

    border-radius: 50%;

    background: white;

    display: flex;

    align-items: center;
    justify-content: center;

    color: #333;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;

    font-size: 12px;
    font-weight: 700;

    line-height: 1;

    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.3);

    z-index: 2;
}


/* =========================================================
   LAYERS BUTTON
   ========================================================= */

.leaflet-control-layers-button {
    width: 30px !important;
    height: 30px !important;

    line-height: 30px !important;

    padding: 0 !important;
    margin: 0 !important;

    box-sizing: border-box !important;

    font-size: 18px;

    text-align: center;

    color: #333;

    text-decoration: none;

    background: #fff;

    display: block;
}

.leaflet-control-layers-button:hover {
    background: #f4f4f4;
}

.leaflet-control-layers-button.active {
    background: #e8f4fc;

    color: #3498db;
}


/* =========================================================
   MEASURE BUTTON
   ========================================================= */

.leaflet-control-measure {
    background: #ffffff;

    width: 30px !important;
    height: 30px !important;

    box-sizing: border-box !important;

    cursor: pointer;

    display: flex;

    justify-content: center;
    align-items: center;

    border-bottom: 1px solid #ccc;

    text-decoration: none;
}

.leaflet-control-measure.active {
    background: #ffc107;
}

.leaflet-control-measure:hover {
    background: #f4f4f4;
}

.leaflet-control-measure.active:hover {
    background: #e0a800;
}


/* =========================================================
   MARKER SHADOW
   ========================================================= */

.leaflet-marker-icon {
    filter: drop-shadow(
        0 2px 3px rgba(0, 0, 0, 0.5)
    );
}


/* =========================================================
   MOBILE
   ========================================================= */

@media screen and (max-width: 600px) {

    /* -----------------------------------------------------
       FILTER BAR
       ----------------------------------------------------- */

    #filter-container {
        min-height: 0;

        padding: 6px 8px;

        display: grid;

        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);

        gap: 6px;

        align-items: center;
    }

    .filter-group {
        width: 100%;

        min-width: 0;

        margin: 0;

        display: flex;

        box-sizing: border-box;
    }

    .filter-group label {
        font-size: 12px;

        margin-right: 5px;

        white-space: nowrap;
    }

    .filter-group input[type="date"] {
        width: 100%;

        min-width: 0;

        max-width: none;

        padding: 4px 5px;

        font-size: 12px;
    }

    .filter-group select {
        width: 100%;

        min-width: 0;

        max-width: none;

        padding: 4px 5px;

        font-size: 12px;
    }


    /* Event type gets the whole row */

    .filter-group:nth-child(3) {
        grid-column: 1 / -1;

        justify-content: flex-start;
    }


    /* Time range */

    .filter-group:nth-child(4) {
        grid-column: 1;
    }


    /* Reset */

    #reset-filter {
        grid-column: 2;

        width: 100%;

        margin-left: 0;

        min-height: 30px;

        padding: 5px 8px;

        font-size: 13px;
    }


    /* -----------------------------------------------------
       MAP HEIGHT
       ----------------------------------------------------- */

    #map-wrapper {
        height: calc(100vh - 142px) !important;
    }


    /* -----------------------------------------------------
       POPUP
       ----------------------------------------------------- */

    /*
     * This is the important mobile popup section.
     *
     * Leaflet normally sets a max-width based on the map.
     * Override that here so the popup can use virtually
     * the entire phone screen.
     */

    .leaflet-popup {
        width: auto !important;

        max-width: none !important;
    }

    .leaflet-popup-content-wrapper {
        width: calc(100vw - 24px) !important;

        max-width: calc(100vw - 24px) !important;

        min-width: 0 !important;

        box-sizing: border-box;

        border-radius: 8px;
    }

    .leaflet-popup-content {
        width: auto !important;

        max-width: none !important;

        min-width: 0 !important;

        margin: 10px 14px !important;

        box-sizing: border-box;
    }

    .popup-scroll-container {
        width: 100% !important;

        max-width: 100% !important;

        max-height: 55vh;

        overflow-x: hidden;

        overflow-y: auto;

        box-sizing: border-box;
    }

    .kv-table {
        width: 100% !important;

        font-size: 11px;

        table-layout: fixed;
    }

    .kv-table td {
        padding: 5px 3px;

        word-break: break-word;

        overflow-wrap: anywhere;
    }

    .kv-table td.key-cell {
        width: 38%;
    }


    /* Larger close button for touch */

    .leaflet-popup-close-button {
        width: 32px !important;

        height: 32px !important;

        line-height: 32px !important;

        font-size: 20px !important;
    }
}


/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media screen and (max-width: 380px) {

    #filter-container {
        padding: 5px 6px;

        gap: 5px;
    }

    .filter-group label {
        font-size: 11px;
    }

    .filter-group input[type="date"],
    .filter-group select {
        font-size: 11px;

        padding: 4px;
    }

    #reset-filter {
        font-size: 12px;
    }

    #map-wrapper {
        height: calc(100vh - 136px) !important;
    }


    /*
     * Nearly full-width popup on very small screens.
     */

    .leaflet-popup-content-wrapper {
        width: calc(100vw - 14px) !important;

        max-width: calc(100vw - 14px) !important;
    }

    .leaflet-popup-content {
        margin: 9px 11px !important;
    }

    .popup-scroll-container {
        max-height: 55vh;
    }

    .kv-table {
        font-size: 10px;
    }
}
.orca-popup-top-pane {
    z-index: 99999 !important;
    pointer-events: auto !important;
}

.orca-data-popup .leaflet-popup-content-wrapper {
    min-width: 300px;
}

.orca-data-popup .leaflet-popup-content {
    width: 280px !important;
}