/* sample_shop 고객·공용 스타일. 프레임워크 없음. 클래스 이름은 src/shared/views/*.tsx, src/web/views/*.tsx 와 맞춘다 */
:root {
  --fg: #1b1b1f;
  --bg: #ffffff;
  --bg-soft: #f7f7f9;
  --muted: #6b7280;
  --line: #e5e7eb;
  --ok: #15803d;
  --ok-bg: #f0fdf4;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --info-bg: #eff6ff;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
}
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--bg-soft); padding: 0 0.25rem; border-radius: 3px; word-break: break-all; }
h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
p { margin: 0.4rem 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* 레이아웃 */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 0.5rem; }
.brand-name { font-weight: 700; text-decoration: none; color: inherit; }
.brand-sub { margin-left: 0.4rem; font-weight: 400; color: var(--muted); }
.nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.link-button.danger { color: var(--danger); }
.main { max-width: 1040px; margin: 0 auto; padding: 1.25rem; }
.site-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--line); color: var(--muted); margin-top: 2rem; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.5rem; align-items: start; }
.two-col > * { min-width: 0; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-sub { color: var(--muted); margin: 0; }
.page-aside { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.section-title { margin-top: 1.5rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--line); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.big { font-size: 1.25rem; font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty-state { padding: 2rem; text-align: center; color: var(--muted); background: var(--bg-soft); border-radius: var(--radius); }

/* 배지·플래시 */
.badge { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.8rem; border: 1px solid var(--line); background: #f3f4f6; white-space: nowrap; vertical-align: middle; }
.badge-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.badge-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.badge-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.badge-muted { color: var(--muted); }
.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid var(--line); background: var(--bg-soft); }
.flash-ok { border-color: var(--ok); background: var(--ok-bg); }
.flash-error { border-color: var(--danger); background: var(--danger-bg); }
.flash-info { border-color: #93c5fd; background: var(--info-bg); }
.flash button { margin-top: 0.5rem; }

/* 표·정의 목록 */
.table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; }
.table th, .table td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
.table th.num, .table td.num { text-align: right; }
.table .empty { color: var(--muted); text-align: center; padding: 1.25rem; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0.5rem 0; }
.dl-row { display: contents; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 폼·버튼 */
.form label { display: block; margin: 0.5rem 0; }
.form input, .form select, .form textarea { font: inherit; padding: 0.45rem 0.55rem; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; max-width: 100%; }
.form input:focus, .form select:focus, .form textarea:focus, button:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 1px; border-color: var(--accent); }
.field { display: block; }
.field-label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.15rem; }
.field input, .field select { width: 100%; }
.field.has-error input, .field.has-error select { border-color: var(--danger); }
.field-error { display: block; color: var(--danger); font-size: 0.85rem; margin-top: 0.15rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem 1rem; margin: 0 0 1rem; min-width: 0; }
legend { font-weight: 600; padding: 0 0.4rem; }
.radio-group { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }
.radio { display: inline-flex !important; align-items: center; gap: 0.35rem; margin: 0.25rem 0 !important; cursor: pointer; }
.radio input { width: auto; }
.qty { width: 4.5rem; text-align: right; }
.qty-form { display: inline-flex; gap: 0.35rem; align-items: center; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.inline-fields .field { margin: 0; flex: 1 1 140px; }
.inline-fields button { flex: 0 0 auto; }
.inline-fields p { flex-basis: 100%; }

button, .button { font: inherit; padding: 0.5rem 1rem; border-radius: 4px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3; }
button:hover, .button:hover { filter: brightness(1.08); }
button[disabled] { opacity: 0.5; cursor: default; filter: none; }
button.secondary, .button.secondary, .secondary-form button { background: #fff; color: var(--accent); }
.danger-form button { background: #fff; color: var(--danger); border-color: var(--danger); }
button.small, .button.small { padding: 0.3rem 0.65rem; font-size: 0.85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0; }
.actions.compact { margin: 0; gap: 0.35rem; }
.action-form { display: inline; margin: 0; }
.add-form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.add-form label { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; }

/* 상품 */
.product-grid { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.product-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.35rem; background: #fff; }
.product-card h3 { margin: 0; font-size: 1.05rem; }
.product-card h3 a { text-decoration: none; color: inherit; }
.product-card h3 a:hover { text-decoration: underline; }
.product-card .kind { margin: 0; font-size: 0.8rem; }
.product-card .desc { flex: 1; color: #374151; font-size: 0.9rem; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.price { display: inline-flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
.price-sale { font-weight: 700; font-size: 1.1rem; }
.price-list { color: var(--muted); text-decoration: line-through; font-size: 0.9rem; }
.price-unit { color: var(--muted); font-size: 0.9rem; }
.product-detail .dl { margin: 1rem 0; }

/* 장바구니 */
.cart-summary { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--bg-soft); position: sticky; top: 1rem; }
.cart-summary h2 { margin-top: 0; }
.cart-summary-list { list-style: none; padding: 0; margin: 0 0 0.75rem; }
.cart-summary-list li { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.25rem 0; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.totals { grid-template-columns: 1fr max-content; }
.totals dd { text-align: right; }
.totals .total dt, .totals .total dd { font-weight: 700; font-size: 1.05rem; padding-top: 0.35rem; border-top: 1px solid var(--line); }
.cart-summary .actions { margin-bottom: 0; }
.cart-foot { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.cart-foot .totals { min-width: 320px; }
.cart-foot .actions { justify-content: flex-end; margin: 0.5rem 0 0; }

/* 주문서 */
.checkout-form { min-width: 0; }
.test-panel { border-style: dashed; border-color: var(--warn); background: var(--warn-bg); }
.test-panel legend, .test-panel h3 { color: var(--warn); }
#cash-receipt { background: var(--bg-soft); }

/* 결제 진행 */
.payment-step .order-box { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; }
.pay-done, .pay-expired, .pay-canceled, .pay-draft, .deposit-guide, .polling, .method-picker { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-top: 1rem; }
.pay-done { border-color: var(--ok); background: var(--ok-bg); }
.pay-expired, .pay-canceled, .pay-draft { border-color: var(--danger); background: var(--danger-bg); }
.pay-done h2, .pay-expired h2, .pay-canceled h2, .pay-draft h2, .deposit-guide h2, .polling h2, .method-picker h2 { margin-top: 0; }
.poll-status { color: var(--muted); font-size: 0.9rem; }
.poll-status[data-polling="1"]::before { content: ""; display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--warn); margin-right: 0.4rem; animation: pulse 1.2s ease-in-out infinite; vertical-align: middle; }
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
.deposit-info { background: var(--bg-soft); padding: 0.75rem 1rem; border-radius: var(--radius); }
.deposit-info .account { font-size: 1.1rem; font-weight: 700; background: none; padding: 0; }
.deposit-guide .test-panel { border: 1px dashed var(--warn); border-radius: var(--radius); padding: 0.75rem 1rem; margin-top: 1rem; }
.deposit-result { margin-top: 0.75rem; }
.pay-result { margin-top: 1rem; }
.pay-window { margin-top: 1rem; }
.toss-window { padding: 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }

/* 모의 결제창: 화면 가운데 모달 */
.mock-window { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.55); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.mock-window-body { background: #fff; border-radius: 10px; padding: 1.25rem 1.5rem; width: min(440px, 100%); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3); border-top: 6px solid var(--warn); }
.mock-window-body h2 { margin-top: 0; }
.mock-window-body .actions { justify-content: flex-end; margin-bottom: 0; }

/* 주문 상세·환불 */
.order-detail h2 { border-bottom: 1px solid var(--line); padding-bottom: 0.25rem; }
.order-status-line { white-space: nowrap; }
.refund-request { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-top: 1.5rem; background: var(--bg-soft); }
.refund-request h2 { margin-top: 0; border: 0; }
.refund-items td:first-child { width: 2rem; }
.refund-estimate { margin: 0.75rem 0; padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* 구독 */
.subscription-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

/* 오류 화면 */
.error-page h1 { margin-top: 0; }
.error-code { color: var(--muted); }
.error-fields { color: var(--danger); }

/* 모바일 */
@media (max-width: 760px) {
  body { font-size: 14px; }
  .main { padding: 1rem; }
  .two-col { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
  .cart-foot { align-items: stretch; }
  .cart-foot .totals { min-width: 0; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .refund-items { white-space: normal; }
  .dl { grid-template-columns: 1fr; gap: 0.1rem; }
  .dl dt { font-size: 0.8rem; margin-top: 0.4rem; }
  .totals { grid-template-columns: 1fr max-content; }
  .totals dt { margin-top: 0; font-size: inherit; }
  .actions button, .actions .button, .actions .action-form, .actions .action-form button { width: 100%; }
  .mock-window-body { padding: 1rem; }
}
