/* ============================================================
   AI 百货 · 全局样式（移动优先，卡片风格）
   ============================================================ */
:root {
  --primary: #4e6ef2;
  --primary-dark: #3b5bdb;
  --success: #16a34a;
  --warn: #ea580c;
  --danger: #dc2626;
  --gold: #f59e0b;
  --text: #1f2937;
  --text-sub: #6b7280;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #eceef3;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(31, 41, 55, 0.06);
  --alipay: #1677ff;
  --wechat: #07c160;
}

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

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(--text);
  font-size: 15px;
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 14px;
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-logo {
  font-size: 22px;
}
.brand-name {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nav {
  display: flex;
  gap: 4px;
}
.nav-link {
  padding: 6px 12px;
  border-radius: 20px;
  color: var(--text-sub);
  font-size: 14px;
}
.nav-link.active,
.nav-link:hover {
  background: rgba(78, 110, 242, 0.1);
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 公告栏 ---------- */
.notice-bar {
  margin: 14px 0 0;
  background: linear-gradient(90deg, #fff7e6, #fff);
  border: 1px solid #ffe1a8;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13.5px;
  color: #8a5b00;
}
.notice-bar b {
  color: var(--warn);
}

/* ---------- 商品列表 ---------- */
.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 4px;
  -webkit-overflow-scrolling: touch;
}
.cat-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-sub);
  font-size: 13.5px;
  cursor: pointer;
}
.cat-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.goods-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 14px 0 30px;
}
@media (min-width: 640px) {
  .goods-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 960px) {
  .goods-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.goods-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease;
}
.goods-card:hover {
  transform: translateY(-2px);
}
.goods-cover {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  position: relative;
}
.goods-cover .cover-emoji {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}
.goods-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.goods-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.goods-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  font-size: 11px;
  color: var(--primary);
  background: rgba(78, 110, 242, 0.08);
  border: 1px solid rgba(78, 110, 242, 0.25);
  padding: 1px 7px;
  border-radius: 10px;
}
.goods-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.goods-price {
  color: var(--danger);
  font-weight: 700;
  font-size: 16px;
}
.goods-price small {
  font-size: 12px;
}
.btn-buy {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 18px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.btn-buy:hover {
  background: var(--primary-dark);
}

.empty {
  text-align: center;
  color: var(--text-sub);
  padding: 60px 0;
}

/* ---------- 通用按钮 / 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card {
  margin-top: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-block {
  width: 100%;
}
.btn-alipay {
  background: var(--alipay);
  color: #fff;
}
.btn-wechat {
  background: var(--wechat);
  color: #fff;
}

/* ---------- 商品详情 ---------- */
.item-hero {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.item-cover {
  width: 96px;
  height: 96px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  flex-shrink: 0;
}
.item-info {
  flex: 1;
  min-width: 0;
}
.item-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}
.item-meta {
  color: var(--text-sub);
  font-size: 13px;
  margin-top: 6px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.item-price {
  color: var(--danger);
  font-size: 22px;
  font-weight: 800;
  margin-top: 8px;
}
.item-price small {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-sub);
  margin-left: 6px;
}

.auto-ship-box {
  margin-top: 14px;
  background: linear-gradient(90deg, #fffbeb, #fef3c7);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-weight: 700;
  color: #92400e;
  font-size: 14.5px;
}
.auto-ship-box a {
  color: var(--warn);
}

.buy-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title::before {
  content: '';
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--primary);
}

.detail-block h3 {
  font-size: 14.5px;
  margin: 12px 0 6px;
  color: var(--text);
}
.detail-block ul {
  padding-left: 18px;
  color: #374151;
  font-size: 14px;
}
.detail-block li {
  margin: 4px 0;
}
.warn-box {
  margin-top: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
}

/* 售后规则 */
.rules-list {
  padding-left: 18px;
  color: #374151;
  font-size: 13.5px;
}
.rules-list li {
  margin: 4px 0;
}

/* ---------- 下单页 ---------- */
.steps {
  display: flex;
  gap: 4px;
  margin: 14px 0;
}
.step {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-sub);
  position: relative;
}
.step .num {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-sub);
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 4px;
}
.step.active .num {
  background: var(--primary);
  color: #fff;
}
.step.done .num {
  background: var(--success);
  color: #fff;
}
.step.active,
.step.done {
  color: var(--text);
  font-weight: 600;
}

.order-prod {
  display: flex;
  gap: 12px;
  align-items: center;
}
.order-prod .cover {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.order-prod .name {
  font-weight: 600;
  font-size: 14.5px;
}
.order-prod .price {
  color: var(--danger);
  font-weight: 700;
}

.form-field {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  background: #fafbfd;
  outline: none;
}
.form-input:focus {
  border-color: var(--primary);
  background: #fff;
}
.form-tip {
  font-size: 12.5px;
  color: var(--text-sub);
  margin-top: 5px;
}

.pay-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pay-method {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  background: #fafbfd;
  transition: all 0.15s ease;
}
.pay-method .pay-icon {
  font-size: 22px;
  font-weight: 800;
  display: block;
  margin-bottom: 4px;
}
.pay-method .pay-icon.alipay {
  color: var(--alipay);
}
.pay-method .pay-icon.wechat {
  color: var(--wechat);
}
.pay-method .pay-name {
  font-size: 13px;
  color: var(--text-sub);
}
.pay-method.selected {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(78, 110, 242, 0.12);
}

/* ---------- 收款码弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-mask.show {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  padding: 22px 18px;
  text-align: center;
  max-height: 92vh;
  overflow-y: auto;
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
}
.modal-sub {
  color: var(--text-sub);
  font-size: 13px;
  margin-top: 4px;
}
.qr-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}
.qr-tab {
  padding: 5px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fafbfd;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.qr-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.qr-box {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fafbfd;
}
.qr-box img {
  width: 200px;
  height: 200px;
  max-width: 100%;
  border-radius: 8px;
  background: #fff;
}
.qr-hint {
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 10px;
}
.qr-amount {
  font-size: 20px;
  font-weight: 800;
  color: var(--danger);
  margin: 6px 0;
}
.qr-order-no {
  font-size: 13px;
  background: #f1f3f9;
  border-radius: 8px;
  padding: 8px;
  margin: 8px 0;
  word-break: break-all;
  user-select: all;
}
.modal .btn {
  margin-top: 10px;
}

/* ---------- 订单查询 ---------- */
.query-form {
  display: flex;
  gap: 8px;
}
.query-form .form-input {
  flex: 1;
}
.query-form .btn {
  flex-shrink: 0;
}

.order-item {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.order-item .head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.order-no {
  font-size: 12.5px;
  color: var(--text-sub);
  font-family: Consolas, monospace;
}
.status-badge {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.status-pending {
  background: #fff7e6;
  color: #b45309;
  border: 1px solid #fde68a;
}
.status-shipped {
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
}
.order-item .prod-name {
  font-weight: 600;
  font-size: 14.5px;
}
.order-item .meta {
  font-size: 12.5px;
  color: var(--text-sub);
  margin-top: 4px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.ship-block {
  margin-top: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.ship-block .label {
  font-size: 12.5px;
  color: var(--text-sub);
  margin-bottom: 4px;
}
.ship-text {
  font-family: Consolas, 'Courier New', monospace;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 13.5px;
  background: #fff;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
  padding: 10px;
  user-select: all;
}
.copy-btn {
  margin-top: 8px;
  font-size: 12.5px;
  padding: 5px 14px;
}
.wait-tip {
  margin-top: 10px;
  background: #fefce8;
  border: 1px solid #fde68a;
  color: #854d0e;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

/* ---------- 后台 ---------- */
.admin-login {
  max-width: 380px;
  margin: 40px auto;
}
.admin-login .card {
  padding: 26px 22px;
}
.login-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
}
@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}
.stat-card .num {
  font-size: 22px;
  font-weight: 800;
}
.stat-card .label {
  font-size: 12.5px;
  color: var(--text-sub);
}
.stat-card.pending .num {
  color: var(--warn);
}
.stat-card.shipped .num {
  color: var(--success);
}
.stat-card.total .num {
  color: var(--primary);
}
.stat-card.today .num {
  color: var(--gold);
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 12px 0;
}
.filter-tabs {
  display: flex;
  gap: 6px;
}
.filter-tab {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-sub);
}
.filter-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.search-box {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.search-box .form-input {
  width: 150px;
  padding: 7px 10px;
  font-size: 13px;
}

.admin-table {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.admin-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 860px;
}
.admin-table th,
.admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.admin-table th {
  background: #fafbfd;
  color: var(--text-sub);
  font-weight: 600;
  white-space: nowrap;
}
.admin-table tr:last-child td {
  border-bottom: none;
}
.admin-table .num-cell {
  font-family: Consolas, monospace;
  font-size: 12.5px;
}
.cell-actions {
  white-space: nowrap;
}
.btn-sm {
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 8px;
}
.btn-sm.ship {
  background: var(--warn);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.btn-sm.copyship {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.ship-preview {
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 220px;
  font-family: Consolas, monospace;
  font-size: 12px;
  color: #374151;
  background: #f8fafc;
  border-radius: 6px;
  padding: 6px 8px;
  display: none;
}
tr.expanded .ship-preview {
  display: block;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 0 30px;
  font-size: 13px;
  color: var(--text-sub);
}

textarea.form-input {
  resize: vertical;
  min-height: 90px;
  font-family: Consolas, monospace;
  font-size: 13.5px;
}
.modal .ship-target {
  font-size: 13px;
  color: var(--text-sub);
  background: #f1f3f9;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 10px;
  text-align: left;
  word-break: break-all;
}

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 18px 0 24px;
  text-align: center;
  color: var(--text-sub);
  font-size: 13px;
}
.site-footer p + p {
  margin-top: 4px;
}
.link-qq {
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 提示 ---------- */
.msg-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  margin-top: 10px;
  display: none;
}
.msg-error.show {
  display: block;
}

.loading {
  text-align: center;
  color: var(--text-sub);
  padding: 40px 0;
  font-size: 14px;
}
