/* AI 商城 全局样式 - 浅色主题，响应式 */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #1a1d24;
  --text-2: #5b6472;
  --text-3: #8b94a3;
  --border: #e5e8ee;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --maxw: 1160px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* 顶部导航 */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--text); white-space: nowrap; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 16px; }
.nav { display: flex; gap: 22px; flex: 1; }
.nav a { color: var(--text-2); font-weight: 500; }
.nav a:hover, .nav a.active { color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.cart-link { position: relative; padding: 8px 10px; color: var(--text-2); font-weight: 500; }
.cart-badge { position: absolute; top: 0; right: -2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 17px; text-align: center; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; color: var(--text); padding: 4px 8px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 18px; font-weight: 600; line-height: 1.2; transition: .15s; background: var(--surface-2); color: var(--text); }
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-danger { background: #fee; color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 通用块 */
.section { padding: 40px 0; }
.section-title { font-size: 22px; font-weight: 700; margin: 0 0 20px; }
.muted { color: var(--text-2); }
.tiny { color: var(--text-3); font-size: 12px; }
.center { text-align: center; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* Hero */
.hero { background: linear-gradient(135deg, #eff4ff 0%, #f7f8fa 100%); border-bottom: 1px solid var(--border); }
.hero-inner { padding: 64px 20px; text-align: center; }
.hero h1 { font-size: 38px; margin: 0 0 14px; font-weight: 800; letter-spacing: -.5px; }
.hero p { font-size: 17px; color: var(--text-2); max-width: 620px; margin: 0 auto 26px; }
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.trust-row { display: flex; gap: 30px; justify-content: center; flex-wrap: wrap; margin-top: 40px; color: var(--text-2); font-size: 13px; }
.trust-row div { display: flex; align-items: center; gap: 7px; }
.trust-row .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

/* 商品卡片网格 */
.grid { display: grid; gap: 18px; }
.grid-products { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.product-card { display: flex; flex-direction: column; transition: .18s; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,24,40,.1); }
.product-thumb { aspect-ratio: 16/10; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; position: relative; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb .ph { font-size: 40px; color: #cbd2dd; }
.badge { position: absolute; top: 10px; left: 10px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 6px; }
.product-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.product-cat { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.product-name { font-weight: 600; font-size: 15px; margin: 0 0 8px; }
.product-desc { color: var(--text-2); font-size: 13px; flex: 1; margin: 0 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { display: flex; align-items: baseline; gap: 8px; }
.price .now { color: var(--danger); font-size: 20px; font-weight: 700; }
.price .now small { font-size: 13px; }
.price .old { color: var(--text-3); text-decoration: line-through; font-size: 13px; }
.product-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.stock-out { opacity: .6; }

/* 分类标签 */
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.chip { padding: 7px 15px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 500; }
.chip.active, .chip:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 详情 */
.detail-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.detail-thumb { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; padding: 30px; }
.detail-thumb img { width: 100%; height: 100%; object-fit: contain; }
.detail-panel h1 { font-size: 26px; margin: 0 0 10px; }
.detail-desc { color: var(--text-2); margin: 18px 0; white-space: pre-wrap; }
.buy-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 20px; }
.qty-row { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.qty-btn { width: 32px; height: 32px; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; font-size: 18px; }
.qty-val { min-width: 36px; text-align: center; font-weight: 600; }

/* 表单 */
.auth-wrap { max-width: 420px; margin: 40px auto; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.panel h2 { margin: 0 0 6px; font-size: 22px; }
.panel .sub { color: var(--text-2); margin: 0 0 24px; font-size: 13px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fee; color: var(--danger); border: 1px solid #fcc; }
.alert-success { background: #eafff0; color: var(--success); border: 1px solid #bfe8cd; }
.tabs { display: flex; gap: 8px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 16px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; background: none; border-top: none; border-left: none; border-right: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* 购物车/表格 */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 13px; }
.table tr:last-child td { border-bottom: none; }
.cart-item { display: flex; align-items: center; gap: 14px; }
.cart-item .ci-thumb { width: 64px; height: 64px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: 26px; color: #cbd2dd; flex: none; }
.summary-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.summary-line { display: flex; justify-content: space-between; padding: 8px 0; }
.summary-line.total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 16px; font-size: 18px; font-weight: 700; }

/* 状态标签 */
.status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.st-pending { background: #fff4e5; color: var(--warn); }
.st-paid { background: #eafff0; color: var(--success); }
.st-cancelled { background: var(--surface-2); color: var(--text-2); }

/* 空状态 */
.empty { text-align: center; padding: 70px 20px; color: var(--text-2); }
.empty .icon { font-size: 52px; color: #cbd2dd; margin-bottom: 12px; }

/* 文章列表 */
.post-item { display: flex; gap: 16px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; }
.post-item .p-thumb { width: 120px; height: 80px; border-radius: 8px; background: var(--surface-2); object-fit: cover; flex: none; }
.post-date { color: var(--text-3); font-size: 12px; }
.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; max-width: 820px; margin: 0 auto; }
.article h1 { font-size: 26px; margin-top: 0; }
.article-body { color: var(--text); line-height: 1.9; }

/* 后台 */
.admin-layout { display: grid; grid-template-columns: 210px 1fr; gap: 24px; }
.sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; align-self: start; }
.sidebar a { display: block; padding: 10px 14px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.sidebar a:hover, .sidebar a.active { background: var(--primary-soft); color: var(--primary); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card .num { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat-card .lbl { color: var(--text-2); font-size: 13px; }
.modal-mask { position: fixed; inset: 0; background: rgba(16,24,40,.45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 520px; padding: 24px; max-height: 85vh; overflow: auto; }
.modal h3 { margin: 0 0 18px; }

/* Toast */
.toast { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 11px 20px; border-radius: 8px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 14px; }

/* 页脚 */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); margin-top: 60px; padding: 36px 0 24px; }
.footer-grid { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.footer-col h4 { font-size: 14px; margin: 0 0 12px; }
.footer-col a, .footer-col p { display: block; color: var(--text-2); margin: 6px 0; font-size: 13px; }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 28px; padding-top: 18px; text-align: center; color: var(--text-3); font-size: 12px; }

@media (max-width: 760px) {
  .nav, .header-actions .btn-outline { display: none; }
  .nav.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: var(--surface); padding: 16px 20px; gap: 10px; border-bottom: 1px solid var(--border); }
  .menu-toggle { display: block; }
  .detail-wrap { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; }
  .sidebar a { white-space: nowrap; }
  .post-item { flex-direction: column; }
  .post-item .p-thumb { width: 100%; height: 140px; }
}
