/* 枣美育 Web 后台管理系统样式 */

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

:root {
  --primary: #409EFF;
  --primary-dark: #337ecc;
  --success: #67C23A;
  --warning: #E6A23C;
  --danger: #F56C6C;
  --info: #909399;
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e4e7ed;
  --text: #303133;
  --text-light: #606266;
  --text-muted: #909399;
  --sidebar-bg: #304156;
  --sidebar-active: #409EFF;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== 侧边栏 ===== */
.sidebar {
  position: fixed; left: 0; top: 0;
  width: 220px; height: 100vh;
  background: var(--sidebar-bg);
  color: #bfcbd9;
  z-index: 100;
  transition: transform 0.3s;
}
.sidebar-brand {
  padding: 20px 16px;
  font-size: 20px; font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand span { color: var(--primary); }
.sidebar-nav { padding: 8px 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  color: #bfcbd9;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active {
  background: rgba(64,158,255,0.15);
  color: var(--primary);
  border-left-color: var(--primary);
}
.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}

/* ===== 主区域 ===== */
.main {
  margin-left: 220px;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.header {
  height: 56px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.header-title { font-size: 16px; font-weight: 600; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 14px; color: var(--text-light);
}
.content { flex: 1; padding: 24px; }

/* ===== 页面区域 ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 16px; font-weight: 600;
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ===== 统计卡片 ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
}
.stat-icon.blue { background: var(--primary); }
.stat-icon.green { background: var(--success); }
.stat-icon.orange { background: var(--warning); }
.stat-icon.red { background: var(--danger); }
.stat-icon.purple { background: #7B3FA0; }
.stat-info {}
.stat-number { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* ===== 表格 ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: #f5f7fa;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px; font-weight: 600;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tr:hover td { background: #f5f7fa; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  outline: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #5daf34; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dd6161; }
.btn-text { background: transparent; color: var(--primary); padding: 4px 8px; }
.btn-text:hover { background: rgba(64,158,255,0.1); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 14px; font-weight: 500;
  color: var(--text-light);
  margin-bottom: 8px;
}
.form-label .required { color: var(--danger); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== 步骤条 ===== */
.steps {
  display: flex; justify-content: center;
  margin-bottom: 24px;
  padding: 16px 0;
}
.step {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  font-size: 14px; color: var(--text-muted);
}
.step-number {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  background: #e4e7ed; color: var(--text-muted);
}
.step.active .step-number { background: var(--primary); color: #fff; }
.step.active { color: var(--primary); font-weight: 600; }
.step.done .step-number { background: var(--success); color: #fff; }
.step.done { color: var(--success); }
.step-line { width: 40px; height: 2px; background: #e4e7ed; margin: 0 4px; }
.step.done + .step-line, .step.active + .step-line { background: var(--primary); }

/* ===== 标签 ===== */
.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
}
.tag-primary { background: rgba(64,158,255,0.1); color: var(--primary); }
.tag-success { background: rgba(103,194,58,0.1); color: var(--success); }
.tag-warning { background: rgba(230,162,60,0.1); color: var(--warning); }
.tag-danger { background: rgba(245,108,108,0.1); color: var(--danger); }
.tag-info { background: rgba(144,147,153,0.1); color: var(--info); }

/* ===== 上传区域 ===== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}
.upload-zone:hover { border-color: var(--primary); background: rgba(64,158,255,0.05); }
.upload-zone.dragging { border-color: var(--primary); background: rgba(64,158,255,0.1); }
.upload-icon { font-size: 48px; color: var(--text-muted); margin-bottom: 12px; }
.upload-text { font-size: 14px; color: var(--text-light); }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.upload-count { font-size: 14px; color: var(--success); margin-top: 12px; font-weight: 600; }

/* 图片预览网格 */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.image-grid-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 1;
  border: 2px solid var(--border);
}
.image-grid-item img { width: 100%; height: 100%; object-fit: cover; }
.image-grid-item .img-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,0.6); color: #fff;
  font-size: 10px; padding: 2px 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.image-grid-item .img-remove {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--danger); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer;
}
.image-grid-item.matched { border-color: var(--success); }
.image-grid-item.unmatched { border-color: var(--danger); }
.image-grid-item .img-tag {
  position: absolute; top: 2px; left: 2px;
  font-size: 10px; padding: 1px 4px;
  border-radius: 3px; background: var(--success); color: #fff;
}
.image-grid-item .img-tag.warn {
  background: var(--warning); color: #fff;
}
.image-grid-item.unmatched { border-color: var(--danger); }

/* ===== 匹配进度 ===== */
.match-progress {
  margin-top: 16px;
  padding: 16px;
  background: #f5f7fa;
  border-radius: 8px;
}
.match-stats { display: flex; gap: 24px; margin-bottom: 12px; }
.match-stat { font-size: 14px; color: var(--text-light); }
.match-stat strong { font-size: 18px; color: var(--text); }

/* ===== 表格导入预览 ===== */
.preview-table-wrap {
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.preview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.preview-table th {
  background: #f0f2f5; padding: 8px 12px;
  text-align: left; font-weight: 600; color: var(--text-light);
  position: sticky; top: 0;
}
.preview-table td { padding: 8px 12px; border-bottom: 1px solid #eee; }
.preview-table .row-ok { background: rgba(103,194,58,0.05); }
.preview-table .row-warn { background: rgba(230,162,60,0.05); }
.preview-table .row-error { background: rgba(245,108,108,0.05); }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--card);
  border-radius: 12px;
  padding: 24px;
  width: 90%; max-width: 600px;
  max-height: 80vh; overflow-y: auto;
}
.modal-title {
  font-size: 18px; font-weight: 600;
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted);
  background: transparent;
}
.modal-close:hover { background: #f5f7fa; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 20px; right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 300;
  transform: translateX(120%);
  transition: transform 0.3s;
  display: flex; align-items: center; gap: 8px;
}
.toast.show { transform: translateX(0); }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-warning { background: var(--warning); color: #fff; }
.toast-info { background: var(--primary); color: #fff; }

/* ===== 分页 ===== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 16px 0;
}
.page-btn {
  padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff; color: var(--text-light);
  cursor: pointer; font-size: 13px;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 搜索栏 ===== */
.search-bar {
  display: flex; gap: 12px; margin-bottom: 16px;
  align-items: center;
}
.search-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.search-input:focus { border-color: var(--primary); }

/* ===== 活动管理 ===== */
.activity-card {
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 12px;
  display: flex; gap: 16px;
}
.activity-cover {
  width: 120px; height: 90px;
  border-radius: 6px; object-fit: cover;
  background: #f5f7fa;
}
.activity-info { flex: 1; }
.activity-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.activity-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.activity-actions { display: flex; gap: 8px; }

/* ===== 动态表单字段配置 ===== */
.field-config-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: #f5f7fa;
  border-radius: 6px;
  margin-bottom: 8px;
}
.field-config-item .field-label { font-size: 14px; font-weight: 500; min-width: 80px; }
.field-config-item .field-type { font-size: 12px; color: var(--text-muted); }
.toggle-switch {
  width: 40px; height: 22px; border-radius: 11px;
  background: #e4e7ed; position: relative; cursor: pointer;
  transition: background 0.2s;
}
.toggle-switch.on { background: var(--primary); }
.toggle-switch .toggle-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; position: absolute; top: 2px; left: 2px;
  transition: left 0.2s;
}
.toggle-switch.on .toggle-dot { left: 20px; }

/* ===== 登录页 ===== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #304156 0%, #409EFF 100%);
}
.login-card {
  background: var(--card);
  border-radius: 12px;
  padding: 40px;
  width: 400px;
  text-align: center;
}
.login-logo { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.login-logo span { color: var(--primary); }
.login-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; }
.login-form .form-group { margin-bottom: 20px; }
.login-btn { width: 100%; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-220px); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; gap: 0; }
}

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

/* ===== 进度条 ===== */
.progress-bar {
  height: 8px; background: #e4e7ed; border-radius: 4px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 4px;
  transition: width 0.3s;
}
.progress-fill.blue { background: var(--primary); }
.progress-fill.green { background: var(--success); }

/* ===== 外观配置 ===== */
.color-picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}
.color-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.color-option.selected {
  border-color: var(--primary);
  background: #EBF5FF;
}
.color-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #ddd;
}
.color-name {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}
.nav-preview-bar {
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  margin-top: 12px;
}
.banner-config-item {
  position: relative;
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
}
.banner-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.5);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}
.category-config-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}
.category-emoji-box {
  width: 56px;
  height: 56px;
  background: #F0F2F5;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
}
.category-remove-btn {
  width: 32px;
  height: 32px;
  color: #F56C6C;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tabbar-config-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid #eee;
}
.tabbar-config-label {
  font-size: 15px;
  font-weight: bold;
  color: #333;
  width: 60px;
}
.tabbar-config-icons {
  display: flex;
  gap: 12px;
}
.icon-upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #F0F2F5;
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.icon-upload-box:hover {
  background: #E0E2E5;
}
.icon-preview {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-upload-label {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}
