/* Dark Mode — opt-in via <html data-theme="dark"> (toggle persisted in localStorage).
   Default (no attribute) leaves the original light theme untouched. Uses attribute-scoped
   overrides + CSS variables so it survives a future Bootstrap 5 migration. */
:root[data-theme="dark"]{
	--dm-bg:#15191c;
	--dm-surface:#1e2428;
	--dm-surface-2:#262d32;
	--dm-text:#e6e6e6;
	--dm-muted:#a8b0b6;
	--dm-border:#363d43;
	--dm-link:#5cb3d6;
}

/* Base surfaces */
[data-theme="dark"] body{background:var(--dm-bg) !important;color:var(--dm-text);}
[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-white{background-color:var(--dm-surface) !important;color:var(--dm-text);}
[data-theme="dark"] .box-style{border-color:var(--dm-border) !important;}
[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .popover,
[data-theme="dark"] .toast{background-color:var(--dm-surface);color:var(--dm-text);border-color:var(--dm-border);}
[data-theme="dark"] .dropdown-item{color:var(--dm-text);}
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus{background-color:var(--dm-surface-2);color:#fff;}

/* Text helpers */
[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary{color:var(--dm-text) !important;}
[data-theme="dark"] a:not(.btn):not(.dropdown-item):not(.nav-link):not(.page-link){color:var(--dm-link);}
[data-theme="dark"] hr{border-color:var(--dm-border);background:var(--dm-border);}

/* Tables */
[data-theme="dark"] .table{color:var(--dm-text);}
[data-theme="dark"] .table td,
[data-theme="dark"] .table th{border-color:var(--dm-border);}
[data-theme="dark"] .table thead th{border-color:var(--dm-border);}
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd){background-color:rgba(255,255,255,.03);}
[data-theme="dark"] .table-hover tbody tr:hover{background-color:rgba(255,255,255,.06);color:var(--dm-text);}

/* Forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text{background-color:var(--dm-surface-2);color:var(--dm-text);border-color:#3a4248;}
[data-theme="dark"] .form-select{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23adb5bd' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");}
[data-theme="dark"] .form-control:focus{background-color:var(--dm-surface-2);color:#fff;}
[data-theme="dark"] .form-control::placeholder{color:#8a9096;}
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-control[readonly]{background-color:#20262a;}

/* Borders / dividers */
[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-left,
[data-theme="dark"] .border-right{border-color:var(--dm-border) !important;}

/* Modals / close button */
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer{border-color:var(--dm-border);}
[data-theme="dark"] .modal-login .modal-footer{background:var(--dm-surface-2);border-color:#3a4248;}
[data-theme="dark"] .close{color:var(--dm-text);text-shadow:none;opacity:.8;}
[data-theme="dark"] .close:hover{color:#fff;}
[data-theme="dark"] .btn-close{filter:invert(1) grayscale(100%) brightness(200%);}

/* Theme-specific affiliate / membership blocks */
[data-theme="dark"] #aff-block,
[data-theme="dark"] #aff-banner{background-color:var(--dm-surface);color:#bfe3ee;border-color:#2a6f87;}
[data-theme="dark"] #aff-block .aff_block_p2{background-color:#173b46;color:#bfe3ee;border-color:#2a6f87;}
[data-theme="dark"] .membership-block{background:var(--dm-surface-2);color:var(--dm-text);border-color:#3a4248;}
[data-theme="dark"] .winner_block .inside{background:var(--dm-surface-2);color:var(--dm-text);text-shadow:none;border-color:var(--dm-border);}

/* Light utility backgrounds used as panels */
[data-theme="dark"] .bg-secondary{background-color:var(--dm-surface-2) !important;}

/* Theme boxes with hard-coded light bg + dark text (would be dark-on-dark otherwise) */
[data-theme="dark"] #grey-box .infobox,
[data-theme="dark"] #sidebar-block .user,
[data-theme="dark"] .price_block,
[data-theme="dark"] .box{background:var(--dm-surface-2) !important;color:var(--dm-text) !important;border-color:var(--dm-border) !important;}

/* Bootstrap alerts → dark-friendly (BS5 alerts are light bg + dark text) */
[data-theme="dark"] .alert-success{color:#79dcab;background-color:#10241b;border-color:#1c3b2c;}
[data-theme="dark"] .alert-danger{color:#f1959e;background-color:#2a1216;border-color:#4a1f25;}
[data-theme="dark"] .alert-warning{color:#ffd97a;background-color:#2a2410;border-color:#4a401c;}
[data-theme="dark"] .alert-info{color:#86d6e8;background-color:#0e2429;border-color:#1c3f48;}
[data-theme="dark"] .alert-primary{color:#8bb4f0;background-color:#0d1b2e;border-color:#1c3354;}
[data-theme="dark"] .alert-secondary,[data-theme="dark"] .alert-light{color:#c3c8cd;background-color:#1d2125;border-color:#363d43;}
[data-theme="dark"] .alert .close,[data-theme="dark"] .alert .btn-close{filter:none;}

/* Light badges / labels / table-light → dark */
[data-theme="dark"] .text-bg-light,
[data-theme="dark"] .badge.bg-light{color:var(--dm-text) !important;background-color:var(--dm-surface-2) !important;}
[data-theme="dark"] .table-light,
[data-theme="dark"] .table-light>td,
[data-theme="dark"] .table-light>th,
[data-theme="dark"] .table .table-light{color:var(--dm-text);background-color:var(--dm-surface-2);}

/* Safety net: BS dark-text utilities → light in dark mode */
[data-theme="dark"] .text-black,
[data-theme="dark"] .text-body,
[data-theme="dark"] .text-black-50{color:var(--dm-text) !important;}

/* Floating toggle button */
#darkModeToggle{position:fixed;bottom:18px;right:18px;z-index:1050;width:44px;height:44px;
	border-radius:50%;border:none;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#433c41;color:#fff;
	display:flex;align-items:center;justify-content:center;font-size:18px;cursor:pointer;transition:transform .15s ease;}
#darkModeToggle:hover{transform:scale(1.08);}
[data-theme="dark"] #darkModeToggle{background:#f0c040;color:#15191c;}

/* ===== Audit pass 2: theme.css hard-coded light surfaces ===== */
/* Sidebar widgets (block / level / user logout / server-time footer / stats) */
[data-theme="dark"] #sidebar-block .block,
[data-theme="dark"] #sidebar-block .level{background:var(--dm-surface-2) !important;color:var(--dm-text) !important;}
[data-theme="dark"] #sidebar-block .block .data,
[data-theme="dark"] #sidebar-block .level a,
[data-theme="dark"] #sidebar-block .user .logout a{color:var(--dm-text) !important;}
[data-theme="dark"] #sidebar-block .user .info,
[data-theme="dark"] #sidebar-block .user .info span{text-shadow:none !important;}
[data-theme="dark"] #sidebar-footer{background:var(--dm-surface) !important;color:var(--dm-text) !important;border-color:var(--dm-border) !important;}
[data-theme="dark"] .sidebar-stats{background:var(--dm-surface) !important;color:var(--dm-text) !important;border-color:var(--dm-border) !important;}

/* PTC website cards (advertise / ptc listings) */
[data-theme="dark"] .website_block{background:var(--dm-surface) !important;color:var(--dm-text) !important;border-color:var(--dm-border) !important;}
[data-theme="dark"] .website_block .reward,
[data-theme="dark"] .website_block .time{background:var(--dm-surface-2) !important;color:var(--dm-text) !important;border-color:var(--dm-border) !important;}

/* Code blocks */
[data-theme="dark"] pre{background:var(--dm-surface-2) !important;color:var(--dm-text) !important;border-color:var(--dm-border) !important;}

/* "OR" divider tagline */
[data-theme="dark"] .tagline{border-color:var(--dm-border);}
[data-theme="dark"] .tagline span{background:var(--dm-surface) !important;color:var(--dm-muted) !important;border-color:var(--dm-border) !important;}

/* Blog comments */
[data-theme="dark"] .blog_comment,
[data-theme="dark"] .comments_wrap{background:var(--dm-surface) !important;color:var(--dm-text) !important;border-color:var(--dm-border) !important;}
[data-theme="dark"] .comments_wrap .content_text,
[data-theme="dark"] .blog_comment p{color:var(--dm-text) !important;}

/* Login modal body text + footer link */
[data-theme="dark"] .modal-login{color:var(--dm-text);}
[data-theme="dark"] .modal-login .modal-footer a{color:var(--dm-link);}

/* WebMinePool mining widget (inline light bg) */
[data-theme="dark"] #wmp-container{background:var(--dm-surface-2) !important;}

/* White hairline borders → dark */
[data-theme="dark"] .bottom-border,
[data-theme="dark"] .top-border,
[data-theme="dark"] .lotteryTop,
[data-theme="dark"] .aff_url_block{border-color:var(--dm-border) !important;}

/* Progress bars (level "X claims to level Y", mining) — grey track + overlaid text */
[data-theme="dark"] .progress{background-color:var(--dm-surface-2);}
[data-theme="dark"] .progress small,
[data-theme="dark"] .progress .position-absolute{color:var(--dm-text);}
