/* ===========================================================
   겨를 결제 (/pay/) — 토스페이먼츠 직접 연동
   본문(assets/css/style.css)의 색·서체 토큰을 그대로 쓰고,
   결제 화면에만 필요한 부품을 여기에 더한다.

   ⚠️ 이 파일을 고치면 세 HTML 의 <link ...pay.css?v=> 버전을 반드시 올릴 것.
      nginx 가 .css 에 30일 캐시를 걸어서, 버전을 안 올리면 새 HTML 에 옛 CSS 가
      붙는다(2026-09-15 에 실제로 이 조합으로 결제 화면이 통째로 깨져 보였다).
   =========================================================== */

body { background: var(--paper); }

/* ---------- 전체 틀 ---------- */
.pay-page { padding: 44px 20px 72px; }
@media (max-width: 640px) { .pay-page { padding: 28px 16px 56px; } }

/* 화면 하나가 "본문 + 오른쪽 요약" 두 칸으로 선다.
   좁아지면 한 줄로 쌓이면서 요약(=결제 버튼)이 자연스럽게 맨 아래로 간다. */
.pay-shell {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 344px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .pay-shell { grid-template-columns: 1fr; gap: 16px; max-width: 560px; }
}

.pay-head { grid-column: 1 / -1; margin-bottom: 4px; }
.pay-head h1 {
  font-size: 30px;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  color: var(--ink);
}
.pay-head p { margin: 0; color: var(--muted); font-size: 14px; }
@media (max-width: 640px) { .pay-head h1 { font-size: 24px; } }

.pay-main { min-width: 0; display: grid; gap: 16px; }

/* ---------- 카드(구역) ---------- */
.pay-section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
}
@media (max-width: 640px) { .pay-section { padding: 20px 17px; } }

.pay-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.pay-step {
  width: 22px; height: 22px;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ---------- 품목 고르기 ---------- */
.pay-items { display: grid; gap: 9px; }
.pay-item {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  border: 1.5px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pay-item:hover { border-color: var(--accent-light); }
.pay-item[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-tint);
}
.pay-item-radio {
  width: 19px; height: 19px;
  flex: none;
  border-radius: 50%;
  border: 2px solid #cfcdc8;
  background: var(--white);
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pay-item[aria-pressed="true"] .pay-item-radio {
  border-color: var(--accent);
  background: var(--accent);
}
.pay-item[aria-pressed="true"] .pay-item-radio::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #fff;
}
.pay-item-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pay-item-name { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.pay-item-note { font-size: 12px; color: var(--muted); line-height: 1.4; }
.pay-item-amt {
  flex: none;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink);
  font-feature-settings: "tnum";
  white-space: nowrap;
}
.pay-item[aria-pressed="true"] .pay-item-amt { color: var(--accent-dark); }
/* 폰에서는 이름 옆에 금액까지 두면 이름이 "초기 / 구축비" 처럼 어색하게 쪼개진다.
   금액을 아랫줄로 내리고 이름과 왼쪽을 맞춘다(동그라미 19px + 간격 14px = 33px). */
@media (max-width: 460px) {
  .pay-item { flex-wrap: wrap; align-items: flex-start; }
  .pay-item-radio { margin-top: 2px; }
  .pay-item-main { flex: 1 1 calc(100% - 33px); gap: 4px; }
  .pay-item-amt { flex: 1 1 100%; padding-left: 33px; margin-top: 8px; font-size: 16px; }
}

/* ---------- 구매자 정보 ---------- */
.pay-fields { display: grid; gap: 14px; }
.pay-field { display: flex; flex-direction: column; gap: 6px; }
.pay-field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.pay-field input {
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pay-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
.pay-field input::placeholder { color: #b6b3ad; }
.pay-field-help { font-size: 11.5px; color: var(--muted); }

/* ---------- 결제수단 ---------- */
.pay-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
@media (max-width: 460px) { .pay-methods { grid-template-columns: 1fr; } }
.pay-method {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1.5px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.pay-method svg { width: 20px; height: 20px; }
.pay-method:hover { border-color: var(--accent-light); }
.pay-method[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent-dark);
}
@media (max-width: 460px) {
  .pay-method { flex-direction: row; gap: 10px; padding: 13px 14px; justify-content: flex-start; }
}

/* ---------- 오른쪽 요약 ---------- */
.pay-aside { min-width: 0; }
@media (min-width: 901px) { .pay-aside { position: sticky; top: 88px; } }

.pay-summary {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.pay-summary h2 {
  font-size: 14px;
  margin: 0 0 16px;
  color: var(--ink);
}
.pay-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  font-size: 13.5px;
  padding-bottom: 11px;
}
.pay-row .k { color: var(--muted); flex: none; }
.pay-row .v { color: var(--ink); text-align: right; word-break: break-all; }
.pay-row .v.placeholder { color: #b6b3ad; }
.pay-row.total {
  border-top: 1px solid var(--line);
  margin-top: 3px;
  padding-top: 16px;
  padding-bottom: 18px;
}
.pay-row.total .k { color: var(--ink); font-weight: 700; font-size: 14px; }
.pay-row.total .v {
  font-size: 25px;
  font-weight: 700;
  color: var(--accent);
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
}
/* 아직 아무것도 안 골랐을 때의 "0원"까지 초록으로 강조하면 진짜 금액처럼 읽힌다 */
.pay-row.total .v.placeholder { color: #cbc9c4; }

/* ---------- 동의 · 버튼 ---------- */
.pay-agree {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 16px;
}
.pay-agree input {
  margin: 2px 0 0;
  flex: none;
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.pay-agree a { color: var(--accent-dark); }

.pay-submit { width: 100%; }
.pay-submit:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

/* 토스 결제라는 것과 안전하다는 걸 버튼 아래에서 짧게 알린다 */
.pay-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 13px;
  font-size: 11.5px;
  color: var(--muted);
}
.pay-trust svg { width: 12px; height: 12px; flex: none; }

.pay-note-sm {
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 0;
  line-height: 1.6;
  text-align: center;
}
.pay-note-sm a { color: var(--accent-dark); }

/* ---------- 상태 화면 (로딩 · 오류 · 결과) ---------- */
.pay-state {
  max-width: 480px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 44px 30px 36px;
  text-align: center;
}
.pay-state .icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  margin: 0 auto 18px;
}
.pay-state .icon.ok { background: var(--accent-tint); color: var(--accent); }
.pay-state .icon.bad { background: #fdecec; color: #c0392b; }
.pay-state .icon.wait { background: var(--paper-2); color: var(--ink-soft); }
.pay-state h2 { font-size: 20px; margin: 0 0 10px; letter-spacing: -0.02em; }
.pay-state p { color: var(--ink-soft); font-size: 14px; margin: 0 0 6px; line-height: 1.6; }
.pay-state .code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 14px;
}
.pay-state .actions {
  margin-top: 26px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.pay-spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: pay-spin 0.8s linear infinite;
}
@keyframes pay-spin { to { transform: rotate(360deg); } }

/* 가상계좌 안내 — 입금할 곳이라 눈에 제일 먼저 들어와야 한다 */
.pay-vaccount {
  border: 1px solid var(--accent);
  background: var(--accent-tint);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-top: 20px;
  text-align: left;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.pay-vaccount .acc {
  display: block;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 2px 0 8px;
  word-break: break-all;
}
.pay-vaccount b { color: var(--ink); font-feature-settings: "tnum"; }

/* ---------- 판매자 정보 (전자상거래법 표시) ---------- */
.pay-seller {
  max-width: 1000px;
  margin: 26px auto 0;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--muted);
  text-align: center;
}
.pay-seller a { color: var(--muted); text-decoration: underline; }
