/* ==========================================================================
   TOP1SUB - COMPREHENSIVE GLOBAL DARK MODE PARITY
   Covers every sibling SPA view (#view-rule, #view-massorder, #view-affiliate,
   #view-ticket, #view-recharge, #view-orders, #view-transactions, #view-profile,
   #view-utilities), dropdowns, modals (#dttCurrencyModal, #dtt-invoice-overlay,
   #modal-create-ticket, #modal-view-ticket), SweetAlert2 popups & Chibi bubble.
   Applies symmetrically to both body.dark-mode and [data-theme="dark"].
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BOOTSTRAP LIGHT UTILITY OVERRIDES INSIDE WORKSPACE & MODALS
   -------------------------------------------------------------------------- */
body.dark-mode #mainContentCard .bg-white,
[data-theme="dark"] #mainContentCard .bg-white,
body.dark-mode .modal-content.bg-white,
[data-theme="dark"] .modal-content.bg-white {
    background-color: #111827 !important;
    border-color: #1e293b !important;
    color: #f1f5f9 !important;
}

body.dark-mode #mainContentCard .bg-light,
[data-theme="dark"] #mainContentCard .bg-light,
body.dark-mode .modal-content .bg-light,
[data-theme="dark"] .modal-content .bg-light {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #mainContentCard .text-dark,
[data-theme="dark"] #mainContentCard .text-dark,
body.dark-mode .modal-content .text-dark,
[data-theme="dark"] .modal-content .text-dark,
body.dark-mode #mainContentCard .text-slate-800,
[data-theme="dark"] #mainContentCard .text-slate-800,
body.dark-mode #mainContentCard .text-slate-700,
[data-theme="dark"] #mainContentCard .text-slate-700 {
    color: #f1f5f9 !important;
}

body.dark-mode #mainContentCard .text-muted,
[data-theme="dark"] #mainContentCard .text-muted,
body.dark-mode #mainContentCard .text-secondary,
[data-theme="dark"] #mainContentCard .text-secondary,
body.dark-mode .modal-content .text-muted,
[data-theme="dark"] .modal-content .text-muted {
    color: #94a3b8 !important;
}

body.dark-mode #mainContentCard .border,
[data-theme="dark"] #mainContentCard .border,
body.dark-mode #mainContentCard .border-top,
[data-theme="dark"] #mainContentCard .border-top,
body.dark-mode #mainContentCard .border-bottom,
[data-theme="dark"] #mainContentCard .border-bottom,
body.dark-mode #mainContentCard .border-light-subtle,
[data-theme="dark"] #mainContentCard .border-light-subtle {
    border-color: #1e293b !important;
}

body.dark-mode #mainContentCard .form-control,
[data-theme="dark"] #mainContentCard .form-control,
body.dark-mode #mainContentCard .form-select,
[data-theme="dark"] #mainContentCard .form-select,
body.dark-mode #mainContentCard .input-custom,
[data-theme="dark"] #mainContentCard .input-custom,
body.dark-mode #mainContentCard .input-link-3d,
[data-theme="dark"] #mainContentCard .input-link-3d,
body.dark-mode .modal-content .form-control,
[data-theme="dark"] .modal-content .form-control,
body.dark-mode .modal-content .form-select,
[data-theme="dark"] .modal-content .form-select {
    background-color: #0b1120 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode #mainContentCard .form-control::placeholder,
[data-theme="dark"] #mainContentCard .form-control::placeholder,
body.dark-mode #mainContentCard .input-custom::placeholder,
[data-theme="dark"] #mainContentCard .input-custom::placeholder,
body.dark-mode .modal-content .form-control::placeholder,
[data-theme="dark"] .modal-content .form-control::placeholder {
    color: #64748b !important;
}

body.dark-mode #mainContentCard .form-control:focus,
[data-theme="dark"] #mainContentCard .form-control:focus,
body.dark-mode #mainContentCard .form-select:focus,
[data-theme="dark"] #mainContentCard .form-select:focus,
body.dark-mode .modal-content .form-control:focus,
[data-theme="dark"] .modal-content .form-control:focus,
body.dark-mode .modal-content .form-select:focus,
[data-theme="dark"] .modal-content .form-select:focus {
    background-color: #0b1120 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

body.dark-mode #mainContentCard .btn-light,
[data-theme="dark"] #mainContentCard .btn-light,
body.dark-mode .modal-content .btn-light,
[data-theme="dark"] .modal-content .btn-light {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #mainContentCard .btn-light:hover,
[data-theme="dark"] #mainContentCard .btn-light:hover,
body.dark-mode .modal-content .btn-light:hover,
[data-theme="dark"] .modal-content .btn-light:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

body.dark-mode .modal-content .btn-close,
[data-theme="dark"] .modal-content .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%) !important;
}

/* --------------------------------------------------------------------------
   2. USER PROFILE DROPDOWN & MOBILE NOTIFICATION DROPDOWN
   -------------------------------------------------------------------------- */
body.dark-mode .dtt-profile-dropdown,
[data-theme="dark"] .dtt-profile-dropdown {
    background: #111827 !important;
    border-color: #334155 !important;
    box-shadow: 0 18px 40px -10px rgba(0, 0, 0, 0.72) !important;
}

body.dark-mode .dtt-profile-dropdown .text-dark,
[data-theme="dark"] .dtt-profile-dropdown .text-dark {
    color: #f8fafc !important;
}

body.dark-mode .dtt-dropdown-dashed-divider,
[data-theme="dark"] .dtt-dropdown-dashed-divider {
    border-top-color: #334155 !important;
}

body.dark-mode .dtt-user-menu-item,
[data-theme="dark"] .dtt-user-menu-item {
    color: #cbd5e1 !important;
}

body.dark-mode .dtt-user-menu-item:hover,
[data-theme="dark"] .dtt-user-menu-item:hover {
    background-color: #1e293b !important;
    color: #ffffff !important;
}

body.dark-mode .dtt-user-menu-item:hover .dtt-user-menu-icon,
[data-theme="dark"] .dtt-user-menu-item:hover .dtt-user-menu-icon {
    color: #60a5fa !important;
}

body.dark-mode .nav-header-mobile-actions .notification_dropdown .dropdown-menu,
[data-theme="dark"] .nav-header-mobile-actions .notification_dropdown .dropdown-menu {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
}

body.dark-mode .nav-header-mobile-actions .notification_dropdown .dropdown-menu .flex-grow-1,
[data-theme="dark"] .nav-header-mobile-actions .notification_dropdown .dropdown-menu .flex-grow-1 {
    color: #cbd5e1 !important;
}

/* Mobile Header Sun/Moon Quick Toggle stays bright on dark .nav-header */
.nav-header-mobile-actions .dtt-header-theme-btn {
    color: #e2e8f0;
    width: 32px;
    height: 32px;
}

/* --------------------------------------------------------------------------
   3. RECHARGE, ORDERS, TRANSACTIONS, PROFILE, RULE, MASS ORDER, AFFILIATE
   -------------------------------------------------------------------------- */
body.dark-mode #view-recharge .dtt-filter-select,
[data-theme="dark"] #view-recharge .dtt-filter-select,
body.dark-mode #view-recharge .dtt-filter-date,
[data-theme="dark"] #view-recharge .dtt-filter-date,
body.dark-mode #view-recharge .dtt-search-input,
[data-theme="dark"] #view-recharge .dtt-search-input,
body.dark-mode #view-recharge .dtt-clear-btn,
[data-theme="dark"] #view-recharge .dtt-clear-btn {
    background-color: #0b1120 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.dark-mode #view-recharge .dtt-search-btn,
[data-theme="dark"] #view-recharge .dtt-search-btn {
    background-color: #2563eb !important;
}

body.dark-mode #view-recharge .dtt-invoice-code-cell,
[data-theme="dark"] #view-recharge .dtt-invoice-code-cell,
body.dark-mode #view-recharge .dtt-gateway-cell,
[data-theme="dark"] #view-recharge .dtt-gateway-cell,
body.dark-mode #view-recharge .dtt-amount-cell,
[data-theme="dark"] #view-recharge .dtt-amount-cell,
body.dark-mode #view-recharge .btn-dtt-eye,
[data-theme="dark"] #view-recharge .btn-dtt-eye,
body.dark-mode #view-recharge .btn-dtt-copy,
[data-theme="dark"] #view-recharge .btn-dtt-copy {
    color: #e2e8f0 !important;
}

body.dark-mode #view-recharge .dtt-date-cell,
[data-theme="dark"] #view-recharge .dtt-date-cell {
    color: #94a3b8 !important;
}

body.dark-mode #view-recharge .bank-limits-row,
[data-theme="dark"] #view-recharge .bank-limits-row {
    border-top-color: #334155 !important;
}

body.dark-mode #view-recharge .recharge-note-card,
[data-theme="dark"] #view-recharge .recharge-note-card {
    background: #182032 !important;
    border: 1px solid rgba(245, 158, 11, 0.36) !important;
    color: #e2e8f0 !important;
}

body.dark-mode #view-recharge .recharge-note-card .note-card-title,
[data-theme="dark"] #view-recharge .recharge-note-card .note-card-title {
    color: #fbbf24 !important;
}

body.dark-mode #view-recharge .recharge-note-card .note-card-item,
[data-theme="dark"] #view-recharge .recharge-note-card .note-card-item,
body.dark-mode #view-recharge .recharge-note-card .note-card-list,
[data-theme="dark"] #view-recharge .recharge-note-card .note-card-list,
body.dark-mode #view-recharge .recharge-note-card .note-card-list li,
[data-theme="dark"] #view-recharge .recharge-note-card .note-card-list li {
    color: #e2e8f0 !important;
}

body.dark-mode #view-recharge .recharge-note-card .note-card-item strong,
[data-theme="dark"] #view-recharge .recharge-note-card .note-card-item strong,
body.dark-mode #view-recharge .recharge-note-card .note-card-list strong,
[data-theme="dark"] #view-recharge .recharge-note-card .note-card-list strong {
    color: #ffffff !important;
    font-weight: 700 !important;
}

body.dark-mode .dtt-page-btn,
[data-theme="dark"] .dtt-page-btn {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

body.dark-mode .dtt-page-btn:hover:not(.disabled):not(.active),
[data-theme="dark"] .dtt-page-btn:hover:not(.disabled):not(.active) {
    background: #334155 !important;
    color: #ffffff !important;
}

/* Native date/datetime calendar icon invert in Dark Mode */
body.dark-mode input[type="date"]::-webkit-calendar-picker-indicator,
body.dark-mode input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.75);
}

/* Profile activity table */
body.dark-mode #view-profile .table,
[data-theme="dark"] #view-profile .table {
    --bs-table-bg: #111827;
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: #1f2937;
    --bs-table-hover-bg: #1e293b;
    --bs-table-hover-color: #f8fafc;
    color: #e2e8f0 !important;
}

body.dark-mode #view-profile .table thead.table-light th,
[data-theme="dark"] #view-profile .table thead.table-light th {
    --bs-table-bg: #1e293b !important;
    background-color: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

/* Rule, Affiliate & Utilities views */
body.dark-mode #rule-terms-container,
[data-theme="dark"] #rule-terms-container {
    color: #cbd5e1 !important;
}

body.dark-mode #rule-terms-container strong,
body.dark-mode #rule-terms-container h1,
body.dark-mode #rule-terms-container h2,
body.dark-mode #rule-terms-container h3,
body.dark-mode #rule-terms-container h4,
[data-theme="dark"] #rule-terms-container strong,
[data-theme="dark"] #rule-terms-container h1,
[data-theme="dark"] #rule-terms-container h2,
[data-theme="dark"] #rule-terms-container h3,
[data-theme="dark"] #rule-terms-container h4 {
    color: #f8fafc !important;
}

body.dark-mode #view-affiliate .progress,
[data-theme="dark"] #view-affiliate .progress {
    background-color: #1e293b !important;
}

body.dark-mode .dtt-page-footer,
[data-theme="dark"] .dtt-page-footer {
    color: #64748b !important;
    border-top-color: #1e293b !important;
}

/* --------------------------------------------------------------------------
   4. ALL MODALS (#dttCurrencyModal, #dtt-invoice-overlay, TICKET MODALS, SWAL)
   -------------------------------------------------------------------------- */
body.dark-mode #dttCurrencyModal .modal-content,
[data-theme="dark"] #dttCurrencyModal .modal-content {
    background: #111827 !important;
    border: 1px solid #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-mode #dttCurrencyModal #dttCurrencyModalTitle,
[data-theme="dark"] #dttCurrencyModal #dttCurrencyModalTitle {
    color: #f8fafc !important;
}

body.dark-mode #dttCurrencyModal p,
[data-theme="dark"] #dttCurrencyModal p {
    color: #cbd5e1 !important;
}

/* VietQR Invoice Modal */
body.dark-mode .dtt-invoice-modal,
[data-theme="dark"] .dtt-invoice-modal {
    background: #111827 !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 28px 60px -12px rgba(0, 0, 0, 0.78) !important;
}

body.dark-mode .dtt-inv-title,
[data-theme="dark"] .dtt-inv-title,
body.dark-mode .dtt-inv-countdown,
[data-theme="dark"] .dtt-inv-countdown,
body.dark-mode .dtt-inv-countdown i,
[data-theme="dark"] .dtt-inv-countdown i,
body.dark-mode .dtt-inv-req-amount,
[data-theme="dark"] .dtt-inv-req-amount {
    color: #f8fafc !important;
}

body.dark-mode .dtt-inv-sub,
[data-theme="dark"] .dtt-inv-sub,
body.dark-mode .dtt-inv-label,
[data-theme="dark"] .dtt-inv-label,
body.dark-mode .dtt-inv-details-title,
[data-theme="dark"] .dtt-inv-details-title,
body.dark-mode .dtt-inv-qr-hint,
[data-theme="dark"] .dtt-inv-qr-hint {
    color: #94a3b8 !important;
}

body.dark-mode .dtt-inv-value,
[data-theme="dark"] .dtt-inv-value {
    color: #e2e8f0 !important;
}

body.dark-mode .dtt-inv-close-btn,
[data-theme="dark"] .dtt-inv-close-btn {
    background: #1e293b !important;
    color: #cbd5e1 !important;
}

body.dark-mode .dtt-inv-close-btn:hover,
[data-theme="dark"] .dtt-inv-close-btn:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

body.dark-mode .dtt-inv-qr-card,
[data-theme="dark"] .dtt-inv-qr-card {
    background: #0b1120 !important;
    border-color: #1e293b !important;
}

/* CRITICAL: Keep VietQR white border quiet zone in Dark Mode so bank scanners succeed */
body.dark-mode .dtt-inv-qr-wrap,
[data-theme="dark"] .dtt-inv-qr-wrap {
    background: #ffffff !important;
}

body.dark-mode .dtt-inv-expired-mask,
[data-theme="dark"] .dtt-inv-expired-mask {
    background: rgba(15, 23, 42, 0.92) !important;
}

body.dark-mode #dtt-inv-expired-mask > div:nth-child(2),
[data-theme="dark"] #dtt-inv-expired-mask > div:nth-child(2) {
    color: #f8fafc !important;
}

#dtt-inv-success-mask {
    background: rgba(255, 255, 255, 0.96);
}

body.dark-mode #dtt-inv-success-mask,
[data-theme="dark"] #dtt-inv-success-mask {
    background: rgba(15, 23, 42, 0.95) !important;
}

body.dark-mode #dtt-inv-success-mask > div:nth-child(2),
[data-theme="dark"] #dtt-inv-success-mask > div:nth-child(2) {
    color: #4ade80 !important;
}

body.dark-mode #dtt-inv-success-mask > div:nth-child(3),
[data-theme="dark"] #dtt-inv-success-mask > div:nth-child(3) {
    color: #cbd5e1 !important;
}

body.dark-mode .dtt-btn-copy,
[data-theme="dark"] .dtt-btn-copy {
    color: #94a3b8 !important;
}

body.dark-mode .dtt-btn-copy:hover,
[data-theme="dark"] .dtt-btn-copy:hover {
    color: #38bdf8 !important;
}

body.dark-mode .dtt-inv-dashed-line,
[data-theme="dark"] .dtt-inv-dashed-line {
    border-top-color: #334155 !important;
}

/* Ticket Modals (#modal-create-ticket, #modal-view-ticket) */
body.dark-mode #modal-create-ticket .modal-content,
[data-theme="dark"] #modal-create-ticket .modal-content,
body.dark-mode #modal-view-ticket .modal-content,
[data-theme="dark"] #modal-view-ticket .modal-content {
    background-color: #111827 !important;
    border: 1px solid #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-mode #modal-create-ticket .form-text,
[data-theme="dark"] #modal-create-ticket .form-text,
body.dark-mode #modal-view-ticket .modal-header,
[data-theme="dark"] #modal-view-ticket .modal-header,
body.dark-mode #modal-view-ticket .modal-footer,
[data-theme="dark"] #modal-view-ticket .modal-footer {
    color: #94a3b8 !important;
    border-color: #1e293b !important;
}

/* SweetAlert2 Global Dark Mode */
body.dark-mode .swal2-popup,
[data-theme="dark"] .swal2-popup {
    background: #111827 !important;
    border: 1px solid #334155 !important;
    color: #f1f5f9 !important;
}

body.dark-mode .swal2-title,
[data-theme="dark"] .swal2-title {
    color: #f8fafc !important;
}

body.dark-mode .swal2-html-container,
[data-theme="dark"] .swal2-html-container {
    color: #cbd5e1 !important;
}

body.dark-mode .swal2-input,
body.dark-mode .swal2-select,
body.dark-mode .swal2-textarea,
[data-theme="dark"] .swal2-input,
[data-theme="dark"] .swal2-select,
[data-theme="dark"] .swal2-textarea {
    background: #0b1120 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

/* Anime Chibi Speech Bubble Dark Mode */
body.dark-mode .chibi-speech-bubble,
[data-theme="dark"] .chibi-speech-bubble {
    background: #0f172a !important;
    border-color: #0284c7 !important;
    box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.72) !important;
}

body.dark-mode .chibi-speech-bubble::after,
[data-theme="dark"] .chibi-speech-bubble::after {
    background: #0f172a !important;
    border-right-color: #0284c7 !important;
    border-bottom-color: #0284c7 !important;
}

body.dark-mode .chibi-bubble-text,
[data-theme="dark"] .chibi-bubble-text {
    color: #f1f5f9 !important;
}

body.dark-mode .chibi-bubble-actions,
[data-theme="dark"] .chibi-bubble-actions {
    border-top-color: #1e293b !important;
}

body.dark-mode .chibi-btn-toggle,
[data-theme="dark"] .chibi-btn-toggle {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #7dd3fc !important;
}

/* Header Notification Popover Dark Mode & Live Toast */
body.dark-mode .dropdown-menu.dtt-noti-popover,
[data-theme="dark"] .dropdown-menu.dtt-noti-popover {
    background: #111827 !important;
    border-color: #334155 !important;
    box-shadow: 0 24px 52px -12px rgba(0, 0, 0, 0.78) !important;
}

body.dark-mode .dtt-noti-head,
[data-theme="dark"] .dtt-noti-head,
body.dark-mode .dtt-noti-foot,
[data-theme="dark"] .dtt-noti-foot {
    background: #0b1120 !important;
    border-color: #1e293b !important;
}

body.dark-mode .dtt-noti-title,
[data-theme="dark"] .dtt-noti-title,
body.dark-mode .dtt-noti-item-title,
[data-theme="dark"] .dtt-noti-item-title {
    color: #f8fafc !important;
}

body.dark-mode .dtt-noti-count,
[data-theme="dark"] .dtt-noti-count,
body.dark-mode .dtt-noti-tag,
[data-theme="dark"] .dtt-noti-tag {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #93c5fd !important;
}

body.dark-mode .dtt-noti-count.is-read,
[data-theme="dark"] .dtt-noti-count.is-read {
    background: rgba(148, 163, 184, 0.16) !important;
    color: #94a3b8 !important;
}

body.dark-mode .dtt-noti-mark-btn,
[data-theme="dark"] .dtt-noti-mark-btn {
    color: #60a5fa !important;
}

body.dark-mode .dtt-noti-item,
[data-theme="dark"] .dtt-noti-item {
    border-bottom-color: #1e293b !important;
}

body.dark-mode .dtt-noti-item.is-unread,
[data-theme="dark"] .dtt-noti-item.is-unread {
    background: rgba(37, 99, 235, 0.1) !important;
}

body.dark-mode .dtt-noti-item:hover,
[data-theme="dark"] .dtt-noti-item:hover {
    background: rgba(30, 41, 59, 0.72) !important;
}

body.dark-mode .dtt-noti-icon,
[data-theme="dark"] .dtt-noti-icon {
    background: rgba(37, 99, 235, 0.22) !important;
    color: #60a5fa !important;
}

body.dark-mode .dtt-noti-icon.is-emerald,
[data-theme="dark"] .dtt-noti-icon.is-emerald {
    background: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
}

body.dark-mode .dtt-noti-item-desc,
[data-theme="dark"] .dtt-noti-item-desc {
    color: #cbd5e1 !important;
}

body.dark-mode .dtt-noti-meta,
[data-theme="dark"] .dtt-noti-meta {
    color: #94a3b8 !important;
}

body.dark-mode .dtt-noti-foot-btn,
[data-theme="dark"] .dtt-noti-foot-btn {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .dtt-noti-foot-btn:hover,
[data-theme="dark"] .dtt-noti-foot-btn:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

body.dark-mode .dtt-noti-foot-btn.is-primary,
[data-theme="dark"] .dtt-noti-foot-btn.is-primary {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
}

body.dark-mode .client-live-toast,
[data-theme="dark"] .client-live-toast {
    background: #111827 !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}

body.dark-mode .btn-recharge-type:not(.active):hover,
[data-theme="dark"] .btn-recharge-type:not(.active):hover {
    background: #283548 !important;
    border-color: #475569 !important;
    color: #f8fafc !important;
}
