/* ========== 全局变量 ========== */
:root {
  --primary: #7c3aed;
  --primary-light: #a78bfa;
  --primary-lighter: #c4b5fd;
  --primary-bg: #f5f3ff;
  --primary-gradient: linear-gradient(135deg, #7c8cf8, #b794f6);
  --text-dark: #4a3080;
  --text-main: #6b4f9e;
  --text-sub: #7c6aa0;
  --text-dim: #a896c0;
  --green: #10b981;
  --green-bg: #ecfdf5;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --orange: #f59e0b;
  --orange-bg: #fffbeb;
  --blue: #3b82f6;
  --blue-bg: #eff6ff;
  --sidebar-w: 240px;
  --header-h: 60px;
  --border: #e9e5f5;
  --card-shadow: 0 4px 24px rgba(139,92,246,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif; background: #f5f3ff; color: var(--text-dark); min-height: 100vh; }

/* ========== 登录页 ========== */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #f5f3ff 100%); }
.login-card { width: 420px; padding: 48px 40px; background: rgba(255,255,255,0.75); backdrop-filter: blur(24px); border-radius: 24px; border: 1px solid rgba(255,255,255,0.6); box-shadow: 0 8px 40px rgba(139,92,246,0.12); }
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo .icon { font-size: 48px; margin-bottom: 12px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text-dark); }
.login-logo p { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.login-field { margin-bottom: 20px; }
.login-field label { display: block; font-size: 13px; color: var(--text-main); margin-bottom: 6px; font-weight: 500; }
.login-field input { width: 100%; padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--border); background: rgba(255,255,255,0.7); font-size: 14px; color: var(--text-dark); outline: none; transition: all 0.3s; }
.login-field input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }
.login-field input::placeholder { color: var(--text-dim); }
.login-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; font-size: 13px; }
.login-options label { display: flex; align-items: center; gap: 6px; color: var(--text-sub); cursor: pointer; }
.login-options label input[type="checkbox"] { accent-color: var(--primary); }
.login-btn { width: 100%; padding: 14px; border: none; border-radius: 12px; background: var(--primary-gradient); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 16px rgba(124,140,248,0.3); }
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,140,248,0.4); }
.login-error { color: var(--red); font-size: 13px; text-align: center; margin-bottom: 16px; display: none; }

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

/* 侧边栏 */
.sidebar { width: var(--sidebar-w); background: linear-gradient(180deg, #4a3080 0%, #6b4f9e 100%); position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; display: flex; flex-direction: column; }
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { color: #fff; font-size: 18px; font-weight: 700; }
.sidebar-header p { color: rgba(255,255,255,0.5); font-size: 11px; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-group-title { font-size: 11px; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 1px; padding: 8px 12px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-radius: 10px; color: rgba(255,255,255,0.65); font-size: 14px; transition: all 0.2s; margin-bottom: 2px; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 600; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.08); }
.sidebar-user .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-gradient); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.sidebar-user .info { flex: 1; }
.sidebar-user .info .name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user .info .role { color: rgba(255,255,255,0.45); font-size: 11px; }
.sidebar-user .logout { color: rgba(255,255,255,0.4); cursor: pointer; font-size: 16px; text-decoration: none; }
.sidebar-user .logout:hover { color: #fff; }

/* 主区域 */
.main-area { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.header { height: var(--header-h); background: rgba(255,255,255,0.8); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 50; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-dim); }
.breadcrumb a { color: var(--text-sub); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--text-dim); }
.breadcrumb .current { color: var(--text-dark); font-weight: 500; }
.content { flex: 1; padding: 28px 32px; }

/* ========== 页面标题 ========== */
.page-title { margin-bottom: 24px; }
.page-title h2 { font-size: 22px; font-weight: 700; color: var(--text-dark); }
.page-title p { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

/* ========== 统计卡片 ========== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card { padding: 24px; background: rgba(255,255,255,0.85); backdrop-filter: blur(12px); border-radius: 16px; border: 1px solid rgba(139,92,246,0.08); box-shadow: var(--card-shadow); transition: all 0.3s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(139,92,246,0.12); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 14px; }
.stat-icon.purple { background: rgba(124,58,237,0.1); }
.stat-icon.green { background: var(--green-bg); }
.stat-icon.blue { background: var(--blue-bg); }
.stat-icon.orange { background: var(--orange-bg); }
.stat-label { font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-dark); }
.stat-change { font-size: 12px; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ========== 卡片 ========== */
.card { padding: 24px; background: rgba(255,255,255,0.85); border-radius: 16px; border: 1px solid rgba(139,92,246,0.08); box-shadow: var(--card-shadow); margin-bottom: 20px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.chart-card { padding: 24px; background: rgba(255,255,255,0.85); border-radius: 16px; border: 1px solid rgba(139,92,246,0.08); box-shadow: var(--card-shadow); }
.chart-card h3 { font-size: 15px; font-weight: 600; color: var(--text-dark); margin-bottom: 16px; }
.chart-placeholder { height: 220px; border-radius: 12px; background: var(--primary-bg); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text-dim); }

/* ========== 表格工具栏 ========== */
.table-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 10px; }
.search-input { padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--border); background: rgba(255,255,255,0.7); font-size: 13px; color: var(--text-dark); outline: none; width: 240px; transition: all 0.3s; }
.search-input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(124,58,237,0.08); }
.search-input::placeholder { color: var(--text-dim); }
.filter-btn { padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--border); background: rgba(255,255,255,0.7); font-size: 13px; color: var(--text-sub); cursor: pointer; transition: all 0.2s; }
.filter-btn:hover { border-color: var(--primary-light); color: var(--primary); }
.filter-btn.active { border-color: var(--primary); background: var(--primary-bg); color: var(--primary); font-weight: 500; }

/* ========== 按钮 ========== */
.btn { padding: 9px 20px; border-radius: 10px; border: none; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn-primary { background: var(--primary-gradient); color: #fff; box-shadow: 0 2px 8px rgba(124,140,248,0.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,140,248,0.4); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-sub); }
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: var(--green-bg); color: var(--green); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn-text { background: none; border: none; color: var(--primary); font-size: 13px; cursor: pointer; padding: 4px 8px; border-radius: 6px; text-decoration: none; }
.btn-text:hover { background: var(--primary-bg); }
.btn-text.danger { color: var(--red); }
.btn-text.danger:hover { background: var(--red-bg); }

/* ========== 数据表格 ========== */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table thead th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-sub); border-bottom: 1.5px solid var(--border); white-space: nowrap; }
.data-table tbody td { padding: 14px 16px; font-size: 13px; color: var(--text-dark); border-bottom: 1px solid rgba(0,0,0,0.04); }
.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: rgba(139,92,246,0.03); }
.data-table tbody tr:last-child td { border-bottom: none; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-gradient); display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; flex-shrink: 0; }
.user-cell .name { font-weight: 500; }
.user-cell .sub { font-size: 12px; color: var(--text-dim); }

/* ========== 状态标签 ========== */
.status-tag { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.status-tag.green { background: var(--green-bg); color: var(--green); }
.status-tag.red { background: var(--red-bg); color: var(--red); }
.status-tag.orange { background: var(--orange-bg); color: var(--orange); }
.status-tag.blue { background: var(--blue-bg); color: var(--blue); }
.status-tag.purple { background: var(--primary-bg); color: var(--primary); }

/* ========== 分页 ========== */
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(0,0,0,0.04); }
.pagination .info { font-size: 13px; color: var(--text-dim); }
.pagination .pages { display: flex; gap: 4px; }
.page-btn, .page-btn:visited { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-size: 13px; color: var(--text-sub); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; text-decoration: none; }
.page-btn:hover { border-color: var(--primary-light); color: var(--primary); }
.page-btn.active { background: var(--primary-gradient); border-color: transparent; color: #fff; }

/* ========== Tab ========== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab { padding: 12px 24px; font-size: 14px; color: var(--text-sub); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; font-weight: 500; text-decoration: none; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ========== 模态框 ========== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 20px; width: 520px; max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-header { padding: 24px 28px 0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 17px; font-weight: 600; color: var(--text-dark); }
.modal-close { width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; cursor: pointer; font-size: 18px; color: var(--text-dim); display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--red-bg); color: var(--red); }
.modal-body { padding: 24px 28px; }
.modal-footer { padding: 0 28px 24px; display: flex; justify-content: flex-end; gap: 10px; }

/* ========== 表单 ========== */
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-size: 13px; font-weight: 500; color: var(--text-main); margin-bottom: 6px; }
.form-row label .required { color: var(--red); margin-left: 2px; }
.form-input { width: 100%; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--border); font-size: 13px; color: var(--text-dark); outline: none; transition: all 0.3s; background: #fff; }
.form-input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(124,58,237,0.08); }
textarea.form-input { min-height: 80px; resize: vertical; }
select.form-input { cursor: pointer; }

/* ========== 空状态 ========== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state .title { font-size: 16px; font-weight: 600; color: var(--text-main); margin-bottom: 8px; }
.empty-state .desc { font-size: 13px; color: var(--text-dim); }

/* ========== 详情页 ========== */
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding: 24px; background: rgba(255,255,255,0.85); border-radius: 16px; border: 1px solid rgba(139,92,246,0.08); box-shadow: var(--card-shadow); }
.detail-header .avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-gradient); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.detail-header .info h2 { font-size: 20px; font-weight: 700; }
.detail-header .info p { font-size: 13px; color: var(--text-dim); }
.detail-header .actions { margin-left: auto; }

.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.info-item { padding: 16px; background: rgba(255,255,255,0.7); border-radius: 12px; }
.info-item .label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.info-item .value { font-size: 15px; font-weight: 600; color: var(--text-dark); }

/* ========== Toast通知 ========== */
.toast { position: fixed; top: 20px; right: 20px; z-index: 9999; padding: 14px 24px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.12); transform: translateX(120%); transition: transform 0.3s ease; }
.toast.show { transform: translateX(0); }
.toast.success { background: var(--green); color: #fff; }
.toast.error { background: var(--red); color: #fff; }
.toast.warning { background: var(--orange); color: #fff; }

/* ========== 确认弹窗 ========== */
.confirm-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 300; display: none; align-items: center; justify-content: center; }
.confirm-overlay.show { display: flex; }
.confirm-box { background: #fff; border-radius: 16px; padding: 28px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.15); text-align: center; }
.confirm-box h3 { font-size: 17px; font-weight: 600; margin-bottom: 12px; color: var(--text-dark); }
.confirm-box p { font-size: 14px; color: var(--text-sub); margin-bottom: 24px; }
.confirm-box .actions { display: flex; gap: 10px; justify-content: center; }

/* ========== 响应式 ========== */
@media (max-width: 1440px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}
