/**
 * main.css - 主样式文件
 * 大汇通电商 - 内部电商选品平台
 * 深色科技风主题
 */

/* ===== 基础重置 ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* 主色调 */
  --primary: #1890ff;
  --primary-dark: #096dd9;
  --primary-light: #40a9ff;
  --secondary: #722ed1;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #f5222d;
  --info: #13c2c2;

  /* 背景色 */
  --bg-primary: #0f1923;
  --bg-secondary: #141e2e;
  --bg-card: #1a2332;
  --bg-card-hover: #1f2d3d;
  --bg-sidebar: #0d1520;
  --bg-header: #0d1520;

  /* 边框色 */
  --border-color: #1e3a5f;
  --border-light: #2a4a6f;

  /* 文字色 */
  --text-primary: #e0e6ed;
  --text-secondary: #8b9bb4;
  --text-muted: #5a6b7f;
  --text-inverse: #ffffff;

  /* 渐变 */
  --gradient-primary: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
  --gradient-dark: linear-gradient(135deg, #0f1923 0%, #141e2e 100%);
  --gradient-card: linear-gradient(135deg, #1a2332 0%, #1f2d3d 100%);

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 20px rgba(24, 144, 255, 0.15);

  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* 过渡 */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 工具类 ===== */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* ===== 登录页容器 ===== */
#login-page {
  width: 100%;
  height: 100vh;
  position: relative;
}

/* ===== 主应用 ===== */
#app {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== 顶部导航栏 ===== */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  z-index: 100;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-inverse);
  cursor: pointer;
  transition: var(--transition);
}

.logo i {
  font-size: 22px;
  color: var(--primary);
}

.logo:hover {
  color: var(--primary-light);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  border: none;
  background: none;
  font-family: inherit;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-item.active {
  color: var(--primary);
  background: rgba(24, 144, 255, 0.1);
  font-weight: 500;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
}

.user-avatar:hover {
  box-shadow: var(--shadow-glow);
  transform: scale(1.05);
}

.user-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.logout-btn {
  padding: 4px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 12px;
  font-family: inherit;
}

.logout-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(245, 34, 45, 0.1);
}

/* ===== 主体容器 ===== */
.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== 左侧边栏 ===== */
.sidebar {
  width: 220px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width 0.3s ease;
}

.sidebar-section {
  padding: 16px 0;
}

.sidebar-title {
  padding: 0 20px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  position: relative;
}

.sidebar-menu-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
  opacity: 0;
  transition: var(--transition);
}

.sidebar-menu-item:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.sidebar-menu-item:hover::before {
  opacity: 0.3;
}

.sidebar-menu-item.active {
  color: var(--primary);
  background: rgba(24, 144, 255, 0.08);
}

.sidebar-menu-item.active::before {
  opacity: 1;
}

.sidebar-menu-item i {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

/* ===== 内容区域 ===== */
.content-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: var(--bg-primary);
  position: relative;
}

.content-area::before {
  content: '';
  position: fixed;
  top: 56px;
  left: 220px;
  right: 0;
  bottom: 36px;
  background:
    radial-gradient(circle at 20% 80%, rgba(24, 144, 255, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(114, 46, 209, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.content-area > * {
  position: relative;
  z-index: 1;
}

/* ===== 通用卡片 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i {
  color: var(--primary);
}

/* ===== 统计卡片 ===== */
.stat-card {
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, rgba(24, 144, 255, 0.1) 0%, transparent 60%);
  border-radius: 0 0 0 80px;
}

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

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
}

.stat-icon.blue { background: rgba(24, 144, 255, 0.15); color: var(--primary); }
.stat-icon.green { background: rgba(82, 196, 26, 0.15); color: var(--success); }
.stat-icon.orange { background: rgba(250, 173, 20, 0.15); color: var(--warning); }
.stat-icon.purple { background: rgba(114, 46, 209, 0.15); color: var(--secondary); }
.stat-icon.cyan { background: rgba(19, 194, 194, 0.15); color: var(--info); }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-inverse);
  margin-bottom: 4px;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.stat-change.up {
  color: var(--success);
  background: rgba(82, 196, 26, 0.1);
}

.stat-change.down {
  color: var(--danger);
  background: rgba(245, 34, 45, 0.1);
}

/* ===== 表格 ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  background: var(--bg-secondary);
}

.data-table tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(30, 58, 95, 0.5);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(24, 144, 255, 0.04);
}

/* ===== 标签 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.tag-success { background: rgba(82, 196, 26, 0.15); color: var(--success); }
.tag-warning { background: rgba(250, 173, 20, 0.15); color: var(--warning); }
.tag-danger { background: rgba(245, 34, 45, 0.15); color: var(--danger); }
.tag-info { background: rgba(24, 144, 255, 0.15); color: var(--primary); }
.tag-default { background: rgba(139, 155, 180, 0.15); color: var(--text-secondary); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: inherit;
  line-height: 1.5;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #40a9ff 0%, #1890ff 100%);
  box-shadow: 0 4px 12px rgba(24, 144, 255, 0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #52c41a 0%, #389e0d 100%);
  color: #fff;
}

.btn-success:hover {
  background: linear-gradient(135deg, #73d13d 0%, #52c41a 100%);
  box-shadow: 0 4px 12px rgba(82, 196, 26, 0.35);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #f5222d 0%, #cf1322 100%);
  color: #fff;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #ff4d4f 0%, #f5222d 100%);
  box-shadow: 0 4px 12px rgba(245, 34, 45, 0.35);
  transform: translateY(-1px);
}

.btn-default {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-default:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(24, 144, 255, 0.05);
}

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

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

/* ===== 输入框 ===== */
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

.form-input:hover {
  border-color: var(--border-light);
}

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

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

/* ===== 选择框 ===== */
.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b9bb4' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

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

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-family: inherit;
}

.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 12px;
}

/* ===== 底部版权 ===== */
.app-footer {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-header);
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
  z-index: 10;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* ===== 动画 ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(24, 144, 255, 0.3); }
  50% { box-shadow: 0 0 20px rgba(24, 144, 255, 0.6); }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

.slide-in-left {
  animation: slideInLeft 0.4s ease-out;
}

/* ===== 加载动画 ===== */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

/* ===== 空状态 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  min-width: 400px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.3s ease-out;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px;
}

.modal-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
}

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

/* ===== 消息提示 ===== */
.toast-container {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 14px;
  min-width: 280px;
  animation: slideInLeft 0.3s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.toast i {
  font-size: 16px;
}

.toast-success i { color: var(--success); }
.toast-error i { color: var(--danger); }
.toast-warning i { color: var(--warning); }
.toast-info i { color: var(--primary); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 0;
    overflow: hidden;
  }

  .content-area {
    padding: 12px;
  }

  .content-area::before {
    left: 0;
  }

  .top-nav {
    display: none;
  }

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

/* ===== 筛选栏 ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ===== 搜索框 ===== */
.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

.search-input-wrapper .form-input {
  padding-left: 36px;
}
