/**
 * 拼音打字速练 - 管理后台样式
 * PC 优先设计，最小宽度 1024px
 */

/* ============ 基础重置 ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --sidebar-active: #6366f1;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

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

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 50%, #6366f1 100%);
}
.login-box {
  background: white;
  border-radius: 16px;
  padding: 48px 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-icon { margin: 0 auto 12px; }
.login-header h1 { font-size: 22px; color: var(--text); margin-bottom: 4px; }
.login-header p { font-size: 14px; color: var(--text-secondary); }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.login-form input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 15px; transition: border-color 0.2s;
}
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.login-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; padding: 8px 12px; background: #fef2f2; border-radius: var(--radius); }

/* ============ 主面板布局 ============ */
.main-panel { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: 220px; background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column; flex-shrink: 0; position: fixed;
  top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-header {
  padding: 24px 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo { font-size: 28px; }
.sidebar-title { font-size: 16px; font-weight: 700; color: #fff; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  color: var(--sidebar-text); text-decoration: none; font-size: 14px;
  transition: all 0.2s; cursor: pointer; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active {
  background: rgba(99,102,241,0.2); color: #fff; border-left-color: var(--sidebar-active);
}
.nav-icon { width: 24px; display: inline-flex; align-items: center; justify-content: center; }
.nav-icon svg { display: block; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: space-between;
}
.sidebar-user { font-size: 13px; color: #a5b4fc; }

/* 内容区 */
.content { flex: 1; margin-left: 220px; padding: 32px; min-height: 100vh; }

/* ============ 通用组件 ============ */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 24px; font-weight: 700; }
.page-header p { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* 仪表盘卡片（简洁版）*/
.dash-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.dash-card {
  background: var(--card-bg); border-radius: 12px; padding: 28px 24px;
  box-shadow: var(--shadow); text-align: center; min-height: 100px;
}
.dash-card-num { font-size: 36px; font-weight: 800; color: var(--text); line-height: 1.1; }
.dash-card-label { font-size: 14px; color: var(--text-secondary); margin-top: 6px; }
.dash-actions { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }

/* 滚动条 */
#actFeed::-webkit-scrollbar { width: 4px; }
#actFeed::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

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

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

/* 按钮 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: 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: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; }
.btn-group { display: flex; gap: 8px; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }

/* 工具栏 */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 10px; align-items: center; }
.toolbar-right { display: flex; gap: 10px; align-items: center; }
.search-input { padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; width: 240px; }
.search-input:focus { outline: none; border-color: var(--primary); }

/* 状态标签 */
.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag-vip { background: #fef3c7; color: #92400e; }
.tag-normal { background: #f1f5f9; color: #64748b; }
.tag-banned { background: #fef2f2; color: #dc2626; }
.tag-active { background: #d1fae5; color: #065f46; }
.tag-success { background: #d1fae5; color: #065f46; }

/* 弹窗 */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
  background: white; border-radius: 12px; padding: 32px; width: 500px; max-width: 90vw;
  max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-box h3 { font-size: 18px; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* Toast */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 24px; border-radius: var(--radius);
  font-size: 14px; z-index: 2000; box-shadow: var(--shadow-lg);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* VIP 配置卡片 */
.plan-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 28px 24px;
  box-shadow: var(--shadow); text-align: center; border: 2px solid transparent;
  transition: all 0.2s; position: relative; cursor: pointer;
}
.plan-card:hover { border-color: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.plan-card.disabled { opacity: 0.5; pointer-events: none; }
.plan-tag { position: absolute; top: 12px; right: 12px; background: var(--primary); color: #fff; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.plan-name { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.plan-price { font-size: 36px; font-weight: 800; color: var(--primary); }
.plan-price .unit { font-size: 18px; font-weight: 600; }
.plan-original { font-size: 14px; color: var(--text-secondary); text-decoration: line-through; margin: 6px 0; }
.plan-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.plan-badge { display: inline-block; padding: 4px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; background: #eef2ff; color: var(--primary); }

/* 分页 */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; }
.pagination .btn { min-width: 36px; }
.pagination .current { font-weight: 700; padding: 6px 12px; }

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

/* 加载中 */
.loading { text-align: center; padding: 40px; color: var(--text-secondary); }

/* 响应式 */
@media (max-width: 1024px) {
  .sidebar { width: 180px; }
  .content { margin-left: 180px; padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-cards { grid-template-columns: 1fr; }
  .sidebar-title { display: none; }
}
@media (max-width: 768px) {
  .main-panel { flex-direction: column; }
  .sidebar { position: relative; width: 100%; flex-direction: row; overflow-x: auto; padding: 8px; }
  .sidebar-header, .sidebar-footer, .sidebar-nav .nav-icon { display: none; }
  .sidebar-nav { display: flex; flex-direction: row; gap: 4px; }
  .nav-item { padding: 8px 14px; border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; }
  .nav-item.active { border-left: none; border-bottom-color: var(--sidebar-active); }
  .content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
}
