/* ===== 지도탐색 (단지·청약 통합 지도) ===== */

/* 헤더/GNB 아래를 전부 차지하는 전체화면 레이아웃 */
html, body { height: 100%; }
body.explore { display: flex; flex-direction: column; overflow: hidden; }
body.explore .stage { flex: 1; position: relative; min-height: 0; display: flex; }
body.explore #exploreMap { flex: 1; min-width: 0; }

/* ===== 지도 위 마커 ===== */
.pin { position: relative; cursor: pointer; line-height: 0; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .3)); transition: transform .12s; }
.pin:hover { transform: scale(1.15); z-index: 5; }
.pin.sel { transform: scale(1.2); }

/* ===== 마우스오버 미리보기 툴팁 ===== */
.tip {
    position: absolute; z-index: 40; pointer-events: none;
    width: 240px; background: #fff; border-radius: 10px; padding: 12px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18); border: 1px solid var(--line);
    opacity: 0; visibility: hidden; transform: translateY(4px);
    transition: opacity .14s, transform .14s, visibility .14s;
}
.tip.on { opacity: 1; visibility: visible; transform: none; }
.tip .kind { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 2px 7px; color: #fff; }
.tip .kind.apt { background: var(--primary); }
.tip .kind.sub { background: var(--accent); }
.tip .kind.lh { background: #e8820c; }        /* 공공임대 (핀색과 동일) */
.tip .kind.opt { background: #8b3fd6; }        /* 오피스텔 (핀색과 동일) */
.tip .kind.bld { background: #7a8699; }        /* 집합건물 (핀색과 동일) */
.tip .kind.school { background: #7c3aed; }
.tip .kind.subway { background: #e0620d; }
.tip .kind.bus { background: #00a1e0; }
.tip .kind.parcel { background: #6b7280; }
.tip h4 { margin: 8px 0 4px; font-size: 15px; }
.tip .addr { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.tip dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12.5px; }
.tip dt { color: var(--muted); }
.tip dd { margin: 0; text-align: right; font-weight: 700; }
.tip .hint { margin: 9px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--muted); text-align: center; }

/* ===== 우측 슬라이드 패널 ===== */
.side {
    width: 520px; flex: 0 0 520px; background: #fff; border-left: 1px solid var(--line);
    display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0, 0, 0, .08);
    margin-right: -520px; opacity: 0;
    transition: margin-right .28s cubic-bezier(.2, .8, .25, 1), opacity .28s;
}
.side.open { margin-right: 0; opacity: 1; }
/* 청약 상세분석 리포트용 패널(살짝 넓게, 전 섹션 세로 스크롤) */
.side.wide { width: min(580px, 96vw); flex: 0 0 min(580px, 96vw); margin-right: calc(-1 * min(580px, 96vw)); }
.side.wide.open { margin-right: 0; }
.side.wide .side-body { padding: 0; background: var(--cy-bg, #f4f6fa); }
.side-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); position: relative; flex: 0 0 auto; }
.side-head .kind { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 3px 8px; color: #fff; }
.side-head .kind.apt { background: var(--primary); }
.side-head .kind.sub { background: var(--accent); }
.side-head .kind.lh { background: #e8820c; }        /* 공공임대 (핀색과 동일) */
.side-head .kind.opt { background: #8b3fd6; }        /* 오피스텔 (핀색과 동일) */
.side-head .kind.bld { background: #7a8699; }        /* 집합건물 (핀색과 동일) */
.side-head .kind.school { background: #7c3aed; }
.side-head .kind.subway { background: #e0620d; }
.side-head .kind.bus { background: #00a1e0; }
.side-head .kind.parcel { background: #6b7280; }
.side-head h2 { margin: 10px 0 4px; font-size: 20px; padding-right: 30px; }
.side-head p { margin: 0; font-size: 13px; color: var(--muted); }
.side-close { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; }
.side-close:hover { color: var(--ink); }
.side-body { flex: 1; overflow-y: auto; padding: 14px 16px 30px; }
.side-body::-webkit-scrollbar { width: 8px; }
.side-body::-webkit-scrollbar-thumb { background: #d5dae3; border-radius: 4px; }

/* ===== 요약 문장 카드 ===== */
.fact { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: #fff; }
.fact-head { display: flex; gap: 11px; align-items: flex-start; padding: 14px 14px 13px; }
.fact-ico { font-size: 19px; line-height: 1.35; flex: 0 0 auto; }
.fact-txt { flex: 1; font-size: 14px; line-height: 1.6; margin: 0; }
.fact-txt b { color: var(--primary); }
.more {
    flex: 0 0 auto; align-self: center; display: inline-flex; align-items: center; gap: 4px;
    border: 1px solid var(--line); background: #f7f9fc; color: var(--muted);
    font-size: 11.5px; font-weight: 700; border-radius: 14px; padding: 5px 10px; cursor: pointer;
    white-space: nowrap; transition: background .15s, color .15s, border-color .15s; font-family: inherit;
}
.more:hover { background: #eef3fe; color: var(--primary); border-color: #cfdcf7; }
.more .chev { display: inline-block; transition: transform .2s; font-size: 9px; }
.fact.open .more { background: #eef3fe; color: var(--primary); border-color: #cfdcf7; }
.fact.open .more .chev { transform: rotate(180deg); }

/* ===== 펼쳐지는 상세 ===== */
.detail { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .26s ease; }
.fact.open .detail { grid-template-rows: 1fr; }
.detail-inner { overflow: hidden; }
.detail-pad { padding: 2px 14px 15px; border-top: 1px dashed var(--line); }

.kv { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 11px; }
.kv th { text-align: left; font-weight: 400; color: var(--muted); padding: 6px 0; white-space: nowrap; vertical-align: top; }
.kv td { text-align: right; padding: 6px 0; font-weight: 700; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px solid #f0f2f6; }

.grid-tbl { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 11px; }
.grid-tbl th { background: #f5f7fa; color: var(--muted); font-weight: 700; padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid-tbl td { padding: 7px 8px; border-bottom: 1px solid #f0f2f6; }
.grid-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid-tbl td:first-child { white-space: nowrap; }   /* 버스번호·시각·출구번호 등 첫 칸은 줄바꿈 금지 */
.grid-tbl tr:last-child td { border-bottom: 0; }

.sub-tit { font-size: 12px; font-weight: 700; color: var(--muted); margin: 14px 0 0; }

/* 미니 막대 차트 */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 74px; margin-top: 12px; }
.bars .b { flex: 1; background: linear-gradient(180deg, #4f8bea, var(--primary)); border-radius: 3px 3px 0 0; position: relative; min-height: 3px; }
.bars .b span { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.bar-x { display: flex; gap: 5px; margin-top: 5px; }
.bar-x span { flex: 1; text-align: center; font-size: 9.5px; color: var(--muted); }

/* 가로 분포 바 */
.dist { margin-top: 11px; }
.dist .row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.dist .lab { width: 46px; color: var(--muted); flex: 0 0 auto; }
.dist .track { flex: 1; height: 9px; background: #eef1f6; border-radius: 5px; overflow: hidden; }
.dist .fill { height: 100%; background: var(--primary); border-radius: 5px; }
.dist .val { width: 52px; text-align: right; font-weight: 700; flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* 📈 실거래가 차트 */
.rt { margin-top: 14px; }
.rt-cur { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.rt-cur b { font-size: 16px; color: #1f2d5a; }
.rt-tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.rt-tab { font-size: 11.5px; padding: 5px 10px; border: 1px solid #d0d5dd; background: #fff; color: #475467; border-radius: 14px; cursor: pointer; font-family: inherit; }
.rt-tab.on { background: #3d5afe; border-color: #3d5afe; color: #fff; }
.rt-tab.dis { opacity: .45; }
.rt-sep { flex: 0 0 1px; align-self: stretch; background: #e0e4ea; margin: 3px 2px; }
.rt-mon { color: #888; font-weight: 400; font-size: 11px; }
.rt-plot { width: 100%; position: relative; }
.rt-float { position: absolute; z-index: 5; transform: translate(-50%, -100%); background: #1f2d5a; color: #fff; font-size: 10.5px; padding: 3px 7px; border-radius: 5px; white-space: nowrap; pointer-events: none; visibility: hidden; }
.rt-float b { color: #fff; }
.rt-float::after { content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 4px solid transparent; border-top-color: #1f2d5a; }
.rt-pin { min-height: 18px; font-size: 12px; color: #1f2d5a; margin: 6px 0 0; }
.rt-pin b { font-weight: 700; }
.rt-hilo { font-size: 11.5px; color: var(--muted); margin: 4px 0 2px; }
.rt-hilo b { color: #1f2d5a; }
.rt-tag { font-size: 9.5px; padding: 1px 4px; border-radius: 3px; margin-left: 4px; font-weight: 700; vertical-align: middle; }
.rt-tag.hi { background: #fdecec; color: #e5484d; }
.rt-tag.lo { background: #eaf1fe; color: #1f6feb; }

/* 💸 거래세 계산기 */
.tax { margin-top: 18px; }
.tax-p { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.tax-p b { font-size: 15px; color: #1f2d5a; }
.tax-slider { width: 100%; margin: 8px 0 6px; accent-color: #6b4fe0; cursor: pointer; }
.tax-line { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 9px 0; border-top: 1px solid #f0f2f6; }
.tax-line > span { color: var(--muted); }
.tax-line b { font-size: 15px; color: #1f2d5a; }
.tax-rate { font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 3px; margin-left: 3px; font-family: inherit; color: var(--muted); }
.rt-nav { cursor: pointer; color: #3d5afe; padding: 0 4px; user-select: none; }
.rt-nav.off { color: #c9ced8; cursor: default; }
.rt-all { color: #3d5afe; cursor: pointer; font-weight: 400; margin-left: 4px; }
.rt-morewrap { text-align: center; margin-top: 6px; }
.rt-more { font-size: 12px; color: #2b3f7a; background: #f7f9fc; border: 1px solid #cfdcf7; border-radius: 6px; padding: 7px 14px; cursor: pointer; font-family: inherit; }
.rt-more:hover { background: #eef3fe; }
.rt-vol { font-size: 11.5px; color: var(--muted); margin: 2px 0 8px; }

/* 학군 학교목록 더보기/간결하게 토글 — 펼치면 '더보기'는 숨고, 목록 맨 아래에 '간결하게'가 나와 다시 접힘 */
.sch-more { display: flex; flex-direction: column; }
.sch-more > summary { order: 0; list-style: none; cursor: pointer; color: #2b3f7a; font-size: 13px; padding: 7px 2px; }
.sch-more > summary::-webkit-details-marker { display: none; }
.sch-more > summary .sm-less { display: none; }
.sch-more[open] > summary { order: 1; text-align: center; margin-top: 6px; border-top: 1px solid #f0f2f6; }
.sch-more[open] > summary .sm-more { display: none; }
.sch-more[open] > summary .sm-less { display: inline; }
/* 펼친 목록을 본문 목록과 이어지게 — 위 빈 간격 제거 + 첫 행 구분선 */
.sch-more[open] > .kv { margin-top: 0; }
.sch-more[open] > .kv tr:first-child th, .sch-more[open] > .kv tr:first-child td { border-top: 1px solid #f0f2f6; }

.deep {
    display: block; margin-top: 13px; text-align: center; font-size: 12px; font-weight: 700;
    color: var(--primary); border: 1px solid #cfdcf7; background: #f7f9fc; border-radius: 6px;
    padding: 8px; cursor: pointer; width: 100%; font-family: inherit;
}
.deep:hover { background: #eef3fe; }

/* ===== 지도 위 컨트롤 ===== */
.map-ui { position: absolute; top: 14px; left: 14px; z-index: 20; display: flex; gap: 8px; }
.map-ui .box { background: rgba(255, 255, 255, .95); border: 1px solid var(--line); border-radius: 20px; padding: 7px 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .1); display: flex; gap: 4px; }
.map-ui button { border: 0; background: none; font-size: 12.5px; font-weight: 700; color: var(--muted); border-radius: 14px; padding: 5px 12px; cursor: pointer; font-family: inherit; }
.map-ui button.on { color: #fff; }
.map-ui button.on[data-type="apt"] { background: var(--primary); }
.map-ui button.on[data-type="sub"] { background: var(--accent); }

/* 지도 검색창 — 중앙 최상단 */
.map-search { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 30; width: min(440px, 60vw); }
.map-search input { width: 100%; box-sizing: border-box; height: 42px; border: 1px solid var(--line); border-radius: 22px; padding: 0 46px 0 18px; font-size: 14px; font-family: inherit; background: rgba(255, 255, 255, .97); box-shadow: 0 3px 12px rgba(0, 0, 0, .16); outline: none; }
.map-search input:focus { border-color: var(--primary); box-shadow: 0 3px 14px rgba(27, 99, 214, .22); }
.map-search button { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; font-size: 15px; cursor: pointer; }
.map-search-list { position: absolute; top: 48px; left: 0; right: 0; margin: 0; padding: 5px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .16); max-height: 320px; overflow-y: auto; display: none; }
.map-search-list.on { display: block; }
.map-search-list li { padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.map-search-list li:hover, .map-search-list li.sel { background: #f0f5fd; }
.map-search-list li .nm { font-weight: 700; color: var(--text); }
.map-search-list li .ad { color: var(--muted); font-size: 12px; margin-top: 1px; }
.map-search-list li .badge { display: inline-block; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--muted); border-radius: 8px; padding: 1px 6px; margin-right: 6px; vertical-align: 1px; }

.map-note { position: absolute; left: 90px; bottom: 14px; z-index: 20; background: rgba(31, 39, 51, .85); color: #fff; font-size: 11.5px; border-radius: 6px; padding: 7px 11px; }

/* ===== 좌측 레이어 툴바 (지적도·항공사진·노선도 등) ===== */
.map-layers {
    position: absolute; left: 14px; top: 14px; z-index: 20; width: 60px;
    background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12); padding: 4px; display: flex; flex-direction: column; gap: 1px;
}
.map-layers .lyr {
    border: 0; background: none; cursor: pointer; font-family: inherit;
    border-radius: 7px; padding: 5px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); transition: background .15s, color .15s;
}
.map-layers .lyr .i { font-size: 17px; line-height: 1; }
.map-layers .lyr .t { font-size: 10px; font-weight: 700; letter-spacing: -.3px; }
.map-layers .lyr:hover { background: #f0f4fa; color: var(--ink); }
.map-layers .lyr.on { background: var(--primary); color: #fff; }
.map-layers .sep { height: 1px; background: var(--line); margin: 2px 4px; }

/* 준비중 안내 토스트 */
.toast {
    position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(8px); z-index: 60;
    background: rgba(31, 39, 51, .92); color: #fff; font-size: 12.5px; border-radius: 20px; padding: 9px 16px;
    opacity: 0; visibility: hidden; transition: opacity .18s, transform .18s, visibility .18s; pointer-events: none;
}
.toast.on { opacity: 1; visibility: visible; transform: translateX(-50%); }

/* SDK 로드 실패 시 */
.map-err { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); font-size: 14px; text-align: center; padding: 20px; }

@media (max-width: 900px) {
    .side { width: 100%; flex-basis: 100%; margin-right: -100%; position: absolute; inset: 0 0 0 auto; z-index: 50; }
}
