/* Dark Mode Overrides */

/* Blue-night base tones + Bootstrap RGB overrides to avoid !important */
[data-bs-theme="dark"] {
  --bs-body-bg: #0D1117;
  --bs-body-bg-rgb: 13, 17, 23;
  --bs-body-color: #E6EDF3;
  --bs-body-color-rgb: 230, 237, 243;
  --bs-secondary-bg: #161B22;
  --bs-tertiary-bg: #1C2128;
  --bs-dark-bg-subtle: #161B22;
  --bs-light-bg-subtle: #161B22;
  --bs-light-rgb: 22, 27, 34;
  --bs-white-rgb: 13, 17, 23;
  --bs-border-color: rgba(240, 246, 252, 0.1);
  --bs-secondary-color: #8B949E;
  --bs-secondary-border-subtle: rgba(240, 246, 252, 0.1);
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
  color: inherit;
  display: flex;
  align-items: center;
}
.theme-toggle:hover {
  opacity: 0.75;
}
.theme-toggle .bi-sun-fill { display: none; }
.theme-toggle .bi-moon-fill { display: inline; }

[data-bs-theme="dark"] .theme-toggle .bi-sun-fill { display: inline; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-fill { display: none; }

/* Navbar — .bg-light and .bg-white now read --bs-light-rgb / --bs-white-rgb */

/* Modal overrides */
[data-bs-theme="dark"] .modal-content {
  background-color: var(--bs-secondary-bg);
  color: var(--bs-body-color);
  border: 1px solid rgba(240, 246, 252, 0.08);
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
  border-color: var(--bs-border-color);
}

/* Spinner modal background */
[data-bs-theme="dark"] #spinner {
  background: rgba(13, 17, 23, 0.7) !important;
}
[data-bs-theme="dark"] #message.modal {
  background: rgba(13, 17, 23, 0.7) !important;
}

/* .text-muted and .text-secondary — now read --bs-secondary-color from variables */

/* Form controls */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}

/* Tables */
[data-bs-theme="dark"] .table {
  color: var(--bs-body-color);
}

/* thead.bg-light — reads --bs-light-rgb */
/* .border-secondary — reads --bs-secondary-border-subtle */
/* body.login-page — reads --bs-body-bg via var() in inline style */

/* Chat message bubbles */
[data-bs-theme="dark"] .pp-right:after {
  border-bottom-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .pp-left:before {
  border-bottom-color: var(--bs-border-color);
}

/* .fixed-top — reads --bs-border-color from variables */

/* Dropdown */
[data-bs-theme="dark"] .dropdown-menu {
  background-color: var(--bs-secondary-bg);
  border: 1px solid rgba(240, 246, 252, 0.08);
}
[data-bs-theme="dark"] .dropdown-item {
  color: var(--bs-body-color);
}
[data-bs-theme="dark"] .dropdown-item:hover {
  background-color: var(--bs-tertiary-bg);
}

/* Tom Select */
[data-bs-theme="dark"] .ts-control,
[data-bs-theme="dark"] .ts-dropdown {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}

/* Bootstrap Table */
[data-bs-theme="dark"] .bootstrap-table .fixed-table-container {
  background-color: var(--bs-body-bg);
}

/* jQuery UI */
[data-bs-theme="dark"] .ui-widget-content {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}
