/*
 * Sub2API 全站可读性增强（Nginx 注入，浅色模式）
 * 覆盖：登录/注册页、侧栏、表格、统计卡片、按钮、页脚等
 */
:root {
  --ui-text: #111827;
  --ui-text-secondary: #374151;
  --ui-text-muted: #4b5563;
  --ui-text-hint: #6b7280;
  --ui-primary: #0f766e;
  --ui-primary-dark: #115e59;
  --ui-link: #0d9488;
}

/* ---------- 全局文字层级（Tailwind 灰字整体加深） ---------- */
html:not(.dark) .text-gray-400,
html:not(.dark) .text-slate-400 {
  color: var(--ui-text-hint) !important;
}

html:not(.dark) .text-gray-500,
html:not(.dark) .text-slate-500 {
  color: var(--ui-text-muted) !important;
}

html:not(.dark) .text-gray-600,
html:not(.dark) .text-slate-600 {
  color: var(--ui-text-secondary) !important;
}

html:not(.dark) .text-gray-700 {
  color: #1f2937 !important;
}

html:not(.dark) body,
html:not(.dark) .text-gray-900 {
  color: var(--ui-text);
}

html:not(.dark) .stat-label,
html:not(.dark) .input-hint,
html:not(.dark) .page-desc,
html:not(.dark) .sidebar-section-title {
  color: var(--ui-text-muted) !important;
  font-weight: 500 !important;
}

html:not(.dark) .table th {
  color: var(--ui-text-secondary) !important;
  font-weight: 600 !important;
}

html:not(.dark) .table td {
  color: #1f2937 !important;
}

html:not(.dark) .sidebar-link {
  color: var(--ui-text-secondary) !important;
}

html:not(.dark) .sidebar-link-active {
  color: var(--ui-primary-dark) !important;
  font-weight: 600 !important;
}

/* ---------- 认证页：品牌区 ---------- */
html:not(.dark) .text-gradient {
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  color: var(--ui-primary-dark) !important;
  font-weight: 800 !important;
}

html:not(.dark) h1.text-gradient + p.text-sm {
  color: var(--ui-text-muted) !important;
  font-weight: 500 !important;
}

/* ---------- 认证页：卡片内（欢迎回来、表单） ---------- */
html:not(.dark) .card-glass h2,
html:not(.dark) h2.text-2xl {
  color: var(--ui-text) !important;
  font-weight: 700 !important;
}

html:not(.dark) .card-glass p.text-sm {
  color: var(--ui-text-secondary) !important;
  font-weight: 500 !important;
}

html:not(.dark) .input-label,
html:not(.dark) label.input-label {
  color: var(--ui-text) !important;
  font-weight: 600 !important;
}

html:not(.dark) .input {
  color: var(--ui-text) !important;
  font-weight: 500 !important;
}

html:not(.dark) .input:not(:disabled) {
  background-color: #fff !important;
  border-color: #9ca3af !important;
}

html:not(.dark) .input::placeholder {
  color: var(--ui-text-hint) !important;
  opacity: 1 !important;
}

html:not(.dark) .input:disabled {
  background-color: #f3f4f6 !important;
  color: var(--ui-text-secondary) !important;
  opacity: 1 !important;
  -webkit-text-fill-color: var(--ui-text-secondary) !important;
}

html:not(.dark) .input + button svg,
html:not(.dark) .relative .text-gray-400 {
  color: #6b7280 !important;
}

/* ---------- 主按钮 / 提交按钮 ---------- */
html:not(.dark) .btn-primary,
html:not(.dark) button.btn-primary,
html:not(.dark) button[type='submit'],
html:not(.dark) form button.w-full.btn-primary,
html:not(.dark) form button.w-full[type='submit'] {
  background: var(--ui-primary) !important;
  background-image: none !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 0.9375rem !important;
  letter-spacing: 0.01em;
  opacity: 1 !important;
  box-shadow: 0 2px 10px rgba(15, 118, 110, 0.4) !important;
}

html:not(.dark) .btn-primary:disabled,
html:not(.dark) button.btn-primary:disabled,
html:not(.dark) button[type='submit']:disabled,
html:not(.dark) form button.w-full:disabled {
  background: var(--ui-primary-dark) !important;
  color: #ffffff !important;
  opacity: 1 !important;
}

html:not(.dark) .btn-primary *,
html:not(.dark) button[type='submit'] * {
  color: #ffffff !important;
  opacity: 1 !important;
}

html:not(.dark) .btn-secondary {
  color: var(--ui-text) !important;
  border-color: #9ca3af !important;
  font-weight: 600 !important;
}

/* ---------- 认证页：卡片下方「还没有账号？注册」 ---------- */
html:not(.dark) .max-w-md > .mt-6.text-center,
html:not(.dark) .max-w-md > .mt-6.text-center p {
  color: var(--ui-text-secondary) !important;
  font-size: 0.9375rem !important;
  font-weight: 500 !important;
}

html:not(.dark) .max-w-md a.text-primary-600,
html:not(.dark) .max-w-md .router-link-active.text-primary-600,
html:not(.dark) a.font-medium.text-primary-600,
html:not(.dark) .text-primary-600 {
  color: var(--ui-link) !important;
  font-weight: 700 !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 认证页：最底部版权 ---------- */
html:not(.dark) .max-w-md > .mt-8.text-center.text-xs,
html:not(.dark) .max-w-md > .mt-8.text-xs {
  color: var(--ui-text-muted) !important;
  font-size: 0.8125rem !important;
  font-weight: 500 !important;
}

/* OAuth 分隔线文字 */
html:not(.dark) .text-xs.text-gray-500 {
  font-weight: 500 !important;
}

/* ---------- 链接 ---------- */
html:not(.dark) a:not(.btn):not(.sidebar-link) {
  font-weight: 500;
}

html:not(.dark) .text-primary-600:hover {
  color: var(--ui-primary-dark) !important;
}

/* ---------- 认证页：卡片与整页字号 ---------- */
html:not(.dark) .card-glass {
  background: rgba(255, 255, 255, 0.96) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08) !important;
}

html:not(.dark) .card-glass,
html:not(.dark) .max-w-md {
  font-size: 15px;
}

html:not(.dark) button[type='submit'],
html:not(.dark) .btn-primary.w-full {
  min-height: 3rem !important;
  font-size: 1rem !important;
}

html:not(.dark) button[type='submit'] svg,
html:not(.dark) .btn-primary svg {
  flex-shrink: 0;
  opacity: 1 !important;
}

/* 登录中：保持白字，避免 spinner 把按钮洗白 */
html:not(.dark) button[type='submit']:disabled .opacity-25,
html:not(.dark) button[type='submit']:disabled .opacity-75 {
  opacity: 1 !important;
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* ========== 认证页：深浅色都必须可见（修复深色模式按钮透明+白字） ========== */
.relative.flex.min-h-screen button.btn.btn-primary,
.relative.flex.min-h-screen button[type='submit'].btn {
  background-color: #0f766e !important;
  background-image: none !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
  border: 1px solid #0f766e !important;
  min-height: 3rem !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 10px rgba(15, 118, 110, 0.45) !important;
}

.relative.flex.min-h-screen button.btn.btn-primary:disabled,
.relative.flex.min-h-screen button[type='submit'].btn:disabled {
  background-color: #115e59 !important;
  border-color: #115e59 !important;
  color: #ffffff !important;
  opacity: 1 !important;
  cursor: wait !important;
}

.relative.flex.min-h-screen button.btn.btn-primary *,
.relative.flex.min-h-screen button[type='submit'].btn * {
  color: #ffffff !important;
  opacity: 1 !important;
}

html.dark .relative.flex.min-h-screen .text-gradient {
  background: none !important;
  background-clip: unset !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: #2dd4bf !important;
  color: #2dd4bf !important;
}

html.dark .relative.flex.min-h-screen h2.text-2xl {
  color: #f8fafc !important;
}

html.dark .relative.flex.min-h-screen .input-label {
  color: #e2e8f0 !important;
}

html.dark .relative.flex.min-h-screen .input {
  color: #f1f5f9 !important;
  background-color: #0f172a !important;
  border-color: #475569 !important;
}

html.dark .relative.flex.min-h-screen .max-w-md > .mt-6 p,
html.dark .relative.flex.min-h-screen .max-w-md > .mt-8 {
  color: #94a3b8 !important;
}

html.dark .relative.flex.min-h-screen a.text-primary-600 {
  color: #2dd4bf !important;
  font-weight: 700 !important;
}

/* ========== 首页功能卡片：图标底色（渐变失效时不再白块+白图标） ========== */
.bg-gradient-to-br.from-blue-500.to-blue-600,
.from-blue-500.to-blue-600.bg-gradient-to-br {
  background-color: #2563eb !important;
  background-image: none !important;
}

.bg-gradient-to-br.from-primary-500.to-primary-600,
.from-primary-500.to-primary-600.bg-gradient-to-br {
  background-color: #0d9488 !important;
  background-image: none !important;
}

.bg-gradient-to-br.from-purple-500.to-purple-600,
.from-purple-500.to-purple-600.bg-gradient-to-br {
  background-color: #9333ea !important;
  background-image: none !important;
}

.flex.h-12.w-12.rounded-xl.from-blue-500,
.flex.h-12.w-12.rounded-xl[class*='from-blue-500'] {
  background-color: #2563eb !important;
  background-image: none !important;
}

.flex.h-12.w-12.rounded-xl.from-primary-500,
.flex.h-12.w-12.rounded-xl[class*='from-primary-500'] {
  background-color: #0d9488 !important;
  background-image: none !important;
}

.flex.h-12.w-12.rounded-xl.from-purple-500,
.flex.h-12.w-12.rounded-xl[class*='from-purple-500'] {
  background-color: #9333ea !important;
  background-image: none !important;
}

/* 首页卡片说明文字（深色模式勿过浅） */
html.dark .group.rounded-2xl p.text-sm.leading-relaxed,
html.dark .text-dark-400 {
  color: #cbd5e1 !important;
}

html.dark .group.rounded-2xl h3.text-lg {
  color: #f8fafc !important;
}

/* 首页/全站 primary 实心按钮 */
a.bg-primary-600,
button.bg-primary-600,
.router-link-active.bg-primary-600,
.inline-flex.bg-primary-600 {
  background-color: #0d9488 !important;
  color: #ffffff !important;
}

html.dark a.bg-gray-900,
html.dark .dark\:bg-white.dark\:text-gray-900 {
  background-color: #f8fafc !important;
  color: #111827 !important;
}

/* ========== 首页厂商徽标 h-8（C / G / A / + 等字母图标） ========== */
.bg-gradient-to-br.from-orange-400.to-orange-500,
.from-orange-400.to-orange-500.bg-gradient-to-br,
.flex.h-8.w-8.rounded-lg.bg-orange-500,
[class*='bg-gradient-to-br'][class*='from-orange-400'] {
  background-color: #ea580c !important;
  background-image: none !important;
}

.bg-gradient-to-br.from-green-500.to-green-600,
.from-green-500.to-green-600.bg-gradient-to-br,
.flex.h-8.w-8.rounded-lg.bg-green-600,
[class*='bg-gradient-to-br'][class*='from-green-500'] {
  background-color: #16a34a !important;
  background-image: none !important;
}

.flex.h-8.w-8.rounded-lg.bg-blue-600,
[class*='bg-gradient-to-br'][class*='from-blue-500'] {
  background-color: #2563eb !important;
  background-image: none !important;
}

.bg-gradient-to-br.from-rose-500.to-pink-600,
.from-rose-500.to-pink-600.bg-gradient-to-br,
.flex.h-8.w-8.rounded-lg.bg-rose-600,
[class*='bg-gradient-to-br'][class*='from-rose-500'],
[class*='bg-gradient-to-br'][class*='to-pink-600'] {
  background-color: #e11d48 !important;
  background-image: none !important;
}

.bg-gradient-to-br.from-gray-500.to-gray-600,
.from-gray-500.to-gray-600.bg-gradient-to-br,
.flex.h-8.w-8.rounded-lg.bg-gray-600,
[class*='bg-gradient-to-br'][class*='from-gray-500'] {
  background-color: #4b5563 !important;
  background-image: none !important;
}

.from-primary-400.to-primary-600.bg-gradient-to-br,
[class*='bg-gradient-to-br'][class*='from-primary-400'] {
  background-color: #0d9488 !important;
  background-image: none !important;
}

.flex.h-8.w-8.rounded-lg span.text-white,
.flex.h-8.w-8.rounded-lg .font-bold.text-white,
.flex.h-12.w-12 .text-white {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
}

/* 厂商标签行：Claude / GPT 等文字 */
html:not(.dark) .flex.flex-wrap.items-center.justify-center.gap-4 .text-sm.font-medium.text-gray-700,
html:not(.dark) span.text-sm.font-medium.text-gray-700 {
  color: #1f2937 !important;
  font-weight: 600 !important;
}

html.dark .flex.flex-wrap.items-center.justify-center.gap-4 span.text-sm.font-medium,
html.dark span.text-sm.font-medium.dark\:text-dark-200 {
  color: #e2e8f0 !important;
  font-weight: 600 !important;
}

html.dark .mb-8.text-center > p.text-sm,
html.dark footer .text-sm.text-gray-500 {
  color: #94a3b8 !important;
}

html.dark .rounded.bg-primary-100.text-primary-600,
html.dark .text-primary-600.dark\:text-primary-400 {
  color: #5eead4 !important;
  background-color: rgba(13, 148, 136, 0.25) !important;
}
