/* =====================================================================
   지역별 통계 (지역통계 > 지역별 통계)
   ---------------------------------------------------------------------
   개발 서버 /main/dsbd/rgnStatsDsbd.do 의 구성을 그대로 옮긴다:
     지표 탭 3종 → 조회 조건 바 → [좌] 지도+시도순위 / [우] KPI 3종+차트 2종 → 주석
   레이아웃·색은 이 사이트의 stat.css / main.css 토큰을 그대로 쓴다.
   ===================================================================== */

/* ---------- 지표 탭 ---------- */
.rg-tabs { display: flex; gap: 6px; margin: 22px 0 0; border-bottom: 1px solid #d9dee7; }
.rg-tabs button {
  padding: 13px 26px; font-size: 16px; font-weight: 500; color: #555;
  border: 1px solid transparent; border-bottom: none; border-radius: 10px 10px 0 0;
  margin-bottom: -1px; background: #f2f4f8;
}
.rg-tabs button:hover { color: #1d47ab; }
.rg-tabs button.on {
  background: #fff; color: #1d47ab; font-weight: 700;
  border-color: #d9dee7; border-bottom: 1px solid #fff;
}

/* ---------- 조회 조건 ---------- */
.rg-filter {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 18px 22px; margin-top: 14px; border-radius: 7px;
  background: #3d5bbe;
}
.rg-f { display: flex; align-items: center; gap: 7px; }
.rg-f label { font-size: 14px; font-weight: 500; color: #fff; white-space: nowrap; }
.rg-filter select {
  height: 36px; padding: 0 10px; font-size: 14px; color: #222;
  border: 1px solid #cbd3e4; border-radius: 4px; background: #fff; min-width: 88px;
}
.rg-f.wide select { min-width: 190px; }
.rg-f.period { gap: 6px; }
.rg-f.period .dash { color: #fff; }
.rg-search {
  height: 36px; padding: 0 22px; margin-left: auto;
  font-size: 15px; font-weight: 600; color: #fff;
  border-radius: 4px; background: #1c2658;
}
.rg-search:hover { background: #12193c; }

/* ---------- 지표 제목 ----------
   상세 페이지는 본문 안 소제목이라 h4, 메인페이지는 단 제목이라 h2 다.
   보이는 모양은 같아야 하므로 선택자만 둘 다 받는다. */
.rg-sec-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 26px 0 14px; }
.rg-sec-head h2,
.rg-sec-head h4 { display: flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 700; color: #1d47ab; }
.rg-sec-head h2 .ic,
.rg-sec-head h4 .ic {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  background: #e7ecfb url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><rect x='2' y='8' width='2.6' height='5' rx='.6' fill='%233057dc'/><rect x='6.7' y='4' width='2.6' height='9' rx='.6' fill='%233057dc'/><rect x='11.4' y='6' width='2.6' height='7' rx='.6' fill='%233057dc'/></svg>") no-repeat 50%;
}

/* 메인페이지에서만 붙는 상세 페이지 링크 — 메인은 소비활동 지표 한 장만
   보여 주므로 나머지 지표·조회 조건으로 가는 길을 여기서 낸다. */
.rg-more {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: #1d47ab;
  border: 1px solid #ccd6f0; background: #fff;
  transition: background .18s, border-color .18s;
}
.rg-more:hover, .rg-more:focus { background: #eef2fd; border-color: #9fb4e8; }

/* ---------- 본문 2단 ----------
   좌우 높이를 맞춘다. 오른쪽(KPI+차트 2종)이 더 길어서 start 정렬로 두면
   지도 카드 아래가 허전하게 잘린다 — 원본 화면처럼 두 판을 같은 높이로. */
.rg-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.rg-card { border: 1px solid #e2e6ef; border-radius: 12px; background: #fff; padding: 18px 20px; }

/* 좌: 지도 + 순위 */
.rg-map-card { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 14px; }
.rg-map-wrap { min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.rg-map-wrap .map-wrap { position: relative; }
.rg-map-wrap .geo-map { width: 100%; height: auto; display: block; }
.rg-map-wrap .map-legend { margin-top: 8px; }

.rg-rank { border-left: 1px solid #eceff5; padding-left: 14px; min-width: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.rg-rank-head { font-size: 14px; font-weight: 700; color: #222; padding-bottom: 9px; border-bottom: 2px solid #3d5bbe; }
.rg-rank-head span { font-weight: 400; font-size: 12px; color: var(--ink-soft); }
/* 높이는 옆 지도가 정한다 — 남으면 늘고 넘치면 그 안에서만 스크롤한다 */
.rg-rank-list { height: 100%; min-height: 0; overflow-y: auto; margin-top: 4px; }
.rg-rank-list li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 6px;
  padding: 7px 2px; border-bottom: 1px solid #f1f3f8; font-size: 13px;
}
.rg-rank-list li .n { color: var(--ink-faint); font-family: var(--mono); font-size: 12px; }
.rg-rank-list li .nm { color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-rank-list li .v { font-family: var(--mono); font-weight: 700; color: #3057dc; }
.rg-rank-list li.on { background: #eef2fd; }

/* 우: KPI + 차트 */
/* 열을 명시한다. 암묵 열(auto)은 내용 최대폭으로 잡히고 칸보다 커도 줄지
   않아서, 차트 캔버스에 박힌 옛 폭(1159px)이 그대로 열 너비가 됐다. */
.rg-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.rg-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rg-kpis > * { min-width: 0; }
.rg-kpi { text-align: center; }
.rg-kpi .t { font-size: 14.5px; font-weight: 700; color: #1d47ab; }
.rg-kpi .ico {
  width: 62px; height: 62px; margin: 12px auto 10px; border-radius: 50%;
  background: #eef2fd; display: grid; place-items: center;
}
.rg-kpi .ico svg { width: 30px; height: 30px; color: #3d5bbe; }
.rg-kpi .cap { font-size: 12px; color: var(--ink-soft); letter-spacing: -.02em; }
.rg-kpi .v { margin-top: 4px; font-family: var(--mono); font-size: 16px; font-weight: 700; }
.rg-kpi .v.up { color: var(--up); }
.rg-kpi .v.down { color: var(--down); }

.rg-ch-tit { font-size: 14.5px; font-weight: 700; color: #222; margin-bottom: 6px; }
.rg-ch-tit em { font-style: normal; font-size: 11.5px; font-weight: 400; color: var(--ink-faint); }
/* 캔버스 고정 폭이 칸을 벌리는 건 .rg-side 열 지정(minmax(0,1fr))과
   JS 쪽 ResizeObserver 로 막는다. 여기에 overflow:hidden 을 걸면 캔버스
   밖으로 나가는 ECharts 툴팁이 잘려서 쓰지 않는다. */
.rg-chart { width: 100%; height: 190px; min-width: 0; }

/* ---------- 주석 ---------- */
.rg-notes { margin: 22px 0 0; }
.rg-notes li { font-size: 12.5px; color: #2f5bbf; line-height: 1.9; }
.rg-notes li.rg-sample { color: var(--ink-soft); margin-top: 4px; }
.rg-notes li.rg-sample b { color: var(--up); font-weight: 700; }

/* ---------- 반응형 ---------- */
@media (max-width: 1280px) {
  .rg-body { grid-template-columns: 1fr; }
  /* 한 단으로 접히면 지도 칸이 본문 폭 전체가 되어 지도가 과하게 커진다 */
  .rg-map-wrap .geo-map { max-width: 520px; margin: 0 auto; }
}
@media (max-width: 900px) {
  .rg-map-card { grid-template-columns: 1fr; }
  .rg-rank { border-left: none; padding-left: 0; border-top: 1px solid #eceff5; padding-top: 12px; }
  .rg-kpis { grid-template-columns: 1fr; }
  .rg-tabs { flex-wrap: wrap; }
  .rg-tabs button { flex: 1 1 auto; padding: 11px 14px; font-size: 14px; }
  .rg-search { margin-left: 0; width: 100%; }
}
@media (max-width: 600px) {
  /* 260921 점검: 조회 조건이 좁은 화면에서 넘치지 않게 — 항목마다 한 줄, 선택 상자는 남는 폭을 나눠 쓴다 */
  .rg-filter { padding: 14px 14px; }
  .rg-f { flex: 1 1 100%; flex-wrap: wrap; min-width: 0; }
  .rg-f label { flex: 0 0 34px; }
  .rg-filter select, .rg-f.wide select { flex: 1 1 0; min-width: 0; }
  .rg-f.period select { flex: 1 1 64px; padding: 0 6px; }
}
