/* ==========================================================================
   Phuket Elephant — Map UI (Leaflet)
   ========================================================================== */

:root {
    --pe-map-nav-offset: 80px;
    --pe-map-primary: #7dba7d;
    --pe-map-primary-dark: #5f9f5f;
    --pe-map-primary-soft: #e8f3e8;
    --pe-map-earth: #7a583a;
    --pe-map-bg: #eef1f5;
    --pe-map-surface: #ffffff;
    --pe-map-text: #0f172a;
    --pe-map-muted: #64748b;
    --pe-map-border: #e2e8f0;
    --pe-map-radius: 14px;
    --pe-map-radius-sm: 10px;
    --pe-map-shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
    --pe-map-shadow-sm: 0 2px 12px rgba(15, 23, 42, 0.08);
    --pe-map-font: 'Poppins', system-ui, sans-serif;
    --pe-map-header-h: auto;
    --pe-map-sidebar-w: min(400px, 38vw);
    /* Collapsed camp list sheet — keep legend / zoom above this on mobile */
    --pe-map-mobile-sheet-peek: 3.25rem;
}

/* Leaflet base */
.leaflet-container {
    font-family: var(--pe-map-font);
    z-index: 0;
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: #e8edf2;
}

.leaflet-container img,
.leaflet-container .leaflet-tile {
    max-width: none !important;
    max-height: none !important;
}

.leaflet-control-zoom {
    border: 0 !important;
    box-shadow: var(--pe-map-shadow-sm) !important;
    border-radius: var(--pe-map-radius-sm) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    font-size: 18px !important;
    color: var(--pe-map-text) !important;
    border-bottom-color: var(--pe-map-border) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--pe-map-primary-soft) !important;
    color: var(--pe-map-primary-dark) !important;
}

.leaflet-bottom.leaflet-right {
    margin-bottom: 1rem;
    margin-right: 1rem;
}

/* Page shell */
body.camp-map-page-body {
    background: var(--pe-map-bg);
    overflow: hidden;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
}

body.camp-map-page-body nav {
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

body.camp-map-page-body .camp-map-page-section {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: var(--pe-map-viewport-h, calc(100dvh - var(--pe-map-nav-offset)));
    min-height: var(--pe-map-viewport-h, calc(100dvh - var(--pe-map-nav-offset)));
    padding: 0;
    margin: 0;
    overflow: hidden;
}

body.camp-map-page-body #campMapShell.camp-map-shell {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

body.camp-map-expanded {
    overflow: hidden;
}

.camp-map-page-section {
    padding: 0;
    margin: 0;
}

.camp-map-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    background: var(--pe-map-surface);
    border-radius: 0;
    overflow: hidden;
    position: relative;
    font-family: var(--pe-map-font);
}

.camp-map-shell--page {
    border: 0;
    box-shadow: none;
}

.camp-map-shell--embed {
    height: 480px;
    min-height: 480px;
    max-height: 480px;
    border: 1px solid var(--pe-map-border);
    border-radius: var(--pe-map-radius);
    box-shadow: var(--pe-map-shadow);
}

.camp-map-shell.is-map-expanded {
    position: fixed;
    inset: 0;
    z-index: 9999;
    width: 100vw;
    height: 100svh;
    max-height: 100svh;
    min-height: 100svh;
    border-radius: 0;
}

.camp-map-shell.is-loading .camp-map-canvas {
    opacity: 0.65;
}

.camp-map-shell.is-loading .camp-map-sidebar-loading {
    display: flex;
}

.camp-map-shell.is-loading .camp-map-sidebar-list {
    visibility: hidden;
    height: 0;
    overflow: hidden;
    flex: 0;
    padding: 0;
}

/* Header */
.camp-map-header {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 0.85rem 1rem 0.75rem;
    background: var(--pe-map-surface);
    border-bottom: 1px solid var(--pe-map-border);
    z-index: 20;
}

.camp-map-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.camp-map-brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--pe-map-primary), var(--pe-map-primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(125, 186, 125, 0.45);
}

.camp-map-brand-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--pe-map-text);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.camp-map-brand-meta {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
    color: var(--pe-map-muted);
}

.camp-map-brand-meta span {
    font-weight: 700;
    color: var(--pe-map-primary-dark);
}

.camp-map-header-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 320px;
    justify-content: flex-end;
    min-width: 0;
}

.camp-map-search {
    position: relative;
    flex: 1 1 200px;
    max-width: 320px;
    min-width: 160px;
}

.camp-map-search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pe-map-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.camp-map-search-input {
    width: 100%;
    border: 1px solid var(--pe-map-border);
    border-radius: 999px;
    padding: 0.55rem 1rem 0.55rem 2.35rem;
    font-size: 0.875rem;
    color: var(--pe-map-text);
    background: #f8fafc;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.camp-map-search-input:focus {
    outline: none;
    border-color: var(--pe-map-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(125, 186, 125, 0.25);
}

.camp-map-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--pe-map-border);
    border-radius: var(--pe-map-radius-sm);
    box-shadow: var(--pe-map-shadow);
    max-height: 260px;
    overflow-y: auto;
    z-index: 1000;
}

.camp-map-search-dropdown.hidden {
    display: none;
}

.camp-map-search-result {
    display: block;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--pe-map-border);
    background: #fff;
    text-align: left;
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
    color: var(--pe-map-text);
    cursor: pointer;
    transition: background 0.12s;
}

.camp-map-search-result:last-child {
    border-bottom: 0;
}

.camp-map-search-result:hover,
.camp-map-search-result:focus {
    background: var(--pe-map-primary-soft);
    outline: none;
}

.camp-map-search-result strong {
    display: block;
    font-weight: 600;
}

.camp-map-search-result small {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: var(--pe-map-muted);
}

.camp-map-search-section {
    padding: 0.4rem 0.85rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pe-map-muted);
    background: #f8fafc;
    border-top: 1px solid var(--pe-map-border);
    border-bottom: 1px solid var(--pe-map-border);
}

.camp-map-filters {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.camp-map-select {
    border: 1px solid var(--pe-map-border);
    border-radius: 999px;
    padding: 0.5rem 2rem 0.5rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--pe-map-text);
    background: #f8fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 0.65rem center;
    appearance: none;
    cursor: pointer;
    max-width: 130px;
}

.camp-map-select:focus {
    outline: none;
    border-color: var(--pe-map-primary);
    box-shadow: 0 0 0 3px rgba(125, 186, 125, 0.2);
}

.camp-map-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.camp-map-header-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-shrink: 0;
}

body.camp-map-page-body #campMapShell .camp-map-btn,
body.camp-map-page-body #campMapShell .camp-map-search-input,
body.camp-map-page-body #campMapShell .camp-map-select,
body.camp-map-page-body #campMapShell .camp-map-sidebar-search-input {
    font-family: var(--pe-map-font);
    line-height: 1.4;
    appearance: none;
    -webkit-appearance: none;
}

.camp-map-btn {
    border: 1px solid var(--pe-map-border);
    background: #fff;
    color: var(--pe-map-text);
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.camp-map-btn:hover {
    background: #f8fafc;
}

.camp-map-btn:active {
    transform: scale(0.98);
}

.camp-map-btn--primary {
    background: var(--pe-map-primary);
    border-color: var(--pe-map-primary-dark);
    color: #fff;
}

.camp-map-btn--primary:hover {
    background: var(--pe-map-primary-dark);
}

.camp-map-btn--ghost {
    display: none;
}

/* Layout */
body.camp-map-page-body #campMapShell .camp-map-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(300px, min(400px, 38vw)) minmax(0, 1fr);
}

.camp-map-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.camp-map-sidebar {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border-right: 1px solid var(--pe-map-border);
    position: relative;
}

.camp-map-sidebar-head {
    flex-shrink: 0;
    padding: 0.85rem 1rem 0.65rem;
    border-bottom: 1px solid var(--pe-map-border);
    background: #fff;
}

.camp-map-sidebar-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.camp-map-sidebar-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--pe-map-text);
}

.camp-map-sidebar-title span {
    color: var(--pe-map-primary-dark);
}

.camp-map-sidebar-hint {
    font-size: 0.7rem;
    color: var(--pe-map-muted);
    white-space: nowrap;
}

.camp-map-sidebar-search {
    position: relative;
}

.camp-map-sidebar-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pe-map-muted);
    font-size: 0.75rem;
    pointer-events: none;
}

.camp-map-sidebar-search-input {
    width: 100%;
    border: 1px solid var(--pe-map-border);
    border-radius: var(--pe-map-radius-sm);
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    font-size: 0.8rem;
    background: #f8fafc;
    color: var(--pe-map-text);
}

.camp-map-sidebar-search-input:focus {
    outline: none;
    border-color: var(--pe-map-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(125, 186, 125, 0.2);
}

.camp-map-sidebar-list {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.camp-map-sidebar-loading {
    display: none;
    padding: 0.5rem;
    flex-direction: column;
    gap: 0.5rem;
}

.camp-map-skeleton {
    height: 88px;
    border-radius: var(--pe-map-radius-sm);
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: camp-map-shimmer 1.2s ease-in-out infinite;
}

@keyframes camp-map-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.camp-map-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--pe-map-muted);
    gap: 0.35rem;
}

.camp-map-empty.hidden {
    display: none;
}

.camp-map-empty i {
    font-size: 2rem;
    color: var(--pe-map-primary);
    opacity: 0.6;
    margin-bottom: 0.35rem;
}

.camp-map-empty p {
    margin: 0;
    font-weight: 600;
    color: var(--pe-map-text);
    font-size: 0.95rem;
}

.camp-map-empty span {
    font-size: 0.8rem;
}

/* List cards */
.camp-map-list-item {
    width: 100%;
    border: 1px solid var(--pe-map-border);
    border-radius: var(--pe-map-radius-sm);
    background: #fff;
    text-align: left;
    padding: 0.65rem;
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0.65rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    box-shadow: var(--pe-map-shadow-sm);
}

.camp-map-list-item:hover {
    border-color: var(--pe-map-primary);
    box-shadow: 0 4px 16px rgba(125, 186, 125, 0.2);
}

.camp-map-list-item.is-active {
    border-color: var(--pe-map-primary);
    background: var(--pe-map-primary-soft);
    box-shadow: 0 0 0 2px rgba(125, 186, 125, 0.35);
}

.camp-map-list-thumb {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
    display: block;
}

.camp-map-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camp-map-list-thumb-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.25rem;
}

.camp-map-list-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.camp-map-list-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--pe-map-text);
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.camp-map-list-title:hover {
    color: var(--pe-map-primary-dark);
    text-decoration: underline;
}

.camp-map-list-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
}

.camp-map-list-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.25;
    color: #ffffff;
    background-color: #0c4a6e;
    padding: 0.15rem 0.4rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.85);
}

.camp-map-list-rating {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--pe-map-earth);
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.camp-map-list-rating .fa-star {
    color: #f59e0b;
    font-size: 0.65rem;
}

.camp-map-list-location {
    font-size: 0.72rem;
    color: var(--pe-map-muted);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.camp-map-list-cta {
    margin-top: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--pe-map-primary-dark);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Map stage */
.camp-map-stage {
    position: relative;
    min-height: 0;
    height: 100%;
    background: #dde4ea;
}

.camp-map-canvas {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.camp-map-shell .camp-map-canvas.leaflet-container,
.camp-map-shell .camp-map-canvas {
    overflow: hidden;
    height: 100% !important;
    min-height: 100% !important;
    width: 100% !important;
}

/* Keep permanent camp name tooltips from being clipped at map edges */
.camp-map-stage .leaflet-pane.leaflet-tooltip-pane,
.camp-map-stage .leaflet-pane.leaflet-overlay-pane {
    z-index: 650;
}

.camp-map-stage .camp-marker-label {
    pointer-events: none;
    white-space: nowrap;
    max-width: min(220px, 42vw);
    overflow: hidden;
    text-overflow: ellipsis;
}

.camp-map-legend.hidden {
    display: none;
}

.camp-map-legend {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    z-index: 500;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    border: 1px solid var(--pe-map-border);
    border-radius: var(--pe-map-radius-sm);
    padding: 0.5rem 0.65rem;
    box-shadow: var(--pe-map-shadow-sm);
    max-width: calc(100% - 5rem);
}

.camp-map-legend-title {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--pe-map-muted);
    margin-bottom: 0.35rem;
}

.camp-map-legend-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.65rem;
    font-size: 0.68rem;
    color: var(--pe-map-text);
}

.camp-map-legend-list li {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.camp-map-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.camp-map-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 650;
}

.camp-map-backdrop.is-visible {
    display: block;
}

.camp-map-shell.is-map-expanded .camp-map-sidebar {
    display: none;
}

.camp-map-shell.is-map-expanded .camp-map-layout {
    grid-template-columns: 1fr;
}

.camp-map-shell.is-map-expanded .camp-map-header {
    padding-top: max(0.85rem, env(safe-area-inset-top));
}

/* Markers */
.camp-leaflet-marker {
    background: transparent;
    border: none;
}

.camp-marker-pin {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 3px solid #fff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.35);
    transition: transform 0.15s;
}

.camp-marker-pin::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    opacity: 0.9;
}

.camp-marker-label {
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    line-height: 1.3;
}

@media (max-width: 767px) {
    .camp-marker-label {
        font-size: 10px;
        padding: 3px 8px;
        max-width: min(180px, 38vw);
    }
}

.camp-marker-label:before {
    display: none;
}

/* Popups */
.camp-popup-desc {
    display: none !important;
}

.camp-popup-wrap .leaflet-popup-content-wrapper {
    border-radius: var(--pe-map-radius);
    padding: 0;
    overflow: hidden;
    box-shadow: var(--pe-map-shadow);
}

.camp-popup-wrap .leaflet-popup-content {
    margin: 0;
    width: 300px !important;
}

.camp-popup-wrap--compact .leaflet-popup-content {
    width: 260px !important;
}

.camp-popup-wrap .leaflet-popup-tip {
    box-shadow: none;
}

.camp-marker-popup {
    font-family: var(--pe-map-font);
}

.camp-popup-image-link {
    display: block;
}

.camp-popup-image {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
}

.camp-popup-wrap--compact .camp-popup-image {
    height: 100px;
}

.camp-popup-image--placeholder {
    height: 100px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2rem;
}

.camp-popup-body {
    padding: 14px 16px 16px;
}

.camp-popup-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--pe-map-text);
    margin: 0 0 6px;
    line-height: 1.3;
}

.camp-popup-title-link {
    color: inherit;
    text-decoration: none;
}

.camp-popup-title-link:hover {
    color: var(--pe-map-primary-dark);
}

.camp-popup-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.25;
    color: #ffffff;
    background-color: #0c4a6e;
    padding: 0.15rem 0.45rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.85);
}

.camp-popup-location {
    font-size: 0.8rem;
    color: var(--pe-map-muted);
    margin: 0 0 12px;
    line-height: 1.4;
}

.camp-popup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.camp-popup-btn {
    display: inline-flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: var(--pe-map-primary);
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    border: 0;
    box-shadow: 0 4px 14px rgba(125, 186, 125, 0.45);
    transition: background 0.15s, transform 0.1s;
    cursor: pointer;
}

.camp-popup-btn--directions {
    background: #eff6ff;
    color: #1d4ed8;
    box-shadow: none;
    border: 1px solid #bfdbfe;
}

.camp-popup-btn--directions:hover {
    background: #dbeafe;
    color: #1e40af;
}

.camp-popup-btn:hover {
    background: var(--pe-map-primary-dark);
    color: #fff;
    transform: translateY(-1px);
}

.camp-popup-btn--view,
.leaflet-container a.camp-popup-btn--view,
.leaflet-popup-content a.camp-popup-btn--view {
    background: #0c4a6e;
    color: #fff;
    box-shadow: 0 4px 14px rgba(26, 86, 50, 0.35);
}

.camp-popup-btn--view:hover,
.leaflet-container a.camp-popup-btn--view:hover,
.leaflet-popup-content a.camp-popup-btn--view:hover {
    background: #143f26;
    color: #fff;
}

.camp-map-list-distance,
.camp-popup-distance,
.camp-distance-note {
    display: none;
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0c4a6e;
    line-height: 1.3;
}

.camp-map-list-distance.is-on,
.camp-popup-distance.is-on,
.camp-distance-note.is-on {
    display: block;
}

.camp-popup-distance {
    margin: 0 0 8px;
}

.camp-distance-note {
    font-size: 0.875rem;
    margin: 0 0 0.75rem;
}

.camp-route-note {
    display: block;
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: #1d4ed8;
    line-height: 1.4;
}

.camp-route-note[hidden] {
    display: none;
}

.camp-distance-btn {
    display: inline-flex;
    align-items: center;
    border: 0;
    background: transparent;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: #0c4a6e;
    cursor: pointer;
    text-decoration: underline;
}

.camp-distance-check-btn,
.camp-map-check-distance {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    margin: 0 0 0.75rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid #bbd7c3;
    border-radius: 0.85rem;
    background: #f3faf5;
    color: #0c4a6e;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
}

.camp-distance-check-btn:disabled,
.camp-map-check-distance:disabled {
    opacity: 0.7;
    cursor: wait;
}

.camp-distance-check-btn[hidden],
.camp-map-check-distance[hidden] {
    display: none;
}

.camp-map-check-distance {
    margin: 0.65rem 0 0;
}

.camp-map-distance-dock {
    position: absolute;
    z-index: 650;
    top: 0.85rem;
    right: 0.85rem;
    left: auto;
    width: max-content;
    max-width: calc(100% - 1.7rem);
    pointer-events: none;
}

.camp-map-distance-dock[hidden] {
    display: none;
}

.camp-map-check-distance--center {
    pointer-events: auto;
    width: auto;
    margin: 0;
    min-height: 3.15rem;
    padding: 0.8rem 1.35rem;
    border: 0;
    border-radius: 999px;
    background: #0c4a6e;
    color: #fff;
    box-shadow: 0 12px 28px rgba(20, 83, 45, 0.38);
    font-size: 1rem;
    font-weight: 800;
}

.camp-map-check-distance--center:hover {
    background: #144628;
    color: #fff;
}

.camp-map-sort-distance {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    margin-top: 0.55rem;
    min-height: 2.4rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #bbd7c3;
    border-radius: 999px;
    background: #fff;
    color: #0c4a6e;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}

.camp-map-sort-distance[hidden] {
    display: none;
}

.camp-map-sort-distance.is-active {
    background: #0c4a6e;
    border-color: #0c4a6e;
    color: #fff;
}

.camp-map-geo-prompt {
    position: absolute;
    inset: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.48);
}

.camp-map-geo-prompt[hidden],
.camp-map-geo-prompt.hidden {
    display: none;
}

.camp-map-geo-prompt-card {
    width: min(22rem, 100%);
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.4rem 1.25rem 1.1rem;
    text-align: center;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.camp-map-geo-prompt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 0.75rem;
    border-radius: 999px;
    background: #e8f6ec;
    color: #0c4a6e;
    font-size: 1.15rem;
}

.camp-map-geo-prompt-card h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #0c4a6e;
}

.camp-map-geo-prompt-card p {
    margin: 0.55rem 0 1rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #4b5563;
}

.camp-map-geo-prompt-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.camp-map-geo-allow,
.camp-map-geo-deny {
    width: 100%;
    min-height: 2.85rem;
    border-radius: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.camp-map-geo-allow {
    border: 0;
    background: #0c4a6e;
    color: #fff;
}

.camp-map-geo-allow:hover {
    background: #144628;
}

.camp-map-geo-deny {
    border: 0;
    background: transparent;
    color: #4b5563;
}

.camp-popup-btn--directions:hover {
    background: #dbeafe;
    color: #1e40af;
}

.camp-map-btn.is-active {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.camp-user-location-marker {
    background: transparent;
    border: 0;
}

.camp-user-location-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    background: #2563eb;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.45);
    z-index: 2;
}

.camp-user-location-pulse {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    background: rgba(37, 99, 235, 0.2);
    border-radius: 50%;
    animation: camp-user-pulse 2s ease-out infinite;
    z-index: 1;
}

@keyframes camp-user-pulse {
    0% { transform: scale(0.45); opacity: 0.9; }
    100% { transform: scale(1.2); opacity: 0; }
}

.camp-user-location-tooltip {
    font-family: var(--pe-map-font);
    font-size: 0.75rem;
    font-weight: 600;
    border: 0;
    box-shadow: var(--pe-map-shadow-sm);
}

.camp-map-route-panel {
    position: absolute;
    left: 1rem;
    bottom: 5.5rem;
    z-index: 500;
    width: min(320px, calc(100% - 2rem));
    background: var(--pe-map-surface);
    border: 1px solid var(--pe-map-border);
    border-radius: var(--pe-map-radius);
    box-shadow: var(--pe-map-shadow);
    padding: 1rem 1rem 0.875rem;
}

.camp-map-route-label {
    margin: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--pe-map-muted);
}

.camp-map-route-title {
    margin: 0.25rem 0 0.35rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--pe-map-text);
    line-height: 1.3;
}

.camp-map-route-meta {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: #1d4ed8;
    font-weight: 600;
}

.camp-map-route-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.camp-map-route-external {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--pe-map-primary-dark);
    text-decoration: none;
}

.camp-map-route-external:hover {
    text-decoration: underline;
}

.camp-map-route-clear,
.camp-map-route-close {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: var(--pe-map-font);
}

.camp-map-route-clear {
    margin-left: auto;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--pe-map-muted);
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
}

.camp-map-route-clear:hover {
    background: #f1f5f9;
    color: var(--pe-map-text);
}

.camp-map-route-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    color: var(--pe-map-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.camp-map-route-close-label {
    line-height: 1;
}

.camp-map-route-close:hover {
    background: #f1f5f9;
    color: var(--pe-map-text);
}

.camp-map-geo-toast {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 600;
    max-width: min(420px, calc(100% - 2rem));
    padding: 0.75rem 1rem;
    border-radius: var(--pe-map-radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.45;
    box-shadow: var(--pe-map-shadow);
    pointer-events: none;
}

.camp-map-geo-toast.is-info {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.camp-map-geo-toast.is-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.camp-map-list-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin-top: 0.35rem;
}

.camp-map-list-directions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 0.75rem;
    font-weight: 700;
    color: #1d4ed8;
    cursor: pointer;
}

.camp-map-list-directions:hover {
    text-decoration: underline;
}

.camp-map-list-cta {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pe-map-primary-dark);
}

.camp-map-route-panel:not(.hidden) {
    animation: camp-route-panel-in 0.22s ease-out;
}

@keyframes camp-route-panel-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Map picker (admin) */
.camp-map-wrap {
    position: relative;
}

.camp-map-search-results {
    max-height: 220px;
    overflow-y: auto;
}

.camp-map-picker-results {
    max-height: 180px;
    overflow-y: auto;
}

.camp-map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Legacy aliases */
.camp-map-shell--booking {
    border: 0;
    box-shadow: none;
}

.camp-map-shell--booking .camp-map-layout {
    grid-template-columns: var(--pe-map-sidebar-w) 1fr;
}

/* Responsive */
@media (max-width: 1023px) {
    :root {
        --pe-map-sidebar-w: min(360px, 42vw);
    }

    .camp-map-header-controls {
        width: 100%;
        justify-content: stretch;
    }

    .camp-map-search {
        max-width: none;
        flex: 1 1 100%;
    }
}

@media (max-width: 767px) {
    body.camp-map-page-body .camp-map-page-section {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: var(--pe-map-nav-offset);
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: none;
        padding-bottom: env(safe-area-inset-bottom, 0);
        z-index: 10;
    }

    body.camp-map-page-body #campMapShell .camp-map-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        position: relative;
        flex: 1 1 auto;
        min-height: 0;
    }

    body.camp-map-page-body #campMapShell .camp-map-stage {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
    }

    .camp-map-header {
        padding: 0.5rem 0.65rem;
        gap: 0.4rem;
    }

    .camp-map-brand-icon {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    .camp-map-brand-title {
        font-size: 0.92rem;
    }

    .camp-map-brand-meta {
        font-size: 0.72rem;
    }

    .camp-map-header-controls {
        gap: 0.35rem;
        align-items: stretch;
    }

    .camp-map-toolbar {
        flex: 1 1 100%;
        width: 100%;
        flex-wrap: nowrap;
        gap: 0.3rem;
        min-width: 0;
    }

    .camp-map-filters {
        flex: 1 1 0;
        min-width: 0;
        flex-wrap: nowrap;
        gap: 0.3rem;
    }

    .camp-map-select {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        font-size: 0.72rem;
        padding: 0.45rem 1.35rem 0.45rem 0.55rem;
    }

    .camp-map-header-actions .camp-map-btn {
        width: 2.35rem;
        height: 2.35rem;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .camp-map-btn--list {
        display: inline-flex;
    }

    .camp-map-layout {
        grid-template-columns: 1fr;
        position: relative;
    }

    .camp-map-sidebar {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 700;
        height: min(58vh, 480px);
        border-right: 0;
        border-top: 1px solid var(--pe-map-border);
        border-radius: 18px 18px 0 0;
        box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.2);
        transform: translateY(calc(100% - 3.25rem));
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .camp-map-sidebar::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #cbd5e1;
        border-radius: 999px;
        margin: 0.5rem auto 0;
        flex-shrink: 0;
    }

    .camp-map-sidebar.is-open {
        transform: translateY(0);
    }

    .camp-map-sidebar-head {
        padding-top: 0.35rem;
    }

    .camp-map-stage .leaflet-bottom.leaflet-right {
        margin-bottom: calc(var(--pe-map-mobile-sheet-peek) + 0.85rem + env(safe-area-inset-bottom, 0)) !important;
        margin-right: 0.65rem !important;
    }

    .camp-map-legend {
        left: 0.5rem;
        right: auto;
        bottom: calc(var(--pe-map-mobile-sheet-peek) + 0.85rem + env(safe-area-inset-bottom, 0));
        z-index: 720;
        font-size: 0.65rem;
        max-width: calc(100% - 4.75rem);
        background: rgba(255, 255, 255, 0.97);
        box-shadow: var(--pe-map-shadow-sm);
    }

    .camp-map-legend-title {
        color: #475569;
    }

    /* Full list open — hide legend so it does not sit under the sheet */
    .camp-map-shell:has(.camp-map-sidebar.is-open) .camp-map-legend {
        visibility: hidden;
        pointer-events: none;
    }

    .camp-map-shell.is-map-expanded .camp-map-sidebar {
        display: none;
    }

    .camp-map-shell.is-map-expanded .camp-map-legend {
        bottom: max(0.65rem, env(safe-area-inset-bottom, 0));
    }

    .camp-map-shell.is-map-expanded .camp-map-stage .leaflet-bottom.leaflet-right {
        margin-bottom: 1rem !important;
    }

    .camp-map-expand-label,
    .camp-map-btn-label {
        display: none;
    }

    .camp-map-route-panel {
        bottom: calc(var(--pe-map-mobile-sheet-peek) + 4.75rem);
        left: 0.65rem;
        width: min(300px, calc(100% - 1.3rem));
    }

    .camp-map-geo-toast {
        top: 0.65rem;
        font-size: 0.75rem;
    }

    .camp-map-distance-dock {
        top: 0.55rem;
        right: 0.55rem;
    }

    .camp-map-check-distance--center {
        min-height: 2.75rem;
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }
}

@media (min-width: 768px) {
    .camp-map-header {
        padding: 0.9rem 1.25rem;
    }

    .camp-map-brand-title {
        font-size: 1.15rem;
    }
}
