:root {
    color-scheme: light;

    --bg: #f1f5f9;
    --surface: rgba(255, 255, 255, .94);
    --surface-solid: #ffffff;
    --surface-input: #f1f5f9;
    --surface-hover: #e2e8f0;

    --text: #1e293b;
    --text-strong: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    --border: #0f172a18;
    --border-strong: #0f172a25;
    --shadow: #0002;

    --primary: #01283c;
    --primary-contrast: #ffffff;
    --accent: #0284c7;

    --success: #16a34a;
    --danger: #dc2626;

    --popup-bg: #ffffff;
    --popup-text: #0f172a;
    --popup-muted: #64748b;

    --map-control-bg: #ffffffee;
    --map-control-hover: #e2e8f0;
    --detail-card-bg: #f1f5f9;
}

* {
    box-sizing: border-box;
}

html,
body,
#map {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

#map {
    position: absolute;
    inset: 0;
}

.floating-panel {
    position: absolute;
    z-index: 4;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    backdrop-filter: blur(18px);
}

.search-panel {
    top: 16px;
    left: 16px;
    width: min(390px, calc(100vw - 32px));
    padding: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 13px;
}

.brand-logo {
    width: auto;
    height: 30px;
}

.brand b,
.brand small {
    display: block;
}

.brand b {
    font-size: 14px;
}

.brand small {
    font-size: 9px;
    color: var(--text-subtle);
    margin-top: 2px;
}

.search-wrap {
    height: 43px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-muted);
}

.search-wrap svg {
    width: 15px;
    height: 15px;
    stroke-width: 1.8;
}

.search-wrap input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-strong);
    font: inherit;
    transition: all 0.3s ease;
    font-size: 13px;
}

.search-wrap input::placeholder {
    color: var(--text-subtle);
}

.search-panel-footer {
    display: flex;
    margin-top: 8px;
    align-items: center;
    gap: 8px;
    padding: 0;
    justify-content: space-between;
}

.search-panel-footer a{
    font-size: 12px;
    font-weight: 400;
    padding: 0 !important;
    margin: 0 !important;
    text-transform: capitalize;
    color: var(--primary);
}

.search-panel-footer div {
    display: flex;
    align-items: center;
    justify-content: end;
    gap: 8px;
}

.search-panel-footer p {
    font-size: 10px;
    padding: 0 !important;
    margin: 0 !important;
    font-weight: 400;
    color: var(--text-muted);
}

.panel-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 10px;
}

.panel-meta>span:first-child {
    display: flex;
    align-items: center;
    gap: 7px;
}

.panel-meta b {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64748b;
}

.dot.online {
    background: var(--success);
    box-shadow: 0 0 9px var(--success);
}

.dot.offline {
    background: var(--danger);
}

.search-results {
    position: absolute;
    top: 102px;
    left: 14px;
    right: 14px;
    max-height: min(55vh, 390px);
    overflow: auto;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.search-results.hidden,
.hidden {
    display: none !important;
}

.search-result {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 11px 12px;
    text-align: left;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
}

.search-result:hover {
    background: var(--surface-hover);
}

.search-result b {
    font-size: 12px;
}

.search-result small {
    font-size: 10px;
    color: var(--text-subtle);
}

.empty-result {
    padding: 14px;
    color: var(--text-muted);
    font-size: 12px;
}

.spinner {
    width: 13px;
    height: 13px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.map-tools {
    position: absolute;
    z-index: 3;
    right: 8px;
    top: 16px;
    display: grid;
    gap: 3px;
    background: #01283c2b;
    backdrop-filter: blur('10px');
    padding: 3px;
    border-radius: 8px;
}

.map-tools button {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: var(--primary);
    color: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.map-tools button svg {
    width: 15px;
    height: 15px;
    stroke-width: 1.8;
}

.map-tools button:hover {
    background: #034b72;
}

.control-divider {
    height: 1px;
    background: var(--border-color, #e5e7eb);
    margin: 2px 0;
}

.details {
    right: 61px;
    top: 16px;
    width: 270px;
    padding: 15px;
}

.details h3 {
    margin: 0 0 5px;
    font-size: 14px;
}

.details .sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-grid div {
    padding: 9px;
    background: var(--detail-card-bg);
    border-radius: 8px;
}

.detail-grid small,
.detail-grid b {
    display: block;
}

.detail-grid small {
    font-size: 9px;
    color: var(--text-subtle);
}

.detail-grid b {
    font-size: 12px;
    margin-top: 4px;
}

.details button {
    float: right;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.details button svg{
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
}

.map-footer {
    position: absolute;
    z-index: 3;
    bottom: 13px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
    pointer-events: none;
    color: var(--text);
    font-size: 10px;
    text-shadow: 0 1px 5px var(--shadow);
}

.maplibregl-popup-content {
    background: var(--popup-bg);
    color: var(--popup-text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    min-width: 190px;
}

.maplibregl-popup-tip {
    border-top-color: var(--popup-bg) !important;
}

.popup-title {
    font-weight: 700;
    margin-bottom: 8px;
}

.popup-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    font-size: 11px;
    padding: 3px 0;
    color: var(--popup-muted);
}

.popup-row b {
    color: var(--popup-text);
    font-weight: 600;
}

@media (max-width: 600px) {
    .search-panel {
        top: 9px;
        left: 9px;
        width: calc(100vw - 18px);
        padding: 11px;
    }

    .map-tools {
        top: auto;
        bottom: 10px;
        right: 9px;
    }

    .details {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 8px 8px 0 0;
    }

    .map-footer {
        bottom: 9px;
        font-size: 9px;
    }

    .search-results {
        top: 115px;
    }

    .panel-meta {
        font-size: 9px;
    }
}

.maplibregl-ctrl-attrib {
    display: none !important;
}