/* admin/styles.css — 核心设计系统 */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(31, 41, 55, 0.8);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-highlight: rgba(99, 102, 241, 0.4);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-light: #6b7280;

  --accent-indigo: #6366f1;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --gradient-indigo-cyan: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --gradient-purple-pink: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==================== 0. 现代化登录验证遮罩 ==================== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 30%, #1e1b4b 0%, #0b0f19 70%);
  backdrop-filter: blur(20px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-overlay.active {
  display: flex;
  animation: loginFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid var(--border-color-highlight);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-indigo-cyan);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.brand-logo-lg {
  font-size: 48px;
  margin-bottom: 12px;
  display: inline-block;
  animation: logoPulse 2s infinite ease-in-out;
}

@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.login-brand h2 {
  font-size: 24px;
  font-weight: 700;
  background: var(--gradient-indigo-cyan);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

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

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  pointer-events: none;
}

.input-wrapper .form-input {
  padding-left: 42px;
  width: 100%;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.login-error-msg {
  color: var(--accent-rose);
  font-size: 13px;
  margin-bottom: 16px;
  min-height: 18px;
  text-align: center;
}

.btn-block {
  width: 100%;
  justify-content: center;
  margin-bottom: 12px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* 页面整体布局 */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边导航栏 */
.sidebar {
  width: 260px;
  background: rgba(17, 24, 39, 0.95);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  backdrop-filter: blur(16px);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 24px 12px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  font-size: 32px;
}

.brand-text h2 {
  font-size: 20px;
  font-weight: 700;
  background: var(--gradient-indigo-cyan);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text .badge {
  font-size: 11px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-indigo);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  transform: translateX(4px);
}

.nav-item.active {
  background: var(--gradient-indigo-cyan);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.nav-icon {
  font-size: 20px;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

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

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
}

/* 主内容区域 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(11, 15, 25, 0.6);
  backdrop-filter: blur(12px);
}

.header-title h1 {
  font-size: 26px;
  font-weight: 700;
}

.header-title .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.user-profile .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-purple-pink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.admin-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.admin-role {
  font-size: 12px;
  color: var(--accent-cyan);
}

.logout-btn {
  margin-left: 8px;
  padding: 6px 12px;
  border-radius: 20px;
}

/* 内容视图 */
.content-body {
  padding: 36px;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* 1. 统计大屏样式 */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  background: var(--bg-card);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.filter-label {
  font-size: 14px;
  color: var(--text-muted);
}

.time-range-group {
  display: flex;
  gap: 8px;
}

.time-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.time-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.time-btn.active {
  background: var(--accent-indigo);
  border-color: var(--accent-indigo);
  color: #ffffff;
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
  border-color: var(--border-color-highlight);
}

.stat-card.accent-blue::before { content: ''; position: absolute; top:0; left:0; width: 4px; height: 100%; background: var(--accent-indigo); }
.stat-card.accent-purple::before { content: ''; position: absolute; top:0; left:0; width: 4px; height: 100%; background: var(--accent-purple); }
.stat-card.accent-cyan::before { content: ''; position: absolute; top:0; left:0; width: 4px; height: 100%; background: var(--accent-cyan); }
.stat-card.accent-emerald::before { content: ''; position: absolute; top:0; left:0; width: 4px; height: 100%; background: var(--accent-emerald); }

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

.stat-title {
  font-size: 14px;
  color: var(--text-muted);
}

.stat-icon {
  font-size: 22px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

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

.trend.positive {
  color: var(--accent-emerald);
  font-weight: 600;
}

/* 图表区域 */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.glass-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.card-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title-bar h3 {
  font-size: 18px;
  font-weight: 600;
}

.chart-tag {
  font-size: 12px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  padding: 4px 10px;
  border-radius: 12px;
}

.canvas-container {
  width: 100%;
  overflow-x: auto;
}

/* 占比列表条 */
.cat-bars-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.cat-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.cat-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--gradient-indigo-cyan);
  transition: width 0.5s ease;
}

/* 2. 操作与列表样式 (分类/商品) */
.action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.product-filters {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-select, .form-input {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.form-textarea {
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  width: 100%;
  resize: vertical;
}

/* 按钮规范 */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--gradient-indigo-cyan);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.2);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.btn-danger:hover {
  background: var(--accent-rose);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* 分类卡片网格 */
.category-grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.25s;
}

.category-card:hover {
  border-color: var(--accent-indigo);
  transform: translateY(-2px);
}

.cat-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cat-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.cat-name {
  font-size: 16px;
  font-weight: 600;
}

.cat-sort {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.card-actions {
  display: flex;
  gap: 8px;
}

/* 表格样式 */
.table-container {
  overflow-x: auto;
}

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

.data-table th {
  padding: 16px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
}

.data-table td {
  padding: 16px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #1f2937;
}

.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}

.badge-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.inactive {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Modal 弹窗机制 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.active {
  display: flex;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 680px;
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.required {
  color: var(--accent-rose);
}

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

.flex-1 { flex: 1; }
