/* TVBox 接口管理系统 — 人性化设计系统 v2 */
/* 消除 AI 感：去渐变背景、毛玻璃、全渐变按钮、超大圆角 */

/* ===== 设计令牌 ===== */
:root {
  --bg-page: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --bg-subtle: #f5f5f5;
  --border-card: #e5e5e5;
  --border-light: #f0f0f0;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-dropdown: 0 4px 16px rgba(0,0,0,0.1);
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #eef2ff;
  --accent-subtle: #e0e7ff;
  --text-body: #1e1b16;
  --text-muted: #78716c;
  --text-faint: #a8a29e;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

.dark {
  --bg-page: #0a0a0b;
  --bg-card: #18181b;
  --bg-card-hover: #27272a;
  --bg-subtle: #1f1f23;
  --border-card: #2a2a2e;
  --border-light: #1f1f23;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-dropdown: 0 4px 16px rgba(0,0,0,0.5);
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: #1e1b4b;
  --accent-subtle: #312e81;
  --text-body: #e7e5e4;
  --text-muted: #a8a29e;
  --text-faint: #78716c;
}

/* ===== 全局基础 ===== */
body {
  background: var(--bg-page) !important;
  color: var(--text-body) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== 全局：所有 dark: 类被媒体查询覆盖时强制跟随 CSS 变量 ===== */
/* 这些覆盖 Tailwind CDN 的 media 策略默认行为 */
/* 背景覆盖 */
.dark\:bg-gray-800, .dark\:bg-gray-900, .dark\:bg-slate-700, .dark\:bg-slate-800, .dark\:bg-slate-900,
.dark\:bg-indigo-900, .dark\:bg-indigo-900\/50, .dark\:bg-indigo-900\/20,
.dark\:bg-red-900, .dark\:bg-red-900\/30,
.dark\:bg-emerald-900, .dark\:bg-emerald-900\/30, .dark\:bg-emerald-900\/20,
.dark\:bg-amber-900\/30, .dark\:bg-amber-900\/20,
.dark\:bg-blue-900, .dark\:bg-blue-900\/20,
.dark\:bg-gray-700, .dark\:bg-gray-700\/80,
.dark\:bg-gray-700\/50, .dark\:bg-gray-700\/90,
.dark\:bg-slate-600, .dark\:bg-slate-600\/80,
.dark\:bg-slate-100, .dark\:bg-slate-200, .dark\:bg-slate-300,
.dark\:bg-gray-100, .dark\:bg-gray-200, .dark\:bg-gray-300 {
  background-color: var(--bg-card) !important;
}

/* 边框覆盖 */
.dark\:border-gray-600, .dark\:border-gray-700, .dark\:border-slate-600,
.dark\:border-gray-700 { border-color: var(--border-card) !important; }

/* 文字色覆盖（完整列表） */
.dark\:text-white, .dark\:text-gray-200, .dark\:text-slate-200,
.dark\:text-slate-100, .dark\:text-gray-100 { color: var(--text-body) !important; }
.dark\:text-gray-300, .dark\:text-slate-300 { color: var(--text-body) !important; }
.dark\:text-gray-400, .dark\:text-slate-400 { color: var(--text-muted) !important; }
.dark\:text-indigo-300, .dark\:text-indigo-400 { color: var(--accent) !important; }

/* 悬停背景覆盖 */
.dark\:hover\:bg-gray-700:hover, .dark\:hover\:bg-slate-700:hover,
.dark\:hover\:bg-indigo-900\/30:hover, .dark\:hover\:bg-red-900\/30:hover,
.dark\:hover\:bg-indigo-800:hover, .dark\:hover\:bg-amber-900\/30:hover,
.dark\:hover\:bg-indigo-900\/50:hover { background-color: var(--bg-card-hover) !important; }

/* 其他 */
.dark\:shadow-md { box-shadow: var(--shadow-card) !important; }
.dark\:focus\:ring-indigo-400:focus { --tw-ring-color: var(--accent) !important; }

/* ===== 全局文本色覆盖 ===== */
/* 确保明暗切换时所有文字跟随 CSS 变量而非硬编码 Tailwind 色值 */
body, .dark body,
.text-slate-700, .dark .text-slate-700,
.text-slate-800, .dark .text-slate-800,
.text-slate-900, .dark .text-slate-900,
.text-gray-700, .dark .text-gray-700,
.text-gray-800, .dark .text-gray-800,
.text-gray-900, .dark .text-gray-900 { color: var(--text-body) !important; }

.text-slate-500, .dark .text-slate-500,
.text-slate-400, .dark .text-slate-400,
.text-gray-500, .dark .text-gray-500,
.text-gray-400, .dark .text-gray-400,
.text-slate-600, .dark .text-slate-600,
.text-gray-600, .dark .text-gray-600 { color: var(--text-muted) !important; }

/* 按钮上的文字：红色（danger）/ 蓝色（primary）/ 绿色（success）/ 琥珀色（warning）按钮上的文字始终保持白色 */
.text-red-500, .text-red-600, .text-red-700, .text-red-400,
.dark .text-red-500, .dark .text-red-600, .dark .text-red-700, .dark .text-red-400 {
  color: #ef4444 !important;
}
.text-indigo-600, .text-indigo-700, .text-indigo-400,
.dark .text-indigo-600, .dark .text-indigo-700, .dark .text-indigo-400 {
  color: #4f46e5 !important;
}
.text-emerald-500, .text-emerald-600, .text-emerald-700, .text-emerald-400,
.dark .text-emerald-500, .dark .text-emerald-600, .dark .text-emerald-700, .dark .text-emerald-400 {
  color: #10b981 !important;
}
.text-amber-500, .text-amber-600, .text-amber-700, .text-amber-400,
.dark .text-amber-500, .dark .text-amber-600, .dark .text-amber-700, .dark .text-amber-400 {
  color: #f59e0b !important;
}
.text-blue-500, .text-blue-600, .text-blue-700, .text-blue-400,
.dark .text-blue-500, .dark .text-blue-600, .dark .text-blue-700, .dark .text-blue-400 {
  color: #3b82f6 !important;
}

/* 白色按钮文字（在有色背景上）— 始终保持白色 */
.text-white, .dark .text-white {
  color: #ffffff !important;
}

.text-slate-200, .dark .text-slate-200,
.text-gray-200 { color: var(--text-body) !important; }

/* ===== 输入框明暗覆盖 ===== */
/* 必须使用 !important 覆盖 Tailwind CDN 的 dark: 类效果 */
input, select, textarea,
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="url"], input[type="search"],
input[type="datetime-local"],
.dark input, .dark select, .dark textarea,
.dark input[type="text"], .dark input[type="password"], .dark input[type="email"], .dark input[type="number"], .dark input[type="url"], .dark input[type="search"],
.dark input[type="datetime-local"] {
  background-color: var(--bg-subtle) !important;
  color: var(--text-body) !important;
  border-color: var(--border-card) !important;
}
input::placeholder, textarea::placeholder {
  color: var(--text-faint) !important;
}

/* ===== 卡片系统 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  border-color: var(--accent-subtle);
}
.card-hover {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}
.card-hover:hover {
  border-color: var(--accent-subtle);
  box-shadow: var(--shadow-card-hover);
}

/* ===== 按钮系统 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.25rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-body);
  border: 1px solid var(--border-card);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--accent-subtle);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text-body);
}
.btn-danger {
  background: #ef4444;
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}
.btn-success {
  background: #10b981;
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #059669;
}
.btn-amber {
  background: #f59e0b;
  color: #fff;
}
.btn-amber:hover:not(:disabled) {
  background: #d97706;
}

/* ===== 进度条 ===== */
.progress-bar {
  background: var(--accent);
  border-radius: 999px;
  height: 8px;
  transition: width 0.5s ease;
}
/* 进度条外围轨道 $mdash; 给进度条一个可见的容器背景 */
.progress-track {
  width: 100%;
  background: var(--border-light);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.dark .progress-track {
  background: var(--border-card);
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.68,-0.55,0.265,1.55);
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { background: #10b981; color: #fff; }
.toast-error { background: #ef4444; color: #fff; }
.toast-info { background: #3b82f6; color: #fff; }
.toast-warning { background: #f59e0b; color: #fff; }

/* ===== 汉堡菜单 ===== */
.hamburger { width: 24px; height: 18px; position: relative; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; }
.hamburger span { display: block; width: 100%; height: 2px; background: #78716c; border-radius: 2px; transition: all 0.3s; }
.dark .hamburger span { background: #a8a29e; }
.hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); background: #ef4444; }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); background: #ef4444; }

/* ===== 骨架屏 ===== */
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton { background: linear-gradient(90deg, #e8e2da 25%, #f5f0eb 50%, #e8e2da 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; }
.dark .skeleton { background: linear-gradient(90deg, #2e2e34 25%, #26262b 50%, #2e2e34 75%); background-size: 200% 100%; }

/* ===== 密码强度 ===== */
.strength-bar { height: 4px; border-radius: 2px; transition: all 0.3s; }
.strength-weak { background: #ef4444; width: 33%; }
.strength-medium { background: #f59e0b; width: 66%; }
.strength-strong { background: #10b981; width: 100%; }

/* ===== 输入框 ===== */
input, select, textarea {
  font-family: inherit;
}

/* ===== 表单动态提示 ===== */
[x-cloak] { display: none !important; }

/* ===== 标签（Badge） ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25rem;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f0ef; color: #57534e; }
.dark .badge-green { background: #064e3b; color: #a7f3d0; }
.dark .badge-red { background: #7f1d1d; color: #fecaca; }
.dark .badge-amber { background: #78350f; color: #fde68a; }
.dark .badge-blue { background: #1e3a5f; color: #bfdbfe; }
.dark .badge-gray { background: #292524; color: #d6d3d1; }

/* ===== 表格 ===== */
.table-wrap {
  overflow-x: auto;
}
.table-wrap table {
  width: 100%;
  font-size: 0.875rem;
}
.table-wrap th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-card);
}
.table-wrap td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-body);
}
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: var(--bg-card-hover); }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-width: 28rem;
  width: 100%;
  padding: 1.5rem;
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  border: 1px solid var(--border-card);
  color: var(--text-body);
  text-decoration: none;
  transition: all 0.15s;
}
.pagination a:hover {
  background: var(--bg-subtle);
  border-color: var(--accent-subtle);
}
.pagination span.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== 徽章数字 ===== */
.number-stat {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-body);
}
