/* F7全球好物代购 - 共用样式 */
:root {
  --bg: #faf9f6;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e8e4dc;
  --brand: #c8553d;
  --brand-dark: #a03d2a;
  --accent: #2d6a4f;
  --warn: #d4a017;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ===== 顶部导航 ===== */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.nav-brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand .logo {
  width: 32px;
  height: 32px;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.nav-links { display: flex; gap: 18px; align-items: center; }
.nav-links a { color: var(--ink); font-size: 14px; }
.nav-links a:hover { color: var(--brand); }
.nav-links .active { color: var(--brand); font-weight: 600; }
.nav-user { font-size: 13px; color: var(--muted); }
.nav-login-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
}
.nav-login-btn:hover { background: var(--brand-dark); }

/* ===== 容器 ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.container-narrow { max-width: 420px; margin: 0 auto; padding: 40px 24px; }

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 60px 24px 40px;
}
.hero h1 {
  font-size: 32px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}
.hero p { color: var(--muted); font-size: 15px; }

/* ===== 批次卡片 ===== */
.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.batch-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.batch-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.batch-card .batch-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.batch-tag.open { background: #e8f5e9; color: #2e7d32; }
.batch-tag.closed { background: #fff3e0; color: #ef6c00; }
.batch-tag.done { background: #f3e5f5; color: #7b1fa2; }
.batch-card h3 { font-size: 17px; margin-bottom: 10px; }
.batch-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
}
.batch-meta .label { display: inline-block; width: 70px; color: var(--ink); }
.batch-desc {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  color: #555;
}

/* ===== 通用表单 ===== */
.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand);
}
.form-group textarea { resize: vertical; min-height: 70px; }
.form-row { display: flex; gap: 12px; }
.form-row > .form-group { flex: 1; }

.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--line); color: var(--ink); }
.btn-secondary:hover { background: #d5d0c5; }
.btn-danger { background: #fee; color: #c33; border: 1px solid #fcc; }
.btn-danger:hover { background: #fcc; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #faf9f6 0%, #f5f0e8 100%);
}
.login-card {
  background: var(--card);
  padding: 40px 36px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 380px;
}
.login-card h2 {
  text-align: center;
  font-size: 22px;
  margin-bottom: 8px;
}
.login-card .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
}
.login-card .error-msg {
  background: #fee;
  color: #c33;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.login-card .error-msg.show { display: block; }

/* ===== 管理后台布局 ===== */
.admin-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 220px;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 20px 0;
  flex-shrink: 0;
}
.sidebar-menu { list-style: none; }
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  color: var(--ink);
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar-menu li a:hover { background: #f5f3ee; text-decoration: none; }
.sidebar-menu li a.active {
  border-left-color: var(--brand);
  background: #faf6f0;
  color: var(--brand);
  font-weight: 600;
}
.sidebar-menu .icon { width: 18px; text-align: center; }
.main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-x: auto;
}
.main-content h2 {
  font-size: 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.main-content h2 .actions { display: flex; gap: 8px; }

/* ===== 数据表格 ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.data-table th {
  background: #f5f3ee;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #faf9f6; }
.data-table .actions-cell { white-space: nowrap; }
.data-table .actions-cell button { margin-right: 4px; }

/* ===== 状态标签 ===== */
.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.status-pill.open { background: #e8f5e9; color: #2e7d32; }
.status-pill.closed { background: #fff3e0; color: #ef6c00; }
.status-pill.done { background: #f3e5f5; color: #7b1fa2; }
.status-pill.pending { background: #fff3e0; color: #ef6c00; }
.status-pill.purchased { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.status-pill.unpurchased { background: #f5f3ee; color: #999; }
.status-pill.paid { background: #e3f2fd; color: #1565c0; }
.status-pill.shipped { background: #f3e5f5; color: #7b1fa2; }
.status-pill.received { background: #e8f5e9; color: #2e7d32; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--card);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal h3 {
  font-size: 18px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .emoji { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 40px 24px 30px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

/* ===== 提示 ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  transform: translateX(120%);
  transition: transform 0.3s;
}
.toast.show { transform: translateX(0); }
.toast.error { background: #c33; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .nav { padding: 12px 16px; }
  .nav-brand { font-size: 16px; }
  .nav-links { gap: 12px; }
  .nav-links a { font-size: 13px; }
  .container { padding: 20px 16px; }
  .hero { padding: 40px 16px 24px; }
  .hero h1 { font-size: 24px; }
  .sidebar { width: 60px; }
  .sidebar-menu li a { padding: 12px 18px; font-size: 0; }
  .sidebar-menu .icon { font-size: 18px; }
  .main-content { padding: 20px 16px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .form-row { flex-direction: column; gap: 0; }
}

/* ===== 商品明细行 ===== */
.item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto 40px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.item-row input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px;
}
.item-row .remove-item-btn {
  background: none;
  border: none;
  color: #c33;
  font-size: 18px;
  cursor: pointer;
}
.add-item-btn {
  background: #f5f3ee;
  border: 1px dashed var(--line);
  padding: 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  width: 100%;
  text-align: center;
  margin-top: 4px;
}
.add-item-btn:hover { background: #ede9e0; color: var(--ink); }

/* ===== 商品图片区域 ===== */
.item-image-area {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}
.item-image-preview {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  cursor: pointer;
}
.item-image-btn {
  padding: 4px 8px !important;
  font-size: 11px !important;
  white-space: nowrap;
}
.item-image-del {
  padding: 2px 6px !important;
  font-size: 10px !important;
  position: absolute;
  top: -4px;
  left: 32px;
  z-index: 1;
}

/* ===== 订单列表中的商品缩略图 ===== */
.order-items-list .item-thumb {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .item-row { grid-template-columns: 1fr 1fr; }
  .item-row .remove-item-btn { grid-column: span 2; text-align: right; }
  .item-image-area { grid-column: span 2; }
}
