/* ============================================================
   极简商城 · 前端样式（极简风 + 响应式）
   桌面与手机自适应：栅格自动收缩、移动端触控友好
   ============================================================ */
:root {
    --bg: #ffffff;
    --fg: #1a1a1a;
    --muted: #8a8a8a;
    --line: #ebebeb;
    --accent: #111111;
    --price: #e0212c;
    --ok: #16a34a;
    --warn: #d97706;
    --err: #dc2626;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--fg);
    font-size: 15px;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
b { font-weight: 600; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------------- 顶部 ---------------- */
.site-header {
    border-bottom: 1px solid var(--line);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.logo { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.nav { display: flex; gap: 20px; font-size: 14px; color: var(--muted); }
.nav a:hover { color: var(--fg); }

.notice {
    background: #f7f7f7;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    padding: 6px 0;
}

/* ---------------- 首页 ---------------- */
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 { font-size: 30px; font-weight: 700; }
.hero p { color: var(--muted); margin-top: 8px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    padding-bottom: 48px;
}
.product-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
    background: #fff;
}
.product-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.06); transform: translateY(-2px); }
.card-img { aspect-ratio: 1 / 1; background: #f6f6f6; }
.thumb-img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #c8c8c8, #8f8f8f);
}
.card-body { padding: 12px 14px 14px; }
.card-body h3 {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.desc {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-foot {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 8px;
}
.price { color: var(--price); font-size: 17px; font-weight: 700; }
.origin-price { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.stock { margin-left: auto; font-size: 12px; color: var(--ok); }
.stock:empty { display: none; }

/* ---------------- 商品详情 ---------------- */
.detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 36px;
    padding: 32px 0 56px;
}
.detail-img {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: #f6f6f6;
}
.detail-info h1 { font-size: 22px; font-weight: 700; }
.detail-price { margin-top: 14px; display: flex; align-items: baseline; gap: 10px; }
.detail-price .price { font-size: 26px; }
.detail-stock { color: var(--muted); font-size: 13px; margin-top: 8px; }
.detail-desc { margin-top: 12px; color: #444; font-size: 14px; }

.buy-form { margin-top: 22px; }
.qty-row { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); }
.qty-box { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.qty-box button {
    width: 36px; height: 36px;
    border: none; background: #fafafa; font-size: 16px; cursor: pointer; color: var(--fg);
}
.qty-box button:active { background: #eee; }
.qty-box input {
    width: 48px; height: 36px; border: none; text-align: center; font-size: 14px;
    border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: 1px solid var(--fg);
    border-radius: 6px;
    background: #fff;
    font-size: 15px;
    cursor: pointer;
    text-align: center;
    transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-block { width: 100%; margin-top: 18px; }

/* ---------------- 面板 / 表单 ---------------- */
.page-title { font-size: 22px; font-weight: 700; padding: 24px 0 16px; }

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 22px;
    margin-bottom: 16px;
    background: #fff;
}
.panel h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
}
.field input:focus, .field textarea:focus { border-color: #999; }
.field textarea { resize: vertical; min-height: 60px; }

.order-item { display: flex; align-items: center; gap: 14px; }
.item-img {
    width: 64px; height: 64px;
    border-radius: 6px; overflow: hidden; background: #f6f6f6; flex-shrink: 0;
}
.item-img .thumb-img { width: 100%; height: 100%; }
.item-img .thumb-ph { font-size: 18px; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: 15px; }
.item-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.item-price { font-weight: 700; color: var(--price); }

.pay-options { display: flex; flex-direction: column; gap: 10px; }
.pay-option {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.pay-option:hover { border-color: #bbb; }
.pay-option input[type="radio"] { width: 18px; height: 18px; accent-color: var(--fg); flex-shrink: 0; }
.pay-link { text-decoration: none; }
.pay-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.pay-alipay { background: #1677ff; }
.pay-douyin { background: #111; }
.pay-name { font-size: 15px; flex: 1; }
.pay-name small { display: block; color: var(--muted); font-size: 12px; }
.pay-arrow { color: var(--muted); font-size: 20px; }

.order-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: #fff;
    margin: 8px 0 32px;
}
.order-bar .total b { color: var(--price); font-size: 20px; }

/* ---------------- 提示 / 结果 ---------------- */
.alert {
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid var(--line);
}
.alert a { text-decoration: underline; font-weight: 600; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: var(--err); }
.alert-ok { background: #f0fdf4; border-color: #bbf7d0; color: var(--ok); }
.alert-warn { background: #fffbeb; border-color: #fde68a; color: var(--warn); }

.result { text-align: center; padding: 60px 0; }
.result-icon {
    width: 72px; height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 34px; font-weight: 700; color: #fff;
}
.result-ok .result-icon { background: var(--ok); }
.result-err .result-icon { background: var(--err); }
.result-warn .result-icon { background: var(--warn); font-size: 24px; }
.result h1 { font-size: 24px; margin-bottom: 10px; }
.result p { color: var(--muted); margin-bottom: 10px; }
.result p b { color: var(--fg); }
.result .btn { margin: 8px 6px 0; }

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

/* ---------------- 订单进度 ---------------- */
.steps { list-style: none; display: flex; gap: 0; }
.steps li { flex: 1; position: relative; text-align: center; }
.steps li:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 9px; right: -50%;
    width: 100%;
    height: 2px;
    background: var(--line);
}
.steps li.done:not(:last-child)::after { background: var(--ok); }
.steps .dot {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--line);
    display: inline-block;
    position: relative;
    z-index: 1;
    margin-bottom: 8px;
}
.steps li.done .dot { background: var(--ok); border-color: var(--ok); }
.steps li.current .dot { border-color: var(--warn); box-shadow: 0 0 0 4px rgba(217,119,6,.15); }
.steps li p { font-size: 12px; color: var(--muted); }
.steps li p b { color: var(--fg); font-size: 13px; }

/* ---------------- 页脚 ---------------- */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 24px 0;
    margin-top: 32px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 640px) {
    .wrap { padding: 0 12px; }
    .hero { padding: 32px 0 20px; }
    .hero h1 { font-size: 24px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .detail { grid-template-columns: 1fr; gap: 18px; padding: 16px 0 40px; }
    .steps li p { font-size: 11px; }
    .order-bar { position: sticky; bottom: 0; border-radius: 0; margin: 0 -12px -12px; }
}
