/* ── Map ── */
#map {
    width: 100%;
    height: 100%;
}

/* ── Glassmorphism panels ── */
.glass-panel {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.07);
}

/* ── Hide scrollbar while keeping scroll functionality ── */
.no-scrollbar {
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* ── Zoom controls ── */
.leaflet-control-zoom {
    border: none !important;
    border-radius: 14px !important;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18) !important;
}

.leaflet-control-zoom a {
    width: 38px !important;
    height: 38px !important;
    line-height: 38px !important;
    background: rgba(255, 255, 255, 0.65) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #374151 !important;
    font-size: 20px !important;
    font-weight: 300 !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4) !important;
    transition: background 0.15s, color 0.15s;
}

.leaflet-control-zoom a:last-child {
    border-bottom: none !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, 0.88) !important;
    color: #111 !important;
}

/* ── Tooltips ── */
.leaflet-tooltip {
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    color: #111827 !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
    font-size: 14px !important;
    line-height: 1.5;
    max-width: 280px;
    pointer-events: none;
}

.leaflet-tooltip-top::before {
    border-top-color: rgba(255, 255, 255, 0.75) !important;
}

.leaflet-tooltip-bottom::before {
    border-bottom-color: rgba(255, 255, 255, 0.75) !important;
}

.tooltip-name {
    font-weight: 700;
    font-size: 14px;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.tooltip-meta {
    color: #4b5563;
    font-size: 14px;
    margin-top: 2px;
}

.tooltip-dist {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ── Popups ── */
.leaflet-popup-content-wrapper {
    border-radius: 14px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18) !important;
    border: none !important;
    padding: 0 !important;
    overflow: hidden;
}

/* 400px on desktop, capped to viewport width on smaller screens */
.leaflet-popup-content {
    margin: 0 !important;
    width: min(400px, calc(100vw - 24px)) !important;
}

.leaflet-popup-tip-container {
    margin-top: -1px;
}

.leaflet-popup-tip {
    box-shadow: none !important;
}

.popup-inner {
    padding: 14px 16px 12px;
}

.popup-name {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    margin-bottom: 6px;
}

.popup-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 3px;
}

.popup-row svg {
    flex-shrink: 0;
    opacity: 0.55;
}

.popup-dist {
    display: inline-block;
    margin-top: 6px;
    margin-bottom: 6px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.popup-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 8px 0;
}

.popup-site {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #3b82f6;
    text-decoration: none;
    word-break: break-all;
}

.popup-site:hover {
    text-decoration: underline;
}

.popup-links {
    margin-top: 6px;
}

.popup-links a {
    margin-right: 6px;
}

.popup-desc {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.5;
    margin-top: 4px;
}

/* ── Marker clusters ── */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-clip: padding-box;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    width: 34px !important;
    height: 34px !important;
    margin-left: 3px !important;
    margin-top: 3px !important;
    border-radius: 50% !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.marker-cluster-small {
    background-color: rgba(16, 185, 129, 0.2) !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
}

.marker-cluster-small div {
    background-color: rgba(16, 185, 129, 0.85) !important;
}

.marker-cluster-medium {
    background-color: rgba(245, 158, 11, 0.2) !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
}

.marker-cluster-medium div {
    background-color: rgba(245, 158, 11, 0.85) !important;
}

.marker-cluster-large {
    background-color: rgba(239, 68, 68, 0.2) !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
}

.marker-cluster-large div {
    background-color: rgba(239, 68, 68, 0.85) !important;
}

/* ── Legend ── */
.map-legend {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.5);
    min-width: 130px;
}

.legend-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 8px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    margin-bottom: 5px;
}

.legend-row:last-child {
    margin-bottom: 0;
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Misc ── */
.leaflet-control-attribution {
    display: none;
}

.marker-icon {
    cursor: pointer;
    transition: transform 0.12s;
}

.marker-icon:hover {
    transform: scale(1.15) translateY(-2px);
}

/* ── Mobile (< 768px) ── */
@media (max-width: 767px) {
    /* Push legend above the bottom filter bar (~68px tall) */
    .leaflet-bottom {
        margin-bottom: 68px;
    }

    /* Permanent tooltips are too cluttered on small screens */
    .leaflet-tooltip {
        display: none !important;
    }
}
