/*
   MapExplorer 전용 스타일.
   주의: Leaflet CDN CSS가 캐시/내부망 문제로 누락되면 타일이 absolute 배치되지 않아
   지도 이미지가 조각난 테이블처럼 보입니다. 아래 Leaflet 핵심 CSS는 그 문제를 방지하기 위한
   최소 안전망입니다.
*/
.oh-map-container.leaflet-container,
.oh-map-container .leaflet-container,
.leaflet-container {
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
    position: absolute;
    left: 0;
    top: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

.leaflet-tile {
    filter: inherit;
    visibility: inherit;
    border: 0;
}

.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }

.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }

.leaflet-control {
    position: relative;
    z-index: 800;
    pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
    position: absolute;
    z-index: 1000;
    pointer-events: none;
}

.leaflet-top { top: 0; }
.leaflet-right { right: 0; }
.leaflet-bottom { bottom: 0; }
.leaflet-left { left: 0; }

.leaflet-control-zoom {
    border: 2px solid rgba(0, 0, 0, .2);
    border-radius: 4px;
    background: #fff;
}

.leaflet-control-zoom a {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    color: #111827;
    background: #fff;
    border-bottom: 1px solid #ccc;
    font: bold 18px/30px Arial, Helvetica, sans-serif;
}

.leaflet-control-zoom a:last-child { border-bottom: 0; }

.leaflet-control-attribution {
    padding: 0 5px;
    color: #334155;
    background: rgba(255, 255, 255, .82);
    font-size: 11px;
}

.leaflet-popup {
    position: absolute;
    text-align: center;
    margin-bottom: 20px;
}

.leaflet-popup-content-wrapper {
    padding: 1px;
    text-align: left;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 14px rgba(0, 0, 0, .2);
}

.leaflet-popup-content {
    margin: 13px 19px;
    line-height: 1.4;
}

.leaflet-popup-tip-container {
    width: 40px;
    height: 20px;
    position: absolute;
    left: 50%;
    margin-left: -20px;
    overflow: hidden;
    pointer-events: none;
}

.leaflet-popup-tip {
    width: 17px;
    height: 17px;
    padding: 1px;
    margin: -10px auto 0;
    transform: rotate(45deg);
    background: #fff;
    box-shadow: 0 3px 14px rgba(0, 0, 0, .2);
}

.oh-map-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
    gap: 1rem;
    align-items: stretch;
}

.oh-map-card {
    min-height: 640px;
}

.oh-map-header-row {
    align-items: flex-start;
    gap: 1rem;
}

.oh-map-container {
    position: relative;
    width: 100%;
    height: 560px;
    min-height: 560px;
    border: 1px solid #dfe7f3;
    border-radius: 16px;
    overflow: hidden;
    background: #eef4fb;
}

.oh-map-container.plain-mode {
    background:
        radial-gradient(circle at 18% 22%, rgba(37, 99, 235, .08), transparent 22%),
        radial-gradient(circle at 78% 72%, rgba(22, 163, 74, .08), transparent 28%),
        linear-gradient(90deg, rgba(148, 163, 184, .16) 1px, transparent 1px),
        linear-gradient(rgba(148, 163, 184, .16) 1px, transparent 1px),
        #f8fafc;
    background-size: auto, auto, 96px 96px, 96px 96px, auto;
}

.oh-map-container.plain-mode::before {
    content: "좌표 분포";
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 1;
    color: rgba(100, 116, 139, .22);
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -.05em;
    pointer-events: none;
}

.oh-map-scope-tabs,
.oh-map-layer-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.oh-map-scope-tab,
.oh-map-layer-tab {
    border: 1px solid #dbe7f5;
    border-radius: 999px;
    padding: .45rem .9rem;
    background: #fff;
    color: #334155;
    font-weight: 700;
    transition: all .15s ease;
}

.oh-map-scope-tab:hover,
.oh-map-layer-tab:hover {
    border-color: #93c5fd;
    color: #0f4c81;
}

.oh-map-scope-tab.active,
.oh-map-layer-tab.active {
    background: #0f4c81;
    border-color: #0f4c81;
    color: #fff;
}

.oh-map-layer-tabs {
    margin: .8rem 0 .65rem;
}

.oh-map-summary-line {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
    color: #64748b;
    font-size: .92rem;
}

.oh-map-summary-line span {
    padding: .25rem .55rem;
    border-radius: 999px;
    background: #f1f5f9;
}

.oh-map-side-summary {
    display: grid;
    gap: .65rem;
}

.oh-map-side-summary > div {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem .85rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.oh-map-side-summary span {
    color: #64748b;
}

.oh-map-side-summary strong {
    color: #0f172a;
}

.oh-map-marker {
    position: relative;
    border-radius: 999px;
    border: 3px solid #fff;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .32);
}

.oh-map-marker::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 999px;
    border: 2px solid currentColor;
    opacity: .22;
}

.oh-map-marker.sample {
    background: #2563eb;
    color: #2563eb;
}

.oh-map-marker.diagnostic {
    background: #dc2626;
    color: #dc2626;
}

.oh-map-marker.analysis {
    background: #16a34a;
    color: #16a34a;
}

.oh-map-popup {
    min-width: 230px;
}

.oh-map-popup strong {
    display: block;
    margin-bottom: .45rem;
    color: #0f172a;
}

.oh-map-popup dl {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: .25rem .55rem;
    margin: 0;
    font-size: .86rem;
}

.oh-map-popup dt {
    color: #64748b;
    font-weight: 700;
}

.oh-map-popup dd {
    margin: 0;
    color: #0f172a;
}

.oh-coordinate-note,
.oh-map-tile-notice {
    padding: .65rem .75rem;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: rgba(239, 246, 255, .96);
    color: #1e3a8a;
    font-size: .86rem;
}

.oh-map-tile-notice {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 700;
    max-width: min(620px, calc(100% - 28px));
    box-shadow: 0 8px 20px rgba(15, 23, 42, .12);
}

@media (max-width: 1280px) {
    .oh-map-layout {
        grid-template-columns: 1fr;
    }

    .oh-map-card {
        min-height: auto;
    }
}

/* 동일/인접 좌표가 많은 경우 마커가 세로로 겹쳐 보이지 않도록 집계 마커로 표시합니다. */
.oh-map-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 3px solid #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .35);
    color: #fff;
    font-weight: 800;
    line-height: 1;
}

.oh-map-cluster span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: .78rem;
    letter-spacing: -.03em;
}

.oh-map-cluster.sample { background: #2563eb; }
.oh-map-cluster.diagnostic { background: #dc2626; }
.oh-map-cluster.analysis { background: #16a34a; }

.oh-map-cluster-popup {
    min-width: 320px;
    max-width: 460px;
}

.oh-map-cluster-popup ol {
    margin: .65rem 0 0;
    padding: .55rem .65rem;
    max-height: 220px;
    overflow: auto;
    border-radius: 10px;
    background: #f8fafc;
    list-style: none;
}

.oh-map-cluster-popup li {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: .4rem;
    padding: .25rem 0;
    color: #334155;
    font-size: .84rem;
    border-bottom: 1px solid #e2e8f0;
}

.oh-map-cluster-popup li:last-child {
    border-bottom: 0;
}

.oh-map-cluster-popup li span {
    color: #64748b;
    font-weight: 700;
}

.oh-map-popup-more {
    margin: .45rem 0 0;
    color: #64748b;
    font-size: .82rem;
}

.oh-map-popup-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: .5rem;
    padding: .35rem .6rem;
    border-radius: .5rem;
    border: 1px solid var(--color-border, #d6dde8);
    background: #fff;
    color: var(--color-primary, #2563eb);
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
}

.oh-map-popup-link:hover {
    background: var(--color-primary-soft, #eef4ff);
    text-decoration: none;
}

.oh-map-cluster-popup li .oh-map-popup-link {
    margin-top: 0;
    margin-left: .4rem;
    padding: .18rem .42rem;
    font-size: .76rem;
}
