:root {
    --table-w: 300px;
    --table-offset: 0px;
}

body.table-open {
    --table-offset: var(--table-w);
}

body.panel-open .layer-strip {
    right: 230px;
}

#html, body {
    padding: 0;
    margin: 0;
    height: 100%;
    width: 100%;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: left 0.3s ease, width 0.3s ease;
}

#map.slide-right {
    left: 300px;
    width: calc(100% - 300px);
}

@media (max-width: 768px) {
    .hidden-by-table {
        visibility: hidden !important;
        opacity: 0;
        transition: visibility 0.2s, opacity 0.2s;
    }
}

.header-container {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    max-width: 30vw;
    text-align: center;
}

#weatherwalay-logo {
    width: 100%;
    max-width: 270px;
    height: auto;
    display: block;
}

#clocktime {
    position: absolute;
    right: 10px;
    top: 10px;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    text-align: justify;
    font-weight: bold;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    background-color: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#clocktime {
    position: absolute;
    right: 10px;
    top: 10px;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-weight: bold;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
}

/* Slide out to the right when panel opens */
#clocktime.exiting-overlay {
    animation: clockExitRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Slide in from the right when panel closes */
#clocktime.entering-overlay {
    animation: clockEnterRight 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes clockExitRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

@keyframes clockEnterRight {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Slide down into panel */
#clocktime.in-panel {
    position: relative;
    top: auto;
    right: auto;
    width: calc(100% - 16px);
    margin: 6px 8px 2px;
    animation: clockSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Slide up out of panel */
#clocktime.leaving-panel {
    animation: clockSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes clockSlideIn {
    from { opacity: 0; transform: translateY(-100%); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes clockSlideOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-100%); }
}

.rp-clock-slot {
    min-height: 38px;
    overflow: hidden;
    margin-bottom: 2px;
}

#clocktime.dark-mode  { color: #fff; background: rgba(0,0,0,0.15);    border: 1px solid rgba(255,255,255,0.1); }
#clocktime.light-mode { color: #000; background: rgba(255,255,255,0.4); border: 1px solid rgba(0,0,0,0.1); }

#update-time {
    padding: 4px;
    text-align: center;
    user-select: none;
    line-height: 1.2rem;
    font-size: 1em;
}

.status-dot {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    vertical-align: middle;
}

.status-dot {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    vertical-align: middle;
}

#categoryContainer { display: none !important; }

#parameterSelect {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
    overflow: hidden;
}

.category-container { display: flex; flex-direction: column; }

.category-btn {
    margin: 3px;
    padding: 5.5px;
    border: none;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    user-select: none;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
}

.category-btn.light-mode { background:#f5f5f5; color:#3f4141; }
.category-btn.dark-mode  { background:#2b3e4e; color:#fff; }

body:not(.dark-mode) .category-btn:hover { color:#0952DF; transform:scale(1.02); box-shadow:0 2px 5px rgba(0,0,0,.15); transition:.4s; }
.dark-mode .category-btn:hover           { color:#ffb001; transform:scale(1.02); box-shadow:0 2px 5px rgba(0,0,0,.15); transition:.4s; }
body:not(.dark-mode) .category-btn.selected { background:#0952DF; color:#fff; }
.dark-mode .category-btn.selected           { background:#ffb001; color:#000; }

.metay.light-mode { color:#0952DF; }
.metay.dark-mode  { color:#ffb001; }

.mapboxgl-ctrl-group { border-radius: 4px 4px 0 0 !important; }

.reset-button {
    position: absolute;
    width: 29px;
    height: 29px;
    top: 96px;
    left: calc(10px + var(--table-offset));
    z-index: 999;
    background-color: #fff;
    box-shadow: -2px 0 0 0 rgba(0,0,0,.1), 2px 0 0 0 rgba(0,0,0,.1);
    border: none;
    border-top: 1px solid #ddd;
    padding: 5px 8px;
    transition: background-color 0.3s ease;
}

.reset-button:hover { background-color: #f0f0f0; }
.reset-icon         { font-size: 12px; }

.basemap-button {
    width: 29px;
    height: 29px;
    background-color: #fff;
    box-shadow: -2px 0 0 0 rgba(0,0,0,.1), 2px 0 0 0 rgba(0,0,0,.1), 0 2px 0 0 rgba(0,0,0,.1);
    border: none;
    border-top: 1px solid #ddd;
    transition: background-color 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}


.basemap-button:hover             { background-color: #f0f0f0; }
.basemap-button img               { width:22px; height:22px; display:block; }
.basemap-button.selected img               { content:url('Logos/Light Basemap Highlighted.png'); }
.basemap-button.selected.dark-basemap img  { content:url('Logos/Dark Basemap Highlighted.png'); }

/* Basemap toggle inside panel — circular globe buttons */
.rp-basemap-row {
    display: flex;
    gap: 12px;
    padding: 10px 8px;
    justify-content: center;
}
.rp-basemap-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    background: none;
    padding: 0;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.rp-basemap-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    pointer-events: none;
}
.rp-basemap-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.table-icon {
    position: absolute;
    width: 29px;
    height: 29px;
    top: 125px;
    left: calc(10px + var(--table-offset));
    z-index: 1000;
    background-color: #fff;
    box-shadow: -2px 0 0 0 rgba(0,0,0,.1), 2px 0 0 0 rgba(0,0,0,.1), 0 2px 0 0 rgba(0,0,0,.1);
    border: none;
    border-top: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    padding: 5px 8px;
    transition: background-color 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.table-icon:hover { background-color: #f0f0f0; }
.table-icon img   { max-width:125%; max-height:125%; object-fit:contain; }

.table-bar {
    position: fixed;
    font-size: 12px;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: linear-gradient(135deg, #ffffff, #cccccc, #9d9d9dbd);
    z-index: 999;
    transition: left 0.3s ease;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.table-bar::-webkit-scrollbar { display: none; }
.dark-mode .table-bar { background: linear-gradient(135deg, #5d627d, #24324f, #171e2f); }
.table-bar.active { left: 0; }

#table-container {
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,.386);
    border-radius: 8px;
    padding: 10px;
    user-select: none;
}

#station-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
    font-family: 'Poppins', sans-serif;
    user-select: none;
}

#station-table th, #station-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
}

#station-table th {
    background-color: #e5e5e9;
    font-weight: bold;
    color: #535862;
    line-height: 16px;
    position: relative;
}

.dark-mode #station-table th { background:#091d2f; color:white; }
#station-table tr             { background:#fff; color:#3f4141; }
.dark-mode #station-table tr  { background:#2b3e4e; color:white; }
#station-table tr:hover            { background:#f5f5f5; }
.dark-mode #station-table tr:hover { background:#4a6072; }

#station-table tr.rain-background { background-image:url('Logos/rain-animation.gif'); background-size:cover; background-position:center; }
#station-table tr.wind-background { background-image:url('Logos/wind_animation.gif'); background-size:cover; background-position:center; }
#station-table th:nth-child(2), #station-table td:nth-child(2) { text-align:center; }

table.dataTable.order-column tbody tr > .sorting_1,
table.dataTable.order-column tbody tr > .sorting_2,
table.dataTable.display tbody tr > .sorting_1,
table.dataTable.display tbody tr > .sorting_2 { background-color: transparent !important; }

.dataTables_wrapper .dataTables_filter {
    width:100% !important; height:100% !important; font-size:12px !important;
    border-radius:8px !important; border:none !important; background-color:#ececec !important;
    color:#3f4141 !important; font-family:'Poppins',sans-serif !important;
    margin:0 !important; margin-bottom:8px !important;
}

.dark-mode .dataTables_wrapper .dataTables_filter { background:#2b3e4e !important; color:#fff !important; }
.dataTables_wrapper .dataTables_filter input { width:100% !important; height:100% !important; padding:8px !important; margin:0 !important; }
.dataTables_filter label { margin:0 !important; height:100% !important; width:100% !important; }
.dataTables_wrapper .dataTables_info { color:#3f4141 !important; }
.dark-mode .dataTables_wrapper .dataTables_info { color:#fff !important; }

table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc,
table.dataTable thead .sorting_asc_disabled,
table.dataTable thead .sorting_desc_disabled { position:relative; padding-right:20px !important; }

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after { font-family:'FontAwesome'; position:absolute; right:5px; top:50%; transform:translateY(-50%); font-size:15px; }

table.dataTable thead .sorting:after       { content:"\f0dc"; background:#e5e5e9; color:#636363; }
table.dataTable thead .sorting_asc:after   { content:"\f0de"; background:#e5e5e9; color:#ffb001; }
table.dataTable thead .sorting_desc:after  { content:"\f0dd"; background:#e5e5e9; color:#ffb001; }

.dark-mode .dataTable thead .sorting:after      { background:#091d2f; color:#fff; }
.dark-mode .dataTable thead .sorting_asc:after  { background:#091d2f; color:#ffb001; }
.dark-mode .dataTable thead .sorting_desc:after { background:#091d2f; color:#ffb001; }

.second-table-row { width:100%; padding:8px !important; }
.second-table-row td  { line-height:1.2 !important; cursor:context-menu !important; text-align:center !important; flex:1; border:none !important; }
.second-table-row tr  { display:flex; align-items:center; justify-content:center; border-bottom:1px solid #ddd; }
.second-table-row th  { font-size:14px; font-weight:bold; color:#333; text-align:center !important; line-height:1.0 !important; cursor:context-menu !important; flex:1; }

.station-type, .last-sync { font-size:10px; font-weight:normal; }
.parameter-name           { font-size:8px; color:#0952DF; }
.dark-mode .parameter-name { color:#ffb001; }
.parameter-value { font-size:24px; font-weight:700; }
.parameter-unit  { font-size:8px; }
.pm-value        { text-align:left !important; margin:0; color:#0952DF; }
.dark-mode .pm-value { color:#ffb001; }

.footer-container {
    position: absolute;
    display: none;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    z-index: 1000;
    user-select: none;
}

#animation-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 8px;
    color: white;
    margin-bottom: 10px;
    font-family: 'Poppins', sans-serif;
}

.timeline-container { position:relative; width:100%; }

#timeline-slider {
    -webkit-appearance: none;
    height: 10px;
    min-width: 50vw;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 2px rgba(0,0,0,.8);
}

#timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: clamp(12px,2.2vh,20px);
    height: clamp(12px,2.2vh,20px);
    background: crimson;
    border-radius: 50%;
    cursor: pointer;
    border: 4px solid white;
    box-shadow: 0 0 4px rgba(0,0,0,.9);
}

#timeline-slider::-moz-range-thumb {
    width: clamp(12px,2.2vh,20px);
    height: clamp(12px,2.2vh,20px);
    background: crimson;
    border-radius: 50%;
    cursor: pointer;
    border: 4px solid white;
    box-shadow: 0 0 4px rgba(0,0,0,.9);
}

#timestamp {
    position: absolute;
    top: -35px;
    background: crimson;
    color: white;
    padding: 2px 8px;
    border-radius: 25px;
    font-size: 12px;
    width: 135px;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
}

@media (max-width:768px) {
    #timestamp { font-size:10px; width:110px; padding:2px 4px; }
}

.controls {
    display: flex;
    gap: 5px;
    margin-top: 12px;
    border: 1px solid rgb(75,75,75);
    border-radius: 50px;
    padding: 6px 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,.3);
}

.control-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50px;
    min-width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 5px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: rgba(0,0,0,0.4);
}

#speed-btn { text-indent:0; font-weight:bold; color:white; }

.control-btn:hover {
    transform: translateY(-1.5px);
    filter: brightness(1.2);
    box-shadow: 0 6px 12px rgba(0,0,0,.3);
    background-color: rgba(255,176,1,0.8);
    color: #0952df !important;
}

.control-btn:active { transform:translateY(0); transition:transform 0.05s ease; }
.play-btn.playing   { background-image:url('Logos/Pause.png') !important; }

#refresh-btn:disabled {
    cursor: wait;
    opacity: 0.6;
    transform: none;
    pointer-events: none;
    animation: spin-ccw 1s linear infinite;
}

@keyframes spin-ccw { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }

.legend-container {
    position: absolute;
    max-width: 15vw;
    max-height: 50vh;
    aspect-ratio: 305/1720;
    left: calc(10px + var(--table-offset));
    bottom: 35px;
    z-index: 1000;
    box-sizing: border-box;
    user-select: none;
}

.station-filters {
    font-family: 'Poppins', sans-serif;
    margin-bottom: 5px;
    padding: 5.5px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,.15);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    justify-content: center;
    align-items: center;
    user-select: none;
}

.station-filters.light-mode { background:#f5f5f5; color:#3f4141; }
.station-filters.dark-mode  { background:#2b3e4e; color:#fff; }
.station-filters label { font-size:12px; display:flex; align-items:center; cursor:pointer; }
.station-filters input[type="checkbox"] { margin-right:6px; width:16px; height:16px; }
body:not(.dark-mode) .station-filters input[type="checkbox"] { accent-color:#0952DF; }
.dark-mode .station-filters input[type="checkbox"]           { accent-color:#ffa500; }
.station-filters label:hover           { color:#0952DF; }
.station-filters.dark-mode label:hover { color:#ffa500; }

.export-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    border-radius: 10px;
    padding: 5.5px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,.15);
    user-select: none;
}

.export-controls.light-mode { color:#3f4141; background:#f5f5f5; }
.export-controls.dark-mode  { color:#fff;    background:#2b3e4e; }

.export-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
    text-align: left;
    font-family: 'Poppins', sans-serif;
}

.export-btn:hover                      { color:#ffb001; transform:translateY(-1px); }
body:not(.dark-mode) .export-btn:hover { color:#0952DF; }

.export-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(30,41,59,0.95);
    backdrop-filter: blur(10px);
    border: 1px solid #334155;
    color: #f1f5f9;
    padding: 12px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    min-width: 100px;
    max-width: 250px;
}

.export-notification.show    { transform: translateX(0); }
.export-notification.success { border-color:#10b981; background:rgba(16,185,129,0.9); }
.export-notification.error   { border-color:#ef4444; background:rgba(239,68,68,0.9); }
.export-notification.info    { border-color:#3b82f6; background:rgba(59,130,246,0.9); }
.notification-icon { font-size:16px; flex-shrink:0; }
.notification-text { flex:1; word-break:break-word; }

.mapboxgl-popup-content {
    background: transparent;
    border-radius: 3px;
    box-shadow: none;
    padding: 0;
    pointer-events: auto;
    position: relative;
}

.station-tooltip {
    background: linear-gradient(135deg, #2258ac, #1E3A3A, #01213d);
    color: #ffb000;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,.403);
    padding: 10px;
    font-family: 'Poppins', sans-serif;
    text-align: center;
    display: flex;
    font-size: 15px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.station-tooltip .value      { font-size:20px; padding-top:5px; color:white; }
.station-tooltip .small-text { font-size:10px; margin-top:10px; color:#eeeee4; line-height:0.2; }
.unit { font-size:14px; font-weight:bold; }

.compass {
    display:flex; justify-content:center; align-items:center;
    width:80px; height:80px; border-radius:100%;
    box-shadow:0 0 10px rgba(0,0,0,.85);
    position:relative; font-family:'Dosis',sans-serif;
    color:#555; text-shadow:1px 1px 1px white;
    margin-top:10px; margin-bottom:10px;
}

.compass::before { font-weight:bold; position:absolute; text-align:center; width:100%; content:"N"; font-size:14px; top:-2px; }

.compass .direction {
    height:100%; width:100%; display:block;
    background:#f2f6f5;
    background:-webkit-linear-gradient(top,#f2f6f5 0%,#cbd5d6 100%);
    border-radius:100%;
}

.compass .direction p {
    text-align:center; margin:0; padding:0; position:absolute; top:50%; left:0;
    width:100%; height:100%; line-height:80px; display:block;
    margin-top:-45px; font-size:28px; font-weight:bold;
}

.compass .direction p span { display:block; line-height:normal; margin-top:-24px; font-size:12px; text-transform:uppercase; font-weight:bold; }
.compass .arrow { width:100%; height:100%; display:block; position:absolute; top:0; }
.compass .arrow::after {
    content:""; width:0; height:0;
    border-left:5px solid transparent; border-right:5px solid transparent;
    border-bottom:10px solid red;
    position:absolute; top:-6px; left:50%; margin-left:-5px; z-index:99;
}

.pressure-trend-arrow { font-family:Arial,sans-serif !important; font-size:30px; line-height:1; display:inline-block; vertical-align:middle; }
.neutral-arrow     { color:#0DF906; }
.rising-arrow      { color:skyblue; }
.falling-arrow     { color:yellow; }
.strong-rise-arrow { color:#0061ff; }
.strong-fall-arrow { color:#F94306; }
.sharp-rise-arrow  { color:#A906F9; }
.sharp-fall-arrow  { color:#F90706; }

.info-container {
    text-align:left; margin-top:10px; padding:15px;
    background:#ff7b3c; color:#fff; border-radius:5px;
    font-family:Poppins,sans-serif; max-width:300px;
    position:relative; z-index:1000;
    opacity:0; visibility:hidden;
    transition:opacity 1s ease, visibility 0s ease 1s;
    display:none;
}

.info-container.show { opacity:1; visibility:visible; display:block; transition:opacity 1s ease, visibility 0s ease; }
.info-container i    { font-size:20px; color:#fff; margin-right:10px; }

.ring-container { position:absolute; width:30px; height:30px; }
.ring-animation {
    position:absolute; width:10px; height:10px;
    margin-top:-2px; margin-left:-2px;
    border-radius:50%; border:2px solid;
    animation:ringPulse 2s infinite ease-out;
}
.central-point { position:absolute; width:6px; height:6px; background-color:inherit; border-radius:50%; }

@keyframes ringPulse {
    0%   { transform:scale(0.5); opacity:1; }
    100% { transform:scale(3);   opacity:0; }
}

.custom-marker { cursor:pointer; }

.radar-marker {
    background-color: #CC1427;
    border: 3px solid white;
    border-radius: 50%;
    width: 14px; height: 14px;
    box-shadow: 0 0 10px rgba(204,20,39,0.5);
    cursor: pointer;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.radar-marker.hidden { display:none; }

.opacity-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: linear-gradient(to right, rgba(0,0,0,0.15), rgba(0,0,0,0.7));
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    margin: 4px 0 8px 0;
}

.dark-mode .opacity-slider {
    background: linear-gradient(to right, rgba(255,255,255,0.1), rgba(255,255,255,0.8));
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width:1.3rem; height:1.3rem;
    background:#CC1427; border-radius:50%;
    cursor:pointer; border:2px solid white;
    box-shadow:0 2px 6px rgba(0,0,0,.3);
    transition:transform 0.1s ease;
}

.opacity-slider::-webkit-slider-thumb:hover { transform:scale(1.2); }

.opacity-slider::-moz-range-thumb {
    width:1.3rem; height:1.3rem;
    background:#CC1427; border-radius:50%;
    cursor:pointer; border:2px solid white;
    box-shadow:0 2px 6px rgba(0,0,0,.3);
}

.radar-options { display:flex; flex-direction:column; gap:6px; }

.radar-location-btn,
.radar-type-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 7px 10px;
    color: rgba(255,255,255,0.45);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    letter-spacing: 0.4px;
    box-sizing: border-box;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    font-family: 'Poppins', sans-serif;
}

.radar-location-btn::after,
.radar-type-btn::after {
    content: '';
    flex-shrink: 0;
    width: 30px; height: 17px;
    border-radius: 9px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    transition: background 0.22s, border-color 0.22s;
    box-shadow: inset -13px 0 0 2px rgba(255,255,255,0.3);
}

.radar-location-btn.active::after,
.radar-type-btn.active::after {
    background: #0665ff;
    border-color: #0665ff;
    box-shadow: inset 13px 0 0 2px rgba(255,255,255,0.9);
}

.radar-location-btn.active,
.radar-type-btn.active {
    background: rgba(6,101,255,0.12);
    border-color: rgba(6,101,255,0.4);
    color: white;
}

.radar-location-btn.last-active { opacity:0.5; cursor:not-allowed; }

.radar-controls-disabled .radar-location-btn,
.radar-controls-disabled .radar-type-btn,
.radar-controls-disabled .opacity-slider {
    opacity: 0.2;
    cursor: not-allowed;
    pointer-events: none;
}

.radar-marker-popup .mapboxgl-popup-content { background:transparent !important; padding:0 !important; box-shadow:none !important; }

.layer-strip {
    background: rgba(0,0,0,.8);
    border: 1px solid hsla(0,0%,100%,.3);
    border-radius: 21px;
    width: 44px;
    position: fixed;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    z-index: 1100;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 13px 0;
    box-shadow: -3px 0 16px rgba(0,0,0,0.35);
    pointer-events: auto;
}

.layer-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    border-radius: 10px;
    padding: 6px;
    margin: 2.5px 3px;
    transition: background 0.18s ease;
}

.layer-btn img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
    transition: filter 0.18s ease, transform 0.18s ease;
}

.layer-btn.active img {
    filter: none !important;
}

.layer-btn svg {
    color: rgba(255,255,255,0.65);
    transition: color 0.18s ease;
}

.layer-btn:hover            { background: #0952df; border-radius: 50%; }
.layer-btn:hover img        { filter: brightness(0) invert(1); }
.layer-btn.active           { background: #0952df; border-radius: 50%; }

.layer-tooltip {
    position: absolute;
    right: calc(100% + 5px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
    background: rgba(0,0,0,0.8);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    padding: 5px 15px 5px 10px;
    border-radius: 25px 0 0 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.layer-btn:hover .layer-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.layer-close-btn {
    display: none;
}

.layer-close-btn.visible {
    display: flex;
}

.right-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 220px;
    height: 100%;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    font-family: 'Poppins', sans-serif;
    overflow: hidden;
    padding: 1rem .5rem 1rem .5rem;
    transform: translateX(110%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.right-panel.open {
    transform: translateX(0);
}

body:not(.dark-mode) .right-panel {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-left: 1px solid rgba(0,0,0,0.08);
    box-shadow: -6px 0 20px rgba(0,0,0,0.08);
}

.dark-mode .right-panel {
    background: rgba(12,20,33,0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-left: 1px solid rgba(255,255,255,0.07);
    box-shadow: -6px 0 20px rgba(0,0,0,0.4);
}

.rp-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: transparent !important;
    pointer-events: none !important;
    transition: none;
}

.rp-backdrop.visible {
    pointer-events: auto !important;
    background: transparent !important;
}

.rp-header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    user-select: none;
}



.rp-logo {
    max-width: 20rem;
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

.rp-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.rp-body::-webkit-scrollbar       { width: 3px; }
.rp-body::-webkit-scrollbar-track { background: transparent; }
.rp-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
.dark-mode .rp-body::-webkit-scrollbar-thumb { background: #334155; }

.rp-group-label {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    padding: 5px;
    border: 1px solid #ffb001;
    border-radius: 6px 6px 0 0;
    color: #0952DF;
    padding: 8px;
}

.dark-mode .rp-group-label {
    color: rgba(255,255,255,0.7);
    border-color: #3471b9;
}

.rp-section {
    padding: 6px 10px 6px;
    border: 1px solid #ffb001;
    border-top: none;
    border-radius: 0 0 6px 6px;
    margin-bottom: 4px;
}

.dark-mode .rp-section { border-color: #3471b9; }

.rp-param {
    border-bottom: 1px solid rgba(0,0,0,0.045);
    border-right: 1px solid #ffb001;
    border-left: 1px solid #ffb001;
}

.dark-mode .rp-param {
    border-right-color: #3471b9;
    border-left-color: #3471b9;
    border-bottom-color: rgba(255,255,255,0.045);
}

.rp-param-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.13s;
}

.rp-param-header:hover                          { background: #e3f2fd }
.dark-mode .rp-param-header:hover               { background: rgba(255,176,1,0.05); }
.rp-param.active > .rp-param-header            { background: #e3f2fd }
.dark-mode .rp-param.active > .rp-param-header { background: rgba(255,176,1,0.06); }

.rp-param-name {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
}

body:not(.dark-mode) .rp-param-name        { color: #1e293b; }
.dark-mode .rp-param-name                   { color: rgba(255,255,255,0.82); }
.rp-param.active .rp-param-name            { font-weight: 700; color: #0952DF; }
.dark-mode .rp-param.active .rp-param-name { color: #ffb001; }

.rp-param-chevron {
    font-size: 16px;
    font-weight: 400;
    color: #94a3b8;
    line-height: 1;
    transition: color 0.18s;
    flex-shrink: 0;
    min-width: 16px;
    text-align: center;
}

.rp-param.open .rp-param-chevron            { color: #0952DF; }
.dark-mode .rp-param.open .rp-param-chevron { color: #ffb001; }

.rp-param-cats {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 8px 0 30px;
}

.rp-cat-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    margin-bottom: 5px;
    border: none;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 11.5px;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    user-select: none;
}

body:not(.dark-mode) .rp-cat-btn        { background: rgba(255, 255, 255);    color: #475569; border-left: 3px solid #0952DF;}
body:not(.dark-mode) .rp-cat-btn:hover  { background: #f8f9fa; color: #0952DF; }
body:not(.dark-mode) .rp-cat-btn.active { background: #0952DF;             color: white; font-weight: 600; }
body:not(.dark-mode) .rp-param.open .rp-param-cats { background: #e3f2fd }
.dark-mode .rp-cat-btn        { background: rgba(13, 20, 34); color: rgba(255,255,255,0.52); border-left: 3px solid #ffb001;}
.dark-mode .rp-cat-btn:hover  { background: rgba(255,176,1,0.1);   color: #ffb001; }
.dark-mode .rp-cat-btn.active { background: #ffb001;               color: #000; font-weight: 600; }
.dark-mode .rp-param.open .rp-param-cats { background: rgba(255,176,1,0.06); }

.rp-toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0 10px; cursor: pointer; user-select: none;
}

.rp-toggle-label { font-size: 11px; font-weight: 700; }
body:not(.dark-mode) .rp-toggle-label { color: #0952DF; }
.dark-mode .rp-toggle-label           { color: rgba(255,255,255,0.7); }

.rp-pill {
    width: 36px; height: 20px;
    border-radius: 10px;
    flex-shrink: 0;
    transition: background 0.22s, box-shadow 0.22s;
}

body:not(.dark-mode) .rp-pill {
    background: rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.15);
    box-shadow: inset -16px 0 0 2px rgba(80,80,80,0.4);
}

body:not(.dark-mode) .rp-pill.on {
    background: #0665ff;
    border-color: #0665ff;
    box-shadow: inset 16px 0 0 2px rgba(255,255,255,0.95);
}

.dark-mode .rp-pill {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: inset -16px 0 0 2px rgba(255,255,255,0.35);
}

.dark-mode .rp-pill.on {
    background: #0665ff;
    border-color: #0665ff;
    box-shadow: inset 16px 0 0 2px rgba(255,255,255,0.9);
}

.rp-sub       { margin-top: 8px; }
.rp-sub-label { font-size: 11px; font-weight: 700; margin: 0 0 6px; }
body:not(.dark-mode) .rp-sub-label { color: #0952DF; }
.dark-mode .rp-sub-label           { color: rgba(255,255,255,0.7); }

.radar-options { display: flex; flex-direction: column; gap: 5px; }

.radar-location-btn,
.radar-type-btn {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%;
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 11px; font-weight: 500; font-family: 'Poppins', sans-serif;
    cursor: pointer; text-align: left; letter-spacing: 0.3px;
    box-sizing: border-box;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

body:not(.dark-mode) .radar-location-btn,
body:not(.dark-mode) .radar-type-btn {
    background: rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.08); color: #475569;
}

.dark-mode .radar-location-btn,
.dark-mode .radar-type-btn {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.45);
}

.radar-location-btn::after,
.radar-type-btn::after {
    content: '';
    flex-shrink: 0;
    width: 30px; height: 17px; border-radius: 9px;
    transition: background 0.2s, box-shadow 0.2s;
    background: rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: inset -12px 0 0 2px rgba(255,255,255,0.5);
}

.dark-mode .radar-location-btn::after,
.dark-mode .radar-type-btn::after {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.1);
    box-shadow: inset -12px 0 0 2px rgba(255,255,255,0.3);
}

.radar-location-btn.active::after,
.radar-type-btn.active::after {
    background: #0665ff; border-color: #0665ff;
    box-shadow: inset 12px 0 0 2px rgba(255,255,255,0.9);
}

.radar-location-btn.active,
.radar-type-btn.active {
    border-color: rgba(6,101,255,0.35); color: #0952DF;
}

body:not(.dark-mode) .radar-location-btn.active { background: rgba(9,82,223,0.07); }

.dark-mode .radar-location-btn.active,
.dark-mode .radar-type-btn.active {
    background: rgba(6,101,255,0.12); color: white;
}

.radar-location-btn.last-active { opacity: 0.5; cursor: not-allowed; }

.radar-controls-disabled .radar-location-btn,
.radar-controls-disabled .radar-type-btn,
.radar-controls-disabled .opacity-slider {
    opacity: 0.2; cursor: not-allowed; pointer-events: none;
}

.rp-check-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    font-family: 'Poppins', sans-serif; user-select: none;
}

.rp-check-grid label { font-size: 11.5px; display: flex; align-items: center; cursor: pointer; padding: 4px 0; }
body:not(.dark-mode) .rp-check-grid label { color: #475569; }
.dark-mode .rp-check-grid label           { color: rgba(255,255,255,0.6); }
.rp-check-grid input[type="checkbox"] { margin-right: 6px; width: 14px; height: 14px; }
body:not(.dark-mode) .rp-check-grid input[type="checkbox"] { accent-color: #0952DF; }
.dark-mode .rp-check-grid input[type="checkbox"]           { accent-color: #ffb001; }
body:not(.dark-mode) .rp-check-grid label:hover { color: #0952DF; }
.dark-mode .rp-check-grid label:hover           { color: #ffb001; }

.rp-export-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 4px;
}

.rp-export-btn {
    border-radius: 7px; padding: 7px 6px;
    font-size: 11px; font-family: 'Poppins', sans-serif;
    cursor: pointer; text-align: left;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
}

body:not(.dark-mode) .rp-export-btn       { background: rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.08); color: #475569; }
body:not(.dark-mode) .rp-export-btn:hover { background: #0952DF; color: white; border-color: #0952DF; }
.dark-mode .rp-export-btn                 { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
.dark-mode .rp-export-btn:hover           { background: #ffb001; color: #000; border-color: #ffb001; }

.meta-icon, .meta-bar, #radar-control-panel, .radar-panel, .radar-menu { display: none !important; }

.table-icon,
.reset-button,
.legend-container,
.header-container,
.footer-container {
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.table-open .header-container { left: calc(50% + var(--table-w) / 2) !important; }
body.table-open .footer-container { left: calc(50% + var(--table-w) / 2) !important; }