/* ===== Kami Shop - 前台样式 ===== */
:root {
  --radius: 12px;
}

* {
  box-sizing: border-box;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f5f7fa;
  color: #1f2937;
  line-height: 1.5;
}

a { color: var(--theme-color, #6366f1); text-decoration: none; }
.btn-primary { background: var(--theme-color, #6366f1); border-color: var(--theme-color, #6366f1); }

.navbar {
  background: var(--navbar-bg, #ffffff);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--theme-color, #6366f1);
}

/* 站点横幅 */
.site-banner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1rem 0;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
}
.site-banner .banner-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0, var(--mask, 0.4));
  backdrop-filter: blur(var(--blur, 0));
}
.site-banner .banner-content {
  position: relative; z-index: 2;
  padding: 2rem 1rem;
}
.site-banner h1 { margin: 0 0 0.5rem; font-size: 1.75rem; font-weight: 800; text-shadow: 0 2px 4px rgba(0,0,0,0.35); }
.site-banner p { margin: 0 0 1rem; font-size: 1.05rem; text-shadow: 0 1px 2px rgba(0,0,0,0.3); opacity: 0.95; }

/* 公告 */
.announcement {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  font-size: 0.95rem;
}

/* 商品卡片 */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.product-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.product-card:hover { transform: translateY(-4px); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.08); }
.product-cover {
  height: 150px;
  background: linear-gradient(135deg, #e5e7eb, #f3f4f6);
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: 0.85rem;
}
.product-cover img { width: 100%; height: 100%; object-fit: cover; }
.product-body { padding: 0.85rem; flex: 1; display: flex; flex-direction: column; }
.product-title { font-size: 1rem; font-weight: 700; margin: 0 0 0.5rem; line-height: 1.3; }
.product-cat { font-size: 0.8rem; color: #6b7280; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.product-price { font-size: 1.15rem; font-weight: 800; color: var(--theme-color, #6366f1); margin: 0 0 0.25rem; }
.product-orig { font-size: 0.85rem; color: #9ca3af; text-decoration: line-through; }
.product-actions { margin-top: auto; }
.btn-buy {
  width: 100%; padding: 0.65rem; font-weight: 700; font-size: 0.95rem;
  border-radius: calc(var(--radius) - 2px);
}

/* 分类筛选 */
.cat-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cat-chip { padding: 0.35rem 0.9rem; border: 1px solid #e5e7eb; border-radius: 999px; font-size: 0.85rem; color: #374151; background: #fff; }
.cat-chip.active { background: var(--theme-color, #6366f1); border-color: var(--theme-color, #6366f1); color: #fff; }

/* 详情页 */
.product-detail { max-width: 860px; margin: 0 auto; }
.detail-media { border-radius: var(--radius); overflow: hidden; border: 1px solid #e5e7eb; margin-bottom: 1rem; height: 340px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; color: #9ca3af; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-actions .stock-badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  background: #e5e7eb; color: #374151; margin-bottom: 0.5rem;
}
.stock-badge.low { background: #fecaca; color: #991b1b; }

/* 订单卡密展示 */
.order-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: var(--radius);
  padding: 1.25rem; margin-top: 1rem;
}
.card-item {
  border: 1px solid #e5e7eb; border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.5rem;
  background: #f9fafb; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.card-item .card-val { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }
.card-item .btn-copy { font-size: 0.75rem; padding: 0.2rem 0.5rem; background: #e5e7eb; border: none; border-radius: 6px; cursor: pointer; }
.card-item .btn-copy:active { background: #d1d5db; }

.status-badge {
  padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-paid { background: #dcfce7; color: #166534; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.form-control { width: 100%; padding: 0.55rem 0.85rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.95rem; }
.form-control:focus { outline: none; border-color: var(--theme-color, #6366f1); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.35rem; color: #374151; }
.form-group { margin-bottom: 1rem; }

footer { margin-top: 2rem; padding: 1.5rem 0; color: #6b7280; font-size: 0.85rem; border-top: 1px solid #e5e7eb; text-align: center; }

/* 深色模式 */
body.dark { background: #0f172a; color: #f1f5f9; }
body.dark .product-card, body.dark .order-card, body.dark .card-item { background: #1e293b; border-color: #334155; color: #f1f5f9; }
body.dark .product-cover { background: #334155; color: #94a3b8; }
body.dark .navbar { background: #1e293b; color: #f1f5f9; }
body.dark .form-control { background: #0f172a; border-color: #334155; color: #f1f5f9; }
body.dark .alert-success { background: #14532d; color: #bbf7d0; border-color: #16a34a; }
body.dark .alert-error { background: #7f1d1d; color: #fecaca; border-color: #dc2626; }
body.dark .alert-info { background: #1e3a8a; color: #bfdbfe; border-color: #2563eb; }
body.dark .announcement { background: #451a03; color: #fcd34d; border-left-color: #f59e0b; }
body.dark .footer-copyright { color: #94a3b8; }

@media (max-width: 640px) {
  .site-banner h1 { font-size: 1.35rem; }
}
