/* ========== 全局重置与基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; color: #333; background: #f5f6fa;
}
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
input, button, select, textarea {
  font-family: inherit; font-size: 14px; outline: none;
}
button { cursor: pointer; border: none; }

/* ========== 登录页 ========== */
.login-body {
  background: linear-gradient(135deg, #C41E3A 0%, #8B0000 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-container {
  background: #fff; border-radius: 16px; padding: 48px 40px;
  width: 420px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo {
  font-size: 24px; font-weight: 700; color: #C41E3A; letter-spacing: 2px;
}
.login-subtitle {
  font-size: 13px; color: #999; margin-top: 6px;
}
.login-form .lf-row {
  margin-bottom: 18px;
}
.login-form .lf-row label {
  display: block; font-size: 13px; color: #666; margin-bottom: 6px;
}
.login-form .lf-row input {
  width: 100%; padding: 12px 14px; border: 1px solid #ddd;
  border-radius: 8px; transition: border-color 0.2s;
}
.login-form .lf-row input:focus {
  border-color: #C41E3A;
}
.lf-options {
  margin-bottom: 24px; font-size: 13px; color: #666;
}
.lf-options input { vertical-align: middle; margin-right: 4px; }
.lf-btn {
  width: 100%; padding: 14px; background: linear-gradient(135deg, #C41E3A, #8B0000);
  color: #fff; border-radius: 8px; font-size: 16px; font-weight: 500;
  transition: opacity 0.2s;
}
.lf-btn:hover { opacity: 0.9; }
.lf-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-footer {
  text-align: center; margin-top: 24px; font-size: 12px; color: #bbb;
}

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

/* 侧边栏 */
.sidebar {
  width: 220px; background: #1a1a2e; color: #fff;
  position: fixed; left: 0; top: 0; bottom: 0; overflow-y: auto; z-index: 100;
}
.sidebar-header {
  padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-title {
  font-size: 16px; font-weight: 600; letter-spacing: 1px;
}
.sidebar-menu { padding: 12px 0; }
.menu-item {
  display: flex; align-items: center; padding: 14px 20px;
  color: rgba(255,255,255,0.7); cursor: pointer; transition: all 0.2s;
}
.menu-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.menu-item.active { background: #C41E3A; color: #fff; }
.menu-icon { width: 20px; text-align: center; margin-right: 10px; font-size: 16px; }
.menu-text { font-size: 14px; }

/* 主内容区 */
.main-content {
  flex: 1; margin-left: 220px; min-height: 100vh;
}
.topbar {
  background: #fff; height: 56px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); position: sticky; top: 0; z-index: 50;
}
.topbar-left { font-size: 16px; font-weight: 600; color: #333; }
.topbar-right {
  display: flex; align-items: center; gap: 20px;
}
.topbar-notify {
  position: relative; cursor: pointer; color: #666;
}
.topbar-notify .badge {
  position: absolute; top: -6px; right: -6px;
  background: #C41E3A; color: #fff; font-size: 10px;
  padding: 1px 5px; border-radius: 10px;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #C41E3A, #8B0000);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500;
}
.user-name { font-size: 13px; color: #666; }

/* 内容容器 */
.content-wrap { padding: 24px; }
.page-title {
  font-size: 20px; font-weight: 600; color: #333; margin-bottom: 20px;
}

/* ========== 仪表盘统计卡片 ========== */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border-radius: 12px; padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stat-card .stat-label {
  font-size: 13px; color: #999; margin-bottom: 8px;
}
.stat-card .stat-value {
  font-size: 28px; font-weight: 700; color: #333;
}
.stat-card .stat-change {
  font-size: 12px; margin-top: 6px;
}
.stat-change.up { color: #52c41a; }
.stat-change.down { color: #ff4d4f; }
.stat-card.red .stat-value { color: #C41E3A; }
.stat-card.blue .stat-value { color: #1890ff; }
.stat-card.green .stat-value { color: #52c41a; }
.stat-card.orange .stat-value { color: #fa8c16; }

/* 图表占位 */
.chart-section {
  background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.chart-title {
  font-size: 15px; font-weight: 600; color: #333; margin-bottom: 16px;
}
.chart-placeholder {
  height: 260px; background: #f8f9fa; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #bbb; font-size: 13px;
}

/* ========== 表格 ========== */
.data-table {
  width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px;
  overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.data-table thead {
  background: #fafafa;
}
.data-table th, .data-table td {
  padding: 14px 16px; text-align: left; font-size: 13px;
}
.data-table th {
  color: #666; font-weight: 500; border-bottom: 1px solid #f0f0f0;
}
.data-table td {
  border-bottom: 1px solid #f5f5f5; color: #333;
}
.data-table tbody tr:hover { background: #fafafa; }
.data-table .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #f0f0f0; display: inline-flex; align-items: center;
  justify-content: center; font-size: 14px; color: #666; margin-right: 10px;
}

/* 状态标签 */
.tag {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  font-size: 12px; font-weight: 500;
}
.tag-green { background: #f6ffed; color: #52c41a; }
.tag-red { background: #fff1f0; color: #ff4d4f; }
.tag-blue { background: #e6f7ff; color: #1890ff; }
.tag-orange { background: #fff7e6; color: #fa8c16; }
.tag-gray { background: #f5f5f5; color: #999; }

/* ========== 工具栏 ========== */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.toolbar-left, .toolbar-right {
  display: flex; align-items: center; gap: 10px;
}
.search-input {
  padding: 8px 14px; border: 1px solid #ddd; border-radius: 6px;
  width: 220px;
}
.filter-select {
  padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px;
  background: #fff;
}
.btn {
  padding: 8px 18px; border-radius: 6px; font-size: 13px; font-weight: 500;
  transition: all 0.2s; display: inline-flex; align-items: center; gap: 4px;
}
.btn-primary {
  background: linear-gradient(135deg, #C41E3A, #8B0000); color: #fff;
}
.btn-primary:hover { opacity: 0.9; }
.btn-default {
  background: #fff; border: 1px solid #ddd; color: #666;
}
.btn-default:hover { border-color: #C41E3A; color: #C41E3A; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger { color: #ff4d4f; }
.btn-danger:hover { background: #fff1f0; }

/* ========== 分页 ========== */
.pagination {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 6px; margin-top: 16px;
}
.pagination .page-btn {
  padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px;
  background: #fff; color: #666; font-size: 13px; cursor: pointer;
}
.pagination .page-btn:hover { border-color: #C41E3A; color: #C41E3A; }
.pagination .page-btn.active {
  background: #C41E3A; color: #fff; border-color: #C41E3A;
}

/* ========== 弹窗 ========== */
.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-box {
  background: #fff; border-radius: 12px; width: 560px; max-width: 90vw;
  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 #f0f0f0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 600; color: #333; }
.modal-close { font-size: 20px; color: #999; cursor: pointer; }
.modal-close:hover { color: #333; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #f0f0f0;
  display: flex; justify-content: flex-end; gap: 10px;
}

/* 表单 */
.form-row {
  margin-bottom: 18px;
}
.form-row label {
  display: block; font-size: 13px; color: #666; margin-bottom: 6px;
}
.form-row label .required { color: #C41E3A; margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #ddd;
  border-radius: 6px; transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #C41E3A;
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }
.form-row-half {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}

/* 开关 */
.switch-wrap {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.switch {
  width: 44px; height: 22px; background: #ddd; border-radius: 11px;
  position: relative; transition: background 0.2s;
}
.switch::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; top: 2px; left: 2px;
  transition: transform 0.2s;
}
.switch.active { background: #C41E3A; }
.switch.active::after { transform: translateX(22px); }

/* ========== 设置页特殊样式 ========== */
.settings-section {
  background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.settings-title {
  font-size: 16px; font-weight: 600; color: #333; margin-bottom: 20px;
  padding-bottom: 12px; border-bottom: 1px solid #f0f0f0;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid #f5f5f5;
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 14px; color: #333; }
.settings-desc { font-size: 12px; color: #999; margin-top: 2px; }

/* 日志表格 */
.log-table { font-size: 12px; }
.log-table th, .log-table td { padding: 10px 12px; }

/* ========== 图片上传 ========== */
.upload-area {
  width: 100%; min-height: 120px; border: 2px dashed #ddd; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s; background: #fafafa; position: relative;
}
.upload-area:hover { border-color: #C41E3A; background: #fff5f5; }
.upload-area.has-image { border-style: solid; border-color: #C41E3A; background: #fff; }
.upload-icon { font-size: 32px; color: #ccc; margin-bottom: 8px; }
.upload-text { font-size: 13px; color: #999; }
.upload-hint { font-size: 12px; color: #bbb; margin-top: 4px; }
.upload-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; }
.upload-area.has-image .upload-input { display: none; }
.upload-preview {
  max-width: 100%; max-height: 200px; border-radius: 6px; object-fit: cover;
  cursor: pointer; transition: opacity 0.2s;
}
.upload-preview:hover { opacity: 0.7; }
.upload-preview-wrap { position: relative; display: inline-block; }
.upload-remove {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  background: #ff4d4f; color: #fff; border-radius: 50%; font-size: 14px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.upload-remove:hover { background: #ff7875; }

/* 表格中的图片 */
.table-thumb {
  width: 48px; height: 48px; border-radius: 6px; object-fit: cover;
  background: #f0f0f0; display: inline-block;
}

/* 空状态 */
.empty-state {
  text-align: center; padding: 60px 20px; color: #bbb;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .empty-text { font-size: 14px; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
  .sidebar { width: 0; overflow: hidden; }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row-half { grid-template-columns: 1fr; }
}
