/* ============================================================
   码上行 — 管理后台样式
   ============================================================ */

/* ---------- 管理后台整体布局 ---------- */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 72px);
  background: #f5f7fa;
}

.admin-sidebar {
  width: 240px;
  background: #1e1b4b;
  color: #e0e0f0;
  flex-shrink: 0;
  padding: 0;
  overflow-y: auto;
}

.admin-sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.admin-sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px;
}

.admin-sidebar-header span {
  font-size: 12px;
  color: rgba(255,255,255,.5);
}

.admin-sidebar-nav {
  padding: 12px 0;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,.65);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  border-left: 3px solid transparent;
}

.admin-nav-item:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.9);
}

.admin-nav-item.active {
  background: rgba(79,70,229,.3);
  color: #fff;
  border-left-color: #818cf8;
  font-weight: 600;
}

.admin-nav-item .nav-icon { font-size: 18px; width: 24px; text-align: center; }
.admin-nav-item .nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 600;
}

/* ---------- 主内容区 ---------- */
.admin-main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

.admin-main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-main-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #1e1b4b;
  margin: 0;
}

.admin-main-header .admin-time {
  font-size: 13px;
  color: #94a3b8;
}

/* ---------- 统计卡片 ---------- */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.admin-stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow .2s;
}

.admin-stat-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}

.admin-stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.admin-stat-icon.purple { background: #ede9fe; }
.admin-stat-icon.blue   { background: #dbeafe; }
.admin-stat-icon.green  { background: #dcfce7; }
.admin-stat-icon.orange { background: #ffedd5; }

.admin-stat-info { flex: 1; }
.admin-stat-label {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.admin-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1e1b4b;
}

.admin-stat-sub {
  font-size: 12px;
  color: #10b981;
  margin-top: 2px;
}

/* ---------- 面板 ---------- */
.admin-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  margin-bottom: 24px;
  overflow: hidden;
}

.admin-panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e1b4b;
  margin: 0;
}

.admin-panel-body {
  padding: 20px;
}

/* ---------- 双列布局 ---------- */
.admin-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ---------- 表格 ---------- */
.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 2px solid #e2e8f0;
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.admin-table tr:hover td { background: #f8fafc; }

.admin-table .user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-table .user-cell img {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.admin-table .user-cell .user-name {
  font-weight: 600;
  color: #1e1b4b;
}

.admin-table .user-cell .user-email {
  font-size: 12px;
  color: #94a3b8;
}

/* ---------- 徽章/标签 ---------- */
.admin-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.admin-badge-success { background: #dcfce7; color: #166534; }
.admin-badge-warning { background: #ffedd5; color: #9a3412; }
.admin-badge-danger  { background: #fee2e2; color: #991b1b; }
.admin-badge-info    { background: #dbeafe; color: #1e40af; }
.admin-badge-purple  { background: #ede9fe; color: #6b21a8; }
.admin-badge-gray    { background: #f1f5f9; color: #475569; }

/* ---------- 操作按钮 ---------- */
.admin-actions {
  display: flex;
  gap: 6px;
}

.admin-btn-sm {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.admin-btn-sm:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.admin-btn-sm.danger {
  border-color: #fecaca;
  color: #dc2626;
}

.admin-btn-sm.danger:hover {
  background: #fef2f2;
}

.admin-btn-sm.primary {
  border-color: #818cf8;
  color: #4f46e5;
  background: #eef2ff;
}

.admin-btn-sm.primary:hover {
  background: #e0e7ff;
}

/* ---------- 搜索/筛选栏 ---------- */
.admin-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-search {
  flex: 1;
  min-width: 200px;
  padding: 8px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #334155;
  background: #fff;
  outline: none;
  transition: border-color .15s;
}

.admin-search:focus { border-color: #818cf8; }

.admin-select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #334155;
  background: #fff;
  cursor: pointer;
  outline: none;
  min-width: 120px;
}

/* ---------- 分页 ---------- */
.admin-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
}

.admin-pagination button {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}

.admin-pagination button:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #818cf8;
  color: #4f46e5;
}

.admin-pagination button.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

.admin-pagination button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.admin-pagination .page-info {
  font-size: 13px;
  color: #94a3b8;
}

/* ---------- 弹窗详情 ---------- */
.admin-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

.admin-detail-grid dt {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

.admin-detail-grid dd {
  font-size: 14px;
  color: #1e1b4b;
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.admin-detail-grid .full {
  grid-column: 1 / -1;
}

/* ---------- 图表区 ---------- */
.admin-chart-wrap {
  position: relative;
  height: 250px;
}

.admin-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ---------- 公告编辑器 ---------- */
.admin-announcement-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-announcement-form input,
.admin-announcement-form textarea {
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #334155;
  outline: none;
  font-family: inherit;
}

.admin-announcement-form input:focus,
.admin-announcement-form textarea:focus {
  border-color: #818cf8;
}

.admin-announcement-form textarea {
  min-height: 80px;
  resize: vertical;
}

.admin-announcement-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-announcement-item {
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 3px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.admin-announcement-item.important {
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.anc-title {
  font-weight: 600;
  font-size: 14px;
  color: #1e1b4b;
}

.anc-content {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

.anc-time {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 6px;
}

/* ---------- 设置表单 ---------- */
.admin-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.admin-settings-grid .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-settings-grid .form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.admin-settings-grid .form-group input,
.admin-settings-grid .form-group textarea,
.admin-settings-grid .form-group select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #334155;
  outline: none;
}

.admin-settings-grid .form-group input:focus,
.admin-settings-grid .form-group textarea:focus {
  border-color: #818cf8;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.toggle-switch {
  position: relative;
  width: 44px; height: 24px;
  background: #cbd5e1;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
}

.toggle-switch.on {
  background: #4f46e5;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.toggle-switch.on::after {
  left: 22px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; padding: 0; }
  .admin-sidebar-nav { display: flex; overflow-x: auto; padding: 8px; }
  .admin-nav-item { padding: 8px 14px; border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; }
  .admin-nav-item.active { border-left: none; border-bottom-color: #818cf8; }
  .admin-main { padding: 16px; }
  .admin-two-col { grid-template-columns: 1fr; }
  .admin-stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .admin-stats-grid { grid-template-columns: 1fr; }
}
