/* =============================
   DIAGNOSIS.CSS
   공공서비스 적정공급 분석 전용
   map.js / panel.js 와 연결
   디자인 리프레시 버전
   ============================= */

#map-shell {
  position: relative;
  top: var(--header-h);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

#app.page-diagnosis #map-shell {
  left: var(--rail-w);
  width: calc(100% - var(--rail-w));
}

#app.page-diagnosis.drawer-open #map-shell {
  left: calc(var(--rail-w) + var(--drawer-w));
  width: calc(100% - var(--rail-w) - var(--drawer-w));
}

#map {
  width: 100%;
  height: 100%;
  min-width: 0;
}

/* =============================
   지도 위 floating panel
   ============================= */
.bubble-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 380px;
  z-index: 1200;
}

#app.drawer-open .bubble-panel {
  left: 14px;
}

.panel-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  padding: 24px 20px 22px;
  backdrop-filter: blur(8px);
}

.home-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -1px;
  color: #2f2f2f;
  margin-bottom: 18px;
}

.control-group {
  margin-top: 22px;
}

.control-group:first-child {
  margin-top: 0;
}

.control-group label {
  display: block;
  font-size: 16px;
  font-weight: 300;
  letter-spacing: -1px;
  color: #2f2f2f;
  margin-bottom: 10px;
}

.control-group select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #cfcfcf;
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
  color: #333;
  letter-spacing: -0.3px;
}

.control-group select:focus {
  border-color: var(--brand-green);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 101, 55, 0.12);
}

.mode-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
}

.mode-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 52px;
  text-align: center;
  line-height: 1.25;
  white-space: normal;
  padding: 10px 8px;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: -0.6px;
  border-radius: 10px;
  border: 1px solid #c7c7c7;
  background: #ffffff;
  color: #444444;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-btn:hover {
  border-color: #9db8ab;
  color: #1f1f1f;
}

.mode-btn.active {
  background: var(--brand-green) !important;
  color: #fff !important;
  border-color: var(--brand-green) !important;
}

.desc-box {
  margin-top: 18px;
  padding: 16px 16px 14px;
  background: #f5f8f5;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 400;
  color: var(--brand-green);
  line-height: 1.65;
  letter-spacing: -0.5px;
}

.desc-title {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -1px;
  margin-bottom: 12px;
  color: #2f2f2f;
}

.desc-source {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 400;
  color: var(--brand-green);
  line-height: 1.55;
  letter-spacing: -0.3px;
}

/* =============================
   범례 / 정보패널
   ============================= */
#legend-panel {
  position: absolute;
  right: 20px;
  top: 20px;
  width: 250px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  padding: 14px 14px 12px;
  z-index: 1200;
  font-size: 14px;
  display: none;
}

.legend-title {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -1px;
  margin-bottom: 12px;
  color: #1f1f1f;
}

.legend-section+.legend-section {
  margin-top: 14px;
}

.legend-subtitle {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.6px;
  margin-bottom: 8px;
  color: #444;
}

.legend-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 7px;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.4px;
  color: #444;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid #333;
  margin-top: 4px;
  flex: 0 0 auto;
}

#legend-status .legend-dot.under {
  background: #b7cb70;
  border: 1px solid #7ea05f;
}

#legend-status .legend-dot.fit {
  background: #b3bfba;
  border: 1px solid #666;
}

#legend-status .legend-dot.over {
  background: #dd1c77;
  border: 1px solid #cd2370;
}

#legend-vulnerable .legend-dot.under {
  background: #6fa186;
  border: 1px solid #006537;
}

#legend-vulnerable .legend-dot.over {
  background: #dd1c77;
  border: 1px solid #cd2370;
}

.legend-box {
  width: 16px;
  height: 16px;
  display: inline-block;
  border: 1px solid #999;
}

.legend-note {
  font-size: 16px;
  font-weight: 300;
  color: #666;
  line-height: 1.5;
  letter-spacing: -0.3px;
  margin: 0 0 8px 0;
}

.legend-size-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.legend-size-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #444;
}

.legend-size-circle {
  display: inline-block;
  border-radius: 50%;
  border: 1px solid #555;
  flex: 0 0 auto;
}

.size-sm {
  width: 8px;
  height: 8px;
}

.size-md {
  width: 14px;
  height: 14px;
}

.size-lg {
  width: 20px;
  height: 20px;
}

#info-panel {
  position: absolute;
  right: 20px;
  bottom: 20px;
  width: 440px;
  max-height: calc(100% - 40px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  padding: 24px 22px;
  z-index: 1200;
  font-size: 16px;
  display: none;
}

.info-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -1px;
  margin-bottom: 14px;
  color: #1f1f1f;
}

.info-empty {
  color: #9a9a9a;
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: -0.3px;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.info-table th,
.info-table td {
  text-align: left;
  padding: 5px 0;
  vertical-align: top;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.3px;
}

.info-table th {
  width: 96px;
  color: #777;
  font-weight: 500;
}

.info-table td {
  color: #333;
  font-weight: 500;
}

/* =============================
   지도 라벨 / leaflet 보정
   ============================= */
.sido-label {
  font-size: 25px;
  font-weight: 400;
  color: #484848;
  text-align: center;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 0 3px white;
}

.sido-label-marker {
  background: transparent;
  border: none;
}

.sgg-tooltip {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  box-shadow: none;
}

.leaflet-interactive {
  outline: none;
}

.leaflet-top.leaflet-left,
.leaflet-top.leaflet-right {
  top: 10px;
}

.leaflet-overlay-pane svg {
  mix-blend-mode: multiply;
}

.leaflet-tooltip.sido-label {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  transform: translate(-50%, -50%);
}

.leaflet-tooltip.sido-label:before {
  display: none;
}

/* =============================
   diagnosis 하단 정보차트
   ============================= */
.info-chart {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #dedede;
}

.info-chart-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.8px;
  color: #333;
  margin-bottom: 14px;
}

.info-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.info-bar-label {
  width: 74px;
  font-size: 15px;
  color: #666;
  font-weight: 500;
  letter-spacing: -0.2px;
  flex: 0 0 auto;
}

.info-bar-track {
  flex: 1;
  height: 30px;
  background: #e9e9e9;
  border-radius: 999px;
  overflow: hidden;
}

.info-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.info-bar-value {
  width: 56px;
  text-align: right;
  font-size: 15px;
  color: #666;
  font-weight: 500;
  letter-spacing: -0.2px;
  flex: 0 0 auto;
}

.bar-local {
  background: #c5347f;
}

.bar-sido,
.bar-national {
  background: #b9ae95;
}

/* =============================
   supply status 패널
   ============================= */
.status-panel-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-panel-header {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}

.status-panel-region {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -1px;
  color: #111;
}

.status-panel-divider {
  font-size: 22px;
  font-weight: 600;
  color: #444;
}

.status-panel-facility {
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -1px;
  color: #777;
}

.status-card {
  border-radius: 999px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.status-card-main {
  font-size: 54px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -2px;
  color: #fff;
}

.status-card-sub {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.8px;
  color: rgba(255, 255, 255, 0.92);
}

.status-card-under {
  background: #b7cb70;
}

.status-card-fit {
  background: #b3bfba;
}

.status-card-over {
  background: #d33387;
}

.status-section-divider {
  border-top: 1px solid #d9d9d9;
}

.status-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.status-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-bar-label {
  width: 98px;
  flex: 0 0 auto;
  font-size: 16px;
  color: #555;
  font-weight: 500;
  letter-spacing: -0.3px;
}

.status-bar-track {
  flex: 1;
  height: 28px;
  background: #e9e9e9;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.status-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.bar-current,
.bar-need {
  background: #bfb49a;
}

.status-bar-value {
  width: 78px;
  flex: 0 0 auto;
  text-align: right;
  font-size: 16px;
  color: #666;
  font-weight: 500;
  letter-spacing: -0.2px;
}

.status-index-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.status-index-label {
  font-size: 18px;
  color: #666;
  font-weight: 500;
  letter-spacing: -0.5px;
}

.status-index-value {
  font-size: 22px;
  color: #333;
  font-weight: 700;
  letter-spacing: -1px;
}

.status-index-note {
  font-size: 14px;
  color: #808285;
  margin-top: 2px;
  line-height: 1.5;
  letter-spacing: -0.2px;
}

/* =============================
   취약지역 핀
   ============================= */
.vulnerable-wrap {
  background: transparent !important;
  border: none !important;
  pointer-events: auto;
}

.vuln {
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease;
  transform-origin: center center;
}

.vulnerable-wrap:hover .vuln {
  transform: scale(1.18);
  filter: brightness(1.08);
  z-index: 1000;
}

.pin-icon {
  width: 28px;
  height: 40px;
  display: block;
  flex: 0 0 14px;
  margin-right: -4px;
}

.label {
  background: rgba(76, 76, 76, 0.78);
  border: none;
  border-radius: 14px;
  padding: 4px 9px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.2px;
  color: #fff;
  box-shadow: none;
}

/* =============================
   diagnosis 반응형
   ============================= */
@media (max-width: 1280px) {
  .bubble-panel {
    width: 360px;
  }

  #info-panel {
    width: 370px;
  }
}

@media (max-width: 900px) {
  .bubble-panel {
    width: min(340px, calc(100% - var(--rail-w) - 20px));
  }

  #legend-panel {
    right: 14px;
    top: 14px;
    width: 190px;
    padding: 14px 14px 12px;
  }

  #info-panel {
    right: 14px;
    bottom: 14px;
    width: min(340px, calc(100% - 28px));
    max-height: 42%;
  }
}

@media (max-width: 640px) {
  .bubble-panel {
    left: calc(var(--rail-w) + 14px);
    top: 14px;
    width: calc(100% - var(--rail-w) - 28px);
  }

  #legend-panel {
    display: none;
  }

  #info-panel {
    width: calc(100% - 28px);
  }

  .panel-card {
    padding: 20px 16px 18px;
  }

  .control-group label,
  .desc-title,
  .legend-title {
    font-size: 17px;
  }

  .mode-btn,
  .desc-box,
  .info-table th,
  .info-table td,
  .legend-row {
    font-size: 15px;
  }
}