* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
}

.layout { display: grid; grid-template-columns: 360px 1fr; min-height: 100vh; }
.left { padding: 16px; border-right: 1px solid #e5e5e5; }
.right { padding: 16px; }

.hint { color: #666; font-size: 14px; margin-top: 6px; }
.msg { margin-top: 12px; color: #b00020; font-size: 14px; }

/* 입력 행(번호 포함) */
.row{
  display: grid;
  grid-template-columns: 28px 110px 1fr 42px; /* 번호칸 + 고객번호 + 주소 + 삭제 */
  gap: 8px;
  margin: 8px 0;
  align-items: center;
}
.idxBadge{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  font-weight:700;
  color:#444;
}

.row input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 10px;
}

.row button {
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
}

.row button:disabled { opacity: 0.5; cursor: not-allowed; }

/* 주소 변환 실패 표시 */
.row.isError input { border-color: #d32f2f; }
.rowErrorMsg{
  grid-column: 2 / -1; /* 번호칸 제외하고 아래로 */
  font-size: 12px;
  color: #d32f2f;
  margin-top: 2px;
}

/* 액션 버튼 */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions button {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
}
.actions button:hover { background: #f7f7f7; }

/* 우측 버튼 바 */
.topbar { display: flex; justify-content: flex-end; gap: 8px; margin: 8px 0 12px; }
.topbar button {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
}
.topbar button:disabled { opacity: 0.5; cursor: not-allowed; }

/* 결과 */
.result { border: 1px solid #eee; border-radius: 14px; padding: 12px; }
.note { margin-top: 12px; color: #666; font-size: 13px; }

/* 로딩/진행률 */
.progressWrap {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 14px;
  background: #fafafa;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(0,0,0,0.15);
  border-top-color: rgba(0,0,0,0.6);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progressText {
  font-size: 13px;
  color: #333;
  margin-bottom: 6px;
}
.progressBar {
  height: 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.10);
  overflow: hidden;
}
.progressBarFill {
  height: 100%;
  width: 0%;
  background: rgba(0,0,0,0.55);
  border-radius: 999px;
  transition: width 180ms ease;
}

/* hidden 강제 */
[hidden] { display: none !important; }

/* 지도 */
.map{
  width: 100%;
  height: 360px;
  border: 1px solid #eee;
  border-radius: 16px;
  background: #f7f7f7;
  margin-bottom: 12px;
}

/* 공유 박스(QR/링크) */
.shareBox{
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fafafa;
}
.shareRow{
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
#shareUrl{
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 10px;
}
#copyBtn{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
}
#copyBtn:hover { background: #f7f7f7; }
#qr { display: flex; justify-content: center; }

/* 반응형 */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .left { border-right: 0; border-bottom: 1px solid #e5e5e5; }
  .right { padding-top: 12px; }
}

@media (max-width: 520px) {
  .left, .right { padding: 12px; }
  h1 { font-size: 20px; margin: 0 0 6px; }
  .hint { font-size: 12px; }

  .row{
    grid-template-columns: 28px 1fr 42px;
    grid-template-areas:
      "idx customer del"
      "idx address  address";
    gap: 8px;
    align-items: center;
  }
  .idxBadge{ grid-area: idx; }

  /* row children order: idxBadge(1), customer input(2), address input(3), del button(4), (optional) errorMsg */
  .row input:nth-child(2){ grid-area: customer; }
  .row input:nth-child(3){ grid-area: address; }
  .row button{ grid-area: del; height: 42px; }

  .actions { flex-direction: column; }
  .actions button,
  .topbar button,
  #copyBtn {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
  }

  .shareRow { grid-template-columns: 1fr; }
  .map { height: 300px; }

  .result ol { padding-left: 18px; }
}
