/* ============================
   产品展示中心 — 后台管理样式
   ============================ */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-gradient: linear-gradient(135deg, #4f46e5, #7c3aed);
  --accent: #06b6d4;

  --bg: #f8fafc;
  --card-bg: #ffffff;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #4f46e5;

  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --border: #e2e8f0;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ==================== 登录页 ==================== */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4338ca 60%, #4f46e5 100%);
  position: relative;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(99,102,241,.3) 0%, transparent 60%),
              radial-gradient(circle at 70% 50%, rgba(6,182,212,.2) 0%, transparent 60%);
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 25px 60px rgba(0,0,0,.3);
  position: relative;
  z-index: 1;
  text-align: center;
}

.login-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(79,70,229,.3);
}

.login-card h2 { font-size: 20px; margin-bottom: 4px; }
.login-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }

.login-card .form-group {
  text-align: left;
  margin-bottom: 16px;
}

.login-card .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.login-card .form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
  font-family: var(--font);
}

.login-card .form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

/* ==================== 管理布局 ==================== */

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

/* ==================== 侧边栏 ==================== */

.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sb-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
}

.sb-text h3 { font-size: 15px; color: #fff; line-height: 1.2; }
.sb-text span { font-size: 11px; color: var(--sidebar-text); }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s;
}

.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-footer span {
  font-size: 12px;
  color: var(--sidebar-text);
}

.btn-logout {
  background: rgba(255,255,255,.08);
  border: none;
  color: var(--sidebar-text);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font);
}

.btn-logout:hover { background: rgba(239,68,68,.2); color: var(--danger); }

/* ==================== 主内容区 ==================== */

.main-area {
  flex: 1;
  margin-left: 220px;
  padding: 28px 32px;
}

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

.view-header h2 {
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-header h2 i { color: var(--primary); }

.view { display: none; }
.view.active { display: block; }

/* ==================== 按钮 ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .25s;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font);
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,70,229,.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79,70,229,.4);
}

.btn-outline {
  background: var(--card-bg);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
}

.btn-icon:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }
.btn-icon.success { color: var(--success); }
.btn-icon.warning { color: var(--warning); }

/* ==================== 统计卡片 ==================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  flex-shrink: 0;
}

.stat-icon.blue { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.stat-icon.cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-icon.green { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.amber { background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); }

/* ==================== 表格 ==================== */

.table-wrap {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

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

.data-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  text-align: left;
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--primary-light); }

.data-table .actions { display: flex; gap: 4px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-featured { background: #eef2ff; color: #4f46e5; }
.badge-no { color: var(--text-muted); }

/* ==================== 模态框 ==================== */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  width: 640px;
  max-width: 92vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,.2);
  animation: modalIn .25s ease;
}

.modal.modal-sm { width: 460px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header h3 i { color: var(--primary); }

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.modal-close:hover { background: #f1f5f9; color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==================== 表单 ==================== */

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
  font-family: var(--font);
  background: var(--card-bg);
  color: var(--text);
}

.form-group textarea { resize: vertical; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}

.form-row {
  display: flex;
  gap: 16px;
}

.flex-2 { flex: 2; }
.flex-1 { flex: 1; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
}

.form-check label { margin-bottom: 0; font-size: 13px; }

/* ==================== Toast ==================== */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn .3s ease, toastOut .3s ease 2.7s forwards;
  max-width: 360px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }

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

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

/* ==================== 响应式 ==================== */

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .sb-text,
  .sidebar .nav-item { font-size: 0; justify-content: center; padding: 12px; }
  .sidebar .nav-item i { font-size: 16px; }
  .sidebar-brand { padding: 14px; justify-content: center; }
  .sidebar-footer { justify-content: center; }
  .sidebar-footer span { display: none; }
  .btn-logout { font-size: 0; padding: 6px; }
  .btn-logout i { font-size: 14px; }
  .main-area { margin-left: 60px; padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; }
  .modal { max-width: 96vw; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .view-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .table-wrap { overflow-x: auto; }
}
