/* =========================================================================
 * 분리수거에 진심 - styles.css
 * 컬러: 에코 그린(primary) + 뉴트럴(화이트/그레이) + 앰버(accent)
 * ========================================================================= */

:root {
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;

  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #eef2f6;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --accent: #f59e0b;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
  --header-h: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html.theme {
  background: var(--bg);
}

body {
  font-family: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[data-lucide] {
  width: 18px;
  height: 18px;
  display: inline-flex;
  vertical-align: middle;
}

/* ----------------------------- 헤더 ----------------------------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}
.site-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand__logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--green-600);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand__logo[data-lucide] {
  width: 40px;
  height: 40px;
  padding: 9px;
}
.brand__title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.brand__subtitle {
  font-size: 12px;
  color: var(--ink-soft);
}
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mode-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
}
.mode-badge--dummy {
  background: #fff7ed;
  color: #b45309;
  border: 1px solid #fed7aa;
}
.mode-badge--live {
  background: var(--green-100);
  color: var(--green-700);
  border: 1px solid #bbf7d0;
}

/* ----------------------------- 버튼 ----------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn--primary {
  background: var(--green-600);
  color: #fff;
}
.btn--primary:hover {
  background: var(--green-700);
}
.btn--ghost {
  background: var(--surface);
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn--ghost:hover {
  background: var(--green-50);
  color: var(--green-700);
  border-color: var(--green-100);
}

/* ----------------------------- 카테고리 탭 ----------------------------- */
.category-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.category-bar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.cat-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 132px;
  padding: 14px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-soft);
  transition: all 0.15s ease;
}
.cat-tab:hover {
  border-color: var(--green-500);
  background: var(--green-50);
}
.cat-tab.is-active {
  background: var(--green-600);
  border-color: var(--green-600);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.cat-tab__icon[data-lucide] {
  width: 26px;
  height: 26px;
}
.cat-tab__label {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  word-break: keep-all;
}

/* ----------------------------- 검색바 ----------------------------- */
.search-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.search-bar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.segmented {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}
.seg-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  padding: 8px 14px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn.is-active {
  background: var(--green-600);
  color: #fff;
}
.search-input {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  min-width: 0;
}
.search-input:focus-within {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100);
}
.search-input__icon {
  color: var(--muted);
  flex-shrink: 0;
}
.search-input input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 12px 0;
  min-width: 0;
}

/* ----------------------------- 본문 2분할 ----------------------------- */
.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - 220px);
  min-height: 460px;
}
.panel__head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.selected-region {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 500;
  min-width: 0;
}
.selected-region strong {
  color: var(--ink);
  font-weight: 700;
}
.badge-cat {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-700);
  background: var(--green-100);
  padding: 3px 8px;
  border-radius: 999px;
}
.result-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-700);
  background: var(--green-50);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ----------------------------- 결과 리스트 ----------------------------- */
.result-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}
.result-list::-webkit-scrollbar {
  width: 8px;
}
.result-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 8px;
}

.bin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s ease;
}
.bin-item:hover {
  background: var(--green-50);
}
.bin-item.is-active {
  background: var(--green-50);
  border-color: var(--green-500);
}
.bin-item__no {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bin-item.is-active .bin-item__no {
  background: var(--green-600);
  color: #fff;
}
.bin-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bin-item__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bin-item__addr {
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 4px;
}
.bin-item__addr [data-lucide] {
  width: 13px;
  height: 13px;
  color: var(--muted);
  flex-shrink: 0;
}
.bin-item__go {
  color: var(--muted);
  flex-shrink: 0;
}
.bin-item.is-active .bin-item__go {
  color: var(--green-600);
}

/* 정보형 - 수수료 */
.info-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.info-item__title {
  font-weight: 700;
  font-size: 14px;
  flex: 1;
}
.info-item__spec {
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--line-soft);
  padding: 3px 9px;
  border-radius: 999px;
}
.info-item__fee {
  font-weight: 900;
  font-size: 15px;
  color: var(--green-700);
  white-space: nowrap;
}

/* 정보형 - 배출정보 카드 */
.info-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  margin: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.info-card__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14px;
  color: var(--green-700);
  margin-bottom: 2px;
}
.info-card__row {
  font-size: 13px;
  color: var(--ink-soft);
}
.info-card__row b {
  display: inline-block;
  width: 64px;
  color: var(--ink);
}

/* 빈 상태 / 로딩 */
.list-empty,
.list-loading,
.region-loading,
.region-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 14px;
}
.list-empty--intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 70px;
}
.list-empty--intro [data-lucide] {
  width: 44px;
  height: 44px;
  color: var(--green-500);
}
.list-empty--intro p {
  line-height: 1.7;
}
.list-empty--intro b {
  color: var(--green-700);
}

/* ----------------------------- 지도 ----------------------------- */
.panel--map {
  padding: 0;
}
.map-area {
  flex: 1;
  width: 100%;
  height: 100%;
  background: var(--green-50);
}
.map-fallback {
  position: relative;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(0deg, rgba(34, 197, 94, 0.04), rgba(34, 197, 94, 0.04)),
    repeating-linear-gradient(0deg, var(--line-soft) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, var(--line-soft) 0 1px, transparent 1px 40px);
}
.map-fallback__note {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
}
.map-fallback__plane {
  position: absolute;
  inset: 0;
}
.map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--green-600);
  transition: transform 0.12s ease, color 0.12s ease;
}
.map-pin [data-lucide] {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  fill: var(--green-500);
}
.map-pin:hover {
  transform: translate(-50%, -110%) scale(1.1);
}
.map-pin.is-active {
  color: var(--accent);
  transform: translate(-50%, -115%) scale(1.25);
  z-index: 5;
}

/* ----------------------------- 다이얼로그 ----------------------------- */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}
.dialog.is-open {
  display: block;
}
.dialog__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.dialog__box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: 80vh;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 6px;
}
.dialog__title {
  font-size: 17px;
  font-weight: 900;
}
.dialog__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 8px;
}
.dialog__close:hover {
  background: var(--line-soft);
  color: var(--ink);
}
.dialog__desc {
  padding: 0 20px 14px;
  font-size: 13px;
  color: var(--ink-soft);
}
.dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 20px 20px;
}

.region-results {
  list-style: none;
  overflow-y: auto;
  padding: 0 12px 16px;
}
.region-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.12s ease;
}
.region-item:hover {
  border-color: var(--green-500);
  background: var(--green-50);
}
.region-item__name {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}
.region-item__addr {
  flex: 1;
  font-size: 13px;
  color: var(--ink-soft);
}
.region-item__chevron {
  color: var(--muted);
}

/* ----------------------------- 필드 ----------------------------- */
.field {
  display: block;
  padding: 0 20px 14px;
}
.field__label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.field__input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.field__input:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px var(--green-100);
}

/* ----------------------------- 반응형 ----------------------------- */
@media (max-width: 860px) {
  .content {
    grid-template-columns: 1fr;
  }
  .panel {
    height: auto;
    min-height: 0;
  }
  .panel--list .result-list {
    max-height: 420px;
  }
  .panel--map {
    height: 420px;
  }
  .search-bar__inner {
    flex-wrap: wrap;
  }
  .search-input {
    order: 3;
    width: 100%;
    flex-basis: 100%;
  }
  .cat-tab {
    min-width: 104px;
    flex: 1 1 28%;
  }
}
