/* Dark Theme Stylesheet for Tradezone365 - Complete Dark Mode */

/* Force dark theme on all elements - Universal selector */
body.dark-theme *:not([class*="fa-"]):not([class*="fas"]):not([class*="fab"]):not([class*="far"]):not(i):not(svg):not(path) {
  background-color: transparent;
}

/* Base styles with stronger colors */
body.dark-theme {
  background-color: #0d0d0d !important;
  color: #e0e0e0 !important;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Main content areas - ensure they're dark */
body.dark-theme #wrapper,
body.dark-theme #content-wrapper,
body.dark-theme #content,
body.dark-theme main,
body.dark-theme .container,
body.dark-theme .container-fluid,
body.dark-theme .row,
body.dark-theme section {
  background-color: #0d0d0d !important;
  color: #e0e0e0 !important;
}

/* Make sure content padding is consistent in dark mode too */
body.dark-theme:not(.sidebar-toggled) #content-wrapper {
  margin-left: 225px;
}

/* Adjust margin for toggled sidebar in dark mode */
body.dark-theme.sidebar-toggled #content-wrapper {
  margin-left: 6.5rem;
}

/* Topbar and navigation elements */
body.dark-theme .topbar,
body.dark-theme .navbar,
body.dark-theme .navbar-light,
body.dark-theme .bg-white,
body.dark-theme header,
body.dark-theme nav,
body.dark-theme .nav {
  background-color: #121212 !important;
  color: #e0e0e0 !important;
  border-color: #2a2a2a !important;
}

/* Fix for all light backgrounds - more comprehensive */
body.dark-theme .bg-white,
body.dark-theme .bg-light,
body.dark-theme .bg-gray-100,
body.dark-theme .bg-gray-200,
body.dark-theme .bg-gray-300,
body.dark-theme [class*="bg-gradient-light"],
body.dark-theme [class*="bg-gradient-white"] {
  background-color: #121212 !important;
  background-image: none !important;
  color: #e0e0e0 !important;
}

/* Sidebar dark styling - darker background */
body.dark-theme .sidebar {
  background-color: #121212 !important;
  background-image: linear-gradient(180deg, #121212 10%, #0d0d0d 100%) !important;
}

/* Admin sidebar specific styling */
body.dark-theme .sidebar-admin {
  background-color: #121212 !important;
  background-image: linear-gradient(180deg, #121212 10%, #0d0d0d 100%) !important;
}

body.dark-theme .sidebar-admin .sidebar-brand {
  color: #ffffff !important;
}

body.dark-theme .sidebar-admin .nav-item .nav-link,
body.dark-theme .sidebar-admin .nav-item .nav-link i {
  color: #d0d0d0 !important;
}

body.dark-theme .sidebar-admin .nav-item .nav-link:active,
body.dark-theme .sidebar-admin .nav-item .nav-link:focus,
body.dark-theme .sidebar-admin .nav-item .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .sidebar-admin .nav-item .nav-link:active i,
body.dark-theme .sidebar-admin .nav-item .nav-link:focus i,
body.dark-theme .sidebar-admin .nav-item .nav-link:hover i,
body.dark-theme .sidebar-admin .nav-item.active .nav-link i {
  color: #fff !important;
}

body.dark-theme .sidebar-admin .nav-item.active .nav-link {
  background-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-theme .sidebar-admin .sidebar-divider {
  border-top-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-theme .sidebar .sidebar-brand {
  color: #fff;
}

/* Admin topbar specific styling */
body.dark-theme .admin-topbar {
  background-color: #1a1a1a !important;
  border-bottom: 1px solid #2a2a2a !important;
}

body.dark-theme .admin-topbar .nav-item .nav-link {
  color: #d0d0d0 !important;
}

body.dark-theme .admin-topbar .text-gray-800 {
  color: #e0e0e0 !important;
}

body.dark-theme #content-wrapper {
  background-color: #121212;
}

body.dark-theme .topbar {
  background-color: #1a1a1a !important;
  border-bottom: 1px solid #2a2a2a;
}

body.dark-theme .topbar .nav-item .nav-link {
  color: #d0d0d0;
}

body.dark-theme .dropdown-menu {
  background-color: #232323;
  border-color: #2d2d2d;
}

body.dark-theme .dropdown-item {
  color: #d0d0d0;
}

body.dark-theme .dropdown-item:hover,
body.dark-theme .dropdown-item:focus {
  background-color: #2d2d2d;
  color: #fff;
}

body.dark-theme .dropdown-divider {
  border-top-color: #3a3a3a;
}

/* Cards dark styling - more comprehensive */
body.dark-theme .card,
body.dark-theme .modern-card,
body.dark-theme .welcome-card,
body.dark-theme [class*="card"],
body.dark-theme .box,
body.dark-theme .panel,
body.dark-theme .widget {
  background-color: #1a1a1a !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
  box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .card-header,
body.dark-theme .card-footer,
body.dark-theme [class*="card-header"],
body.dark-theme [class*="card-footer"],
body.dark-theme .box-header,
body.dark-theme .panel-heading {
  background-color: #151515 !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .card-body,
body.dark-theme [class*="card-body"] {
  color: #e0e0e0 !important;
}

/* Fix for all background light elements */
body.dark-theme .bg-light,
body.dark-theme .welcome-card .bg-light,
body.dark-theme div[class*="bg-light"],
body.dark-theme .list-group-item {
  background-color: #292929 !important;
  border-color: #3a3a3a !important;
  color: #e0e0e0 !important;
}

/* Text colors in dark theme */
body.dark-theme .text-gray-800,
body.dark-theme .text-dark,
body.dark-theme .text-body {
  color: #e0e0e0 !important;
}

body.dark-theme .text-gray-600,
body.dark-theme .text-gray-700 {
  color: #b0b0b0 !important;
}

body.dark-theme .text-muted {
  color: #909090 !important;
}

/* Welcome Card specific styling */
body.dark-theme .welcome-card {
  background-color: #232323 !important;
  box-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .welcome-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 2rem 0 rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .welcome-card .bg-gradient-primary {
  background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
}

body.dark-theme .welcome-card .border-left.border-primary {
  border-left-color: #4e73df !important;
}

/* Custom elements and components */
body.dark-theme .btn-light {
  background-color: #2d2d2d;
  border-color: #3a3a3a;
  color: #d0d0d0;
}

body.dark-theme .btn-light:hover {
  background-color: #3a3a3a;
  color: #fff;
}

/* Navigation tabs dark styling */
body.dark-theme .nav-tabs {
  border-bottom-color: #3a3a3a;
}

body.dark-theme .nav-tabs .nav-link {
  color: #b0b0b0;
}

body.dark-theme .nav-tabs .nav-link.active,
body.dark-theme .nav-tabs .nav-item.show .nav-link {
  background-color: #232323;
  border-color: #3a3a3a #3a3a3a #232323;
  color: #fff;
}

body.dark-theme .nav-tabs .nav-link:hover {
  border-color: #3a3a3a #3a3a3a #3a3a3a;
}

/* Table dark styling */
body.dark-theme .table,
body.dark-theme table,
body.dark-theme tr,
body.dark-theme th,
body.dark-theme td {
  color: #d0d0d0 !important;
  background-color: #1a1a1a !important;
  border-color: #2d2d2d !important;
}

body.dark-theme .table thead th,
body.dark-theme table thead th,
body.dark-theme th {
  background-color: #151515 !important;
  border-bottom-color: #2d2d2d !important;
}

body.dark-theme .table-striped tbody tr:nth-of-type(odd) {
  background-color: #222222 !important;
}

body.dark-theme .table-hover tbody tr:hover {
  background-color: #252525 !important;
}

body.dark-theme .dataTable {
  background-color: #232323 !important;
}

body.dark-theme .dataTables_wrapper .dataTables_length,
body.dark-theme .dataTables_wrapper .dataTables_filter,
body.dark-theme .dataTables_wrapper .dataTables_info,
body.dark-theme .dataTables_wrapper .dataTables_processing,
body.dark-theme .dataTables_wrapper .dataTables_paginate {
  color: #d0d0d0 !important;
}

body.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button {
  color: #d0d0d0 !important;
}

body.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background-color: #2d2d2d !important;
  border-color: #3a3a3a !important;
}

/* Form elements dark styling */
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea,
body.dark-theme .form-control,
body.dark-theme .modern-input,
body.dark-theme .custom-select,
body.dark-theme [type="text"],
body.dark-theme [type="email"],
body.dark-theme [type="password"],
body.dark-theme [type="number"],
body.dark-theme [type="search"],
body.dark-theme [type="tel"],
body.dark-theme [type="url"],
body.dark-theme [role="textbox"] {
  background-color: #222222 !important;
  border-color: #3a3a3a !important;
  color: #e0e0e0 !important;
}

body.dark-theme input:focus,
body.dark-theme select:focus,
body.dark-theme textarea:focus,
body.dark-theme .form-control:focus,
body.dark-theme .modern-input:focus,
body.dark-theme .custom-select:focus {
  background-color: #333 !important;
  border-color: #4e73df !important;
  color: #fff !important;
  box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25) !important;
}

body.dark-theme .input-group-text {
  background-color: #2d2d2d !important;
  border-color: #3a3a3a !important;
  color: #d0d0d0 !important;
}

/* Stat cards dark theme */
body.dark-theme .stat-card {
  background-color: #232323;
}

body.dark-theme .stat-card.primary {
  border-left-color: #4e73df;
}

body.dark-theme .stat-card.success {
  border-left-color: #1cc88a;
}

body.dark-theme .stat-card.info {
  border-left-color: #36b9cc;
}

body.dark-theme .stat-card.warning {
  border-left-color: #f6c23e;
}

body.dark-theme .stat-card.danger {
  border-left-color: #e74a3b;
}

/* Modern alerts dark styling */
body.dark-theme .modern-alert {
  background-color: #232323;
  border-color: #2d2d2d;
}

body.dark-theme .modern-alert-success {
  border-left-color: #1cc88a;
}

body.dark-theme .modern-alert-danger {
  border-left-color: #e74a3b;
}

body.dark-theme .modern-alert-warning {
  border-left-color: #f6c23e;
}

body.dark-theme .modern-alert-info {
  border-left-color: #36b9cc;
}

/* Footer dark styling */
body.dark-theme .sticky-footer {
  background-color: #1a1a1a;
  border-top: 1px solid #2a2a2a;
  color: #b0b0b0;
}

/* Charts container darker background for TradingView widgets */
body.dark-theme .tradingview-widget-container {
  background-color: #0d0d0d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .tradingview-widget-container * {
  background-color: #1a1a1a !important;
  color: #e0e0e0 !important;
}

body.dark-theme .tradingview-widget-copyright {
  background-color: #1a1a1a !important;
  color: #6c757d !important;
}

/* Payment method selection */
body.dark-theme .payment-method-item {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
}

body.dark-theme .payment-method-item.selected,
body.dark-theme .payment-method-item:hover {
  background-color: #2a2a2a !important;
  border-color: #4e73df !important;
}

/* Modal dialogs */
body.dark-theme .modal-content {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer {
  background-color: #1d1d1d !important;
  border-color: #2d2d2d !important;
}

body.dark-theme .modal-title {
  color: #e0e0e0 !important;
}

body.dark-theme .close {
  color: #e0e0e0 !important;
  text-shadow: none !important;
}

body.dark-theme .close:hover {
  color: #ffffff !important;
}

/* Scrollbar dark styling */
body.dark-theme::-webkit-scrollbar {
  width: 12px;
}

body.dark-theme::-webkit-scrollbar-track {
  background: #1a1a1a;
}

body.dark-theme::-webkit-scrollbar-thumb {
  background-color: #3a3a3a;
  border-radius: 6px;
  border: 3px solid #1a1a1a;
}

body.dark-theme::-webkit-scrollbar-thumb:hover {
  background-color: #4a4a4a;
}

/* TradingView widgets dynamic dark theme */
body.dark-theme .tradingview-widget-container iframe {
  filter: brightness(0.8) contrast(1.1) !important;
}

/* Bootstrap elements */
body.dark-theme .list-group-item {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
}

body.dark-theme .list-group-item-action:hover {
  background-color: #2a2a2a !important;
}

body.dark-theme .badge-light {
  background-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .page-link {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
  color: #d0d0d0 !important;
}

body.dark-theme .page-item.active .page-link {
  background-color: #4e73df !important;
  border-color: #4e73df !important;
  color: #ffffff !important;
}

body.dark-theme .page-item.disabled .page-link {
  background-color: #1a1a1a !important;
  border-color: #2d2d2d !important;
  color: #6c757d !important;
}

/* Toast notifications dark styling */
body.dark-theme .toast-container .toast {
  background-color: #232323;
  color: #e0e0e0;
  border-color: #3a3a3a;
}

/* Force-refresh page on theme change for better compatibility */
body.dark-theme .reload-required {
  display: none;
}

/* Fix for chart container backgrounds */
body.dark-theme #bitcoin, 
body.dark-theme #ethereum, 
body.dark-theme #stocks, 
body.dark-theme #forex,
body.dark-theme .tab-content,
body.dark-theme .tab-pane {
  background-color: #1a1a1a !important;
  color: #e0e0e0 !important;
}

/* Fix white backgrounds in panels and containers */
body.dark-theme .panel,
body.dark-theme .panel-default,
body.dark-theme .panel-body,
body.dark-theme .panel-heading,
body.dark-theme .panel-footer,
body.dark-theme .account-summary,
body.dark-theme .transaction-list,
body.dark-theme .info-box,
body.dark-theme .well,
body.dark-theme .jumbotron {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

/* Fixes for chart overlays */
body.dark-theme .tooltip,
body.dark-theme .popover {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .tooltip-inner {
  background-color: #232323 !important;
  color: #e0e0e0 !important;
}

body.dark-theme .popover-header {
  background-color: #1d1d1d !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .popover-body {
  color: #e0e0e0 !important;
}

/* Background color for in-page containers */
body.dark-theme .container,
body.dark-theme .container-fluid,
body.dark-theme .row,
body.dark-theme .col,
body.dark-theme [class^="col-"] {
  background-color: transparent !important;
}

/* Fixed SVG and Canvas elements */
body.dark-theme svg,
body.dark-theme canvas {
  filter: invert(0.85) hue-rotate(180deg);
}

/* Override all iframes - important for embedded content */
body.dark-theme iframe {
  filter: invert(0.9) hue-rotate(180deg) !important;
}

/* Override TradingView widget iframes - special handling */
body.dark-theme .tradingview-widget-container iframe {
  filter: brightness(0.8) contrast(1.1) !important;
}

/* Stronger form controls */
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea,
body.dark-theme .form-control,
body.dark-theme .modern-input,
body.dark-theme .custom-select,
body.dark-theme [type="text"],
body.dark-theme [type="email"],
body.dark-theme [type="password"],
body.dark-theme [type="number"],
body.dark-theme [type="search"],
body.dark-theme [type="tel"],
body.dark-theme [type="url"],
body.dark-theme [role="textbox"] {
  background-color: #222222 !important;
  border-color: #3a3a3a !important;
  color: #e0e0e0 !important;
}

/* Buttons in dark theme */
body.dark-theme .btn,
body.dark-theme [class*="btn-default"],
body.dark-theme [class*="btn-light"],
body.dark-theme [class*="btn-white"] {
  background-color: #2d2d2d !important;
  border-color: #3a3a3a !important;
  color: #e0e0e0 !important;
}

body.dark-theme .btn:hover,
body.dark-theme [class*="btn-default"]:hover,
body.dark-theme [class*="btn-light"]:hover,
body.dark-theme [class*="btn-white"]:hover {
  background-color: #3a3a3a !important;
  border-color: #4e73df !important;
  color: #ffffff !important;
}

/* Table elements - deeper colors */
body.dark-theme .table,
body.dark-theme table,
body.dark-theme tr,
body.dark-theme th,
body.dark-theme td {
  color: #d0d0d0 !important;
  background-color: #1a1a1a !important;
  border-color: #2d2d2d !important;
}

body.dark-theme .table thead th,
body.dark-theme table thead th,
body.dark-theme th {
  background-color: #151515 !important;
  border-bottom-color: #2d2d2d !important;
}

body.dark-theme .table-striped tbody tr:nth-of-type(odd) {
  background-color: #222222 !important;
}

body.dark-theme .table-hover tbody tr:hover {
  background-color: #252525 !important;
}

/* Fix for active tab/button backgrounds */
body.dark-theme .active,
body.dark-theme .btn-active,
body.dark-theme .nav-item.active,
body.dark-theme .nav-link.active,
body.dark-theme [aria-selected="true"] {
  background-color: #2d2d2d !important;
  color: #ffffff !important;
}

/* Override DataTables specific elements */
body.dark-theme div.dataTables_wrapper div.dataTables_length,
body.dark-theme div.dataTables_wrapper div.dataTables_filter,
body.dark-theme div.dataTables_wrapper div.dataTables_info,
body.dark-theme div.dataTables_wrapper div.dataTables_paginate {
  color: #d0d0d0 !important;
}

body.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button.current,
body.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: #2d2d2d !important;
  border-color: #3a3a3a !important;
  color: #ffffff !important;
}

/* Top-level container fixes */
body.dark-theme html,
body.dark-theme body,
body.dark-theme #app,
body.dark-theme #root,
body.dark-theme #wrapper,
body.dark-theme .wrapper,
body.dark-theme .app-container,
body.dark-theme .page-container {
  background-color: #0d0d0d !important;
  color: #e0e0e0 !important;
}

/* Fix TradingView specific elements */
body.dark-theme .tradingview-widget-container {
  background-color: #0d0d0d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .tv-lightweight-charts,
body.dark-theme [class*="TVChartContainer"] {
  background-color: #0d0d0d !important;
}

/* Improve chart contrast in dark mode */
body.dark-theme .tradingview-widget-container.applying-dark-theme iframe {
  opacity: 0.95 !important;
}

/* Enhanced Floating Elements - Modals, Dropdowns, Tooltips */
body.dark-theme .modal,
body.dark-theme .modal-dialog,
body.dark-theme .modal-content,
body.dark-theme .popover,
body.dark-theme .tooltip,
body.dark-theme .dropdown-menu,
body.dark-theme .dropdown-item,
body.dark-theme .menu,
body.dark-theme .submenu,
body.dark-theme .toggle-dropdown {
  background-color: #1a1a1a !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer,
body.dark-theme .popover-header {
  background-color: #151515 !important;
  border-color: #2d2d2d !important;
}

/* Fix any remaining browser default styles */
body.dark-theme hr {
  border-color: #2d2d2d !important;
}

body.dark-theme pre,
body.dark-theme code,
body.dark-theme kbd {
  background-color: #1a1a1a !important;
  color: #e0e0e0 !important;
  border-color: #2d2d2d !important;
}

/* Specific color overrides for text */
body.dark-theme h1, 
body.dark-theme h2, 
body.dark-theme h3, 
body.dark-theme h4, 
body.dark-theme h5, 
body.dark-theme h6,
body.dark-theme .h1, 
body.dark-theme .h2, 
body.dark-theme .h3, 
body.dark-theme .h4, 
body.dark-theme .h5, 
body.dark-theme .h6,
body.dark-theme [class*="text-dark"],
body.dark-theme [class*="text-body"] {
  color: #ffffff !important;
}

/* Exclude crypto card from dark theme styling */
body.dark-theme .cc-card-wrap {
  /* Keep original image without any filters or modifications */
  filter: none !important;
  -webkit-filter: none !important;
}

body.dark-theme .cc-card-wrap * {
  /* Preserve text colors on the card */
  color: inherit !important;
  filter: none !important;
  -webkit-filter: none !important;
}

/* Fix the crypto card text colors explicitly to ensure visibility */
body.dark-theme .cc-card-number,
body.dark-theme .cc-card-exp,
body.dark-theme .cc-card-name {
  color: #ccc !important;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5) !important;
}

/* Ensure the card background image isn't affected by any filters */
body.dark-theme .cc-card-wrap {
  background-image: url("../img/card.png") !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}

/* Exclude specifically marked elements from dark theme styling */
body.dark-theme .dark-theme-exclude {
  filter: none !important;
  -webkit-filter: none !important;
  background-color: transparent !important;
}

/* Ensure all child elements are also excluded */
body.dark-theme .dark-theme-exclude * {
  filter: none !important;
  -webkit-filter: none !important;
}

/* Ensure that any SVG filters applied to images in dark mode don't affect the card */
body.dark-theme svg.dark-theme-exclude,
body.dark-theme canvas.dark-theme-exclude,
body.dark-theme img.dark-theme-exclude,
body.dark-theme .dark-theme-exclude img,
body.dark-theme .dark-theme-exclude svg,
body.dark-theme .dark-theme-exclude canvas {
  filter: none !important;
  -webkit-filter: none !important;
}

/* Darker version of the original styles (keeping the structure) */

/* Apply same sidebar responsive behavior for dark theme */
@media (max-width: 768px) {
  /* Reset content margin on mobile for dark theme */
  body.dark-theme #content-wrapper, 
  body.dark-theme.sidebar-toggled #content-wrapper {
    margin-left: 0;
    width: 100%;
  }
  
  /* Fix mobile layout for sidebar in dark mode */
  body.dark-theme .sidebar.sidebar-admin {
    position: absolute;
    height: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
  }
  
  /* When toggled on mobile in dark mode, show sidebar */
  body.dark-theme .sidebar.sidebar-admin.toggled {
    transform: translateX(0);
  }
}

/* Charts container darker background for TradingView widgets */
body.dark-theme .tradingview-widget-container {
  background-color: #0d0d0d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .tradingview-widget-container * {
  background-color: #1a1a1a !important;
  color: #e0e0e0 !important;
}

body.dark-theme .tradingview-widget-copyright {
  background-color: #1a1a1a !important;
  color: #6c757d !important;
}

/* Payment method selection */
body.dark-theme .payment-method-item {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
}

body.dark-theme .payment-method-item.selected,
body.dark-theme .payment-method-item:hover {
  background-color: #2a2a2a !important;
  border-color: #4e73df !important;
}

/* Modal dialogs */
body.dark-theme .modal-content {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer {
  background-color: #1d1d1d !important;
  border-color: #2d2d2d !important;
}

body.dark-theme .modal-title {
  color: #e0e0e0 !important;
}

body.dark-theme .close {
  color: #e0e0e0 !important;
  text-shadow: none !important;
}

body.dark-theme .close:hover {
  color: #ffffff !important;
}

/* Scrollbar dark styling */
body.dark-theme::-webkit-scrollbar {
  width: 12px;
}

body.dark-theme::-webkit-scrollbar-track {
  background: #1a1a1a;
}

body.dark-theme::-webkit-scrollbar-thumb {
  background-color: #3a3a3a;
  border-radius: 6px;
  border: 3px solid #1a1a1a;
}

body.dark-theme::-webkit-scrollbar-thumb:hover {
  background-color: #4a4a4a;
}

/* TradingView widgets dynamic dark theme */
body.dark-theme .tradingview-widget-container iframe {
  filter: brightness(0.8) contrast(1.1) !important;
}

/* Bootstrap elements */
body.dark-theme .list-group-item {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
}

body.dark-theme .list-group-item-action:hover {
  background-color: #2a2a2a !important;
}

body.dark-theme .badge-light {
  background-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .page-link {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
  color: #d0d0d0 !important;
}

body.dark-theme .page-item.active .page-link {
  background-color: #4e73df !important;
  border-color: #4e73df !important;
  color: #ffffff !important;
}

body.dark-theme .page-item.disabled .page-link {
  background-color: #1a1a1a !important;
  border-color: #2d2d2d !important;
  color: #6c757d !important;
}

/* Toast notifications dark styling */
body.dark-theme .toast-container .toast {
  background-color: #232323;
  color: #e0e0e0;
  border-color: #3a3a3a;
}

/* Force-refresh page on theme change for better compatibility */
body.dark-theme .reload-required {
  display: none;
}

/* Fix for chart container backgrounds */
body.dark-theme #bitcoin, 
body.dark-theme #ethereum, 
body.dark-theme #stocks, 
body.dark-theme #forex,
body.dark-theme .tab-content,
body.dark-theme .tab-pane {
  background-color: #1a1a1a !important;
  color: #e0e0e0 !important;
}

/* Fix white backgrounds in panels and containers */
body.dark-theme .panel,
body.dark-theme .panel-default,
body.dark-theme .panel-body,
body.dark-theme .panel-heading,
body.dark-theme .panel-footer,
body.dark-theme .account-summary,
body.dark-theme .transaction-list,
body.dark-theme .info-box,
body.dark-theme .well,
body.dark-theme .jumbotron {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

/* Fixes for chart overlays */
body.dark-theme .tooltip,
body.dark-theme .popover {
  background-color: #232323 !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .tooltip-inner {
  background-color: #232323 !important;
  color: #e0e0e0 !important;
}

body.dark-theme .popover-header {
  background-color: #1d1d1d !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .popover-body {
  color: #e0e0e0 !important;
}

/* Background color for in-page containers */
body.dark-theme .container,
body.dark-theme .container-fluid,
body.dark-theme .row,
body.dark-theme .col,
body.dark-theme [class^="col-"] {
  background-color: transparent !important;
}

/* Fixed SVG and Canvas elements */
body.dark-theme svg,
body.dark-theme canvas {
  filter: invert(0.85) hue-rotate(180deg);
}

/* Override all iframes - important for embedded content */
body.dark-theme iframe {
  filter: invert(0.9) hue-rotate(180deg) !important;
}

/* Override TradingView widget iframes - special handling */
body.dark-theme .tradingview-widget-container iframe {
  filter: brightness(0.8) contrast(1.1) !important;
}

/* Stronger form controls */
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea,
body.dark-theme .form-control,
body.dark-theme .modern-input,
body.dark-theme .custom-select,
body.dark-theme [type="text"],
body.dark-theme [type="email"],
body.dark-theme [type="password"],
body.dark-theme [type="number"],
body.dark-theme [type="search"],
body.dark-theme [type="tel"],
body.dark-theme [type="url"],
body.dark-theme [role="textbox"] {
  background-color: #222222 !important;
  border-color: #3a3a3a !important;
  color: #e0e0e0 !important;
}

/* Buttons in dark theme */
body.dark-theme .btn,
body.dark-theme [class*="btn-default"],
body.dark-theme [class*="btn-light"],
body.dark-theme [class*="btn-white"] {
  background-color: #2d2d2d !important;
  border-color: #3a3a3a !important;
  color: #e0e0e0 !important;
}

body.dark-theme .btn:hover,
body.dark-theme [class*="btn-default"]:hover,
body.dark-theme [class*="btn-light"]:hover,
body.dark-theme [class*="btn-white"]:hover {
  background-color: #3a3a3a !important;
  border-color: #4e73df !important;
  color: #ffffff !important;
}

/* Table elements - deeper colors */
body.dark-theme .table,
body.dark-theme table,
body.dark-theme tr,
body.dark-theme th,
body.dark-theme td {
  color: #d0d0d0 !important;
  background-color: #1a1a1a !important;
  border-color: #2d2d2d !important;
}

body.dark-theme .table thead th,
body.dark-theme table thead th,
body.dark-theme th {
  background-color: #151515 !important;
  border-bottom-color: #2d2d2d !important;
}

body.dark-theme .table-striped tbody tr:nth-of-type(odd) {
  background-color: #222222 !important;
}

body.dark-theme .table-hover tbody tr:hover {
  background-color: #252525 !important;
}

/* Fix for active tab/button backgrounds */
body.dark-theme .active,
body.dark-theme .btn-active,
body.dark-theme .nav-item.active,
body.dark-theme .nav-link.active,
body.dark-theme [aria-selected="true"] {
  background-color: #2d2d2d !important;
  color: #ffffff !important;
}

/* Override DataTables specific elements */
body.dark-theme div.dataTables_wrapper div.dataTables_length,
body.dark-theme div.dataTables_wrapper div.dataTables_filter,
body.dark-theme div.dataTables_wrapper div.dataTables_info,
body.dark-theme div.dataTables_wrapper div.dataTables_paginate {
  color: #d0d0d0 !important;
}

body.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button.current,
body.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: #2d2d2d !important;
  border-color: #3a3a3a !important;
  color: #ffffff !important;
}

/* Top-level container fixes */
body.dark-theme html,
body.dark-theme body,
body.dark-theme #app,
body.dark-theme #root,
body.dark-theme #wrapper,
body.dark-theme .wrapper,
body.dark-theme .app-container,
body.dark-theme .page-container {
  background-color: #0d0d0d !important;
  color: #e0e0e0 !important;
}

/* Fix TradingView specific elements */
body.dark-theme .tradingview-widget-container {
  background-color: #0d0d0d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .tv-lightweight-charts,
body.dark-theme [class*="TVChartContainer"] {
  background-color: #0d0d0d !important;
}

/* Improve chart contrast in dark mode */
body.dark-theme .tradingview-widget-container.applying-dark-theme iframe {
  opacity: 0.95 !important;
}

/* Enhanced Floating Elements - Modals, Dropdowns, Tooltips */
body.dark-theme .modal,
body.dark-theme .modal-dialog,
body.dark-theme .modal-content,
body.dark-theme .popover,
body.dark-theme .tooltip,
body.dark-theme .dropdown-menu,
body.dark-theme .dropdown-item,
body.dark-theme .menu,
body.dark-theme .submenu,
body.dark-theme .toggle-dropdown {
  background-color: #1a1a1a !important;
  border-color: #2d2d2d !important;
  color: #e0e0e0 !important;
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer,
body.dark-theme .popover-header {
  background-color: #151515 !important;
  border-color: #2d2d2d !important;
}

/* Fix any remaining browser default styles */
body.dark-theme hr {
  border-color: #2d2d2d !important;
}

body.dark-theme pre,
body.dark-theme code,
body.dark-theme kbd {
  background-color: #1a1a1a !important;
  color: #e0e0e0 !important;
  border-color: #2d2d2d !important;
}

/* Specific color overrides for text */
body.dark-theme h1, 
body.dark-theme h2, 
body.dark-theme h3, 
body.dark-theme h4, 
body.dark-theme h5, 
body.dark-theme h6,
body.dark-theme .h1, 
body.dark-theme .h2, 
body.dark-theme .h3, 
body.dark-theme .h4, 
body.dark-theme .h5, 
body.dark-theme .h6,
body.dark-theme [class*="text-dark"],
body.dark-theme [class*="text-body"] {
  color: #ffffff !important;
}

/* Exclude crypto card from dark theme styling */
body.dark-theme .cc-card-wrap {
  /* Keep original image without any filters or modifications */
  filter: none !important;
  -webkit-filter: none !important;
}

body.dark-theme .cc-card-wrap * {
  /* Preserve text colors on the card */
  color: inherit !important;
  filter: none !important;
  -webkit-filter: none !important;
}

/* Fix the crypto card text colors explicitly to ensure visibility */
body.dark-theme .cc-card-number,
body.dark-theme .cc-card-exp,
body.dark-theme .cc-card-name {
  color: #ccc !important;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5) !important;
}

/* Ensure the card background image isn't affected by any filters */
body.dark-theme .cc-card-wrap {
  background-image: url("../img/card.png") !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: contain !important;
}

/* Exclude specifically marked elements from dark theme styling */
body.dark-theme .dark-theme-exclude {
  filter: none !important;
  -webkit-filter: none !important;
  background-color: transparent !important;
}

/* Ensure all child elements are also excluded */
body.dark-theme .dark-theme-exclude * {
  filter: none !important;
  -webkit-filter: none !important;
}

/* Ensure that any SVG filters applied to images in dark mode don't affect the card */
body.dark-theme svg.dark-theme-exclude,
body.dark-theme canvas.dark-theme-exclude,
body.dark-theme img.dark-theme-exclude,
body.dark-theme .dark-theme-exclude img,
body.dark-theme .dark-theme-exclude svg,
body.dark-theme .dark-theme-exclude canvas {
  filter: none !important;
  -webkit-filter: none !important;
}

/* Darker version of the original styles (keeping the structure) */
