/* 深色主题 — 通过 html[data-theme="dark"] 切换 */
html[data-theme="dark"] {
  --primary: #4096ff;
  --primary-dark: #1677ff;
  --primary-light: rgba(22, 119, 255, 0.15);
  --text: #e8edf5;
  --text-secondary: #a8b4c8;
  --text-muted: #7a879c;
  --border: #2a3344;
  --bg: #0a0e17;
  --card: #11161f;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

html[data-theme="dark"] body.portal-body {
  background: var(--bg);
}

html[data-theme="dark"] .portal-bg {
  background:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(22, 119, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 85% 10%, rgba(0, 180, 42, 0.06), transparent 50%),
    linear-gradient(180deg, #0c111a 0%, var(--bg) 100%);
}

html[data-theme="dark"] .portal-header {
  background: rgba(10, 14, 23, 0.92);
  border-bottom-color: rgba(42, 51, 68, 0.9);
}

html[data-theme="dark"] .portal-search-box {
  background: #1a2230;
}

html[data-theme="dark"] .portal-search:focus-within .portal-search-box {
  background: #141c28;
}

html[data-theme="dark"] .portal-search input {
  color: #e8ecf1;
}

html[data-theme="dark"] .portal-search input::placeholder {
  color: #6b7785;
}

html[data-theme="dark"] .portal-btn-outline,
html[data-theme="dark"] .portal-menu-toggle,
html[data-theme="dark"] .portal-user-btn {
  background: #141c28;
  border-color: var(--border);
  color: var(--text-secondary);
}

html[data-theme="dark"] .portal-footer {
  background: #080c14;
  border-top-color: var(--border);
}

html[data-theme="dark"] .site-card,
html[data-theme="dark"] .site-icon-card,
html[data-theme="dark"] .page-panel,
html[data-theme="dark"] .news-list,
html[data-theme="dark"] .news-article,
html[data-theme="dark"] .form-page,
html[data-theme="dark"] .vendor-card,
html[data-theme="dark"] .vendor-wall-item,
html[data-theme="dark"] .compare-table-wrap,
html[data-theme="dark"] .home-panel,
html[data-theme="dark"] .home-side-card,
html[data-theme="dark"] .home-quickdock,
html[data-theme="dark"] .info-card {
  background: var(--card);
  border-color: var(--border);
}

html[data-theme="dark"] .site-card .card-logo,
html[data-theme="dark"] .site-icon-card-logo img {
  background: #1a2230;
  border-color: var(--border);
}

html[data-theme="dark"] .card-fav-btn,
html[data-theme="dark"] .detail-fav-btn {
  background: rgba(17, 22, 31, 0.95);
  border-color: var(--border);
}

html[data-theme="dark"] .tag-chip {
  background: #141c28;
  border-color: var(--border);
  color: var(--text-secondary);
}

html[data-theme="dark"] .tag-chip:hover,
html[data-theme="dark"] .tag-chip.active {
  background: var(--primary-light);
  color: var(--primary);
}

html[data-theme="dark"] .home-hero {
  background: linear-gradient(135deg, #0d1b33 0%, #1677ff 40%, #0a1628 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"] .home-hero-search-box {
  background: #141c28;
}

html[data-theme="dark"] .home-hero-search-box input {
  color: #e8ecf1;
  caret-color: #69b1ff;
}

html[data-theme="dark"] .home-hero-search-box input::placeholder {
  color: #6b7785;
}

html[data-theme="dark"] .home-hero-search-box input:-webkit-autofill,
html[data-theme="dark"] .home-hero-search-box input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e8ecf1;
  box-shadow: 0 0 0 1000px #141c28 inset;
}

html[data-theme="dark"] .search-suggest-panel {
  background: #141c28;
  border-color: var(--border);
}

html[data-theme="dark"] .compare-table th {
  background: #141c28;
}

html[data-theme="dark"] .compare-table tbody tr:hover {
  background: rgba(22, 119, 255, 0.08);
}

html[data-theme="dark"] .about-card {
  background: #141c28;
}

html[data-theme="dark"] .apply-cta {
  background: linear-gradient(135deg, #0e1622, #11161f);
  border-color: rgba(22, 119, 255, 0.25);
}

html[data-theme="dark"] .user-drawer {
  background: #0e1622;
  border-left-color: var(--border);
}

html[data-theme="dark"] .user-drawer-mask {
  background: rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .rank-num {
  background: #1a2230;
  color: var(--text-muted);
}

html[data-theme="dark"] .home-keyword {
  background: #1a2230;
}

html[data-theme="dark"] .form-page input,
html[data-theme="dark"] .form-page select,
html[data-theme="dark"] .form-page textarea {
  background: #141c28;
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="dark"] .badge-custom {
  background: var(--primary-light);
}

html[data-theme="dark"] .portal-theme-btn.is-dark .fa-sun { display: inline; }
html[data-theme="dark"] .portal-theme-btn.is-dark .fa-moon { display: none; }

.portal-theme-btn .fa-sun { display: none; }
.portal-theme-btn .fa-moon { display: inline; }

html[data-theme="dark"] .news-cat-1 { background: rgba(22,119,255,0.2); color: #69b1ff; }
html[data-theme="dark"] .news-cat-2 { background: rgba(114,46,209,0.2); color: #b37feb; }
html[data-theme="dark"] .news-cat-3 { background: rgba(0,180,42,0.2); color: #7be188; }
html[data-theme="dark"] .home-ad-top-item {
  background: var(--card);
  border-color: var(--border);
}

html[data-theme="dark"] .home-side-ads {
  background: var(--card);
}
