/* ==========================================================================
 * VideoHub V2.0 — 主题与全局基础样式 (web/css/theme.css)
 * 支持深空暗色 (dark) 与极简亮色 (light) 无缝切换
 * 显式声明自定义背景阶梯与表单控件对比度，避免浏览器默认白底或自动填充导致白字白底看不清
 * ========================================================================== */
* {
  box-sizing: border-box;
}

html.dark {
  color-scheme: dark;
}

html.light {
  color-scheme: light;
}

body {
  background-color: #0a0e17;
  color: #f8fafc;
  font-family: 'Inter', 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', sans-serif;
  overflow: hidden;
  user-select: text;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  user-select: none;
}

/* --------------------------------------------------------------------------
 * 深空暗色主题基础色阶（独立于 Tailwind 运行时配置，确保离线/首屏 100% 稳定生效）
 * -------------------------------------------------------------------------- */
.bg-bg-950 { background-color: #0a0e17; }
.bg-bg-950\/90 { background-color: rgba(10, 14, 23, 0.9); }
.bg-bg-950\/70 { background-color: rgba(10, 14, 23, 0.7); }
.bg-bg-950\/60 { background-color: rgba(10, 14, 23, 0.6); }
.bg-bg-950\/50 { background-color: rgba(10, 14, 23, 0.5); }

.bg-bg-900 { background-color: #111827; }
.bg-bg-900\/90 { background-color: rgba(17, 24, 39, 0.9); }
.bg-bg-900\/80 { background-color: rgba(17, 24, 39, 0.8); }

.bg-bg-800 { background-color: #1e293b; }
.bg-bg-800\/70 { background-color: rgba(30, 41, 59, 0.7); }
.hover\:bg-bg-800:hover { background-color: #1e293b; }
.hover\:bg-bg-800\/70:hover { background-color: rgba(30, 41, 59, 0.7); }

.bg-bg-700 { background-color: #334155; }

/* --------------------------------------------------------------------------
 * 暗色主题表单控件高对比度保障（彻底解决输入框白底白字/浅青字看不清问题）
 * -------------------------------------------------------------------------- */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
  background-color: #0f172a !important;
  color: #f8fafc;
  border-color: #334155 !important;
  caret-color: #60a5fa;
  user-select: text;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"])::placeholder,
textarea::placeholder {
  color: #94a3b8 !important;
  opacity: 1;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* 保留暗色下语义高亮输入字色（在 #0f172a 深底上高对比度清晰可读） */
input.text-cyan-400, select.text-cyan-400, textarea.text-cyan-400 { color: #38bdf8 !important; }
input.text-cyan-300, select.text-cyan-300, textarea.text-cyan-300 { color: #67e8f9 !important; }
input.text-emerald-400, select.text-emerald-400, textarea.text-emerald-400 { color: #34d399 !important; }
input.text-emerald-300, select.text-emerald-300, textarea.text-emerald-300 { color: #6ee7b7 !important; }
input.text-amber-300, select.text-amber-300, textarea.text-amber-300 { color: #fcd34d !important; }

/* 防止浏览器自动填充把暗色输入框刷成纯白/淡黄底 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #0f172a inset !important;
  -webkit-text-fill-color: #f8fafc !important;
  transition: background-color 5000s ease-in-out 0s;
}

select option {
  background-color: #0f172a;
  color: #f8fafc;
}

/* 提升暗色模式下说明标签与辅助文字的清晰度 */
.text-slate-400 {
  color: #cbd5e1;
}
.text-slate-500 {
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
 * 极简亮色主题覆盖
 * -------------------------------------------------------------------------- */
:root {
  --vh-svg-canvas: #0c1322;
  --vh-svg-canvas-border: rgba(30, 41, 59, 0.9);
  --vh-svg-dot: #1e293b;
  --vh-svg-divider: #263449;
  --vh-svg-node: #111b2e;
  --vh-svg-hub: #13203b;
  --vh-svg-chip: #0f172a;
  --vh-svg-border-muted: #293548;
  --vh-svg-badge-green: rgba(16, 185, 129, 0.16);
  --vh-svg-badge-blue: rgba(59, 130, 246, 0.18);
  --vh-svg-badge-cyan: rgba(6, 182, 212, 0.16);
  --vh-svg-badge-purple: rgba(168, 85, 247, 0.16);
  --vh-svg-text-primary: #f8fafc;
  --vh-svg-text-muted: #94a3b8;
  --vh-svg-green: #34d399;
  --vh-svg-blue: #60a5fa;
  --vh-svg-cyan: #22d3ee;
  --vh-svg-purple: #c084fc;
}

.vh-diagram-card {
  background-color: var(--vh-svg-canvas);
  border-color: var(--vh-svg-canvas-border);
}

html.light {
  --vh-svg-canvas: #ffffff;
  --vh-svg-canvas-border: #e2e8f0;
  --vh-svg-dot: #cbd5e1;
  --vh-svg-divider: #cbd5e1;
  --vh-svg-node: #f8fafc;
  --vh-svg-hub: #eff6ff;
  --vh-svg-chip: #f8fafc;
  --vh-svg-border-muted: #cbd5e1;
  --vh-svg-badge-green: #d1fae5;
  --vh-svg-badge-blue: #dbeafe;
  --vh-svg-badge-cyan: #cffafe;
  --vh-svg-badge-purple: #f3e8ff;
  --vh-svg-text-primary: #0f172a;
  --vh-svg-text-muted: #64748b;
  --vh-svg-green: #059669;
  --vh-svg-blue: #2563eb;
  --vh-svg-cyan: #0891b2;
  --vh-svg-purple: #7e22ce;
}

html.light .vh-diagram-card {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

html.light body {
  background-color: #f8fafc;
  color: #0f172a;
}
html.light .bg-bg-950,
html.light .bg-bg-950\/90,
html.light .bg-bg-950\/70,
html.light .bg-bg-950\/60,
html.light .bg-bg-950\/50 {
  background-color: #f1f5f9 !important;
}
html.light .bg-bg-900,
html.light .bg-bg-900\/90,
html.light .bg-bg-900\/80 {
  background-color: #ffffff !important;
}
html.light .bg-bg-800,
html.light .bg-bg-800\/70,
html.light .hover\:bg-bg-800:hover {
  background-color: #e2e8f0 !important;
}
html.light .border-slate-800\/80,
html.light .border-slate-800,
html.light .border-slate-700 {
  border-color: #cbd5e1 !important;
}
html.light .text-white {
  color: #0f172a !important;
}
html.light .text-slate-200 {
  color: #1e293b !important;
}
html.light .text-slate-300 {
  color: #334155 !important;
}
html.light .text-slate-400 {
  color: #475569 !important;
}
html.light .text-slate-500 {
  color: #64748b !important;
}
html.light .text-cyan-400,
html.light .text-cyan-300 {
  color: #0284c7 !important;
}
html.light .text-emerald-400,
html.light .text-emerald-300 {
  color: #059669 !important;
}
html.light .text-amber-300 {
  color: #b45309 !important;
}
/* 亮色主题下保留实色按钮上的纯白文字 */
html.light .bg-blue-600,
html.light .bg-emerald-600,
html.light .bg-cyan-600,
html.light .bg-purple-600,
html.light .bg-amber-600,
html.light .bg-rose-600 {
  color: #ffffff !important;
}
html.light input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html.light select,
html.light textarea {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
html.light input:-webkit-autofill,
html.light input:-webkit-autofill:hover,
html.light input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  -webkit-text-fill-color: #0f172a !important;
}
html.light select option {
  background-color: #ffffff;
  color: #0f172a;
}
html.light .card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

/* 雅致灰主题 (Gray Mode) */
html.gray {
  color-scheme: dark;
  --vh-svg-canvas: #2b2f36;
  --vh-svg-canvas-border: #3f4550;
  --vh-svg-dot: #3d434d;
  --vh-svg-divider: #4b525e;
  --vh-svg-node: #333840;
  --vh-svg-hub: #353d49;
  --vh-svg-chip: #2d323a;
  --vh-svg-border-muted: #464d59;
  --vh-svg-badge-green: rgba(16, 185, 129, 0.18);
  --vh-svg-badge-blue: rgba(59, 130, 246, 0.2);
  --vh-svg-badge-cyan: rgba(6, 182, 212, 0.18);
  --vh-svg-badge-purple: rgba(168, 85, 247, 0.18);
  --vh-svg-text-primary: #f3f4f6;
  --vh-svg-text-muted: #a1a8b3;
  --vh-svg-green: #34d399;
  --vh-svg-blue: #60a5fa;
  --vh-svg-cyan: #22d3ee;
  --vh-svg-purple: #c084fc;
}

html.gray .vh-diagram-card {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

html.gray body {
  background-color: #202328;
  color: #f3f4f6;
}

html.gray .bg-bg-950 { background-color: #202328 !important; }
html.gray .bg-bg-950\/90 { background-color: rgba(32, 35, 40, 0.92) !important; }
html.gray .bg-bg-950\/80 { background-color: rgba(32, 35, 40, 0.84) !important; }
html.gray .bg-bg-950\/60 { background-color: rgba(32, 35, 40, 0.68) !important; }
html.gray .bg-bg-900 { background-color: #292d34 !important; }
html.gray .bg-bg-900\/80 { background-color: rgba(41, 45, 52, 0.9) !important; }
html.gray .bg-bg-900\/70 { background-color: rgba(41, 45, 52, 0.85) !important; }
html.gray .bg-bg-800 { background-color: #343942 !important; }
html.gray .bg-bg-800\/50 { background-color: rgba(52, 57, 66, 0.65) !important; }
html.gray .bg-bg-700 { background-color: #3f4550 !important; }

html.gray .border-slate-800,
html.gray .border-slate-800\/80,
html.gray .border-slate-800\/60,
html.gray .border-slate-700 {
  border-color: #3e444f !important;
}

html.gray .text-white { color: #f9fafb !important; }
html.gray .text-slate-200 { color: #e5e7eb !important; }
html.gray .text-slate-300 { color: #d1d5db !important; }
html.gray .text-slate-400 { color: #a1a8b3 !important; }
html.gray .text-slate-500 { color: #8c94a0 !important; }

html.gray input,
html.gray select,
html.gray textarea {
  background-color: #2c3038 !important;
  color: #f3f4f6 !important;
  border-color: #464d59 !important;
}

html.gray input:-webkit-autofill {
  -webkit-text-fill-color: #f3f4f6 !important;
  -webkit-box-shadow: 0 0 0 1000px #2c3038 inset !important;
}

html.gray select option {
  background-color: #292d34;
  color: #f3f4f6;
}

html.gray .card {
  background: #2b2f36;
  border-color: #3f4550;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

html.gray ::-webkit-scrollbar-thumb {
  background: #4b525e;
}

html.gray ::-webkit-scrollbar-thumb:hover {
  background: #616977;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b82f6;
}
