/* /map — sidebar + full-bleed interactive map */

/* The "force header solid" rule now lives in components/header.css so it
   covers every page that needs it (map, park detail, etc.). */

/* ─────────── Page layout: left sidebar + map ─────────── */
.map-page {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: calc(100dvh - var(--header-h));
    background: var(--color-bg);
}

/* ─────────── Sidebar ─────────── */
.map-sidebar {
    background: linear-gradient(180deg, #0a2a20 0%, #143b2e 100%);
    color: var(--color-ivory);
    padding: var(--sp-6) var(--sp-5);
    border-right: 1px solid rgba(200, 163, 91, 0.18);
    overflow-y: auto;
    /* Match the map's visible height so the sidebar scrolls independently
       when filters overflow on short screens. */
    max-height: calc(100dvh - var(--header-h));
    position: sticky;
    top: var(--header-h);
    z-index: 2;
}
.map-sidebar__head { margin-bottom: var(--sp-6); }
.map-sidebar__head .eyebrow { color: var(--color-gold-500); }
.map-sidebar__head h1 {
    color: var(--color-ivory);
    font-size: var(--fs-xl);
    margin: var(--sp-2) 0 var(--sp-1);
    letter-spacing: -0.01em;
}
.map-sidebar__sub {
    color: rgba(250, 247, 240, 0.75);
    font-size: var(--fs-xs);
    margin: 0;
}
.map-sidebar__sub strong { color: var(--color-gold-500); font-weight: 700; }

.map-sidebar__field { margin-bottom: var(--sp-5); }
.map-sidebar__label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-gold-500);
    margin-bottom: 0.4rem;
}

/* Search input with leading icon + clear button. */
.map-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.map-search-wrap > svg {
    position: absolute;
    left: 0.7rem;
    width: 14px; height: 14px;
    color: rgba(250, 247, 240, 0.55);
    pointer-events: none;
}
.map-search {
    width: 100%;
    padding: 0.65rem 2.2rem 0.65rem 2.1rem;
    background: rgba(250, 247, 240, 0.08);
    border: 1px solid rgba(250, 247, 240, 0.18);
    border-radius: var(--r-md);
    color: var(--color-ivory);
    font-size: var(--fs-sm);
    transition: border-color var(--d-fast) var(--ease-out),
                background var(--d-fast) var(--ease-out);
}
.map-search::placeholder { color: rgba(250, 247, 240, 0.45); }
.map-search:focus {
    outline: none;
    border-color: var(--color-gold-500);
    background: rgba(250, 247, 240, 0.14);
}
.map-search__clear {
    position: absolute;
    right: 0.4rem;
    width: 26px; height: 26px;
    background: rgba(250, 247, 240, 0.08);
    color: var(--color-ivory);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.map-search__clear:hover { background: rgba(250, 247, 240, 0.18); }
.map-search__meta {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: rgba(250, 247, 240, 0.6);
}

/* Select inputs */
.map-sidebar__select {
    width: 100%;
    padding: 0.6rem 0.7rem;
    background: rgba(250, 247, 240, 0.08);
    border: 1px solid rgba(250, 247, 240, 0.18);
    border-radius: var(--r-md);
    color: var(--color-ivory);
    font-size: var(--fs-sm);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23c8a35b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 10px 10px;
    padding-right: 1.8rem;
}
.map-sidebar__select option { background: #0a2a20; color: var(--color-ivory); }
.map-sidebar__select:focus { outline: none; border-color: var(--color-gold-500); }

/* Action row */
.map-sidebar__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2);
    margin-bottom: var(--sp-5);
}
.map-sidebar__actions .btn {
    color: var(--color-ivory);
    border-color: rgba(250, 247, 240, 0.25);
    background: rgba(250, 247, 240, 0.05);
    justify-content: center;
    gap: 0.3rem;
}
.map-sidebar__actions .btn:hover {
    background: rgba(250, 247, 240, 0.12);
    border-color: var(--color-gold-500);
}
.map-sidebar__actions #map-tilt-toggle[aria-pressed="true"] {
    background: var(--color-gold-500);
    color: var(--color-forest-900);
    border-color: var(--color-gold-500);
}
.map-sidebar__actions .btn svg { width: 14px; height: 14px; }

/* Legend */
.map-sidebar__legend {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: var(--sp-4);
    border-top: 1px solid rgba(250, 247, 240, 0.1);
    font-size: 0.78rem;
    color: rgba(250, 247, 240, 0.75);
}
.map-sidebar__legend-row {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.map-page__legend-pin,
.map-page__legend-cluster {
    width: 12px; height: 12px;
    border-radius: 50%;
    border: 1.5px solid rgba(7, 38, 29, 0.7);
    flex-shrink: 0;
}
.map-page__legend-pin     { background: #c8a35b; box-shadow: 0 0 0 2px rgba(200, 163, 91, 0.25); }
.map-page__legend-cluster { background: #3f8569; }

/* ─────────── Map canvas ─────────── */
.map-page__canvas-wrap {
    position: relative;
}
.map-page__canvas {
    position: absolute;
    inset: 0;
    background: #e6efe8;
}
.map-page__canvas .maplibregl-map { font-family: inherit; }

/* Loading overlay */
.map-page__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(250, 247, 240, 0.94);
    color: var(--color-forest-900);
    font-size: var(--fs-sm);
    z-index: 5;
    transition: opacity 300ms var(--ease-out);
}
.map-page__loading.is-hidden { opacity: 0; pointer-events: none; }
.map-page__loading-spin {
    width: 18px; height: 18px;
    border: 2px solid rgba(63, 133, 105, 0.2);
    border-top-color: var(--color-forest-800);
    border-radius: 50%;
    animation: map-spin 0.8s linear infinite;
}
@keyframes map-spin { to { transform: rotate(360deg); } }

.map-page__noscript {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-6);
    background: var(--color-bg-warm);
    color: var(--color-forest-900);
}

/* ─────────── Popup ─────────── */
.map-popup .maplibregl-popup-content {
    padding: 0;
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(7, 38, 29, 0.25);
    border: 1px solid var(--color-line);
}
.map-popup .maplibregl-popup-close-button {
    color: var(--color-forest-900);
    font-size: 1.2rem;
    padding: 4px 8px;
    z-index: 2;
}
/* Hover popups don't get a close button (they auto-close on mouseleave). */
.map-popup--hover .maplibregl-popup-close-button { display: none; }
.map-popup__body {
    width: 280px;
    padding: 0 0 0.85rem;
    font-size: var(--fs-sm);
    color: var(--color-forest-900);
}
.map-popup__hero {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
    background: var(--color-line);
}
.map-popup__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.25;
    padding: 0.7rem 0.85rem 0.2rem;
    color: var(--color-forest-900);
}
.map-popup__title-link {
    color: inherit;
    text-decoration: none;
    transition: color var(--d-fast) var(--ease-out);
}
.map-popup__title-link:hover { color: var(--color-gold-700); text-decoration: underline; }
.map-popup__loc {
    padding: 0 0.85rem;
    font-size: var(--fs-xs);
    color: var(--color-muted);
}
.map-popup__meta {
    padding: 0.4rem 0.85rem 0;
    font-size: var(--fs-xs);
    color: var(--color-forest-800);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.map-popup__star  { color: var(--color-gold-700); font-weight: 600; }
.map-popup__rev   { color: var(--color-muted); }
.map-popup__price { color: var(--color-forest-700); font-weight: 600; }
.map-popup__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.5rem 0.85rem 0;
}
.map-popup__pill {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    background: rgba(63, 133, 105, 0.1);
    color: var(--color-forest-800);
    border-radius: var(--r-full);
}
.map-popup__cta {
    padding: 0.65rem 0.85rem 0;
}
.map-popup__loading {
    padding: 0.5rem 0.85rem 0;
    color: var(--color-muted);
    font-size: var(--fs-xs);
    font-style: italic;
}

/* ─────────── Mobile: sidebar collapses to a top drawer ─────────── */
@media (max-width: 880px) {
    .map-page {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .map-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid rgba(200, 163, 91, 0.18);
        padding: var(--sp-4) var(--sp-4) var(--sp-5);
    }
    .map-sidebar__head { margin-bottom: var(--sp-4); }
    .map-sidebar__head h1 { font-size: var(--fs-lg); }
    .map-sidebar__field { margin-bottom: var(--sp-3); }
    .map-page__canvas-wrap { min-height: 65vh; }
}
