/* V3 public frontend styles (PDP T09; UED 7.1-7.3).
   System font stack suited to mixed Simplified Chinese + English. */

:root {
  --bg: #f4f6f8;
  --card: #fff;
  --line: #e3e7ec;
  --text: #232a31;
  --muted: #7a838c;
  --primary: #4f7cff;
  --danger: #d4380d;
  --warn-bg: #fff7e6;
  --warn-line: #ffd591;
  --price: #d4a000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue",
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.hidden { display: none !important; }

.container { max-width: 560px; width: 92%; margin: 28px auto; }
.card { background: var(--card); padding: 20px; border-radius: 12px; box-shadow: 0 8px 20px rgba(0,0,0,.06); position: relative; }

h2, h3 { text-align: center; margin: 12px 0; }
hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

input, textarea, select {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
textarea { resize: vertical; min-height: 70px; }

button { font: inherit; cursor: pointer; }
.btn-primary {
  width: 100%; padding: 12px; margin-top: 10px; border: none; border-radius: 6px;
  background: var(--primary); color: #fff;
}
.btn-primary:disabled { background: #9aa3ad; }
.btn-secondary {
  padding: 10px 14px; border: 1px solid var(--primary); border-radius: 6px;
  background: #fff; color: var(--primary); white-space: nowrap;
}
.btn-secondary:disabled { color: #9aa3ad; border-color: #cdd3da; }

.flex { display: flex; gap: 10px; }
.flex select { width: auto; flex: 0 0 auto; }

.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); padding: 12px; border-radius: 8px; margin: 10px 0; }
.warn-text { font-size: 13px; color: #666; margin-top: 6px; }
.danger { color: var(--danger); }
.empty { color: var(--muted); font-style: italic; }

/* ---- welcome overlay ---- */
.welcome {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(160deg, #1f2933, #3a4a5a);
  color: #fff; display: flex; justify-content: center; align-items: center;
  text-align: center; transition: opacity .4s ease;
}
.welcome.fade { opacity: 0; }
.welcome-inner { padding: 24px; cursor: pointer; }
.welcome-text-1 { font-size: 30px; font-weight: 600; letter-spacing: 2px; }
.welcome-text-2 { font-size: 22px; margin-top: 14px; opacity: .92; }
.welcome-wait { font-size: 18px; margin-top: 16px; opacity: .85; }
.welcome-hint { margin-top: 26px; font-size: 13px; opacity: .65; }

/* ---- message board ---- */
.message-board {
  background: #fffef7; border: 1px solid var(--warn-line);
  border-radius: 10px; padding: 16px; margin: 12px 0;
}
.message-body { white-space: normal; }
.mb-btn { width: 100%; margin-top: 12px; padding: 10px; border: 1px solid var(--warn-line); border-radius: 6px; background: #fff; }
.mb-reopen { padding: 8px 12px; border: 1px dashed var(--warn-line); border-radius: 6px; background: #fff; margin: 6px 0; }

/* ---- product selector ---- */
.selector { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.selected-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.selected-list { display: flex; flex-direction: column; gap: 8px; }
.selected-row {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  background: #fafbfc; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
}
.selected-row .sr-main { flex: 1; }
.selected-row .sr-name { font-weight: 600; }
.selected-row .sr-meta { font-size: 13px; color: var(--muted); }
.selected-row .sr-price { color: var(--price); font-weight: 600; }
.selected-row .sr-actions { display: flex; gap: 6px; }
.selected-row .sr-actions button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.selected-row .sr-actions .rm { color: var(--danger); border-color: #f0c0b4; }

/* ---- bottom sheet / panel ---- */
.sheet { position: fixed; inset: 0; z-index: 900; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.sheet-body {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 100%; max-width: 560px; max-height: 86vh;
  background: #fff; border-radius: 14px 14px 0 0; display: flex; flex-direction: column;
  animation: sheet-up .25s ease;
}
@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@media (min-width: 721px) {
  .sheet-body { top: 50%; bottom: auto; transform: translate(-50%, -50%); border-radius: 14px; animation: none; }
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-close { background: none; border: none; font-size: 24px; line-height: 1; color: var(--muted); }
.sheet-content { padding: 16px; overflow-y: auto; }

.cat-group { margin-bottom: 18px; }
.cat-title { font-weight: 600; margin-bottom: 8px; }
.prod-card {
  display: flex; gap: 12px; align-items: center; padding: 10px;
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; background: #fff;
}
.prod-card:hover { border-color: var(--primary); }
.prod-card.disabled { opacity: .5; cursor: not-allowed; }
.prod-thumb { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); background: #f0f1f2; flex: 0 0 auto; }
.prod-info { flex: 1; }
.prod-name { font-weight: 600; }
.prod-price { color: var(--price); font-size: 13px; }
.aux-link { font-size: 12px; color: var(--primary); text-decoration: none; }

.opt-group { margin: 12px 0; }
.opt-group > label { display: block; font-weight: 600; margin-bottom: 6px; }
.opt-list { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-chip {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 20px; background: #fff; cursor: pointer;
}
.opt-chip.selected { border-color: var(--primary); background: #eef3ff; color: var(--primary); }
.opt-chip.soldout { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.opt-chip .chip-price { color: var(--price); font-size: 12px; margin-left: 4px; }

.emboss-image { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); margin: 8px 0; }
.qty-row { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.qty-row input { width: 90px; }
.sheet-actions { padding: 14px 16px; border-top: 1px solid var(--line); }
.sheet-error { color: var(--danger); font-size: 13px; margin: 8px 0; min-height: 18px; }
.price-line { margin: 10px 0; }
.price-line .price { color: var(--price); font-weight: 600; }
