:root {
    --bg: #0f1115;
    --surface: #151821;
    --surface-2: #1e2230;
    --line: #2a2f3e;
    --text: #e7eaf3;
    --muted: #8b93a7;
    --accent: #f15bb5;
    --accent-2: #4cc9f0;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    row-gap: 10px;
}
.topbar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
}
.brand { font-weight: 700; letter-spacing: 0.4px; }
.search-row { display: flex; gap: 8px; flex: 1; align-items: center; min-width: 0; }
.saved-btn { white-space: nowrap; }

/* Mobile: stack the topbar into two rows. Brand + Saved on top, search controls below. */
@media (max-width: 720px) {
    .topbar { padding: 10px 12px; }
    .topbar-head {
        width: 100%;
        flex: 0 0 100%;
    }
    .search-row {
        width: 100%;
        flex: 0 0 100%;
    }
    .search-row #zip { flex: 0 0 80px; }
    .search-row #radius { flex: 0 0 78px; }
    .search-row button[type="submit"] { flex: 1 1 auto; }
    .search-row #toggle-filters { flex: 0 0 auto; }
    .saved-btn { padding: 7px 12px; }
}
.search-row input[type="text"],
.search-row input,
.search-row select,
#level {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 7px 10px;
    font: inherit;
}
#zip { width: 90px; }
.search-row button {
    background: var(--accent);
    color: #0f1115;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    cursor: pointer;
}
.search-row button.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}
.search-row button.ghost.active {
    background: var(--accent-2);
    color: #0f1115;
    border-color: var(--accent-2);
}
.search-row button .star { color: #ffd166; margin-right: 2px; }
.search-row button.ghost.active .star { color: #0f1115; }
.count-pill {
    display: inline-block;
    min-width: 18px;
    margin-left: 4px;
    padding: 1px 6px;
    font-size: 11px;
    line-height: 1.4;
    background: rgba(255,255,255,0.12);
    border-radius: 999px;
    text-align: center;
}
.count-pill:empty { display: none; }
.search-row button.ghost.active .count-pill { background: rgba(0,0,0,0.18); }

.filters {
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    max-height: 40vh;       /* never eat more than 40% of the viewport */
    overflow-y: auto;       /* scroll inside the panel when content overflows */
    flex-shrink: 0;
}
.filters.hidden { display: none; }
.main { min-height: 0; }    /* allow the results+map row to shrink below content size */
.filter-group { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.filter-group label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); min-width: 50px; }
.filter-group.inline { gap: 18px; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-row.chip-wrap { max-width: 100%; }
.chip {
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s ease;
}
.chip:hover { background: #262b3a; }
.chip.active { background: var(--accent); color: #0f1115; border-color: var(--accent); }

.main {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(320px, 380px) 1fr;
    min-height: 0;
}
.results {
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 8px;
}

/* Mobile: drop the locked-viewport layout and let the page scroll naturally.
   Filters expand fully, results stack below, map at the bottom. */
@media (max-width: 720px) {
    html, body { height: auto; }
    body      { display: block; }
    .filters  { max-height: none; overflow-y: visible; }
    .main     {
        display: block;
        flex: none;
    }
    .results {
        max-height: none;
        overflow-y: visible;
        border-right: none;
        border-bottom: 1px solid var(--line);
    }
    #map { height: 70vh; width: 100%; }
}
.hint { color: var(--muted); padding: 24px; text-align: center; }

.card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.1s ease;
}
.card:hover, .card.highlight { border-color: var(--accent); }
.card header { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.card-title { margin: 2px 0; font-size: 15px; }
.card-host { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
.card-when, .card-where { margin: 2px 0; font-size: 13px; color: #cdd3e0; }
.card footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }
.card footer a, .card footer button {
    background: transparent;
    color: var(--accent-2);
    border: 1px solid var(--line);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
}
.card footer button.saved { background: var(--accent-2); color: #0f1115; border-color: var(--accent-2); }

.badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #2a2f3e;
    color: var(--text);
    line-height: 1.4;
}
.style-badge { color: #0f1115; font-weight: 600; }
.level-badge { background: #353a4d; }
.price-badge { background: #2a3e2f; color: #b3e6c1; }

#map { min-height: 0; }
.leaflet-container { background: #0a0c12; }

.marker-pin {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.6);
}
