/* ============================================
 * 像素田园管理后台 - 全部样式
 * ============================================ */

/* ---------- 重置与基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #333;
  background: #f5f6fa;
  min-width: 1024px;
}
a { text-decoration: none; color: inherit; }
.hidden { display: none !important; }

/* ---------- 登录页 ---------- */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}
.login-card {
  width: 380px; padding: 40px 36px;
  background: #fff; border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.login-title {
  text-align: center; font-size: 22px; margin-bottom: 28px;
  color: #1a1a2e;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; margin-bottom: 6px; color: #666; font-size: 13px;
}
.login-error {
  color: #e74c3c; font-size: 13px; margin-bottom: 12px;
  padding: 8px 12px; background: #fdecea; border-radius: 4px;
}

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

/* 侧边栏 */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: #1a1a2e; color: #ccc;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
}
.sidebar-logo {
  padding: 20px 16px; font-size: 15px; font-weight: 600;
  color: #fff; border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 8px;
}
.logo-icon { font-size: 22px; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; color: #aaa; font-size: 14px;
  transition: all .2s; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: rgba(74,144,217,.15); color: #4a90d9;
  border-left-color: #4a90d9;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-btn {
  display: block; width: 100%;
  padding: 10px; margin-bottom: 8px;
  background: transparent; color: #aaa;
  border: 1px solid rgba(255,255,255,.1); border-radius: 6px;
  cursor: pointer; font-size: 13px; text-align: center;
  transition: all .2s;
}
.sidebar-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-btn-danger:hover { background: rgba(231,76,60,.2); color: #e74c3c; border-color: #e74c3c; }

/* 主内容区 */
.main-content {
  flex: 1; margin-left: 220px;
  display: flex; flex-direction: column;
}
.topbar {
  height: 56px; background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  position: sticky; top: 0; z-index: 10;
}
.breadcrumb { font-size: 15px; font-weight: 600; color: #333; }
.admin-info { display: flex; align-items: center; gap: 6px; color: #666; font-size: 13px; }
.admin-avatar { font-size: 18px; }

.view-container { padding: 20px 24px; flex: 1; }
.view { animation: fadeIn .25s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 数据卡片 ---------- */
.card-grid-6 {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px;
  margin-bottom: 20px;
}
.card-grid-4 {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff; border-radius: 8px; padding: 18px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.1); }
.stat-card .card-icon { font-size: 28px; margin-bottom: 8px; }
.stat-card .card-value { font-size: 24px; font-weight: 700; color: #1a1a2e; }
.stat-card .card-label { font-size: 12px; color: #999; margin-top: 4px; }

/* ---------- 面板 ---------- */
.panel {
  background: #fff; border-radius: 8px; padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05); margin-bottom: 20px;
}
.panel h3 { font-size: 15px; margin-bottom: 14px; color: #333; }
.chart-panel {
  background: #fff; border-radius: 8px; padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05); margin-bottom: 20px;
}
.chart-panel h3 { font-size: 15px; margin-bottom: 14px; }
.chart-wrapper { width: 100%; height: 320px; position: relative; }
.chart-wrapper canvas { width: 100%; height: 100%; }

/* ---------- 表格 ---------- */
.table-wrapper { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.data-table th {
  background: #f8f9fa; padding: 10px 12px; text-align: left;
  font-weight: 600; color: #555; border-bottom: 2px solid #eee;
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px; border-bottom: 1px solid #f0f0f0;
  color: #444;
}
.data-table tbody tr:nth-child(even) { background: #f8f9fa; }
.data-table tbody tr:hover { background: #e8f0fe; }

/* 状态标签 */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; font-weight: 500;
}
.badge-active { background: #d4edda; color: #155724; }
.badge-banned { background: #f8d7da; color: #721c24; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-pending { background: #fff3cd; color: #856404; }

/* 排名徽章 */
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-weight: 700; font-size: 13px;
}
.rank-1 { background: #ffd700; color: #7a5c00; }
.rank-2 { background: #c0c0c0; color: #555; }
.rank-3 { background: #cd7f32; color: #fff; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar label { color: #666; font-size: 13px; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 8px 16px; border: 1px solid #ddd; border-radius: 4px;
  background: #fff; color: #333; cursor: pointer; font-size: 13px;
  transition: all .2s;
}
.btn:hover { border-color: #bbb; }
.btn-primary { background: #4a90d9; color: #fff; border-color: #4a90d9; }
.btn-primary:hover { background: #3a7bc8; border-color: #3a7bc8; }
.btn-danger { background: #e74c3c; color: #fff; border-color: #e74c3c; }
.btn-danger:hover { background: #c0392b; border-color: #c0392b; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; padding: 10px; font-size: 15px; }

/* ---------- 输入框 ---------- */
.input {
  padding: 8px 10px; border: 1px solid #ddd; border-radius: 4px;
  font-size: 13px; outline: none; transition: border-color .2s;
  background: #fff;
}
.input:focus { border-color: #4a90d9; box-shadow: 0 0 0 2px rgba(74,144,217,.15); }

/* ---------- 分页 ---------- */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin-top: 16px;
}
.pagination button {
  padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px;
  background: #fff; cursor: pointer; font-size: 13px;
}
.pagination button:hover:not(:disabled) { border-color: #4a90d9; color: #4a90d9; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: #666; margin: 0 8px; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 2px solid #eee;
}
.tab {
  padding: 10px 20px; background: transparent; border: none;
  cursor: pointer; font-size: 14px; color: #666;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .2s;
}
.tab:hover { color: #4a90d9; }
.tab.active { color: #4a90d9; border-bottom-color: #4a90d9; font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: #fff; border-radius: 8px; width: 520px; max-width: 90%;
  max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid #eee;
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 16px; }
.modal-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: #999; line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid #eee;
  display: flex; justify-content: flex-end; gap: 8px;
}
.modal-body pre {
  background: #f5f6fa; padding: 12px; border-radius: 4px;
  font-size: 12px; max-height: 400px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
}
.modal-body .form-group label { display: block; margin-bottom: 4px; color: #666; font-size: 13px; }
.modal-body .form-group .input { width: 100%; margin-bottom: 12px; }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 20px; border-radius: 6px; color: #fff;
  font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.15);
  animation: slideIn .25s;
}
.toast-success { background: #27ae60; }
.toast-error { background: #e74c3c; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 加载状态 ---------- */
.loading { text-align: center; padding: 40px; color: #999; font-size: 14px; }

/* ---------- 操作按钮组 ---------- */
.action-btns { display: flex; gap: 4px; }
