/* ============================================
   App Styles — 全局应用样式
   基于 design-tokens.css，需在其后加载
   ============================================ */

/* === 统一滚动条样式 === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg-page);
  font-family: var(--font-family);
  font-size: var(--text-base);
  color: var(--text-primary);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

/* === 卡片 === */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
  margin-bottom: var(--space-6);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
}
.card-body {
  padding: var(--space-5);
}

/* === 统计卡片 === */
.stat-card {
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  color: var(--text-inverse);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  opacity: 0.1;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.stat-card h6 {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  opacity: 0.9;
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stat-card h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin: 0;
  line-height: 1.2;
}

.stat-card.orders   { background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-500) 100%); }
.stat-card.warranty { background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-600) 100%); }
.stat-card.reviews  { background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-400) 100%); }
.stat-card.contacts { background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-500) 100%); }

/* === 迷你统计 === */
.mini-stat {
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  text-align: center;
  transition: all var(--transition-base);
}
.mini-stat:hover { 
  box-shadow: var(--shadow-sm); 
  border-color: var(--brand-200);
}
.mini-stat .value { 
  font-size: var(--text-3xl); 
  font-weight: var(--font-bold); 
  color: var(--text-primary); 
  line-height: 1.2;
}
.mini-stat .label { 
  font-size: var(--text-xs); 
  color: var(--text-secondary); 
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === 按钮 === */
.btn {
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  padding: 10px 20px;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

.btn-brand {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-600) 100%);
  border: none;
  color: #fff;
  font-weight: var(--font-semibold);
  padding: 12px 28px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-brand);
  transition: all var(--transition-base);
}
.btn-brand:hover {
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--brand-700) 100%);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.35);
}
.btn-brand:active {
  transform: translateY(0);
  box-shadow: var(--shadow-brand);
}

.btn-sm {
  padding: 6px 14px;
  font-size: var(--text-sm);
}

.btn-xs {
  padding: 4px 10px;
  font-size: var(--text-xs);
}

/* === 表单控件 === */
.form-control,
.form-select {
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-default);
  padding: 10px 14px;
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
  background-color: var(--bg-surface);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  outline: none;
}
.form-control::placeholder,
.form-select::placeholder {
  color: var(--text-muted);
}

.form-label {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  display: block;
}

/* === 安全徽章 === */
.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--success-50);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  color: var(--success-600);
  font-size: var(--text-sm);
}
.security-badge svg { width: 16px; height: 16px; flex-shrink: 0; }

/* === 步骤指示器 === */
.step-indicator {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 80px;
  margin-bottom: 40px;
}
.step-indicator::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: var(--border-light);
  z-index: 0;
}
.step-indicator::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 15%;
  height: 2px;
  background: var(--brand-500);
  z-index: 0;
  transition: width var(--transition-slow) ease;
  width: 0;
}
.step-indicator[data-progress="1"]::after { width: 0; }
.step-indicator[data-progress="2"]::after { width: 35%; }
.step-indicator[data-progress="3"]::after { width: 70%; }

.step {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  font-size: 15px;
  color: var(--text-muted);
  transition: all var(--transition-slow);
  box-shadow: var(--shadow-sm);
}
.step .step-label {
  font-size: 10px;
  margin-top: 4px;
  white-space: nowrap;
}
.step.active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  box-shadow: var(--shadow-brand);
  transform: scale(1.1);
}
.step.completed {
  background: var(--success-500);
  border-color: var(--success-500);
  color: #fff;
  box-shadow: var(--shadow-success);
}
.step.active .step-label,
.step.completed .step-label {
  color: #fff;
}

/* === Toast 通知 === */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.toast-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  max-width: 440px;
  animation: toastSlideIn var(--transition-slow) ease;
  border-left: 4px solid transparent;
}
.toast-item.success { border-left-color: var(--success-500); }
.toast-item.error   { border-left-color: var(--danger-500); }
.toast-item.warning { border-left-color: var(--warning-500); }
.toast-item.info    { border-left-color: var(--info-500); }

.toast-item .toast-icon { flex-shrink: 0; width: 20px; height: 20px; }
.toast-item .toast-msg  { flex: 1; font-size: var(--text-sm); color: var(--text-primary); }
.toast-item .toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  padding: 0;
  line-height: 1;
}
.toast-item.removing {
  animation: toastSlideOut var(--transition-base) ease forwards;
}

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

/* === Skeleton 骨架屏 === */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text  { height: 14px; margin-bottom: var(--space-2); }
.skeleton-title { height: 20px; width: 60%; margin-bottom: var(--space-3); }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); }
.skeleton-card { height: 80px; border-radius: var(--radius-md); }

@keyframes skeletonShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* === 空状态 === */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}
.empty-state svg {
  width: 80px;
  height: 80px;
  color: var(--gray-300);
  margin-bottom: var(--space-4);
}
.empty-state h4 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.empty-state p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 320px;
  margin: 0 auto;
}

/* === 表格增强 === */
.table-container {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  position: relative;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.table-container table {
  width: 100%;
  margin-bottom: 0;
  display: table !important;
  border-collapse: collapse;
}
.table-container table thead {
  display: table-header-group !important;
}
.table-container table thead tr {
  display: table-row !important;
}
.table-container table thead th {
  background: var(--brand-500) !important;
  font-size: var(--text-sm) !important;
  font-weight: var(--font-semibold) !important;
  color: #ffffff !important;
  white-space: nowrap !important;
  padding: 14px 16px;
  border-bottom: 2px solid var(--brand-700);
  border-right: 1px solid rgba(255,255,255,0.15);
  vertical-align: middle;
  display: table-cell !important;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-container table thead th:last-child {
  border-right: none;
}
.table-container table thead th:hover {
  background: var(--brand-600) !important;
}
.table-container table tbody {
  display: table-row-group !important;
}
.table-container table tbody tr {
  display: table-row !important;
}
.table-container table tbody td {
  display: table-cell !important;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
}
.table-container table tbody td:last-child {
  border-right: none;
}
.table-container table tbody tr:hover {
  background: var(--gray-50);
}

/* === 排序表头 === */
.sortable-header {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sortable-header:hover { 
  color: #ffffff;
}
.table-container table thead th .sort-icon {
  font-size: 12px;
  color: rgba(255,255,255,0.6) !important;
  transition: all var(--transition-fast);
}
.table-container table thead th:hover .sort-icon {
  color: #ffffff !important;
}
.table-container table thead th .sort-icon.asc {
  color: #ffffff !important;
}
.table-container table thead th .sort-icon.desc {
  color: #ffffff !important;
}

/* === 日期筛选按钮 === */
.date-filter .btn {
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: var(--text-sm);
  margin-right: 4px;
  font-weight: var(--font-medium);
}
.date-filter .btn.active {
  background: var(--brand-500);
  color: #fff;
  border-color: var(--brand-500);
}

/* === 区块标题 === */
.section-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* === 徽章 === */
.badge-up {
  background: var(--success-100);
  color: var(--success-600);
  font-weight: var(--font-semibold);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
}
.badge-down {
  background: var(--danger-100);
  color: var(--danger-600);
  font-weight: var(--font-semibold);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
}

/* === 状态徽章 === */
.badge-status {
  display: inline-flex;
  align-items: center;
  font-weight: var(--font-semibold);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  line-height: 1.2;
  gap: 4px;
}
.badge-status.enabled,
.badge-status.resolved {
  background: var(--success-100);
  color: var(--success-600);
}
.badge-status.disabled {
  background: var(--gray-100);
  color: var(--gray-500);
}
.badge-status.pending {
  background: var(--warning-100);
  color: var(--warning-600);
}
.badge-status.danger {
  background: var(--danger-100);
  color: var(--danger-600);
}

/* === 侧边栏 === */
.sidebar {
  min-height: 100vh;
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
}
.sidebar .nav-link {
  color: rgba(255,255,255,.7);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  margin: 2px 8px;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
}
.sidebar .nav-link.active {
  color: #fff;
  background: var(--brand-500);
  font-weight: var(--font-semibold);
}
.sidebar .nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.sidebar-header .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--brand-500);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-header .logo-icon svg { width: 22px; height: 22px; color: #fff; }
.sidebar-header h5 {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: var(--text-inverse);
}

/* 移动端侧边栏 */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--z-modal);
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
  }
  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }
}

/* === 页脚 === */
.app-footer {
  margin-top: var(--space-12);
  margin-bottom: var(--space-8);
  text-align: center;
}
.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}
.app-footer a:hover { color: var(--brand-500); }

/* === 星级评分 === */
.star-rating {
  display: flex;
  gap: 8px;
}
.star-rating .star {
  font-size: 32px;
  color: var(--gray-300);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.star-rating .star:hover,
.star-rating .star.active {
  color: #fbbf24;
  transform: scale(1.1);
}

/* === 亚马逊留评按钮 === */
.btn-amazon-review {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #FF9900 0%, #FF6B00 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 107, 0, 0.4);
  text-decoration: none;
  min-width: 280px;
}
.btn-amazon-review:hover {
  background: linear-gradient(135deg, #FFAD33 0%, #FF8C00 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 0, 0.5);
}
.btn-amazon-review:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 107, 0, 0.3);
}
.btn-amazon-review:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(255, 153, 0, 0.3);
}
.btn-amazon-review.animate-pulse {
  animation: amazonPulse 2s ease-in-out infinite;
}
@keyframes amazonPulse {
  0%, 100% {
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.4);
  }
  50% {
    box-shadow: 0 6px 25px rgba(255, 107, 0, 0.6);
  }
}

/* === 产品信息卡片 === */
.product-info-card {
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

/* === 导航分隔线 === */
.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: var(--space-2) 8px;
}

/* === 搜索框 === */
.search-input-group {
  position: relative;
}
.search-input-group input {
  padding-left: 36px;
}
.search-input-group::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
}

/* === 分页 === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) 8px;
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
  position: relative;
  z-index: 2;
  background: var(--bg-surface);
}
.pagination span {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}
.pagination .btn {
  min-width: 36px;
  height: 36px;
  padding: 0;
}

/* === 卡片底部 === */
.card-footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.card-footer .pagination {
  margin-top: 0;
  padding: 0;
  background: transparent;
}

/* === 按钮组 === */
.btn-group {
  display: flex;
  gap: var(--space-2);
}

/* === 进度条 === */
.progress-bar {
  border-radius: var(--radius-full);
  height: 6px;
}

/* === 模态框 === */
.modal-content {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow-xl);
}
.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-5);
}
.modal-footer {
  border-top: 1px solid var(--border-light);
  padding: var(--space-5);
}

/* === 表单分组 === */
.form-group {
  margin-bottom: var(--space-4);
}

/* === 工具提示 === */
.tooltip {
  font-size: var(--text-xs);
}

/* === 图片预览 === */
.image-preview {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

/* === 卡片内容区域 === */
.card-body {
  padding: var(--space-5);
}

/* === 卡片头部 === */
.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* === 卡片标题 === */
.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin: 0;
}

/* === 卡片副标题 === */
.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 4px;
}

/* === 网格布局 === */
.grid {
  display: grid;
  gap: var(--space-4);
}

/* === 行内操作按钮 === */
.action-buttons {
  display: flex;
  gap: var(--space-1);
}

/* === 统计数字动画 === */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-count {
  animation: countUp 0.6s ease-out;
}

/* === 加载动画 === */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === 禁用状态 === */
.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* === 隐藏元素 === */
.hidden {
  display: none !important;
}

/* === 响应式调整 === */
@media (max-width: 576px) {
  .card-body {
    padding: var(--space-4);
  }
  .btn {
    padding: 8px 16px;
    font-size: var(--text-sm);
  }
  .step-indicator {
    gap: 40px;
  }
  .step {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
}
