/* ============================================
   home.niuboren.com - 后台样式
   ============================================ */

:root {
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-light: #DBEAFE;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F9FAFB;
  --bg-tertiary: #F3F4F6;
  --text-primary: #1F2937;
  --text-secondary: #6B7280;
  --text-tertiary: #9CA3AF;
  --border-color: #E5E7EB;
  --sidebar-bg: #1F2937;
  --sidebar-width: 260px;
}

/* ── 深色主题 ────────────────────────────── */

[data-theme='dark'] {
  --bg-primary: #1F2937;
  --bg-secondary: #111827;
  --bg-tertiary: #374151;
  --text-primary: #F9FAFB;
  --text-secondary: #D1D5DB;
  --text-tertiary: #9CA3AF;
  --border-color: #374151;
  --sidebar-bg: #111827;
}

/* ── 布局 ────────────────────────────────── */

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* ── 侧边栏 ──────────────────────────────── */

.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.admin-sidebar-header {
  height: var(--header-height, 64px);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.admin-sidebar-logo {
  color: white;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-sidebar-logo i {
  font-size: 1.35rem;
  color: var(--primary);
}

.admin-sidebar-logo:hover {
  color: rgba(255, 255, 255, 0.9);
}

.admin-sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.admin-nav-group {
  margin-bottom: 0.5rem;
}

.admin-nav-group-label {
  padding: 0.5rem 0.75rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.2rem;
  color: rgba(192, 192, 192, 0.65);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 1.2rem;
  border-radius: 0.5rem;
  margin-bottom: 2px;
  font-weight: 600;
}

.admin-nav-item i {
  font-size: 1.125rem;
  width: 20px;
  text-align: center;
}

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

.admin-nav-item.active {
  color: rgb(255, 255, 255);
  background: var(--primary);
}

.admin-sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.admin-sidebar-footer .admin-nav-item {
  color: rgba(255, 255, 255, 0.5);
}

.admin-sidebar-footer .admin-nav-item:hover {
  color: rgba(255, 255, 255, 0.9);
}

.admin-sidebar-footer .admin-nav-item.text-danger {
  color: rgba(239, 68, 68, 0.8);
}

.admin-sidebar-footer .admin-nav-item.text-danger:hover {
  color: #EF4444;
  background: rgba(239, 68, 68, 0.1);
}

/* ── 主内容区 ────────────────────────────── */

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-secondary);
  transition: margin-left 0.3s ease;
}

/* ── 顶栏 ────────────────────────────────── */

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: var(--header-height, 64px);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
}

.admin-header-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: all 0.2s;
  text-decoration: none;
}

.admin-header-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

/* ── 内容区 ──────────────────────────────── */

.admin-content {
  flex: 1;
  padding: 1.5rem;
}

/* ── 统计卡片（Bootstrap 卡片风格） ──────── */

.stat-card-new {
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card-new:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.stat-card-new .card-body {
  padding: 1.25rem;
}

.stat-card-new h6 {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.stat-card-new h3 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card-new small {
  font-size: 0.75rem;
}

/* ── 头像圆形 ────────────────────────────── */

.avatar-circle {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ── 卡片通用 ────────────────────────────── */

.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.875rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.card-body {
  color: var(--text-primary);
}

.table-light th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-color: var(--border-color);
}

.table-hover tbody tr:hover {
  background: var(--bg-secondary);
}

.table td, .table th {
  border-color: var(--border-color);
  color: var(--text-primary);
}

.progress {
  background: var(--bg-tertiary);
}

/* ── 后台表格 ────────────────────────────── */

.admin-table-container {
  background: var(--bg-primary);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
}

.admin-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.9375rem;
}

.admin-table tbody tr:hover {
  background: var(--bg-secondary);
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* ── 标签 ────────────────────────────────── */

.admin-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.admin-tag-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.admin-tag-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.admin-tag-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* ── 按钮 ────────────────────────────────── */

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.admin-btn-primary {
  background: var(--primary);
  color: white;
}

.admin-btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  color: white;
}

.admin-btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.admin-btn-secondary:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.admin-btn-danger {
  background: var(--danger);
  color: white;
}

.admin-btn-danger:hover {
  background: #DC2626;
  color: white;
}

.admin-btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

/* ── 输入框 ──────────────────────────────── */

.admin-input {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: all 0.2s ease;
}

.admin-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.admin-input::placeholder {
  color: var(--text-tertiary);
}

.admin-input.is-invalid {
  border-color: var(--danger);
}

/* ── Toast 通知 ───────────────────────────── */

.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  background: var(--bg-primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease;
  min-width: 300px;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger); }

.toast-icon {
  font-size: 1.25rem;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }

.toast-message {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.9375rem;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── 遮罩层 ──────────────────────────────── */

.admin-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* ── 登录页 ──────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 1rem;
}

.login-card {
  background: white;
  border-radius: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.btn-login {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: white;
  font-weight: 600;
  width: 100%;
  transition: all 0.3s;
  cursor: pointer;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
  color: white;
}

/* ── 空状态 ──────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: block;
  opacity: 0.5;
}

.empty-state h4 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* ── 响应式 ──────────────────────────────── */

@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }

  .admin-main {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

  .admin-sidebar-overlay.open {
    display: block;
  }

  .admin-table-container {
    overflow-x: auto;
  }
}
