/* ==========================================================================
   AviScio Master Theme Override Layer (Bootstrap 4 / SB Admin 2 / Select2 / DataTables)
   Consumes CSS custom properties injected by templates/partials/_theme_vars.html.
   Semantic colors (success, warning, danger, info) are intentionally preserved.
   ========================================================================== */

body {
  background-color: var(--theme-body-bg, #f8fafc);
}

/* --- Links & Text Utilities --- */
a {
  color: var(--theme-primary, #4d6edb);
}

a:hover {
  color: var(--theme-primary-dark, #31479b);
}

.text-primary {
  color: var(--theme-primary, #4d6edb) !important;
}

a.text-primary:hover,
a.text-primary:focus {
  color: var(--theme-primary-dark, #31479b) !important;
}

/* --- Backgrounds & Borders --- */
.bg-primary {
  background-color: var(--theme-primary, #4d6edb) !important;
}

.bg-gradient-primary {
  background-color: var(--theme-primary, #4d6edb) !important;
  background-image: linear-gradient(
    180deg,
    var(--theme-primary, #4d6edb) 10%,
    var(--theme-primary-dark, #31479b) 100%
  ) !important;
  background-size: cover;
}

.border-primary {
  border-color: var(--theme-primary, #4d6edb) !important;
}

.border-left-primary {
  border-left: 0.25rem solid var(--theme-primary, #4d6edb) !important;
}

.border-bottom-primary {
  border-bottom: 0.25rem solid var(--theme-primary, #4d6edb) !important;
}

/* --- Primary Buttons --- */
.btn-primary {
  color: var(--theme-on-primary, #ffffff) !important;
  background-color: var(--theme-primary, #4d6edb) !important;
  border-color: var(--theme-primary, #4d6edb) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active,
.show > .btn-primary.dropdown-toggle {
  color: var(--theme-on-primary, #ffffff) !important;
  background-color: var(--theme-primary-dark, #31479b) !important;
  border-color: var(--theme-primary-dark, #31479b) !important;
}

.btn-primary:focus,
.btn-primary.focus {
  box-shadow: 0 0 0 0.2rem rgba(var(--theme-primary-rgb, 77, 110, 219), 0.35) !important;
}

.btn-outline-primary {
  color: var(--theme-primary, #4d6edb) !important;
  border-color: var(--theme-primary, #4d6edb) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:not(:disabled):not(.disabled):active,
.btn-outline-primary:not(:disabled):not(.disabled).active,
.show > .btn-outline-primary.dropdown-toggle {
  color: var(--theme-on-primary, #ffffff) !important;
  background-color: var(--theme-primary, #4d6edb) !important;
  border-color: var(--theme-primary, #4d6edb) !important;
}

.btn-link {
  color: var(--theme-primary, #4d6edb);
}

.btn-link:hover {
  color: var(--theme-primary-dark, #31479b);
}

/* --- Badges & Progress Bars --- */
.badge-primary {
  color: var(--theme-on-primary, #ffffff);
  background-color: var(--theme-primary, #4d6edb);
}

a.badge-primary:hover,
a.badge-primary:focus {
  color: var(--theme-on-primary, #ffffff);
  background-color: var(--theme-primary-dark, #31479b);
}

.progress-bar {
  background-color: var(--theme-primary, #4d6edb);
}

/* --- Navigation Pills, Tabs & Pagination --- */
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  color: var(--theme-on-primary, #ffffff);
  background-color: var(--theme-primary, #4d6edb);
}

.page-link {
  color: var(--theme-primary, #4d6edb);
}

.page-link:hover {
  color: var(--theme-primary-dark, #31479b);
}

.page-item.active .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  color: var(--theme-on-primary, #ffffff) !important;
  background: var(--theme-primary, #4d6edb) !important;
  background-color: var(--theme-primary, #4d6edb) !important;
  border-color: var(--theme-primary, #4d6edb) !important;
}

.list-group-item.active {
  color: var(--theme-on-primary, #ffffff);
  background-color: var(--theme-primary, #4d6edb);
  border-color: var(--theme-primary, #4d6edb);
}

.dropdown-item.active,
.dropdown-item:active {
  color: var(--theme-on-primary, #ffffff);
  background-color: var(--theme-primary, #4d6edb);
}

/* --- Form Focus & Checkboxes/Radios --- */
.form-control:focus,
.custom-select:focus {
  border-color: var(--theme-primary, #4d6edb);
  box-shadow: 0 0 0 0.2rem rgba(var(--theme-primary-rgb, 77, 110, 219), 0.22);
}

.custom-control-input:checked ~ .custom-control-label::before {
  color: var(--theme-on-primary, #ffffff);
  border-color: var(--theme-primary, #4d6edb);
  background-color: var(--theme-primary, #4d6edb);
}

/* --- Select2 Highlights --- */
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--theme-primary, #4d6edb) !important;
  color: var(--theme-on-primary, #ffffff) !important;
}

/* --- Footer Surface --- */
footer.av-footer {
  background-color: var(--theme-footer-bg, #1e293b) !important;
  color: var(--theme-footer-text, #e0e0e0) !important;
}

footer.av-footer a {
  color: var(--theme-footer-text, #e0e0e0) !important;
}
