/* 咖市客 - 全局样式 */
:root {
  --primary: #5D3A1A;
  --primary-light: #8B6914;
  --accent: #C8953B;
  --accent-light: #E8D5B7;
  --bg: #FDF8F0;
  --bg-card: #FFFFFF;
  --text: #3D2B1F;
  --text-light: #8B7355;
  --success: #2D8B4E;
  --danger: #C0392B;
  --warning: #E67E22;
  --info: #2980B9;
  --border: #E8D5B7;
  --shadow: 0 2px 12px rgba(93, 58, 26, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* 导航栏 */
.navbar {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand .logo-icon { font-size: 28px; }

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.navbar-nav a, .navbar-nav span {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}

.navbar-nav a:hover, .navbar-nav a.active {
  background: var(--accent-light);
  color: var(--primary);
}

.navbar-nav .badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* 主容器 */
.main-container { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* 卡片 */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(93, 58, 26, 0.12); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title { font-size: 18px; font-weight: 600; color: var(--primary); }

/* 统计卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  border-left: 4px solid var(--accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-card .stat-icon { font-size: 40px; opacity: 0.3; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 14px; color: var(--text-light); margin-top: 4px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
}

.btn:hover { transform: translateY(-1px); opacity: 0.9; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--text); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 149, 59, 0.15);
}
.form-textarea { min-height: 80px; resize: vertical; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--accent-light); font-weight: 600; font-size: 13px; color: var(--primary); }
.table tr:hover td { background: rgba(200, 149, 59, 0.05); }

/* 标签 */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.tag-primary { background: var(--accent-light); color: var(--primary); }
.tag-success { background: #DCFCE7; color: var(--success); }
.tag-danger { background: #FEE2E2; color: var(--danger); }
.tag-warning { background: #FEF3C7; color: var(--warning); }
.tag-info { background: #DBEAFE; color: var(--info); }
.tag-pending { background: #FEF3C7; color: #92400E; }

/* 商品卡片网格 */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.product-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
}

.product-card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(93, 58, 26, 0.15); }

.product-card .product-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
}

.product-card .product-image {
  height: 200px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
}

.product-card .product-info { padding: 16px; }

.product-card .product-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.product-card .product-desc {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 12px;
  line-height: 1.4;
}

.product-card .product-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.product-card .sale-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--danger);
}

.product-card .original-price {
  font-size: 14px;
  color: #999;
  text-decoration: line-through;
}

.product-card .product-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* 分类标签栏 */
.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 4px;
}

.category-tab {
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: all 0.2s;
  white-space: nowrap;
}

.category-tab:hover, .category-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* 购物车 */
.cart-sidebar {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 400px;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s;
}

.cart-sidebar.open { transform: translateX(0); }

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
  display: none;
}

.cart-overlay.open { display: block; }

.cart-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.cart-item .item-image {
  width: 60px;
  height: 60px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
}

.cart-item .item-info { flex: 1; }

.cart-item .item-name { font-size: 14px; font-weight: 500; }

.cart-item .item-price { color: var(--danger); font-weight: 600; }

.cart-item .qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.qty-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

.cart-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cart-total .total-label { font-size: 16px; }
.cart-total .total-amount { font-size: 24px; font-weight: 700; color: var(--danger); }

/* 订单状态流程 */
.order-status-flow {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 32px 0;
}

.order-status-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
  max-width: 120px;
}

.order-status-step .step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s;
}

.order-status-step.active .step-dot { background: var(--accent); color: #fff; }
.order-status-step.done .step-dot { background: var(--success); color: #fff; }

.order-status-step .step-line {
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #eee;
  z-index: -1;
}

.order-status-step .step-label { font-size: 12px; color: var(--text-light); margin-top: 8px; }

/* 后台侧边栏布局 */
.admin-layout { display: flex; min-height: calc(100vh - 64px); }

.admin-sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 16px 0;
  flex-shrink: 0;
}

.admin-sidebar .sidebar-title {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-light);
  padding: 0 20px;
  margin: 16px 0 8px;
  letter-spacing: 1px;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
  background: var(--accent-light);
  color: var(--primary);
  font-weight: 500;
}

.admin-content { flex: 1; padding: 24px; overflow-x: auto; }

/* 弹窗 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: var(--accent-light); }

/* 营销工具卡片 */
.marketing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.marketing-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  border-top: 3px solid var(--accent);
}

.marketing-card .mc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.marketing-card .mc-title { font-size: 18px; font-weight: 600; }
.marketing-card .mc-desc { font-size: 13px; color: var(--text-light); margin-bottom: 16px; }

/* Toast */
.toast {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 400;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 响应式 */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .admin-sidebar a { display: inline-block; padding: 8px 12px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .cart-sidebar { width: 100%; }
  .main-container { padding: 12px; }
}
