/* Map screen — filter panel + Leaflet map + results list + POI detail panel.
   Tokens/fonts/shared components (pill-button, chip, badge-pill) come from
   frontend.css, loaded before this file. */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: var(--font-body); color: var(--ink); background: var(--bg); }

.accent-teal { color: var(--accent-teal); }
.hidden { display: none !important; }

.map-screen { display: flex; flex-direction: column; height: 100vh; width: 100%; overflow: hidden; }

/* ===== Header ===== */
.map-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: #fff;
    z-index: 1200; /* well above Leaflet's own panes/controls (~700/1000), so the sticky header + its search dropdown never render behind the map */
    flex-wrap: nowrap;
}
.back-button {
    display: inline-flex; align-items: center; gap: 8px;
    border: none; background: none; cursor: pointer; text-decoration: none;
    color: var(--ink); white-space: nowrap;
}
.back-arrow { font: 800 18px "Manrope", sans-serif; }
.back-button-logo { height: 33px; width: auto; display: block; }
.region-name { font: 600 13px "Inter", sans-serif; color: rgba(40, 35, 30, 0.55); white-space: nowrap; }
.map-search-wrap { flex: 1; position: relative; min-width: 0; }
.map-search-wrap input {
    width: 100%; padding: 10px 16px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong);
    outline: none; font: 500 14px "Inter", sans-serif; background: rgba(40, 35, 30, 0.03);
}
.map-search-wrap input:focus { border-color: var(--accent-teal); background: #fff; }
.lang-switch { padding: 8px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); font: 600 13px "Inter", sans-serif; background: #fff; }

.filter-toggle-btn {
    display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-pill); border: none;
    cursor: pointer; background: var(--ink); color: #fff; font: 700 13.5px "Inter", sans-serif; white-space: nowrap;
}
.filter-badge {
    background: var(--accent-teal); border-radius: 50%; width: 18px; height: 18px; display: inline-flex;
    align-items: center; justify-content: center; font: 700 11px sans-serif;
}

/* ===== Search dropdown (shared look) ===== */
.search-results {
    position: absolute; z-index: 900; top: calc(100% + 6px); left: 0; right: 0;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md);
    max-height: 320px; overflow-y: auto; list-style: none; margin: 0; padding: 6px 0;
    box-shadow: var(--shadow-panel);
}
.search-results:empty { display: none; }
.search-group-label { font: 700 11px "Inter", sans-serif; text-transform: uppercase; letter-spacing: 0.03em; color: rgba(40, 35, 30, 0.45); padding: 8px 16px 4px; }
.search-result-item { padding: 8px 16px; cursor: pointer; font: 500 14px "Inter", sans-serif; }
.search-result-item:hover, .search-result-item:focus { background: rgba(40, 35, 30, 0.05); }
.search-result-item mark { background: color-mix(in oklch, var(--accent-terracotta) 30%, white); color: inherit; }

/* ===== Body layout: filter panel + map + results list ===== */
.map-body { position: relative; flex: 1; display: flex; overflow: hidden; }

.filter-panel {
    display: none;
    width: 300px; flex: none; border-right: 1px solid var(--border); padding: 20px; overflow-y: auto;
    background: #fff; z-index: 1100;
}
.filter-panel.open { display: block; }
.filter-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.filter-panel-title { font: 700 15px "Manrope", sans-serif; }
.filter-panel-header-actions { display: flex; gap: 14px; align-items: center; }
.reset-link { background: none; border: none; color: var(--accent-terracotta); font: 600 12.5px "Inter", sans-serif; cursor: pointer; padding: 0; }
.mobile-close-filter { display: none; border: none; background: rgba(40, 35, 30, 0.06); border-radius: 50%; width: 26px; height: 26px; align-items: center; justify-content: center; cursor: pointer; }
.apply-btn-mobile { display: none; width: 100%; margin-top: 16px; }

.accordion-section { border-bottom: 1px solid var(--border); padding: 12px 0; }
.accordion-header {
    width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: none;
    cursor: pointer; font: 700 13.5px "Manrope", sans-serif; color: var(--ink); padding: 4px 2px;
}
.chevron { display: inline-block; transition: transform 0.15s; }
.accordion-header.open .chevron { transform: rotate(180deg); }
.accordion-body { display: none; flex-direction: column; gap: 2px; margin-top: 10px; }
.accordion-body.open { display: flex; }

.sidebar-toolbar { display: flex; gap: 8px; margin-bottom: 8px; }
.sidebar-toolbar button {
    font-size: 0.78rem; padding: 5px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong);
    background: #fff; cursor: pointer; font-family: "Inter", sans-serif;
}

#category-list { list-style: none; margin: 0; padding: 0; }
.category-item { margin-bottom: 2px; }
.category-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; }
.category-row input[type="checkbox"] { flex: none; }
.category-icon-wrap { flex: none; line-height: 0; }
.category-label { flex: 1; font: 500 13.5px "Inter", sans-serif; }
.category-row .count { color: rgba(40, 35, 30, 0.4); font: 500 12px "Inter", sans-serif; }
.category-children { margin-left: 30px; display: none; list-style: none; padding: 0; }
.category-children.open { display: block; }
.category-toggle-children {
    flex: none; display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; margin: -4px -4px -4px 0; border-radius: 50%;
    background: none; border: none; cursor: pointer; font-size: 1.15rem; line-height: 1;
    color: rgba(40, 35, 30, 0.65);
}
.category-toggle-children:hover { background: rgba(40, 35, 30, 0.08); color: var(--ink); }

.toggle-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; font: 500 13.5px "Inter", sans-serif; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 34px; height: 20px; border-radius: 100px; background: rgba(40, 35, 30, 0.18); position: relative; flex: none; transition: background 0.15s; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.25); }
.toggle-row input:checked + .toggle-track { background: var(--accent-teal); }
.toggle-row input:checked + .toggle-track .toggle-thumb { transform: translateX(14px); }

.select-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px; font: 500 13.5px "Inter", sans-serif; }
.select-row select {
    padding: 6px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong);
    background: #fff; font: 500 13px "Inter", sans-serif;
}

.tag-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== Map area ===== */
.map-area { position: relative; flex: 1.4; height: auto; }
#map { width: 100%; height: 100%; }

.view-toggle { position: absolute; z-index: 1000; top: 12px; left: 12px; display: flex; box-shadow: var(--shadow-card); border-radius: var(--radius-pill); overflow: hidden; }
.view-toggle button {
    padding: 9px 18px; border: none; background: #fff; color: var(--ink); cursor: pointer; font: 700 13px "Inter", sans-serif;
}
.view-toggle button.active { background: var(--ink); color: #fff; }

.locate-btn-float {
    position: absolute; z-index: 1000; top: 56px; left: 12px;
    display: flex; align-items: center; gap: 6px; padding: 9px 16px; border: none;
    background: #fff; color: var(--ink); cursor: pointer; font: 700 13px "Inter", sans-serif;
    box-shadow: var(--shadow-card); border-radius: var(--radius-pill);
}

.layer-switcher { position: absolute; z-index: 1000; top: 12px; right: 12px; display: flex; box-shadow: var(--shadow-card); border-radius: var(--radius-pill); overflow: hidden; }
.layer-switcher button {
    padding: 9px 14px; border: none; background: #fff; color: var(--ink); cursor: pointer; font: 700 12.5px "Inter", sans-serif; white-space: nowrap;
}
.layer-switcher button.active { background: var(--ink); color: #fff; }

.map-pin span {
    display: block; width: 16px; height: 16px; border-radius: 50% 50% 50% 0;
    border: 2px solid #fff; box-shadow: var(--shadow-pin); transform: rotate(45deg);
}
.map-pin.locked span { opacity: 0.85; }
.map-pin .lock-badge {
    position: absolute; top: -9px; left: 3px; font-size: 9px; line-height: 1; font-style: normal;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.4));
}
.marker-cluster-travelinfo { background: transparent; }
.marker-cluster-travelinfo div {
    width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font: 700 13px "Manrope", sans-serif; border: 2px solid rgba(255,255,255,0.85); box-shadow: var(--shadow-card);
}

.unlock-banner-group {
    position: absolute; z-index: 1000; bottom: 16px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px;
}
.unlock-banner-group.hidden { display: none; }
.unlock-banner {
    padding: 10px 20px; border: none; border-radius: var(--radius-pill); box-shadow: var(--shadow-card);
    background: var(--ink); color: #fff; font: 700 13px "Inter", sans-serif; cursor: pointer; white-space: nowrap;
}
.unlock-banner-login {
    padding: 10px 20px; border-radius: var(--radius-pill); box-shadow: var(--shadow-card);
    background: #fff; color: var(--ink); border: 1px solid var(--border-strong);
    font: 700 13px "Inter", sans-serif; text-decoration: none; white-space: nowrap;
}
.price-compare { opacity: 0.65; font-weight: 500; }

/* ===== Results list ===== */
.results-list { width: 320px; flex: none; overflow-y: auto; background: #fff; border-left: 1px solid var(--border); }
.results-list.hidden { display: none; }
.results-header { padding: 14px 16px; font: 700 13px "Inter", sans-serif; color: rgba(40, 35, 30, 0.5); border-bottom: 1px solid var(--border); }
.result-row { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.result-row:hover { background: rgba(40, 35, 30, 0.04); }
.result-row-icon { flex: none; }
.result-row-main { flex: 1; min-width: 0; }
.result-row-category { font: 600 11px "Inter", sans-serif; color: rgba(40, 35, 30, 0.5); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 2px; }
.result-row-name { font: 700 14px "Manrope", sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-row-meta { font: 500 12.5px "Inter", sans-serif; color: rgba(40, 35, 30, 0.55); margin-top: 2px; }
.result-row.locked { opacity: 0.75; }
.result-row.locked .result-row-name { color: rgba(40, 35, 30, 0.7); }
.locked-label { color: var(--accent-terracotta, #d97757); font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; font-size: 11px; }
.blurred-name { filter: blur(4px); user-select: none; }
.detail-name.blurred-name { filter: blur(7px); }
.result-empty { padding: 16px; color: rgba(40, 35, 30, 0.5); font: 500 14px "Inter", sans-serif; }

/* ===== POI detail modal ===== */
.poi-backdrop { position: fixed; inset: 0; background: rgba(20, 20, 19, 0.35); display: none; z-index: 1400; }
.poi-backdrop.open { display: block; }
.poi-modal {
    position: fixed; background: #fff; z-index: 1401; display: none; overflow-y: auto;
    top: 0; right: 0; bottom: 0; width: 380px; box-shadow: var(--shadow-panel);
    transition: width 0.2s ease, left 0.2s ease, right 0.2s ease, transform 0.2s ease;
}
.poi-modal.open { display: block; }
.poi-modal.wide { width: min(920px, 94vw); left: 50%; right: auto; transform: translateX(-50%); }
.poi-modal-inner { padding: 0 0 32px; position: relative; }
.poi-modal-toolbar { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 14px 0; }
.poi-modal-toolbar-btn {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.9); cursor: pointer; font: 600 14px sans-serif; box-shadow: var(--shadow-card);
}
.poi-modal-toolbar-btn:hover { background: #fff; }
#poi-modal-content { padding: 12px 24px 0; }
#poi-modal-content > .poi-gallery-slider { margin: 0 -24px 16px; }
.poi-modal.wide #poi-modal-content > .poi-gallery-slider { aspect-ratio: 16 / 7; }

.poi-gallery-slider { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--border); }
.poi-gallery-track { display: flex; height: 100%; transition: transform 0.3s ease; }
.poi-gallery-slide { flex: 0 0 100%; width: 100%; height: 100%; margin: 0; position: relative; }
.poi-gallery-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poi-gallery-slide figcaption {
    position: absolute; bottom: 0; right: 0; background: rgba(0, 0, 0, 0.55); color: #fff;
    font-size: 0.7rem; padding: 3px 10px; border-radius: var(--radius-sm) 0 0 0;
}
.poi-gallery-slide figcaption a { color: #fff; text-decoration: underline; }
.poi-gallery-nav {
    position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%;
    border: none; background: rgba(255, 255, 255, 0.85); color: var(--ink); font: 700 20px/1 sans-serif;
    cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-card);
}
.poi-gallery-nav:hover { background: #fff; }
.poi-gallery-prev { left: 10px; }
.poi-gallery-next { right: 10px; }

.detail-category-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.detail-category-label { font: 600 12px "Inter", sans-serif; color: rgba(40, 35, 30, 0.55); text-transform: uppercase; letter-spacing: 0.02em; }
.detail-name { font: 800 24px/1.25 "Manrope", sans-serif; color: var(--ink); margin: 0 0 8px; }
.detail-meta { font: 500 14px "Inter", sans-serif; color: rgba(40, 35, 30, 0.6); margin-bottom: 10px; display: inline-block; }

.poi-badge { display: inline-block; padding: 4px 10px; border-radius: var(--radius-pill); font-size: 0.75rem; color: #fff; }
.poi-secret-badge { background: var(--accent-terracotta); margin-bottom: 12px; }

#poi-modal-content.teaser { padding-bottom: 24px; }
.poi-teaser-image { position: relative; margin: 0 -24px 16px; overflow: hidden; }
.poi-teaser-image img { width: 100%; height: 200px; object-fit: cover; display: block; filter: brightness(0.75) saturate(0.85) blur(10px); transform: scale(1.08); }
.poi-teaser-image .lock-badge-overlay {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 32px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}
.unlock-card {
    margin-top: 16px; padding: 16px; border-radius: var(--radius-md); background: rgba(40, 35, 30, 0.04);
    border: 1px solid var(--border); text-align: center;
}
.unlock-hint { font: 500 13.5px/1.5 "Inter", sans-serif; color: rgba(40, 35, 30, 0.65); margin: 0 0 12px; }
.unlock-card .pill-button { width: 100%; }

.detail-actions-primary { display: flex; gap: 10px; margin: 14px 0 10px; }
.detail-actions-primary .pill-button { flex: 1; padding: 12px; }
.pill-button.outline.save-btn.saved { border-color: var(--accent-terracotta); color: var(--accent-terracotta); }
.detail-actions-secondary { display: flex; gap: 8px; margin-bottom: 18px; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
    border-radius: 50%; border: 1px solid var(--border-strong); background: #fff; color: var(--ink);
    text-decoration: none; cursor: pointer; font-size: 16px;
}
.icon-btn:hover { background: rgba(40, 35, 30, 0.05); }

#poi-modal-content p { font: 400 14.5px/1.7 "Inter", sans-serif; color: rgba(40, 35, 30, 0.8); }
#poi-modal-content h3 { font: 700 14px "Manrope", sans-serif; margin: 18px 0 8px; }
#poi-modal-content ul:not(.poi-nearby):not(.tag-list) { padding-left: 20px; margin: 0 0 12px; }

.detail-info-box { padding: 10px 14px 5px; margin: 12px 0; border-radius: 0 var(--radius-md) var(--radius-md) 0; border-left: 3px solid; }
.detail-info-box.tips { background: color-mix(in oklch, var(--accent-teal) 10%, white); border-left-color: var(--accent-teal); }
.detail-info-box.highlights { background: color-mix(in oklch, var(--accent-amber) 16%, white); border-left-color: var(--accent-amber); }
#poi-modal-content .detail-info-box .detail-section-heading { margin: 0 0 6px; }
#poi-modal-content .detail-info-box li { font: 400 14.5px/1.7 "Inter", sans-serif; }
.detail-section-heading { display: flex; align-items: center; gap: 6px; }
.detail-section-heading.tips { color: var(--accent-teal); }
.detail-section-heading.highlights { color: color-mix(in oklch, var(--accent-amber) 75%, var(--ink)); }
.detail-section-icon { font-size: 0.95rem; line-height: 1; }

.poi-warning { display: flex; align-items: flex-start; gap: 8px; background: #f8e6e3; border-left: 3px solid var(--accent-terracotta); padding: 10px 14px 5px; margin: 12px 0; font: 400 14.5px/1.7 "Inter", sans-serif; border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.poi-warning-icon { flex: none; line-height: 1.5; }

.practical-info p { padding: 10px 0; border-top: 1px solid var(--border); margin: 0; font: 500 13px "Inter", sans-serif; }
.practical-info p:first-child { border-top: none; }
.practical-info button { border: none; background: none; padding: 0; color: var(--accent-teal); cursor: pointer; font: 500 13px "Inter", sans-serif; }

.poi-amenity-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.poi-amenity-bar span { font-size: 0.75rem; background: rgba(40, 35, 30, 0.06); padding: 5px 10px; border-radius: var(--radius-pill); }

.poi-nearby { list-style: none; padding: 0; margin: 0; }
.poi-nearby li { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.poi-nearby-icon { display: flex; flex: none; }
.poi-nearby a { color: var(--accent-teal); text-decoration: none; font: 600 13.5px "Inter", sans-serif; }

.reviews-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.reviews-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 4px; }
.review-item { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.review-item:last-child { border-bottom: none; padding-bottom: 0; }
.review-item-stars { color: var(--accent-terracotta); font-size: 14px; letter-spacing: 1px; }
.review-item-meta { font: 500 12px "Inter", sans-serif; color: rgba(40, 35, 30, 0.5); margin: 2px 0 6px; }
.review-item-body { font: 400 14px/1.6 "Inter", sans-serif; color: rgba(40, 35, 30, 0.8); margin: 0; }

.own-review { margin-top: 18px; padding: 16px; border-radius: var(--radius-md); background: rgba(40, 35, 30, 0.03); border: 1px solid var(--border); }
.own-review h4 { font: 700 13.5px "Manrope", sans-serif; margin: 0 0 10px; }
.own-review .pill-button.outline { width: 100%; }
.own-review-form { display: flex; flex-direction: column; gap: 10px; }
.own-review-form textarea { min-height: 72px; resize: vertical; }
.own-review-form textarea, .own-review-form input[type="text"] {
    font: 400 14px "Inter", sans-serif; padding: 10px 12px; border-radius: var(--radius-md);
    border: 1px solid var(--border-strong); width: 100%; box-sizing: border-box;
}
.own-review-form .pill-button { align-self: flex-start; padding: 10px 20px; }
.own-review-message { font: 500 13px "Inter", sans-serif; color: var(--accent-teal); }

.star-picker { display: flex; gap: 4px; }
.star-picker-btn { background: none; border: none; padding: 0; font-size: 26px; line-height: 1; color: var(--accent-terracotta); cursor: pointer; }

.hint { color: rgba(40, 35, 30, 0.5); font-size: 0.82rem; }

/* ===== Mobile (<900px): filter panel + detail panel become full overlays,
   map/list are toggled single-pane instead of permanent side-by-side ===== */
@media (max-width: 899px) {
    .map-header { padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
    .region-name { display: none; }
    .map-search-wrap { order: 3; flex-basis: 100%; }

    .filter-panel {
        position: fixed; inset: 0; z-index: 1300; width: auto; border-right: none; padding: 20px; padding-bottom: 100px;
    }
    .mobile-close-filter { display: inline-flex; }
    .apply-btn-mobile { display: block; }

    .map-area { flex: none; width: 100%; height: 100%; }
    .map-area:has(#map.hidden) { display: none; }
    .results-list { width: 100%; flex: 1; border-left: none; }

    .poi-modal { inset: 0; width: 100%; box-shadow: none; }
}

@media (min-width: 900px) {
    /* Both panes stay visible on desktop — the map/list toggle only matters on mobile. */
    .view-toggle { display: none; }
    #map, .results-list { display: block !important; }
    /* .view-toggle above is hidden here, so the locate button moves up into its slot instead of leaving a gap. */
    .locate-btn-float { top: 12px; }
}
