/* ===== 淡黄色风格商城管理后台 ===== */

:root {
  --bg-primary: #FFFBF0;
  --bg-secondary: #FFF8E7;
  --bg-card: #FFFFFF;
  --bg-hover: #FFF3D6;
  --color-primary: #F5A623;
  --color-primary-dark: #E09600;
  --color-primary-light: #FFD980;
  --color-success: #52C41A;
  --color-danger: #FF4D4F;
  --color-warning: #FAAD14;
  --color-info: #1890FF;
  --text-primary: #3D2E0F;
  --text-secondary: #8C7B5A;
  --text-placeholder: #C4B896;
  --border-color: #F0E4C3;
  --border-light: #F7EFDC;
  --shadow-sm: 0 2px 8px rgba(180, 150, 50, 0.08);
  --shadow-md: 0 4px 16px rgba(180, 150, 50, 0.12);
  --shadow-lg: 0 8px 32px rgba(180, 150, 50, 0.16);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 220px;
  --topbar-height: 64px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
}

#app {
  display: flex;
  min-height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #FFF8E1 0%, #FFF3D6 100%);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-logo {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
}

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

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  margin-bottom: 4px;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--color-primary-dark);
}

.nav-item.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245, 166, 35, 0.3);
}

.nav-icon {
  font-size: 18px;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-placeholder);
  text-align: center;
}

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-time {
  font-size: 13px;
  color: var(--text-secondary);
}

.page-body {
  flex: 1;
  padding: 24px 32px;
}

/* ===== 控制台统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--bg-secondary);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.stat-trend {
  font-size: 12px;
  margin-top: 8px;
}

.stat-trend.up { color: var(--color-success); }
.stat-trend.down { color: var(--color-danger); }

/* ===== 数据表格 ===== */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 260px;
  padding: 8px 36px 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--color-primary);
}

.search-box::after {
  content: '🔍';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

.filter-select {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

.table-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: var(--bg-secondary);
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-secondary);
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.product-info {
  min-width: 0;
}

.product-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.product-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

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

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.on {
  background: #F0FBE8;
  color: var(--color-success);
}

.status-badge.off {
  background: #FFF1F0;
  color: var(--color-danger);
}

.order-status-0 { background: #FFF7E6; color: var(--color-warning); }
.order-status-1 { background: #E6F7FF; color: var(--color-info); }
.order-status-2 { background: #F9F0FF; color: #722ED1; }
.order-status-3 { background: #E6FFFB; color: #13C2C2; }
.order-status-4 { background: #F5F5F5; color: var(--text-secondary); }
.order-status-5 { background: #FFF1F0; color: #FF4D4F; }

.action-btns {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
}

.action-btn:hover { opacity: 0.8; }

.action-btn.edit {
  background: var(--bg-secondary);
  color: var(--color-primary-dark);
}

.action-btn.toggle {
  background: #FFF3D6;
  color: var(--color-primary-dark);
}

.action-btn.delete {
  background: #FFF1F0;
  color: var(--color-danger);
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 14px;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.page-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245, 166, 35, 0.3);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-default {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px dashed var(--color-primary);
  color: var(--color-primary);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(60, 46, 15, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

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

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 720px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

.modal-sm {
  width: 400px;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.modal-close:hover {
  background: var(--bg-secondary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

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

/* ===== 表单 ===== */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  flex: 1;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-secondary);
}

.required {
  color: var(--color-danger);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
}

.form-group textarea {
  resize: vertical;
}

/* ===== 图片上传 ===== */
.image-upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--bg-secondary);
}

.image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.image-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-item .remove-img {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.image-upload-btns {
  display: flex;
  gap: 8px;
}

/* ===== 规格设置 ===== */
.spec-item {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.spec-item input {
  flex: 1;
}

.spec-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: #FFF1F0;
  color: var(--color-danger);
  border: none;
  cursor: pointer;
  font-size: 18px;
}

/* 变体价格设置 */
.variant-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.variant-spec {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variant-fields {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.variant-fields input {
  width: 90px;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ===== 确认弹窗 ===== */
.confirm-message {
  font-size: 15px;
  color: var(--text-primary);
  text-align: center;
  padding: 12px 0;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--text-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  box-shadow: var(--shadow-md);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

/* ===== 复选框标签 ===== */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-placeholder);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* ===== 轮播图管理 ===== */
.banner-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.banner-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: box-shadow 0.2s;
}

.banner-card:hover {
  box-shadow: var(--shadow-sm);
}

.banner-card-img {
  flex-shrink: 0;
  width: 240px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
}

.banner-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-card-info {
  flex: 1;
  min-width: 0;
}

.banner-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.banner-card-link {
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-all;
  line-height: 1.5;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 64px;
  }
  .sidebar-logo .logo-text,
  .nav-item span:not(.nav-icon),
  .sidebar-footer {
    display: none;
  }
  .main-content {
    margin-left: 64px;
  }
  .form-row {
    flex-direction: column;
  }
  .page-body {
    padding: 16px;
  }
}

/* ===== 富文本编辑器 ===== */
.rich-editor {
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fff;
}

.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.rich-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.rich-btn:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.rich-divider {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  margin: 0 4px;
}

.rich-content {
  min-height: 160px;
  max-height: 400px;
  overflow-y: auto;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  outline: none;
}

.rich-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-placeholder);
}

.rich-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 12px 0 6px;
}

.rich-content p {
  margin: 6px 0;
}

.rich-content ul,
.rich-content ol {
  margin: 6px 0;
  padding-left: 24px;
}

.rich-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 8px 0;
}

.rich-content a {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ===== 节日主题选择器 ===== */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.theme-card {
  cursor: pointer;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s;
  background: #fff;
}

.theme-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.15);
}

.theme-card.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.2);
}

.theme-card.selected::after {
  content: '\2713';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.theme-card {
  position: relative;
}

.theme-preview {
  width: 100%;
  height: 100px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.theme-preview-header {
  height: 24px;
  width: 100%;
}

.theme-preview-body {
  flex: 1;
  display: flex;
  gap: 6px;
  padding: 8px;
}

.theme-preview-card {
  flex: 1;
  border-radius: 4px;
  border: 1px solid;
}

.theme-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 8px 12px 0;
}

.theme-desc {
  font-size: 12px;
  color: var(--text-placeholder);
  padding: 0 12px 10px;
}
