* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", sans-serif; }
body { display: flex; }

#sidebar {
  width: 340px;
  height: 100vh;
  overflow-y: auto;
  background: #fafafa;
  border-right: 1px solid #e6e6e6;
  padding: 20px;
  flex-shrink: 0;
  z-index: 1000;
}
#sidebar header h1 { font-size: 18px; margin: 0 0 6px; }
#sidebar header .hint { font-size: 12px; color: #888; margin: 0 0 16px; }

#search-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
#search-form > label { font-size: 12px; color: #555; display: flex; flex-direction: column; gap: 6px; }
#search-form input[type="text"] {
  padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px;
}
#search-form input[type="text"]:focus { outline: 2px solid #03c75a; outline-offset: -2px; border-color: transparent; }
#search-form input[type="range"] { width: 100%; }

.radius-row { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: #222; }
#radius-text {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  text-align: right;
}
#radius-text:focus { outline: 2px solid #03c75a; outline-offset: -2px; border-color: transparent; }
#search-form button[type="submit"] {
  padding: 10px 14px; border: 0; border-radius: 8px; background: #fee500; color: #191600;
  font-weight: 700; font-size: 14px; cursor: pointer;
}
#search-form button[type="submit"]:hover { background: #ffd900; }

/* 표시 토글 (기준 핀 / 반경 원) */
.toggles {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  background: white;
  border: 1px solid #eee;
  border-radius: 8px;
}
.toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #444;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.toggle input[type="checkbox"] {
  accent-color: #03c75a;
  cursor: pointer;
}

.status { font-size: 13px; color: #666; margin-bottom: 12px; min-height: 18px; line-height: 1.4; }
.status.error { color: #d33; }

#results { display: flex; flex-direction: column; gap: 8px; }
.result-card {
  padding: 10px 12px; border: 1px solid #e8e8e8; border-radius: 8px; background: white;
  cursor: pointer; transition: border-color .15s;
}
.result-card:hover { border-color: #fee500; }
.result-card .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.result-card .title { font-weight: 600; font-size: 14px; color: #222; }
.result-card .distance {
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: #ffeaee; color: #d6394d; white-space: nowrap;
}
.result-card .distance.distance-here {
  background: #e6f7ee;
  color: #03a050;
}
.result-card .address { font-size: 12px; color: #888; margin-top: 4px; }

/* 카드 액션 버튼 */
.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.card-actions button {
  flex: 1;
  padding: 6px 6px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #444;
  transition: all .15s;
  white-space: nowrap;
}
.card-actions .btn-center:hover {
  background: #03c75a;
  border-color: #03c75a;
  color: white;
}
.card-actions .btn-label:hover {
  background: #2e7dc8;
  border-color: #2e7dc8;
  color: white;
}
.card-actions .btn-label.off {
  background: #eef3f8;
  border-color: #2e7dc8;
  color: #2e7dc8;
}
.card-actions .btn-remove:hover {
  background: #d6394d;
  border-color: #d6394d;
  color: white;
}

#sidebar footer { margin-top: 20px; padding-top: 12px; border-top: 1px dashed #ddd; }
#sidebar footer small { color: #aaa; font-size: 11px; }

#map { flex: 1; height: 100vh; }

/* 기준 위치 빨간 원 */
.center-marker {
  width: 22px; height: 22px;
  background: #d6394d;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

/* 매장 위치 점 (라벨 꺼졌을 때) */
.store-dot {
  width: 14px; height: 14px;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* 매장 라벨 (말풍선 형태) */
.store-marker-wrap { position: relative; display: inline-block; }
.store-marker {
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.store-marker-arrow {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border: 6px solid transparent;
  border-top-width: 7px;
}

/* 거리 라벨 */
.distance-label {
  background: white;
  border: 2px solid #d6394d;
  color: #d6394d;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

/* ── 수동 매장 추가 ── */
.btn-add-mode {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid #bbb;
  border-radius: 8px;
  background: white;
  color: #444;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.btn-add-mode:hover { background: #f3f3f3; }
.btn-add-mode.active {
  background: #d6394d;
  border-color: #d6394d;
  color: white;
}
.btn-add-mode.active:hover { background: #b82e3f; }

#map.add-mode { cursor: crosshair !important; }
#map.add-mode { outline: 2px dashed #d6394d; outline-offset: -6px; }

.manual-section-header {
  font-size: 11px;
  color: #666;
  font-weight: 700;
  letter-spacing: .04em;
  margin: 4px 0 6px;
  text-transform: uppercase;
}

#manual-results { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.result-card.out-of-radius { opacity: .55; background: #f5f5f5; }
.result-card.out-of-radius .title { color: #888; }
.result-card .distance.distance-out {
  background: #eee;
  color: #888;
}

.manual-pending-form {
  padding: 10px 12px;
  border: 1px solid #d6394d;
  border-radius: 8px;
  background: #fff8f9;
  margin-bottom: 8px;
}
.manual-pending-form .pending-coords {
  font-size: 11px;
  color: #888;
  margin-bottom: 6px;
}
.manual-pending-form input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
}
.manual-pending-form input[type="text"]:focus {
  outline: 2px solid #d6394d;
  outline-offset: -2px;
  border-color: transparent;
}
.manual-pending-form input[type="text"]:disabled {
  background: #f5f5f5;
  color: #999;
}
.manual-pending-form .pending-actions { display: flex; gap: 6px; }
.manual-pending-form .pending-actions button {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #444;
  transition: all .15s;
}
.manual-pending-form .btn-add-confirm:hover {
  background: #03c75a;
  border-color: #03c75a;
  color: white;
}
.manual-pending-form .btn-add-confirm:disabled,
.manual-pending-form .btn-add-cancel:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.manual-pending-form .btn-add-cancel:hover {
  background: #888;
  border-color: #888;
  color: white;
}

