/* Root background (light mode default) */
#root {
  background-color: #ffffff;
}

/* ========================= */
/* THEME ROOT (BODY / ROOT)  */
/* ========================= */

body.dark-mode:not(.no-global-theme),
body.bm-dashboard-dark:not(.no-global-theme) {
  background-color: #1b2a41 !important;
  color: #ffffff !important;
}

body.dark-mode:not(.no-global-theme) #root,
body.bm-dashboard-dark:not(.no-global-theme) #root {
  background-color: #1b2a41 !important;
  color: #ffffff !important;
}

/* SAFE BASE (dark mode) */
body.dark-mode:not(.no-global-theme),
body.bm-dashboard-dark:not(.no-global-theme) {
  color: #ffffff;
}

/* ========================= */
/* TYPOGRAPHY (DARK MODE)    */
/* ========================= */

/* Text elements (avoid targeting all divs) */
body.dark-mode:not(.no-global-theme) p,
body.dark-mode:not(.no-global-theme) span,
body.dark-mode:not(.no-global-theme) label,
body.bm-dashboard-dark:not(.no-global-theme) p,
body.bm-dashboard-dark:not(.no-global-theme) span,
body.bm-dashboard-dark:not(.no-global-theme) label {
  color: #ffffff !important;
}

/* Headings */
body.dark-mode:not(.no-global-theme) h1,
body.dark-mode:not(.no-global-theme) h2,
body.dark-mode:not(.no-global-theme) h3,
body.dark-mode:not(.no-global-theme) h4,
body.dark-mode:not(.no-global-theme) h5,
body.dark-mode:not(.no-global-theme) h6,
body.bm-dashboard-dark:not(.no-global-theme) h1,
body.bm-dashboard-dark:not(.no-global-theme) h2,
body.bm-dashboard-dark:not(.no-global-theme) h3,
body.bm-dashboard-dark:not(.no-global-theme) h4,
body.bm-dashboard-dark:not(.no-global-theme) h5,
body.bm-dashboard-dark:not(.no-global-theme) h6 {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Muted text */
body.dark-mode:not(.no-global-theme) .text-muted,
body.bm-dashboard-dark:not(.no-global-theme) .text-muted {
  color: #b8c5d1 !important;
}

/* ========================= */
/* LAYOUT CONTAINERS (DARK)  */
/* ========================= */

body.dark-mode:not(.no-global-theme) .container,
body.dark-mode:not(.no-global-theme) .container-fluid,
body.bm-dashboard-dark:not(.no-global-theme) .container,
body.bm-dashboard-dark:not(.no-global-theme) .container-fluid {
  background-color: #1b2a41;
  color: #ffffff;
}

/* Cards */
body.dark-mode:not(.no-global-theme) .card,
body.bm-dashboard-dark:not(.no-global-theme) .card {
  background-color: #2e5061;
  border-color: #3a506b;
  color: #ffffff;
}

/* ========================= */
/* TABLES (DARK)             */
/* ========================= */

body.dark-mode:not(.no-global-theme) .table,
body.bm-dashboard-dark:not(.no-global-theme) .table {
  color: #ffffff !important;
}

body.dark-mode:not(.no-global-theme) .table th,
body.dark-mode:not(.no-global-theme) .table td,
body.bm-dashboard-dark:not(.no-global-theme) .table th,
body.bm-dashboard-dark:not(.no-global-theme) .table td {
  color: #ffffff !important;
  border-color: #3a506b;
}

body.bm-dashboard-dark:not(.no-global-theme) .table th {
  background-color: #2e5061 !important;
}

/* ========================= */
/* BUTTONS (DARK)            */
/* ========================= */

body.dark-mode:not(.no-global-theme) .btn,
body.bm-dashboard-dark:not(.no-global-theme) .btn {
  color: #ffffff !important;
}

body.dark-mode:not(.no-global-theme) .btn-primary,
body.bm-dashboard-dark:not(.no-global-theme) .btn-primary {
  background-color: #3a506b;
  border-color: #3a506b;
}

/* ========================= */
/* FORMS (DARK + LIGHT)      */
/* ========================= */

/* Dark-mode form controls (SAFE: does not touch checkbox/radio/switch) */
body.dark-mode:not(.no-global-theme) .form-control,
body.bm-dashboard-dark:not(.no-global-theme) .form-control,
body.dark-mode:not(.no-global-theme) select.form-control,
body.bm-dashboard-dark:not(.no-global-theme) select.form-control {
  background-color: #1e293b !important;
  color: #ffffff !important;
  border: 1px solid #334155 !important;
}

/* Dark-mode placeholders */
body.dark-mode:not(.no-global-theme) .form-control::placeholder,
body.bm-dashboard-dark:not(.no-global-theme) .form-control::placeholder {
  color: #94a3b8 !important;
}

/* Dark-mode select arrow styling (Bootstrap selects) */
body.dark-mode:not(.no-global-theme) select.form-control,
body.bm-dashboard-dark:not(.no-global-theme) select.form-control {
  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='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 16px 12px !important;
}

/* Dark-mode option colors (browser-dependent, but helps) */
body.dark-mode:not(.no-global-theme) option,
body.bm-dashboard-dark:not(.no-global-theme) option {
  background-color: #1e293b !important;
  color: #ffffff !important;
}

/* Light-mode form controls (Option B): Bootstrap `.form-control` only */
body:not(.dark-mode) .form-control,
body:not(.dark-mode) textarea.form-control,
body:not(.dark-mode) select.form-control {
  background-color: #ffffff !important;
  color: #212529 !important;
  border-color: #ced4da !important;
}

/* ========================= */
/* MODALS (DARK)             */
/* ========================= */

body.dark-mode:not(.no-global-theme) .modal-content,
body.bm-dashboard-dark:not(.no-global-theme) .modal-content {
  background-color: #1b2a41 !important;
  border: 1px solid #2e3d55 !important;
  color: #ffffff !important;
}

body.dark-mode:not(.no-global-theme) .modal-header,
body.dark-mode:not(.no-global-theme) .modal-body,
body.dark-mode:not(.no-global-theme) .modal-footer,
body.bm-dashboard-dark:not(.no-global-theme) .modal-header,
body.bm-dashboard-dark:not(.no-global-theme) .modal-body,
body.bm-dashboard-dark:not(.no-global-theme) .modal-footer {
  background-color: #1b2a41 !important;
  color: #ffffff !important;
  border-color: #2e3d55 !important;
}

body.dark-mode:not(.no-global-theme) .modal-header,
body.bm-dashboard-dark:not(.no-global-theme) .modal-header {
  background-color: #24344d !important;
  border-bottom: 1px solid #334155 !important;
  color: #ffffff !important;
  padding: 1rem 1.5rem;
}

body.dark-mode:not(.no-global-theme) .modal-title,
body.bm-dashboard-dark:not(.no-global-theme) .modal-title {
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Modal table header */
body.dark-mode:not(.no-global-theme) .modal-content .table thead th,
body.bm-dashboard-dark:not(.no-global-theme) .modal-content .table thead th {
  background-color: #2d3d5a !important;
  color: #ffffff !important;
  border-bottom: 2px solid #334155 !important;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

/* ========================= */
/* DROPDOWNS (DARK)          */
/* ========================= */

body.dark-mode:not(.no-global-theme) .dropdown-menu,
body.bm-dashboard-dark:not(.no-global-theme) .dropdown-menu {
  background-color: #2e5061;
  border-color: #3a506b;
}

/* ========================= */
/* PAGINATION (DARK)         */
/* ========================= */

body.dark-mode:not(.no-global-theme) .page-link,
body.bm-dashboard-dark:not(.no-global-theme) .page-link {
  background-color: #2e5061;
  border-color: #3a506b;
  color: #ffffff !important;
}

/* ========================= */
/* UTILITIES                 */
/* ========================= */

/* container scrolling */
.container-fluid {
  overflow-x: auto;
}

.container-fluid::-webkit-scrollbar {
  display: none;
}

/* back-to-top button */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #2a1b3d;
  color: #ffffff;
  border-radius: 50%;
  font-size: 22px;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 1000;
}

.back-to-top:hover {
  transform: translateY(-4px);
  opacity: 0.9;
}
