/* Metapsy dark mode for ROB assistant (_app bundle). Matches main site tokens. */

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background-color: #1a2226 !important;
  color: #e2e8eb;
}

html[data-theme="dark"] .bg-light {
  background-color: #243038 !important;
  color: #e2e8eb;
}

html[data-theme="dark"] .text-dark {
  color: #e2e8eb !important;
}

html[data-theme="dark"] .text-danger,
html[data-theme="dark"] .text-warning,
html[data-theme="dark"] .text-success {
  color: #000 !important;
}

html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .small.text-muted {
  color: #9fb0b8 !important;
}

html[data-theme="dark"] .text-black-50 {
  color: rgba(197, 209, 214, 0.55) !important;
}

html[data-theme="dark"] .lead {
  color: #c5d1d6 !important;
}

html[data-theme="dark"] hr {
  box-shadow: none !important;
  opacity: 1 !important;
  color: rgba(61, 79, 88, 0.5) !important;
  border: 0 !important;
  border-top: 1px solid currentColor !important;
}

/* Sidebar chrome */
html[data-theme="dark"] .greyish {
  color: rgba(197, 209, 214, 0.88) !important;
}

html[data-theme="dark"] .btn-active {
  background-color: rgba(94, 186, 189, 0.28) !important;
  color: #e8f6f6 !important;
}

html[data-theme="dark"] .btn-toggle,
html[data-theme="dark"] .btn-toggle:focus,
html[data-theme="dark"] .btn-toggle-2,
html[data-theme="dark"] .btn-toggle-2:focus {
  color: rgba(226, 232, 235, 0.82) !important;
}

html[data-theme="dark"] .btn-toggle:hover,
html[data-theme="dark"] .btn-toggle-2:hover {
  color: #e2e8eb !important;
}

html[data-theme="dark"] .btn-toggle[aria-expanded="true"],
html[data-theme="dark"] .btn-toggle-2[aria-expanded="true"] {
  color: #e2e8eb !important;
}

html[data-theme="dark"] .btn-toggle::before,
html[data-theme="dark"] .btn-toggle-2::before {
  filter: invert(1) brightness(1.15);
}

html[data-theme="dark"] .btn-notoggle,
html[data-theme="dark"] .btn-notoggle:focus {
  color: rgba(226, 232, 235, 0.82) !important;
}

html[data-theme="dark"] .btn-notoggle:hover {
  color: #e2e8eb !important;
}

html[data-theme="dark"] .link-dark {
  color: #b8c5cc !important;
}

html[data-theme="dark"] .link-dark:hover {
  color: var(--bs-primary) !important;
}

html[data-theme="dark"] a.disabled,
html[data-theme="dark"] .btn-toggle-nav a.disabled {
  color: #5a6b73 !important;
}

html[data-theme="dark"] .sidebar-link {
  color: #9fb0b8;
}

html[data-theme="dark"] .sidebar-link:hover {
  color: var(--bs-primary);
}

/* Main column & fixed info panes */
html[data-theme="dark"] #main-div {
  background-color: #243038 !important;
  color: #e2e8eb;
  box-shadow: none !important;
}

html[data-theme="dark"] #main-div [style*="background-color: white"] {
  background-color: #1f2a30 !important;
  color: #e2e8eb !important;
}

html[data-theme="dark"] #main-div span[style*="background-color: lightgray"] {
  background-color: #3d4f58 !important;
  color: #e2e8eb !important;
}

html[data-theme="dark"] #main-div [style*="border-left: 1px lightgray solid"],
html[data-theme="dark"] #main-div [style*="border: 1px solid lightgray"] {
  border-color: #3d4f58 !important;
}

html[data-theme="dark"] .btn-muted {
  background-color: #2d383d !important;
  color: #e2e8eb !important;
  border-color: #3d4f58 !important;
}

html[data-theme="dark"] .btn-muted[style*="border-color: lightgray"] {
  border-color: #4d5a62 !important;
}

/* Chunky corner chrome around floating control groups (matches .bg-light panels) */
html[data-theme="dark"] .btn-group {
  background-color: #243038 !important;
  border-style: solid !important;
  border-color: #243038 !important;
  border-bottom: 0 !important;
  border-right: 0 !important;
  border-top: 0.5rem #243038 solid !important;
  border-left: 0.59rem #243038 solid !important;
  border-radius: 0.6rem 0 0 0 !important;
}

/* Forms */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] textarea {
  background-color: #2d383d;
  border-color: #4d5a62;
  color: #e2e8eb;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  background-color: #2d383d;
  color: #e2e8eb;
}

html[data-theme="dark"] .form-label,
html[data-theme="dark"] label.col-form-label {
  color: #c5d1d6;
}

/* Code & tables */
html[data-theme="dark"] code {
  color: #e2e8eb;
  background-color: rgba(0, 0, 0, 0.25);
  padding: 0.1em 0.35em;
  border-radius: 0.2rem;
}

html[data-theme="dark"] .table {
  color: #e2e8eb;
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.04);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .table > :not(caption) > * > * {
  border-bottom-color: #3d4f58;
}

/* Modal (citation) */
html[data-theme="dark"] .modal-content {
  background-color: #243038;
  color: #e2e8eb;
  border-color: #3d4f58 !important;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
  border-color: #3d4f58;
}

html[data-theme="dark"] .btn-close:not(.btn-close-white) {
  filter: invert(1) grayscale(100%);
  opacity: 0.5;
}

html[data-theme="dark"] .btn-close:not(.btn-close-white):hover {
  opacity: 0.72;
}

html[data-theme="dark"] .btn-close:not(.btn-close-white):focus {
  opacity: 0.85;
  box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.4);
}

html[data-theme="dark"] #citation-text {
  color: #e2e8eb;
}

/* Results (Assessment): overall card, per-question cards, rating squares */
html[data-theme="dark"] #main-content-results .card {
  background-color: #1f2a30 !important;
  border-color: #3d4f58 !important;
  color: #e2e8eb;
}

html[data-theme="dark"] #main-content-results .card-body {
  background-color: #1f2a30 !important;
  color: #e2e8eb;
}

html[data-theme="dark"] #main-content-results .card-body p {
  color: #e2e8eb;
}

html[data-theme="dark"] #main-content-results .card-body span[style*="color: gray"] {
  color: #9fb0b8 !important;
}

/* Domain result panels: border from .rob-collapse-exp in styles.css (no inline !important) */
html[data-theme="dark"] .rob-collapse-exp,
html[data-theme="dark"] .rob-collapse-exp.collapsing,
html[data-theme="dark"] .rob-collapse-exp.collapse.show {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

html[data-theme="dark"] #main-content-results .rating-group > h5 {
  color: #c5d1d6 !important;
}

html[data-theme="dark"] #main-content-results .rating {
  border-color: #4d5a62 !important;
}

html[data-theme="dark"] #main-content-results .rating:not(.bg-success):not(.bg-warning):not(.bg-danger) {
  background-color: #2d383d !important;
}

html[data-theme="dark"] #main-content-results .rating.bg-success {
  background-color: #1a5c38 !important;
  border-color: rgba(94, 186, 189, 0.4) !important;
}

html[data-theme="dark"] #main-content-results .rating.bg-warning {
  background-color: #5c4a12 !important;
  border-color: #7a6518 !important;
}

html[data-theme="dark"] #main-content-results .rating.bg-warning > .rating-inner {
  color: #fff !important;
}

html[data-theme="dark"] #main-content-results .rating.bg-danger {
  background-color: #6b232c !important;
  border-color: #8f3640 !important;
}

html[data-theme="dark"] #main-content-results .btn-edit {
  background-color: #3d4f58 !important;
  color: #e2e8eb !important;
}

html[data-theme="dark"] #main-content-results .btn-edit:hover {
  background-color: #4d5a62 !important;
  color: #fff !important;
}

html[data-theme="dark"] #main-content-results img[style*="0.125"] {
  border-color: #3d4f58 !important;
}

/* Overall verdict icon (inline color from app.js uses BS vars) */
html[data-theme="dark"] #rating-overall-symbol[style*="bs-danger"] {
  color: #f28b8b !important;
}

html[data-theme="dark"] #rating-overall-symbol[style*="bs-success"] {
  color: #7dcea0 !important;
}

html[data-theme="dark"] #rating-overall-symbol[style*="bs-warning"] {
  color: #f0d090 !important;
}

/* Infobox: Rate New Study */
html[data-theme="dark"] #infobox-results a.btn-secondary.rob-rate-new-btn {
  border: 0.25px solid rgba(108, 117, 125, 0.55) !important;
}

/* Results: export / copy (.rob-export-btn light border in styles.css) */
html[data-theme="dark"] #main-content-results .btn-primary.rob-export-btn {
  border: none !important;
  box-shadow: none !important;
}

/* Decorative background */
html[data-theme="dark"] #honeycomb {
  opacity: 0.12;
  filter: brightness(0.85);
}
