/**
 * 通用组件样式 — 质感升级版
 * 升级日期：2026-07-15
 */

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before { display: none; }
.btn:hover::before { display: none; }
.btn:hover {
  transform: translateY(-1px);
}

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 28px; font-size: 15px; }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 3px rgba(15, 118, 110, 0.2), 0 4px 12px rgba(15, 118, 110, 0.15);
}
.btn-primary:hover {
  background: #0d9488;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3), 0 10px 24px rgba(15, 118, 110, 0.2);
  transform: translateY(-2px);
}
.btn-primary:active {
  background: #0d9488;
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(15, 118, 110, 0.2), 0 2px 6px rgba(15, 118, 110, 0.12);
}
.btn-primary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn:disabled, .btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}
.btn.loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 6px;
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-50);
}
.btn-outline:active { transform: translateY(1px); }
.btn-outline:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { opacity: 0.9; transform: translateY(-2px); }
.btn-danger:active { transform: translateY(0); }
.btn-danger:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }

.btn-icon {
  background: none;
  border: none;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--primary); }

.btn-icon .badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(226, 232, 240, 0.8);
  margin-bottom: var(--spacing-lg);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 2%, rgba(15, 118, 110, 0.2) 15%, rgba(15, 118, 110, 0.06) 60%, transparent 90%);
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.07), 0 14px 36px rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 118, 110, 0.15);
  transform: translateY(-2px);
}

.card:hover::before {
  opacity: 1;
}

.card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
  color: var(--text-primary);
}

/* 卡片强调色变体 — 替代糖果色底色 */
.card-accent-1 {
  border-left: 3px solid #0f766e;
}
.card-accent-2 {
  border-left: 3px solid #3b82f6;
}
.card-accent-3 {
  border-left: 3px solid #8b5cf6;
}

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px var(--spacing-lg);
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--primary);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  display: none;
}

.stat-card:hover {
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 118, 110, 0.15);
  border-left-color: var(--primary);
  transform: translateY(-2px);
}

.stat-card:hover .stat-num {
  color: var(--primary);
}

.stat-icon {
  font-size: 24px;
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08) 0%, rgba(15, 118, 110, 0.04) 100%);
  color: var(--primary);
}

.stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
}

.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== 图表 ===== */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
}

.chart-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
  color: var(--text-primary);
}

.chart-container {
  width: 100%;
  height: 280px;
}

/* ===== 表格 ===== */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  background: #ffffff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th, .table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.table th {
  background: linear-gradient(180deg, #f8fafc 0%, #f3f5f7 100%);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 0.3px;
}

.table-sm th, .table-sm td { padding: 8px 12px; }

.table tbody tr {
  transition: background 0.15s ease;
}
.table tbody tr:hover { background: rgba(15, 118, 110, 0.04); }

/* 状态胶囊 */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
}
.status-pill.active {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}
.status-pill.expired {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
.status-pill.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

/* ===== 表单 ===== */
.form-group { margin-bottom: var(--spacing-lg); }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: 0.3px;
  text-transform: none;
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
  color: var(--text-muted);
  font-size: 12px;
}

.form-control select, select.form-control {
  cursor: pointer;
}


.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: #fafbfc;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--text-primary);
}

.form-input:hover, .form-select:hover {
  border-color: var(--text-disabled);
}

.form-input::placeholder {
  color: var(--text-disabled);
  transition: color 0.2s ease;
}

.form-input:focus::placeholder {
  color: transparent;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  border-bottom-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.08), 0 2px 8px rgba(15, 118, 110, 0.06), 0 2px 0 0 var(--primary) inset;
  background: var(--bg-input-focus);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-input-sm { padding: 7px 10px; font-size: 13px; }
.form-input-lg { padding: 14px 18px; font-size: 16px; }

/* ===== 徽章 ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}

.badge-default { background: var(--bg-input); color: var(--text-secondary); }
.badge-success { background: rgba(21, 128, 61, 0.1); color: #15803d; }
.badge-warning { background: rgba(180, 83, 9, 0.08); color: #92400e; }
.badge-danger { background: rgba(185, 28, 28, 0.1); color: #b91c1c; }
.badge-info { background: var(--primary-50); color: var(--primary); }

/* ===== 筛选栏 ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
  padding: var(--spacing-md) var(--spacing-lg);
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* 筛选标签（回显已选条件） */
.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  background: var(--primary-50);
  color: var(--primary);
  border: 1px solid rgba(15, 118, 110, 0.15);
  transition: all 0.15s ease;
}
.filter-tag:hover {
  background: rgba(15, 118, 110, 0.12);
}
.filter-tag .filter-tag-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  background: rgba(15, 118, 110, 0.1);
  transition: background 0.15s ease;
}
.filter-tag .filter-tag-close:hover {
  background: rgba(15, 118, 110, 0.2);
}

/* ===== Tabs ===== */
.dashboard-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: var(--spacing-xl);
  padding: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-lg);
}

.dashboard-tabs .tab-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-tabs .tab-btn:hover { color: var(--text-primary); }
.dashboard-tabs .tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ===== 文字工具类 ===== */
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-lg { margin-bottom: var(--spacing-lg); }

/* ===== 骨架屏 ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--border-light) 50%, var(--bg-input) 75%);
  background-size: 300px 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: -300px 0; }
  100% { background-position: 300px 0; }
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modal-overlay-in 0.2s ease;
}

.modal-overlay.show {
  display: flex;
}

@keyframes modal-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2), 0 8px 24px rgba(15, 23, 42, 0.1);
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  animation: modal-enter 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 20px;
  transition: all 0.15s ease;
}
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-light);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: var(--spacing-xl);
  right: var(--spacing-xl);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  font-size: 13px;
  pointer-events: auto;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.toast::before {
  content: '';
  width: 3px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-success { border-color: rgba(22, 163, 74, 0.2); }
.toast-success::before { background: var(--success); }
.toast-danger { border-color: rgba(220, 38, 38, 0.2); }
.toast-danger::before { background: var(--danger); }
.toast-warning { border-color: rgba(217, 119, 6, 0.2); }
.toast-warning::before { background: var(--warning); }
.toast-info { border-color: rgba(15, 118, 110, 0.2); }
.toast-info::before { background: var(--info); }

/* ===== Tooltip ===== */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: #111827;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 600;
}

[data-tooltip]:hover::after { opacity: 1; }

/* ===== 空状态 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state .empty-icon,
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state .empty-title {
  font-size: var(--font-h3);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.empty-state .empty-desc,
.empty-state-text {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 280px;
  line-height: var(--leading-relaxed);
  margin-bottom: 16px;
}

.empty-state-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(15, 118, 110, 0.2);
}
.empty-state-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .page-container { padding: var(--spacing-lg); }
  .filter-bar { flex-direction: column; align-items: stretch; }
}
