/* ============ 管理后台样式 ============ */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-width: 220px;
}

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

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

/* 布局 */
.layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-header {
  padding: 20px; text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-header h1 { font-size: 18px; font-weight: 700; }
.sidebar-header p { font-size: 11px; opacity: 0.6; margin-top: 4px; }
.sidebar-menu { padding: 12px 0; }
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; cursor: pointer; transition: all 0.2s;
  font-size: 14px; color: rgba(255,255,255,0.7);
}
.sidebar-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar-item.active { background: rgba(99,102,241,0.3); color: #fff; border-right: 3px solid #818cf8; }
.sidebar-item .icon { font-size: 18px; }

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

/* 顶栏 */
.topbar {
  background: var(--card-bg);
  padding: 0 24px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar .title { font-size: 18px; font-weight: 700; }
.topbar .user { display: flex; align-items: center; gap: 10px; }
.topbar .user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.topbar .user-name { font-size: 14px; font-weight: 600; }
.topbar .user-role { font-size: 12px; color: var(--text-secondary); }

/* 内容区 */
.content { flex: 1; padding: 24px; }

/* 卡片 */
.card {
  background: var(--card-bg); border-radius: 12px; padding: 20px;
  margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }

/* 统计卡片 */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--card-bg); border-radius: 12px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex; align-items: center; gap: 16px;
}
.stat-card .icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.stat-card .icon.blue { background: #dbeafe; }
.stat-card .icon.green { background: #d1fae5; }
.stat-card .icon.orange { background: #fef3c7; }
.stat-card .icon.red { background: #fee2e2; }
.stat-card .icon.purple { background: #ede9fe; }
.stat-card .info .label { font-size: 12px; color: var(--text-secondary); }
.stat-card .info .value { font-size: 24px; font-weight: 800; margin-top: 4px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f8fafc; text-align: left; padding: 12px; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover { background: #f8fafc; }

/* 状态标签 */
.tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.tag.blue { background: #dbeafe; color: #1e40af; }
.tag.green { background: #d1fae5; color: #065f46; }
.tag.orange { background: #fef3c7; color: #92400e; }
.tag.red { background: #fee2e2; color: #991b1b; }
.tag.gray { background: #f1f5f9; color: #475569; }
.tag.purple { background: #ede9fe; color: #5b21b6; }

/* 按钮 */
.btn { display: inline-block; padding: 8px 16px; border-radius: 8px; border: none; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }

/* 表单 */
.form-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.form-group { margin-bottom: 16px; flex: 1; min-width: 200px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.2s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { min-height: 80px; resize: vertical; }

/* 筛选栏 */
.filter-bar { background: var(--card-bg); border-radius: 12px; padding: 16px; margin-bottom: 16px; display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar .form-group { margin: 0; min-width: 160px; }

/* 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--card-bg); border-radius: 16px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px; font-size: 18px; font-weight: 700; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header .close { cursor: pointer; font-size: 24px; color: var(--text-light); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: flex-end; }

/* 空状态 */
.empty { text-align: center; padding: 40px; color: var(--text-light); }
.empty .icon { font-size: 48px; margin-bottom: 12px; }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; background: rgba(0,0,0,0.8); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 9999; opacity: 0; transition: all 0.3s; transform: translateX(100px); }
.toast.show { opacity: 1; transform: translateX(0); }

/* 排行榜 */
.ranking-list { list-style: none; }
.ranking-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ranking-item:last-child { border-bottom: none; }
.ranking-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--border); }
.ranking-num.top1 { background: #fef3c7; color: #92400e; }
.ranking-num.top2 { background: #f1f5f9; color: #475569; }
.ranking-num.top3 { background: #fee2e2; color: #991b1b; }

/* 登录页 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%); }
.login-box { background: #fff; border-radius: 16px; padding: 40px; width: 360px; }
.login-box h1 { text-align: center; font-size: 22px; margin-bottom: 8px; }
.login-box p { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; }

/* 分页 */
.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 16px; }
.pagination button { padding: 6px 12px; border: 1px solid var(--border); background: var(--card-bg); border-radius: 6px; cursor: pointer; font-size: 13px; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
