/* ============================================================
   NROASIKO - Dark Mode (kích hoạt bằng class "dark" trên <html>)
   Nạp SAU theme.css và sau <style> nội trang.
   ============================================================ */

html.dark {
  color-scheme: dark;

  --bg: #0b1220;
  --bg-soft: #16203a;
  --surface: #131c30;
  --surface-warm: #1b2136;
  --text: #c7d2e0;
  --heading: #f1f5f9;
  --muted: #93a1b5;
  --line: #26324a;
  --line-brand: rgba(249, 115, 22, 0.32);

  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, 0.65);
}

/* ============================================================
   BASE
   ============================================================ */
html.dark body.site-body,
html.dark body {
  background-color: var(--bg);
  background-image: radial-gradient(1200px 600px at 50% -10%, #1a2440 0%, transparent 60%);
  background-repeat: no-repeat;
  color: var(--text);
}
html.dark .site-container { color: var(--text); }
html.dark ::selection { background: rgba(249, 115, 22, 0.4); color: #fff; }

/* ============================================================
   HEADER / NAV / TICKER
   ============================================================ */
html.dark .site-header {
  background: rgba(15, 21, 36, 0.9);
  border-bottom-color: var(--line-brand);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
html.dark .site-nav a { color: var(--text); }
html.dark .site-nav a:hover,
html.dark .site-nav a.active { color: #fb923c; background: rgba(249, 115, 22, 0.12); }

html.dark .btn-login { color: var(--text); background: #1e293b; border-color: #334155; }
html.dark .btn-login:hover { color: #fb923c; background: #253449; }

html.dark .user-pill { background: var(--surface); border-color: rgba(249, 115, 22, 0.45); }
html.dark .user-pill img { background: var(--bg-soft); }
html.dark .user-pill .u-name { color: var(--heading); }
html.dark .user-pill .chev { color: #64748b; }

html.dark .user-dropdown { background: var(--surface); border-color: var(--line); box-shadow: 0 22px 44px -14px rgba(0, 0, 0, 0.7); }
html.dark .user-dropdown .ud-head { color: var(--muted); border-bottom-color: var(--line); }
html.dark .user-dropdown a { color: var(--text); }
html.dark .user-dropdown a:hover { background: rgba(249, 115, 22, 0.12); color: #fb923c; }
html.dark .user-dropdown .u-danger { color: #fb7185; }
html.dark .user-dropdown .u-danger:hover { background: rgba(225, 29, 72, 0.14); color: #fda4af; }
html.dark .user-dropdown .ud-sep { background: var(--line); }

html.dark .site-toggle { background: #1e293b; border-color: #334155; color: var(--heading); }

html.dark .site-mobile-nav { background: var(--surface); }
html.dark .site-mobile-nav a { color: var(--text); }
html.dark .site-mobile-nav a:hover,
html.dark .site-mobile-nav a.active { background: rgba(249, 115, 22, 0.12); color: #fb923c; }
html.dark .site-mobile-nav .m-user { background: rgba(249, 115, 22, 0.1); border-color: rgba(249, 115, 22, 0.4); }
html.dark .site-mobile-nav .m-user img { background: var(--surface); }
html.dark .site-mobile-nav .m-user .m-name { color: var(--heading); }
html.dark .site-mobile-nav .m-user .m-logout { background: rgba(225, 29, 72, 0.14); border-color: rgba(225, 29, 72, 0.35); color: #fb7185; }
html.dark .site-mobile-nav .m-auth { border-top-color: var(--line); }
html.dark .site-mobile-nav .m-auth a.m-login { background: #1e293b; color: var(--text); border-color: #334155; }

html.dark .site-ticker {
  background: linear-gradient(90deg, rgba(27, 33, 54, 0.95), #1e293b, rgba(27, 33, 54, 0.95));
  border-bottom-color: rgba(249, 115, 22, 0.28);
  box-shadow: none;
}
html.dark .site-ticker a.ticker-link { color: var(--heading); }
html.dark .site-ticker a.ticker-link:hover { color: #fb923c; }
html.dark .site-ticker .ticker-time { color: var(--muted); }
html.dark .site-ticker .ticker-cta { color: #fdba74; }
html.dark .site-ticker .ticker-cta:hover { color: #ffedd5; }

/* ============================================================
   PANELS / SECTIONS
   ============================================================ */
html.dark .panel-warm { background: linear-gradient(160deg, var(--surface-warm), var(--surface)); }
html.dark .panel-head .ph-icon,
html.dark .section-title .st-icon { background: rgba(249, 115, 22, 0.16); color: #fdba74; }
html.dark .reward-item:hover { background: var(--surface); }
html.dark .reward-price { background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }
html.dark .bonus-section { background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(245, 158, 11, 0.08)); }
html.dark .rail-node-dot { background: var(--bg-soft); }
html.dark .rail-node.done .rail-node-dot { background: rgba(16, 185, 129, 0.16); }
html.dark .milestone-card.is-mythic { background: linear-gradient(180deg, rgba(251, 191, 36, 0.12), var(--surface)); }

/* Rarity badges */
html.dark .rar-common { background: #1e293b; color: #cbd5e1; }
html.dark .rar-rare { background: rgba(14, 165, 233, 0.18); color: #7dd3fc; }
html.dark .rar-epic { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
html.dark .rar-legend { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

/* ============================================================
   TABLES / LEGACY
   ============================================================ */
html.dark .table thead th { background: rgba(249, 115, 22, 0.12); color: var(--heading); }
html.dark .table tbody tr:hover { background: rgba(249, 115, 22, 0.08); }
html.dark .topic_name,
html.dark .alert-frame { background: rgba(249, 115, 22, 0.08); }
html.dark .card { background: var(--surface); }
html.dark .card-header { background: rgba(249, 115, 22, 0.12); color: var(--heading); }
html.dark .forum-post-info { background: var(--bg-soft); }

/* ============================================================
   FORMS / BUTTONS
   ============================================================ */
html.dark .form-control,
html.dark .form-select,
html.dark textarea.form-control { background: #0f1729; color: var(--text); border-color: var(--line); }
html.dark .form-control::placeholder { color: #64748b; }
html.dark .input-group-text { background: #1e293b; color: var(--muted); border-color: var(--line); }
html.dark .btn-secondary { background: #1e293b !important; border-color: #334155 !important; color: var(--text) !important; }

/* ============================================================
   ALERTS / BADGES
   ============================================================ */
html.dark .alert-danger { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
html.dark .alert-success { background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }
html.dark .alert-warning { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }
html.dark .alert-info { background: rgba(59, 130, 246, 0.14); border-color: rgba(59, 130, 246, 0.4); color: #93c5fd; }
html.dark .badge-pill--safe { background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }
html.dark .badge-pill--warn { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }

/* ============================================================
   CHIPS / EDITOR / PAGINATION
   ============================================================ */
html.dark .chip-tabs .chip { background: var(--surface); color: var(--text); }
html.dark .editor-box { background: var(--surface); }
html.dark .editor-toolbar .tool-btn { background: var(--surface); color: #fdba74; }
html.dark .pagination a { background: var(--surface); color: var(--text); }
html.dark .pagination a:hover { background: rgba(249, 115, 22, 0.12); }

/* ============================================================
   index.php inline (glass panels, body)
   ============================================================ */
html.dark .glass-panel {
  background: rgba(19, 28, 48, 0.85) !important;
  border-color: var(--line-brand) !important;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5) !important;
}
html.dark .glass-panel-highlight {
  background: linear-gradient(135deg, rgba(27, 33, 54, 0.95) 0%, rgba(19, 28, 48, 0.98) 100%) !important;
  border-color: rgba(249, 115, 22, 0.4) !important;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5) !important;
}

/* ============================================================
   TAILWIND UTILITIES (index.php) — remap light -> dark
   ============================================================ */
html.dark .bg-\[\#f8fafc\] { background-color: var(--bg) !important; }
html.dark .bg-white,
html.dark .bg-white\/85,
html.dark .bg-white\/90,
html.dark .bg-white\/95 { background-color: var(--surface) !important; }
html.dark .bg-slate-50,
html.dark .bg-slate-100,
html.dark .bg-slate-100\/70 { background-color: var(--bg-soft) !important; }

html.dark .bg-orange-50 { background-color: rgba(249, 115, 22, 0.1) !important; }
html.dark .bg-orange-100 { background-color: rgba(249, 115, 22, 0.16) !important; }
html.dark .bg-amber-50 { background-color: rgba(251, 191, 36, 0.1) !important; }
html.dark .bg-amber-100 { background-color: rgba(251, 191, 36, 0.16) !important; }
html.dark .bg-cyan-50 { background-color: rgba(6, 182, 212, 0.1) !important; }
html.dark .bg-cyan-100 { background-color: rgba(6, 182, 212, 0.16) !important; }
html.dark .bg-emerald-50 { background-color: rgba(16, 185, 129, 0.1) !important; }
html.dark .bg-emerald-100 { background-color: rgba(16, 185, 129, 0.16) !important; }
html.dark .bg-red-50 { background-color: rgba(239, 68, 68, 0.1) !important; }
html.dark .bg-red-100 { background-color: rgba(239, 68, 68, 0.16) !important; }
html.dark .bg-blue-50 { background-color: rgba(59, 130, 246, 0.1) !important; }

html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-300,
html.dark .border-white\/90 { border-color: var(--line) !important; }

html.dark .text-slate-950,
html.dark .text-slate-900,
html.dark .text-slate-800 { color: var(--heading) !important; }
html.dark .text-slate-700,
html.dark .text-slate-600 { color: var(--text) !important; }
html.dark .text-slate-500,
html.dark .text-slate-400,
html.dark .text-slate-300 { color: var(--muted) !important; }

html.dark .text-orange-600,
html.dark .text-orange-700,
html.dark .text-orange-800 { color: #fb923c !important; }
html.dark .text-amber-600,
html.dark .text-amber-700,
html.dark .text-amber-800 { color: #fcd34d !important; }
html.dark .text-cyan-600,
html.dark .text-cyan-700 { color: #22d3ee !important; }
html.dark .text-emerald-600,
html.dark .text-emerald-700 { color: #34d399 !important; }
html.dark .text-blue-600,
html.dark .text-blue-700 { color: #60a5fa !important; }
html.dark .text-red-600 { color: #f87171 !important; }

/* gradient stops dùng cho khung avatar bài ghim */
html.dark .from-amber-100 { --tw-gradient-from: #1e293b var(--tw-gradient-from-position); --tw-gradient-to: rgba(30, 41, 59, 0) var(--tw-gradient-to-position); }
html.dark .to-orange-200 { --tw-gradient-to: #1b2136 var(--tw-gradient-to-position); }
html.dark .bg-\[\#0b1020\] { background-color: var(--surface); }

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #334155;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .18s;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand-strong); }
.theme-toggle .icon-moon { display: none; }
html.dark .theme-toggle { background: #1e293b; border-color: #334155; color: #fcd34d; }
html.dark .theme-toggle:hover { border-color: var(--brand); color: #fdba74; }
html.dark .theme-toggle .icon-sun { display: none; }
html.dark .theme-toggle .icon-moon { display: inline; }
@media (max-width: 992px) {
  .theme-toggle { width: 40px; height: 40px; }
}

/* Scrollbar (WebKit) */
html.dark ::-webkit-scrollbar { width: 12px; height: 12px; }
html.dark ::-webkit-scrollbar-track { background: #0f1729; }
html.dark ::-webkit-scrollbar-thumb { background: #2a3855; border: 3px solid #0f1729; border-radius: 999px; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #3a4a6b; }

/* ============================================================
   BOOTSTRAP HELPERS
   ============================================================ */
html.dark .bg-light { background-color: var(--bg-soft) !important; }
html.dark .text-dark { color: var(--heading) !important; }
html.dark .text-secondary { color: var(--muted) !important; }
html.dark .text-muted { color: var(--muted) !important; }
html.dark .text-success { color: #34d399 !important; }
html.dark .text-primary { color: #60a5fa !important; }
html.dark .text-danger { color: #f87171 !important; }
html.dark .text-warning { color: #fcd34d !important; }
html.dark .text-info { color: #22d3ee !important; }

/* ============================================================
   PAGE: atmbank.php (Ủng hộ)
   ============================================================ */
html.dark .atm-container { background: var(--surface); border-color: var(--line); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5); }
html.dark .step-card { background: var(--surface); border-color: var(--line-brand); }
html.dark .step-title { color: #fdba74; }
html.dark .qr-box { background: #fff; border-color: var(--brand); }
html.dark .info-list-item { background: var(--bg-soft) !important; border-color: var(--line) !important; }
html.dark .highlight-content { background: rgba(225, 29, 72, 0.1); border-color: rgba(225, 29, 72, 0.45); }
html.dark .status-polling { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }
html.dark .table-custom th { background: rgba(249, 115, 22, 0.12); color: #fdba74; border-bottom-color: var(--line-brand); }
html.dark .atm-tabs { background: var(--bg-soft); border-bottom-color: var(--line); }
html.dark .atm-tab { color: var(--muted); }
html.dark .atm-tab.active { background: var(--surface-warm); color: #fdba74; border-bottom-color: #fdba74; }
html.dark .atm-tab.active i { color: #fdba74; }
html.dark .atm-tab:hover:not(.active) { background: rgba(249, 115, 22, 0.12); color: #fb923c; }
html.dark #tab-manual.active { background: var(--surface-warm); color: #c4b5fd; border-bottom-color: #a78bfa; }
html.dark #tab-manual.active i { color: #c4b5fd; }
html.dark #tab-manual:hover:not(.active) { background: rgba(124, 58, 237, 0.12); color: #c4b5fd; }
html.dark #tab-donate.active { background: var(--surface-warm); color: #fbbf24; border-bottom-color: #f59e0b; }
html.dark #tab-donate.active i { color: #fbbf24; }
html.dark #tab-donate:hover:not(.active) { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
html.dark .btn-amount-single { background: var(--bg-soft); border-color: var(--brand); color: #fdba74; }
html.dark .copy-btn { background: rgba(16, 185, 129, 0.16); border-color: rgba(16, 185, 129, 0.4); color: #6ee7b7; }
html.dark .copy-btn-danger { background: rgba(225, 29, 72, 0.16); border-color: rgba(225, 29, 72, 0.4); color: #fda4af; }
/* tab thủ công: vài khối inline */
html.dark #panel-manual div[style*="#f5f3ff"] { background: rgba(124, 58, 237, 0.12) !important; }
html.dark #panel-manual div[style*="#ecfdf5"] { background: rgba(16, 185, 129, 0.14) !important; }
html.dark #qrManualContent { color: #c4b5fd !important; }
html.dark #panel-manual li { color: var(--text); }

/* ============================================================
   PAGE: bangxephang.php (BXH)
   ============================================================ */
html.dark .bxh-v2,
html.dark .bxh-lock-card { background: var(--surface); border-color: var(--line); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); }
html.dark .bxh-hero-title { color: var(--heading); text-shadow: none; }
html.dark .bxh-hero-tag { background: var(--bg-soft); border-color: var(--line); }
html.dark .bxh-nav { background: var(--bg-soft); border-color: var(--line); }
html.dark .bxh-tab-btn { color: var(--text); }
html.dark .bxh-tab-btn:hover { color: var(--heading); background: rgba(255, 255, 255, 0.06); }
html.dark .bxh-subtab-btn { background: var(--bg-soft); color: #fdba74; border-color: var(--line); }
html.dark .bxh-subtab-btn:hover { background: rgba(249, 115, 22, 0.16); color: #ffedd5; }
html.dark .podium-card { background: var(--surface); border-color: var(--line); }
html.dark .podium-card--1 { background: linear-gradient(180deg, var(--surface), var(--surface-warm)); }
html.dark .podium-card--2,
html.dark .podium-card--3 { background: var(--surface); }
html.dark .podium-name { color: var(--heading); }
html.dark .podium-card--1 .podium-name { color: #fbbf24; }
html.dark .podium-details { background: rgba(255, 255, 255, 0.06); color: var(--muted); border-color: rgba(255, 255, 255, 0.08); }
html.dark .podium-details b { color: var(--heading); }
html.dark .bxh-section-title { color: var(--heading); }
html.dark .bxh-section-desc { color: var(--muted); }
html.dark .bxh-row { background: var(--bg-soft); border-color: var(--line); }
html.dark .bxh-row:hover { background: var(--surface); border-color: var(--rose); }
html.dark .bxh-rank--other { background: #1e293b; color: #cbd5e1; border-color: var(--line); }
html.dark .bxh-player-avatar { border-color: var(--line); }
html.dark .bxh-player-name { color: var(--heading); }
html.dark .bxh-power-bar-bg { background: #1e293b; }
html.dark .bxh-power-split { color: var(--muted); }
html.dark .bxh-lock-title { color: #fdba74; }
html.dark .bxh-lock-desc { color: var(--muted); }
html.dark .bxh-lock-alert { background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }
