@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* 品牌核心主色调 (深海机械蓝系) */
  --admin-primary: #0A4178;
  --admin-primary-light: #0E5FA8;
  --admin-primary-glow: rgba(14, 95, 168, 0.15);
  
  /* 侧边栏深色系 */
  --sidebar-bg: #091a2e;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: #0E5FA8;
  --sidebar-active-bg: rgba(14, 95, 168, 0.18);
  --sidebar-border: rgba(255, 255, 255, 0.07);
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f1f5f9;

  /* 背景与卡片 */
  --admin-bg: #f8fafc;
  --admin-card-bg: #ffffff;
  --admin-border: #e2e8f0;
  --admin-border-light: #f1f5f9;

  /* 文字颜色 */
  --text-main: #0f172a;
  --text-regular: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* 语义色彩 */
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-success-border: #a7f3d0;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-warning-border: #fde68a;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  --color-danger-border: #fecaca;
  --color-info: #0284c7;
  --color-info-bg: #f0f9ff;
  --color-info-border: #bae6fd;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--admin-bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--admin-primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--admin-primary-light);
}

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

/* ================= 侧边栏 ================= */
.admin-sidebar {
  width: 260px;
  background: linear-gradient(180deg, #081729 0%, #061220 100%);
  color: #dbeafe;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 20;
  box-shadow: 1px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-brand {
  height: 72px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand img {
  width: 38px;
  height: 38px;
  background: transparent;
  border-radius: 0;
  padding: 0;
  object-fit: contain;
  box-shadow: none;
}

.sidebar-brand-text h2 {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.sidebar-brand-text p {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 2px;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 14px;
  list-style: none;
  overflow-y: auto;
}

.sidebar-section-title {
  padding: 14px 12px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #475569;
  font-weight: 700;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 9px;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-nav li a:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-hover);
}

.sidebar-nav li a.active {
  background-color: var(--sidebar-active-bg);
  color: #38bdf8;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.25);
}

.sidebar-nav li a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3.5px;
  background: #38bdf8;
  border-radius: 0 4px 4px 0;
}

.sidebar-nav li a i {
  width: 18px;
  font-size: 15px;
  text-align: center;
  color: #64748b;
  transition: color 0.2s;
}

.sidebar-nav li a:hover i {
  color: #cbd5e1;
}

.sidebar-nav li a.active i {
  color: #38bdf8;
}

.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #ffffff;
  padding: 2px 7px;
  font-size: 11px;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.15);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e2e8f0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e3a8a 0%, #0A4178 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #93c5fd;
  font-size: 13px;
}

.logout-link {
  color: #94a3b8;
  font-size: 15px;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-link:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ================= 主内容区 ================= */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--admin-bg);
}

/* 顶部导航栏 */
.admin-header {
  height: 72px;
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.breadcrumbs i {
  font-size: 10px;
  color: var(--text-light);
}

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover {
  color: var(--admin-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  background: #f1f5f9;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
}

.admin-content {
  padding: 28px 32px;
  flex: 1;
}

/* ================= 卡片与面板 ================= */
.card {
  background: var(--admin-card-bg);
  border-radius: 14px;
  border: 1px solid var(--admin-border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: var(--admin-primary);
  font-size: 14px;
}

.card-body {
  padding: 22px;
}

/* 顶部搜索操作栏 (独立或卡片内) */
.table-toolbar {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--admin-border);
  background: #ffffff;
}

.search-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-group i {
  position: absolute;
  left: 12px;
  color: var(--text-light);
  font-size: 13px;
  pointer-events: none;
}

.search-input-group input {
  padding: 8px 12px 8px 34px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  font-size: 13px;
  width: 250px;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
}

.search-input-group input:focus {
  background: #fff;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px var(--admin-primary-glow);
  width: 280px;
}

/* ================= 仪表盘统计卡片 ================= */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--admin-border);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.stat-icon.blue { background: linear-gradient(135deg, #0A4178 0%, #0E5FA8 100%); }
.stat-icon.green { background: linear-gradient(135deg, #059669 0%, #10b981 100%); }
.stat-icon.amber { background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%); }
.stat-icon.purple { background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%); }

.stat-info h3 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.stat-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ================= 表格精细化 ================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

table.admin-table th {
  background: #f8fafc;
  padding: 14px 18px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
}

table.admin-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--admin-border-light);
  vertical-align: middle;
  color: var(--text-regular);
  font-size: 13.5px;
  background: #fff;
  transition: background-color 0.15s;
}

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

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

/* 表格内图片 */
.table-thumb {
  width: 72px;
  height: 50px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: #ffffff;
  padding: 3px;
  object-fit: contain;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s;
  display: block;
}

.table-thumb:hover {
  transform: scale(1.05);
}

.table-empty-thumb {
  width: 72px;
  height: 50px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 11px;
}

/* ================= 按钮与操作 ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-primary {
  background: var(--admin-primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(10, 65, 120, 0.2);
}

.btn-primary:hover {
  background: var(--admin-primary-light);
  color: #fff;
  box-shadow: 0 4px 10px rgba(10, 65, 120, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--admin-border);
  color: var(--text-regular);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--text-main);
}

.btn-danger {
  background: #ffffff;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fef2f2;
  border-color: #f87171;
  color: #b91c1c;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 6px;
  font-weight: 500;
}

/* 紧凑图标操作按钮 */
.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--admin-border);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 13px;
  transition: all 0.2s;
  cursor: pointer;
}

.action-btn:hover {
  background: #f8fafc;
  color: var(--admin-primary);
  border-color: var(--admin-primary-light);
}

.action-btn.delete:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* ================= 状态徽章 (严禁折行，带状态光点) ================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.3;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.badge-success {
  background: var(--color-success-bg);
  color: #065f46;
  border: 1px solid var(--color-success-border);
}
.badge-success .badge-dot {
  background: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: #92400e;
  border: 1px solid var(--color-warning-border);
}
.badge-warning .badge-dot {
  background: var(--color-warning);
}

.badge-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.badge-secondary .badge-dot {
  background: #94a3b8;
}

.badge-category {
  background: #f0fdfa;
  color: #0f766e;
  border: 1px solid #ccfbf1;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

/* 规格参数微标签 */
.spec-tag {
  display: inline-block;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--admin-primary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

/* ================= 表单设计 ================= */
.form-group {
  margin-bottom: 20px;
}

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

.form-control {
  width: 100%;
  padding: 9px 13px;
  font-size: 13.5px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px var(--admin-primary-glow);
}

.form-control::placeholder {
  color: var(--text-light);
}

.form-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* Flash 消息 */
.alert {
  padding: 13px 18px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.alert-success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: #065f46;
}

.alert-danger {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: #991b1b;
}

/* 底部状态/分页栏 */
.table-footer {
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--admin-border);
  font-size: 13px;
  color: var(--text-muted);
  background: #fafbfc;
}

@media (max-width: 960px) {
  .admin-wrapper { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-header { padding: 0 20px; }
  .admin-content { padding: 20px; }
}
