/* Em Dobro — dark theme. UI copy is Portuguese; code is English. */

:root {
    --bg: #0a0a0b;
    --bg-elev: #141417;
    --bg-elev-2: #1c1c21;
    --bg-elev-3: #24242b;
    --border: #2a2a31;
    --border-strong: #3a3a44;
    --text: #f2f2f4;
    --text-dim: #a6a6b0;
    --text-faint: #6b6b77;
    --accent: #ff6a3d;
    --accent-2: #ffb03d;
    --accent-soft: rgba(255, 106, 61, 0.14);
    --good: #3ddc84;
    --good-soft: rgba(61, 220, 132, 0.14);
    --bad: #ff5470;
    --bad-soft: rgba(255, 84, 112, 0.14);
    --warn-soft: rgba(255, 176, 61, 0.14);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-pill: 999px;
    --shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

body {
    background:
        radial-gradient(1100px 480px at 82% -8%, rgba(255, 106, 61, 0.10), transparent 60%),
        radial-gradient(900px 480px at -10% 0%, rgba(255, 176, 61, 0.06), transparent 55%),
        var(--bg);
    display: flex;
    flex-direction: column;
}

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
.app-header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 18px max(clamp(16px, 4vw, 40px), calc((100% - 1200px) / 2 + clamp(16px, 4vw, 40px)));
    border-bottom: 1px solid var(--border);
}
.app-header__brand { display: flex; align-items: center; gap: 14px; }
.app-header__profile { flex: none; }
.logo-mark {
    display: grid; place-items: center;
    width: 46px; height: 46px; border-radius: 12px;
    font-weight: 800; font-size: 20px; color: #1a1207;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    box-shadow: var(--shadow);
}
.app-header h1 { margin: 0; font-size: clamp(18px, 2.4vw, 23px); font-weight: 600; letter-spacing: -0.01em; }
.app-header h1 strong {
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 2px 0 0; color: var(--text-dim); font-size: 13px; }

/* ---------- Public influencer page header (/r/<username>) ---------- */
.app-header__avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none; }

.app-header__profile .app-header__avatar {
    width: 22px;
    height: 22px;
    margin-right: 6px;
    flex: none;
}

.profile-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.profile-avatar-preview {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    display: block;
}
.app-header__social { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.app-header__social .pill-btn { padding: 6px 12px; font-size: 13px; }
.app-header--influencer {
    position: relative;
    justify-content: flex-start;
    text-align: left;
    min-height: 176px;
    padding-top: 28px;
    padding-bottom: 28px;
}
.app-header--influencer .app-header__brand {
    justify-content: flex-start;
    gap: 24px;
}
.app-header--influencer .app-header__brand > .app-header__avatar {
    width: 104px;
    height: 104px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.48),
        0 0 0 8px rgba(255, 106, 61, 0.12);
}
.app-header--influencer h1 {
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.08;
    font-weight: 700;
}
.app-header--influencer .tagline {
    margin-top: 6px;
    font-size: 15px;
}
.app-header--influencer .app-header__social {
    justify-content: flex-start;
    margin-top: 12px;
}
.app-header--influencer .app-header__social .pill-btn {
    padding: 8px 14px;
    font-size: 14px;
}
.app-header--influencer .app-header__profile {
    position: absolute;
    right: max(clamp(16px, 4vw, 40px), calc((100% - 1200px) / 2 + clamp(16px, 4vw, 40px)));
}

@media (max-width: 720px) {
    .app-header--influencer .app-header__profile {
        position: static;
    }
}

@media (max-width: 520px) {
    .app-header--influencer {
        min-height: 236px;
        padding-top: 22px;
        padding-bottom: 18px;
    }
    .app-header--influencer .app-header__brand {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        width: 100%;
    }
    .app-header--influencer .app-header__brand > .app-header__avatar {
        width: 92px;
        height: 92px;
    }
    .app-header--influencer h1 {
        font-size: 22px;
    }
    .app-header--influencer .tagline {
        font-size: 14px;
        max-width: 300px;
    }
}

/* ---------- Toolbar ---------- */
.toolbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; gap: 10px; align-items: center;
    /* Background/border span the viewport, but the content shares the same
       left edge as the .results container (max-width 1200px, centered). */
    padding: 12px max(clamp(16px, 4vw, 40px), calc((100% - 1200px) / 2 + clamp(16px, 4vw, 40px)));
    background: rgba(10, 10, 11, 0.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

/* Round glass button that expands into the search field (iOS-style).
   The field itself stays hidden until .toolbar gets .search-open. */
.search-toggle {
    display: grid; place-items: center; flex: none;
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--bg-elev); border: 1px solid var(--border);
    color: var(--text); transition: border-color 0.15s, background 0.15s;
}
.search-toggle:hover { border-color: var(--border-strong); }
.search-toggle.is-active {
    background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2);
}

.search { position: relative; flex: 1; display: none; }
.toolbar.search-open .search { display: block; animation: search-in 0.18s ease; }
.toolbar.search-open .presets { display: none; }
@keyframes search-in {
    from { opacity: 0; transform: translateX(-6px); }
}
.search input {
    width: 100%; padding: 11px 42px 11px 16px;
    background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius-pill); color: var(--text); font-size: 15px;
    transition: border-color 0.15s;
}
.search input:focus { outline: none; border-color: var(--accent); }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--bg-elev-2); border: 1px solid var(--border);
    color: var(--text-dim); font-size: 12px;
}
.search__clear:hover { color: var(--text); border-color: var(--border-strong); }

.pill-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 10px 16px; border-radius: var(--radius-pill);
    background: var(--bg-elev); border: 1px solid var(--border);
    color: var(--text); font-size: 14px; font-weight: 500;
    transition: border-color 0.15s, background 0.15s;
    white-space: nowrap;
}
.pill-btn:hover { border-color: var(--border-strong); }
.pill-btn.is-active {
    background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2);
}
.pill-btn__icon { font-size: 15px; display: inline-flex; align-items: center; }
.count-bubble {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
    background: var(--accent); color: #1a1207; font-size: 12px; font-weight: 700;
    border-radius: var(--radius-pill);
}
.sort {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--text-dim); font-size: 13px; white-space: nowrap;
}
.sort select {
    padding: 9px 12px; background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 14px;
}
.sort select:focus { outline: none; border-color: var(--accent); }

/* ---------- Presets (inside the sticky toolbar) ---------- */
.presets {
    display: flex; gap: 8px; overflow-x: auto; align-items: center;
    flex: 1; min-width: 0; padding: 2px 0;
    scrollbar-width: none;
}
.presets::-webkit-scrollbar { display: none; }
.presets .pill-btn { flex: none; }
.presets__sep { width: 1px; align-self: stretch; margin: 3px 4px; background: var(--border-strong); flex: none; }
/* Conditional "clear filters" chip: lives right after the Filtros button so it
   sits next to what it clears. Same pill shape as its neighbors; the accent
   text is what marks it as an action rather than a filter. */
.clear-chip {
    display: inline-flex; align-items: center; gap: 7px; flex: none;
    padding: 10px 16px; border-radius: var(--radius-pill);
    background: var(--bg-elev); border: 1px solid var(--border);
    color: var(--accent-2); font-size: 14px; font-weight: 500;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s;
}
.clear-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.presets__chips { display: contents; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 15px; border-radius: var(--radius-pill);
    background: var(--bg-elev); border: 1px solid var(--border);
    color: var(--text-dim); font-size: 14px; font-weight: 500; white-space: nowrap;
    transition: all 0.15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active {
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    border-color: transparent; color: #1a1207; font-weight: 600;
}
.chip__count { font-size: 12px; opacity: 0.65; }
.chip__emoji { font-size: 15px; line-height: 1; }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }
.chip.is-active .chip__dot { background: #1a1207; box-shadow: none; }
.chip__x { font-size: 11px; opacity: 0.8; margin-left: 2px; }
.chip--selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); font-weight: 600; }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }
.chip:disabled:hover { border-color: var(--border); color: var(--text-dim); }

/* ---------- Filters sheet (mobile-first bottom sheet) ---------- */
body.no-scroll { overflow: hidden; }
.sheet-overlay {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px);
    display: flex; align-items: flex-end; justify-content: center;
    animation: fade 0.15s ease;
}
.sheet {
    background: var(--bg-elev); width: 100%; max-width: 760px;
    max-height: 90vh; max-height: 90dvh;
    display: flex; flex-direction: column;
    border: 1px solid var(--border); border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow); animation: slideup 0.22s ease;
}
.sheet__head {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: calc(18px + env(safe-area-inset-top)) 20px 14px; border-bottom: 1px solid var(--border);
}
.sheet__grip {
    position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong);
}
.sheet__title { margin: 0; font-size: 17px; font-weight: 600; flex: 1; }
.sheet__close {
    width: 34px; height: 34px; border-radius: 50%; flex: none;
    background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text); font-size: 15px;
}
.sheet__body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 26px; }
.sheet__foot { padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg-elev); }

.fgroup__title { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.field-label { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; display: block; }
.hint { color: var(--text-faint); font-size: 12px; margin: 10px 0 0; line-height: 1.5; }
.muted { color: var(--text-faint); font-size: 12px; }

.input, select.input {
    padding: 11px 12px; background: var(--bg-elev-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 15px; width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); }
.input--time { width: auto; min-width: 120px; }
select.input {
    appearance: none; -webkit-appearance: none;
    padding-right: 38px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='%236b6b77' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 20px;
}
select.input:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none' stroke='%23ff6a3d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
}
select.input option { background: var(--bg-elev-2); color: var(--text); }

/* Onde */
.where-loc {
    display: inline-flex; align-items: center; gap: 9px; width: 100%;
    padding: 13px 16px; border-radius: var(--radius-sm);
    background: var(--bg-elev-2); border: 1px solid var(--border);
    color: var(--text); font-size: 15px; font-weight: 500;
}
.where-loc.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.where-loc.is-loading { opacity: 0.7; }
.where-loc__x { margin-left: auto; opacity: 0.7; }
.where-sep { text-align: center; color: var(--text-faint); font-size: 12px; margin: 16px 0 12px; }
.radius-wrap { margin-top: 14px; }
.loc-status { font-size: 12px; color: var(--text-dim); margin: 8px 0 0; }
.range-row { display: flex; align-items: center; gap: 12px; }
input[type="range"] { flex: 1; accent-color: var(--accent); height: 24px; }
.range-val { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; min-width: 54px; }

/* Searchable chip groups */
.searchable { display: flex; flex-direction: column; gap: 10px; }
.searchable__search { position: relative; }
.searchable__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); display: inline-flex; }
.input--search { padding-left: 36px; }
.selected-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-cloud { display: flex; flex-wrap: wrap; gap: 7px; max-height: 220px; overflow-y: auto; padding: 2px; }
.chips-cloud .chip { font-size: 13.5px; padding: 8px 13px; }

/* Quando — time field with clear-state */
.time-field { display: flex; align-items: center; gap: 12px; }
.time-field.is-set .input--time { border-color: var(--accent); color: var(--accent-2); font-weight: 600; }
.time-clear { display: none; background: none; border: none; color: var(--accent-2); font-size: 13px; padding: 4px; }
.time-field.is-set .time-clear { display: inline; }

/* Toggle */
.toggle { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; font-size: 15px; }
.toggle input { display: none; }
.toggle__track {
    width: 44px; height: 26px; border-radius: 999px; background: var(--bg-elev-3);
    border: 1px solid var(--border); position: relative; transition: background 0.15s; flex: none;
}
.toggle__track::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
    border-radius: 50%; background: var(--text-faint); transition: transform 0.15s, background 0.15s;
}
.toggle input:checked + .toggle__track { background: var(--accent-soft); border-color: var(--accent); }
.toggle input:checked + .toggle__track::after { transform: translateX(18px); background: var(--accent); }

/* Toast — transient feedback (e.g. tapping "Favoritos" with none saved) */
.toast {
    position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
    transform: translate(-50%, 12px);
    max-width: min(92vw, 420px); padding: 12px 18px;
    background: var(--bg-elev-2); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); color: var(--text); font-size: 14px;
    box-shadow: var(--shadow); text-align: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
    padding: 11px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--bg-elev-2); color: var(--text); font-size: 14px; font-weight: 500;
}
.btn__icon { flex: none; }
.btn:hover { border-color: var(--border-strong); }
.btn--accent {
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    border-color: transparent; color: #1a1207; font-weight: 600;
}
.btn--block { width: 100%; padding: 14px; font-size: 15px; }

/* Desktop: center the sheet, two-column body */
@media (min-width: 620px) {
    .sheet-overlay { align-items: center; padding: 24px; }
    .sheet { border-radius: 22px; }
    .sheet__grip { display: none; }
    .sheet__body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 30px; }
}

/* ---------- Results ---------- */
.results { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 18px clamp(16px, 4vw, 40px) 40px; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.results-head__info { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.results-head__controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.result-count { color: var(--text-dim); font-size: 14px; }
.result-count b { color: var(--text); }
.link-btn { background: none; border: none; color: var(--accent-2); font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

.view-toggle { display: flex; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.view-toggle__btn {
    padding: 7px 14px; border: none; background: none; color: var(--text-dim);
    font-size: 13px; font-weight: 600; border-radius: var(--radius-pill); cursor: pointer; white-space: nowrap;
}
.view-toggle__btn.is-active { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #1a1207; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.card {
    position: relative;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
/* Wraps media+body so the used-card dimming (grayscale+opacity) can target just
   this subtree — filter rasterizes everything under it with no way for a
   descendant to opt back out, so .card__photo-fx (logo + used-overlay, incl. the
   colored rating tag) has to live outside .card__inner entirely, as a sibling. */
.card__inner { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.card--used .card__inner { filter: grayscale(1); opacity: 0.65; }
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.card__media { position: relative; aspect-ratio: 16 / 9; background: var(--bg-elev-2); }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px;
    border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 600; backdrop-filter: blur(4px);
}
.badge--open { background: rgba(8,32,20,0.82); color: var(--good); border: 1px solid rgba(61,220,132,0.45); }
.badge--closed { background: rgba(20,4,8,0.82); color: var(--bad); border: 1px solid rgba(255,84,112,0.4); }
.badge--dist { background: rgba(0,0,0,0.55); color: #fff; }
.badge--featured {
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    color: #1a1207; font-weight: 800; letter-spacing: 0.2px;
}
/* .card__photo-fx sits outside .card__inner (see comment there) but is sized/
   positioned to exactly match .card__media's own box, so its children (logo,
   used-overlay) line up with the photo despite not being nested inside it.
   No overflow:hidden here: .card__logo deliberately straddles the media/body
   seam (bottom:-18px) to sit half on the photo, half on the card body — the
   outer .card already clips its own rounded corners, so clipping here would
   only cut the logo's bottom half for no reason. */
.card__photo-fx { position: absolute; top: 0; left: 0; right: 0; aspect-ratio: 16 / 9; }
.card__logo {
    position: absolute; bottom: -18px; right: 14px; width: 46px; height: 46px; border-radius: 12px;
    background: #fff center/cover no-repeat; border: 2px solid var(--bg-elev); box-shadow: var(--shadow);
}
.card__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card__title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.25; }
.card__benefit { margin: 0; color: var(--accent-2); font-size: 13.5px; font-weight: 500; }
.card__meta { color: var(--text-dim); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; }
.card__meta .dot { color: var(--text-faint); }
.card__cats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.tag { padding: 3px 9px; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: 11.5px; color: var(--text-dim); }
.tag--char { background: var(--accent-soft); border-color: rgba(255,106,61,0.3); color: var(--accent-2); font-weight: 600; }
.card__hours { font-size: 12.5px; color: var(--text-faint); }

/* ---------- Pager (infinite-scroll sentinel/status) ---------- */
.pager { display: flex; justify-content: center; align-items: center; min-height: 32px; margin-top: 28px; color: var(--text-dim); font-size: 14px; }

/* ---------- Map view ---------- */
/* z-index:0 (not just position:relative) makes this its own stacking context,
   so Leaflet's internal z-indices (controls sit at 1000+) stay contained here
   and never escape above the modal overlay (z-index:50). */
.map-wrap { position: relative; z-index: 0; width: 100%; }
.map-view {
    width: 100%; height: min(70vh, 640px); border-radius: var(--radius);
    overflow: hidden; border: 1px solid var(--border); background: var(--bg-elev-2);
}
.map-view.leaflet-container { font: inherit; }

/* Expanded (fullscreen) mode: fixed below the modal (z-index:50) so a pin
   click's detail modal still opens on top of it. */
.map-wrap.is-expanded { position: fixed; inset: 0; z-index: 40; width: auto; background: var(--bg); }
.map-wrap.is-expanded .map-view { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; border: none; }

.map-expand-btn {
    position: absolute; top: 12px; right: 12px; z-index: 1000;
    width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: rgba(10,10,11,0.85); border: 1px solid var(--border); color: var(--text); font-size: 17px; cursor: pointer;
}
.map-expand-btn:hover { background: var(--bg-elev-3); }

.map-pin-wrap { background: none; border: none; }
.map-pin { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 50%; cursor: pointer; }
.map-pin--dot { width: 14px; height: 14px; border: 2px solid var(--bg); box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
.map-pin--logo { width: 30px; height: 30px; object-fit: cover; border: 2px solid; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,0.6); }

.map-you-wrap { background: none; border: none; }
.map-you-dot {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2;
    width: 14px; height: 14px; border-radius: 50%; background: #3b82f6; border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.35);
}
.map-you-halo {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 14px; height: 14px; border-radius: 50%; background: rgba(59,130,246,0.45);
    animation: map-you-pulse 2s ease-out infinite;
}
@keyframes map-you-pulse {
    from { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    to { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}
.map-status {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 1200;
    background: rgba(10,10,11,0.85); border: 1px solid var(--border); color: var(--text-dim);
    font-size: 13px; padding: 8px 14px; border-radius: var(--radius-pill);
    max-width: calc(100% - 32px); text-align: center; pointer-events: none;
}
.map-legend {
    position: absolute; bottom: 12px; left: 12px; z-index: 1000; display: flex; gap: 12px;
    background: rgba(10,10,11,0.85); border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: 6px 12px; font-size: 12px; color: var(--text-dim);
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend__dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.map-legend__dot--open { background: var(--good); }
.map-legend__dot--closed { background: var(--bad); }
.leaflet-control-zoom a, .leaflet-control-locate a {
    background: var(--bg-elev-2) !important; color: var(--text) !important; border-color: var(--border) !important;
    display: flex; align-items: center; justify-content: center;
}
.leaflet-control-zoom a:hover, .leaflet-control-locate a:hover { background: var(--bg-elev-3) !important; }
.leaflet-control-attribution { background: rgba(10,10,11,0.7) !important; color: var(--text-dim) !important; }
.leaflet-control-attribution a { color: var(--text-dim) !important; }
.leaflet-tooltip {
    background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 12.5px; padding: 4px 8px;
}
.leaflet-tooltip-top::before { border-top-color: var(--border); }

/* ---------- States ---------- */
.state {
    text-align: center; padding: 60px 20px; color: var(--text-dim);
}
.state__emoji { font-size: 40px; display: block; margin-bottom: 12px; }
/* Relaxation suggestions in the empty state — stacked, thumb-sized on mobile. */
.state__suggestions {
    display: flex; flex-direction: column; gap: 10px;
    max-width: 360px; margin: 18px auto 0;
}
.state__suggestions .btn { width: 100%; justify-content: center; }
.skeleton {
    background: linear-gradient(100deg, var(--bg-elev) 30%, var(--bg-elev-2) 50%, var(--bg-elev) 70%);
    background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius); height: 280px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.66); backdrop-filter: blur(4px);
    display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0;
    animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
    background: var(--bg-elev); width: 100%; max-width: 560px;
    max-height: 92vh; max-height: 92dvh;
    border-radius: 20px 20px 0 0; border: 1px solid var(--border); box-shadow: var(--shadow);
    animation: slideup 0.2s ease;
    position: relative; display: flex; flex-direction: column; overflow: hidden;
}
@keyframes slideup { from { transform: translateY(24px); } }
/* Scrolls independently so .modal__close (a sibling, not a child) stays
   pinned to the top-right regardless of scroll position. */
.modal__scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.modal__hero { aspect-ratio: 16/9; background: var(--bg-elev-2); position: relative; }
.modal__hero img { width: 100%; height: 100%; object-fit: cover; }
.modal__hero-actions {
    position: absolute; bottom: 10px; right: 10px; z-index: 1;
    display: flex; gap: 8px;
}
.modal__hero-actions .card__fav {
    position: static;
}
.modal__close {
    position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 2;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(0,0,0,0.6); color: #fff; border: none; font-size: 18px; line-height: 1;
}
.modal__body { padding: 20px; }
.modal__body h2 { margin: 0 0 4px; font-size: 21px; }
.modal__benefit { color: var(--accent-2); font-weight: 600; margin: 0 0 14px; }
.modal__row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.modal__section { margin-top: 18px; }
.modal__section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin: 0 0 10px; }
.hours-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hours-table td { padding: 7px 0; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.hours-table td.day { color: var(--text); width: 110px; }
.hours-table tr.today td { color: var(--accent-2); font-weight: 600; }
.rules { font-size: 13px; color: var(--text-dim); line-height: 1.6; white-space: pre-line; }
/* Inline at the end of the rules text so it reads as part of it. */
.rules-toggle {
    display: inline; padding: 0; margin: 0;
    background: none; border: none;
    color: var(--accent-2); font-size: inherit; font-weight: 600;
}
.rules-toggle:hover { text-decoration: underline; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Recommendation note — deliberately loud so a personal "why I recommend this"
   doesn't blend into the neutral address/hours/rules sections around it. */
.modal__section--note {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.modal__section--note h3 { color: var(--accent-2); }
.modal__section--note .rules { color: var(--text); font-size: 14px; }

/* z-index:0 gives this its own stacking context so Leaflet's internal
   z-indices (controls sit at 1000+) stay contained here instead of escaping
   above the modal's own chrome (.modal__close, etc). */
.modal__map {
    position: relative; z-index: 0; width: 100%; height: 200px;
    border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--bg-elev-2);
}
.modal__map.leaflet-container { font: inherit; }

/* ---------- "Continue explorando" (related places in the detail modal) ---------- */
.related-row {
    display: flex; gap: 10px; overflow-x: auto;
    scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 0 12px; padding-bottom: 2px;
}
.related-row::-webkit-scrollbar { display: none; }
.related-card {
    flex: none; width: 142px; scroll-snap-align: start;
    text-align: left; padding: 0; overflow: hidden;
    background: var(--bg-elev-2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    transition: border-color 0.15s;
}
.related-card:hover { border-color: var(--border-strong); }
.related-card__media { aspect-ratio: 16 / 10; background: var(--bg-elev-3); }
.related-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.related-card__body { display: grid; gap: 4px; padding: 8px 10px 10px; }
.related-card__name {
    font-size: 13px; font-weight: 600; line-height: 1.25;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.related-card__meta {
    display: flex; align-items: center; gap: 5px;
    font-size: 11.5px; color: var(--text-dim); min-width: 0;
}
.related-card__meta > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-card__dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); }
.related-card__dot.is-open { background: var(--good); }
.related-card__dist { flex: none; margin-left: auto; }
.explore-chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Used-coupon rating popup ---------- */
.rating-overlay { align-items: center; z-index: 60; }
.rating-modal {
    width: 100%; max-width: 380px; background: var(--bg-elev); border: 1px solid var(--border);
    border-radius: 20px; box-shadow: var(--shadow); padding: 22px; animation: slideup 0.2s ease;
}
.rating-modal h3 { margin: 0 0 4px; font-size: 16px; }
.rating-modal .sub { margin: 0; color: var(--text-dim); font-size: 13px; }
.rating-options { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ---------- Recommendations onboarding ---------- */
.onboarding-modal { position: relative; text-align: center; }
.onboarding-modal .modal__close { top: 12px; right: 12px; width: 30px; height: 30px; font-size: 15px; background: var(--bg-elev-2); }
.onboarding-emoji { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.onboarding-modal .sub { margin-top: 6px; line-height: 1.55; }
.onboarding-block {
    margin: 18px 0; padding: 14px; text-align: left;
    background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius-sm);
}
.onboarding-label {
    display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--accent-2); font-weight: 700; margin-bottom: 8px;
}
.onboarding-url { display: flex; align-items: center; gap: 8px; }
.onboarding-url__text {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 13px; color: var(--text); font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.onboarding-copy { flex-shrink: 0; padding: 7px 14px; font-size: 13px; }
.onboarding-copy.is-active { border-color: var(--good); color: var(--good); }
.onboarding-status { margin: 10px 0 0; font-size: 13px; color: var(--text-dim); }
.onboarding-status strong { color: var(--accent-2); }
.onboarding-status--muted { color: var(--text-faint); }

@media (min-width: 620px) {
    .modal-overlay { align-items: center; padding: 20px; }
    .modal { border-radius: 20px; }
}

@media (max-width: 520px) {
    .sort span { display: none; }
    .results-head__controls { width: 100%; justify-content: space-between; }
    .cards { grid-template-columns: 1fr; }
    .map-view { height: 60vh; }
}

/* ---------- Footer ---------- */
.app-footer { padding: 20px; text-align: center; color: var(--text-faint); font-size: 12px; border-top: 1px solid var(--border); }

/* ---------- Auth pages (login / invite / profile) ---------- */
.auth-page { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 28px; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 6px; font-size: 20px; }
.auth-card p.sub { margin: 0 0 20px; color: var(--text-dim); font-size: 13px; }
.tabs { display: flex; gap: 18px; margin: 18px 0 20px; border-bottom: 1px solid var(--border); }
.tab {
    background: none; border: none; padding: 10px 2px; margin-bottom: -1px;
    font-size: 14px; font-weight: 600; color: var(--text-faint);
    border-bottom: 2px solid transparent;
}
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel[hidden] { display: none; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.alert { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert--error { background: rgba(255, 84, 112, 0.12); border: 1px solid rgba(255, 84, 112, 0.4); color: var(--bad); }
.alert--ok { background: var(--good-soft); border: 1px solid rgba(61, 220, 132, 0.35); color: var(--good); }
.profile-section { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); }
.profile-section h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin: 0 0 14px; }
.invite-link { word-break: break-all; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; margin-top: 10px; }
.copy-status { margin: 6px 0 0; }
.auth-card--wide { max-width: 620px; }

/* ---------- Analytics ---------- */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; }
.stat {
    flex: 1 1 120px; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px; display: flex; flex-direction: column; gap: 4px;
}
.stat__value { font-size: 24px; font-weight: 700; color: var(--accent-2); }
.stat__label { font-size: 12px; color: var(--text-faint); }
.chart-svg { width: 100%; height: auto; margin-top: 6px; }
.chart-bar { fill: var(--accent); }
.chart-label { fill: var(--text-faint); font-size: 9px; }
.user-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-bar-label { width: 110px; flex: none; font-size: 13px; color: var(--text-dim); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-bar-track { flex: 1; height: 14px; background: var(--bg-elev-2); border-radius: var(--radius-pill); overflow: hidden; }
.user-bar-fill { height: 100%; background: linear-gradient(135deg, var(--accent-2), var(--accent)); border-radius: var(--radius-pill); }
.user-bar-count { width: 32px; flex: none; font-size: 13px; font-weight: 600; text-align: left; }
.badge--pending { background: var(--bg-elev-2); color: var(--text-faint); border: 1px solid var(--border); }
.table-scroll { overflow-x: auto; }
.invites-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.invites-table th {
    text-align: left; padding: 8px 10px; color: var(--text-faint); font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border);
}
.invites-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.invites-table tr:last-child td { border-bottom: none; }

/* ---------- Favorite heart ---------- */
.card__fav {
    position: absolute; top: 10px; right: 10px; z-index: 1;
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.15);
    font-size: 17px; line-height: 1; color: #fff; transition: transform 0.12s, background 0.12s;
}
.card__fav:hover { transform: scale(1.08); }
.card__fav.is-active { background: rgba(255, 106, 61, 0.85); border-color: transparent; }

/* Recommend button sits to the left of the favorite heart on cards; in the
   modal's .modal__hero-actions both fall back to position:static and lay out
   in a flex row instead (see rule above), so no offset is needed there. */
.card__rec { right: 50px; }
.card__rec.is-active { background: rgba(61, 220, 132, 0.85); border-color: transparent; }
.modal__rec-group { display: inline-flex; gap: 8px; align-items: center; }

.note-textarea {
    width: 100%; resize: vertical; padding: 10px 12px; margin-top: 12px;
    background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-family: inherit; font-size: 14px;
}

.card--used .card__inner { filter: grayscale(1); opacity: 0.65; }
/* .card__logo isn't inside .card__inner (see .card__photo-fx comment above), so
   it needs its own direct grayscale to still read as "dimmed" like the rest of
   a used card, plus its own veil (below) to match the used-overlay's darkening.
   z-index above .card__used-overlay so that veil is one single paint over the
   whole logo — splitting it (grayscale-overlay covers the top, a patch covers
   just the leftover bottom strip) means two separately-clipped layers have to
   line up pixel-perfectly, which visibly seams. */
.card--used .card__logo { z-index: 3; filter: grayscale(1); }
.card--used .card__logo::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit;
    background: rgba(0, 0, 0, 0.45);
}
.card__used-overlay {
    position: absolute; inset: 0; z-index: 2;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    background: rgba(0, 0, 0, 0.45); text-align: center; padding: 0 16px;
}
.card__used-label {
    padding: 6px 18px; border-radius: var(--radius-pill); background: rgba(20,4,8,0.85);
    color: #fff; font-size: 13px; font-weight: 800; letter-spacing: 1.5px; border: 1px solid rgba(255,255,255,0.25);
}
.card__used-rating {
    padding: 4px 12px; border-radius: var(--radius-pill); background: rgba(0,0,0,0.6);
    color: #fff; font-size: 11.5px; font-weight: 600; border: 1px solid rgba(255,255,255,0.2);
}
/* Same red/amber/green mapping as .used-toggle.is-active[data-rating] in the detail modal. */
.card__used-rating[data-rating="worth_without_double"] { color: var(--good); border-color: rgba(61,220,132,0.5); }
.card__used-rating[data-rating="only_with_double"] { color: var(--accent-2); border-color: rgba(255,176,61,0.5); }
.card__used-rating[data-rating="not_worth"] { color: var(--bad); border-color: rgba(255,84,112,0.5); }

.used-toggle {
    background: var(--accent-soft); border: 1.5px solid rgba(255,106,61,0.55);
    color: var(--accent-2); font-weight: 700;
}
.used-toggle:hover { background: rgba(255,106,61,0.22); border-color: var(--accent); }
.used-toggle.is-active {
    background: var(--good-soft); border-color: rgba(61,220,132,0.45); color: var(--good);
}
.used-toggle.is-active[data-rating="not_worth"] {
    background: var(--bad-soft); border-color: rgba(255,84,112,0.45); color: var(--bad);
}
.used-toggle.is-active[data-rating="only_with_double"] {
    background: var(--warn-soft); border-color: rgba(255,176,61,0.45); color: var(--accent-2);
}

/* ---------- Grouped multi-address cards ---------- */
.card--grouped {
    border-color: var(--border-strong);
    background: linear-gradient(180deg, var(--bg-elev), var(--bg-elev-2));
}

.card__title-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.card__multi-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 1px 7px;
    border-radius: 999px;
    align-self: center;
}

.card__locations {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-top: 1px solid var(--border);
    padding-top: 6px;
}

.location-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12.5px;
    line-height: 1.2;
}

.location-row:hover {
    background: var(--bg-elev-2);
}

.loc-neigh {
    color: var(--text);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.loc-neigh--open {
    color: var(--good);
}

.loc-hours {
    color: var(--text-faint);
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.loc-dist {
    color: var(--text-dim);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}
