:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --border: #dfe5f1;
    --text: #1d2736;
    --muted: #5d6b82;
    --accent: #1d4ed8;
    --accent-soft: rgba(29, 78, 216, 0.12);
    --shadow: 0 8px 24px rgba(19, 35, 56, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    height: 100%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
}

.app-shell {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: min(360px, 32vw);
    min-width: 260px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    z-index: 500;
}

.sidebar-header {
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.sidebar-header h1 {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
}

#filter-input {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    background: #fff;
    outline: none;
}

#filter-input:focus {
    border-color: rgba(29, 78, 216, 0.7);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

.lookup-box {
    position: relative;
}

.search-button {
    margin-top: 0.6rem;
    width: 100%;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    padding: 0.7rem 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.search-button:hover,
.search-button:focus-visible {
    filter: brightness(1.05);
    outline: none;
}

.lookup-results {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: none;
    max-height: 260px;
    overflow-y: auto;
}

.lookup-results.visible {
    display: block;
}

.lookup-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: #fff;
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid #edf2fa;
    cursor: pointer;
    color: var(--text);
}

.lookup-item:last-child {
    border-bottom: none;
}

.lookup-item:hover,
.lookup-item:focus-visible {
    background: #f4f8ff;
    outline: none;
}

.lookup-item small {
    display: block;
    color: var(--muted);
    margin-top: 0.15rem;
}

.distance-filter {
    margin: 12px 0;
}

.distance-filter label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9em;
}

.distance-range-inputs {
    position: relative;
    height: 24px;
}

.range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    transform: translateY(-50%);
    background: #d8dde3;
    border-radius: 2px;
    pointer-events: none;
    z-index: 0;
}

.distance-range-inputs input[type="range"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 24px; /* NEW — match container so its centerline is 12px, same as .range-track */
    display: block; /* NEW — avoid inline-element default line-height affecting box height */
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    z-index: 1;
}

.distance-range-inputs input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
}
.distance-range-inputs input[type="range"]::-moz-range-track {
    height: 4px;
    background: transparent;
}

.distance-range-inputs input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2f6feb;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    margin-top: -6px; /* centers 16px thumb on the 4px track: (4-16)/2 */
    position: relative;
    z-index: 2;
}
.distance-range-inputs input[type="range"]::-moz-range-thumb {
    pointer-events: auto;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #2f6feb;
    border: 2px solid #fff;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.distance-range-inputs input[type="range"]:focus,
.distance-range-inputs input[type="range"]:active {
    z-index: 3;
}

#distance-value {
    color: #2f6feb;
}

.place-type-filters {
    margin-top: 0.8rem;
    padding: 0.7rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8faff;
}

.filter-group {
    margin-bottom: 0.8rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.filter-group select {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.group-list {
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.group-item {
    width: 100%;
    text-align: left;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    color: var(--text);
    cursor: pointer;
    transition:
        transform 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.group-item:hover,
.group-item:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(29, 78, 216, 0.6);
    box-shadow: 0 6px 18px rgba(29, 78, 216, 0.08);
    outline: none;
}

.group-item strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.18rem;
}

.group-item span {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
}

#map {
    flex: 1;
    min-height: 100%;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: #fff;
}

.place-list {
    margin: 0.4rem 0 0;
    padding-left: 1.2rem;
    max-height: 180px;
    overflow-y: auto;
}

.place-list li {
    margin: 0.2rem 0;
}

.selected-place {
    background: rgba(29, 78, 216, 0.08);
    border-radius: 6px;
}

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        height: 38vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    #map {
        height: 62vh;
    }
}
