/*
 * XTRI admin theme
 * Colours taken from the mobile app design:
 *   #22272f  app background
 *   #313843  nav bar / raised surface
 *   #34ef35  brand green (buttons, highlights)
 *   #ffffff  text
 * Loaded after adminlte.css; the layouts set data-bs-theme="dark" on <html>.
 */

/* ------------------------------------------------------------------ */
/* Bootstrap tokens                                                    */
/* ------------------------------------------------------------------ */
[data-bs-theme=dark] {
  --xt-green: #34ef35;
  --xt-green-rgb: 52, 239, 53;
  --xt-green-hover: #5cf35d;
  --xt-green-active: #22d523;
  --xt-ink: #22272f;
  --xt-ink-rgb: 34, 39, 47;
  --xt-surface: #313843;
  --xt-surface-rgb: 49, 56, 67;
  --xt-card: #2a3039;
  --xt-input-border: #454e5c;

  --bs-body-color: #f1f3f5;
  --bs-body-color-rgb: 241, 243, 245;
  --bs-body-bg: #2a3039;
  --bs-body-bg-rgb: 42, 48, 57;
  --bs-emphasis-color: #fff;
  --bs-emphasis-color-rgb: 255, 255, 255;
  --bs-secondary-color: rgba(241, 243, 245, 0.68);
  --bs-secondary-color-rgb: 241, 243, 245;
  --bs-secondary-bg: #313843;
  --bs-secondary-bg-rgb: 49, 56, 67;
  --bs-tertiary-color: rgba(241, 243, 245, 0.5);
  --bs-tertiary-color-rgb: 241, 243, 245;
  --bs-tertiary-bg: #22272f;
  --bs-tertiary-bg-rgb: 34, 39, 47;

  --bs-primary: #34ef35;
  --bs-primary-rgb: 52, 239, 53;
  --bs-success: #34ef35;
  --bs-success-rgb: 52, 239, 53;
  --bs-info: #34ef35;
  --bs-info-rgb: 52, 239, 53;
  --bs-secondary: #4a5361;
  --bs-secondary-rgb: 74, 83, 97;
  --bs-danger: #ff5c66;
  --bs-danger-rgb: 255, 92, 102;

  --bs-primary-text-emphasis: #7df57e;
  --bs-success-text-emphasis: #7df57e;
  --bs-info-text-emphasis: #7df57e;
  --bs-primary-bg-subtle: #173a24;
  --bs-success-bg-subtle: #173a24;
  --bs-info-bg-subtle: #173a24;
  --bs-primary-border-subtle: #1f8a2a;
  --bs-success-border-subtle: #1f8a2a;
  --bs-info-border-subtle: #1f8a2a;

  --bs-link-color: #34ef35;
  --bs-link-color-rgb: 52, 239, 53;
  --bs-link-hover-color: #7df57e;
  --bs-link-hover-color-rgb: 125, 245, 126;

  --bs-border-color: #3d4552;
  --bs-border-color-translucent: rgba(255, 255, 255, 0.1);
  --bs-focus-ring-color: rgba(52, 239, 53, 0.25);
  --bs-form-valid-color: #34ef35;
  --bs-form-valid-border-color: #34ef35;
}

/* ------------------------------------------------------------------ */
/* Layout: header, sidebar, footer                                     */
/* ------------------------------------------------------------------ */
[data-bs-theme=dark] .app-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

[data-bs-theme=dark] .app-header .nav-link {
  color: #c9ced6;
}

[data-bs-theme=dark] .app-header .nav-link:hover {
  color: var(--xt-green);
}

[data-bs-theme=dark] .user-menu .user-header.text-bg-primary {
  background-color: #22272f !important;
  color: #fff !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-bs-theme=dark] .navbar-nav > .user-menu > .dropdown-menu > li.user-header > img {
  border-color: #34ef35;
}

[data-bs-theme=dark] .user-menu .user-header small {
  color: var(--bs-secondary-color);
}

[data-bs-theme=dark] .app-sidebar {
  --lte-sidebar-color: #c9ced6;
  --lte-sidebar-hover-color: #fff;
  --lte-sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --lte-sidebar-active-color: var(--xt-green);
  --lte-sidebar-menu-active-bg: rgba(var(--xt-green-rgb), 0.12);
  --lte-sidebar-menu-active-color: var(--xt-green);
  --lte-sidebar-submenu-color: #c9ced6;
  --lte-sidebar-submenu-hover-color: #fff;
  --lte-sidebar-submenu-hover-bg: rgba(255, 255, 255, 0.06);
  --lte-sidebar-submenu-active-color: var(--xt-green);
  --lte-sidebar-submenu-active-bg: rgba(var(--xt-green-rgb), 0.12);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

[data-bs-theme=dark] .app-sidebar .sidebar-brand {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme=dark] .app-sidebar .brand-link .brand-text {
  color: #fff;
  font-weight: 600 !important;
  letter-spacing: 0.02em;
}

[data-bs-theme=dark] .sidebar-menu .nav-link.active {
  color: var(--xt-green) !important;
  background-color: rgba(var(--xt-green-rgb), 0.12) !important;
  box-shadow: inset 3px 0 0 var(--xt-green);
}

[data-bs-theme=dark] .sidebar-menu .nav-link.active .nav-icon {
  color: var(--xt-green);
}

[data-bs-theme=dark] .app-footer {
  background-color: var(--xt-surface);
  border-top-color: rgba(255, 255, 255, 0.06);
}

[data-bs-theme=dark] .app-content-header h3 {
  color: #fff;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
[data-bs-theme=dark] .btn-primary,
[data-bs-theme=dark] .btn-info,
[data-bs-theme=dark] .btn-success {
  --bs-btn-color: #22272f;
  --bs-btn-bg: #34ef35;
  --bs-btn-border-color: #34ef35;
  --bs-btn-hover-color: #22272f;
  --bs-btn-hover-bg: #5cf35d;
  --bs-btn-hover-border-color: #5cf35d;
  --bs-btn-focus-shadow-rgb: 52, 239, 53;
  --bs-btn-active-color: #22272f;
  --bs-btn-active-bg: #22d523;
  --bs-btn-active-border-color: #22d523;
  --bs-btn-disabled-color: #22272f;
  --bs-btn-disabled-bg: #34ef35;
  --bs-btn-disabled-border-color: #34ef35;
  font-weight: 600;
}

/* Several views add .text-white to green buttons; keep the label readable */
[data-bs-theme=dark] .btn-primary.text-white,
[data-bs-theme=dark] .btn-info.text-white,
[data-bs-theme=dark] .btn-success.text-white {
  color: #22272f !important;
}

[data-bs-theme=dark] .btn-outline-primary,
[data-bs-theme=dark] .btn-outline-info,
[data-bs-theme=dark] .btn-outline-success {
  --bs-btn-color: #34ef35;
  --bs-btn-border-color: #34ef35;
  --bs-btn-hover-color: #22272f;
  --bs-btn-hover-bg: #34ef35;
  --bs-btn-hover-border-color: #34ef35;
  --bs-btn-focus-shadow-rgb: 52, 239, 53;
  --bs-btn-active-color: #22272f;
  --bs-btn-active-bg: #34ef35;
  --bs-btn-active-border-color: #34ef35;
  --bs-btn-disabled-color: #34ef35;
  --bs-btn-disabled-border-color: #34ef35;
}

[data-bs-theme=dark] .btn-secondary,
[data-bs-theme=dark] .btn-default {
  --bs-btn-color: #fff;
  --bs-btn-bg: #3d4552;
  --bs-btn-border-color: #3d4552;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #4a5361;
  --bs-btn-hover-border-color: #4a5361;
  --bs-btn-focus-shadow-rgb: 74, 83, 97;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #555f6e;
  --bs-btn-active-border-color: #555f6e;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #3d4552;
  --bs-btn-disabled-border-color: #3d4552;
}

[data-bs-theme=dark] .btn-outline-secondary {
  --bs-btn-color: #c9ced6;
  --bs-btn-border-color: #4a5361;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #4a5361;
  --bs-btn-hover-border-color: #4a5361;
  --bs-btn-focus-shadow-rgb: 74, 83, 97;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #4a5361;
  --bs-btn-active-border-color: #4a5361;
}

/* ------------------------------------------------------------------ */
/* Colour utilities and AdminLTE card variants                         */
/* ------------------------------------------------------------------ */
[data-bs-theme=dark] .card-primary,
[data-bs-theme=dark] .card-success,
[data-bs-theme=dark] .card-info,
[data-bs-theme=dark] .bg-primary,
[data-bs-theme=dark] .bg-success,
[data-bs-theme=dark] .bg-info,
[data-bs-theme=dark] .text-bg-primary,
[data-bs-theme=dark] .text-bg-success,
[data-bs-theme=dark] .text-bg-info {
  --lte-card-variant-bg: #34ef35;
  --lte-card-variant-bg-rgb: 52, 239, 53;
  --lte-card-variant-color: #22272f;
  --lte-card-variant-color-rgb: 34, 39, 47;
}

[data-bs-theme=dark] .card-secondary,
[data-bs-theme=dark] .bg-secondary,
[data-bs-theme=dark] .text-bg-secondary {
  --lte-card-variant-bg: #4a5361;
  --lte-card-variant-bg-rgb: 74, 83, 97;
}

[data-bs-theme=dark] .text-bg-primary,
[data-bs-theme=dark] .text-bg-success,
[data-bs-theme=dark] .text-bg-info {
  color: #22272f !important;
}

/* --bs-secondary is a surface grey here, too dark for text */
[data-bs-theme=dark] .text-secondary,
[data-bs-theme=dark] .link-secondary {
  color: var(--bs-secondary-color) !important;
}

[data-bs-theme=dark] .link-secondary:hover {
  color: #fff !important;
}

/* ------------------------------------------------------------------ */
/* Cards, tables, info boxes                                           */
/* ------------------------------------------------------------------ */
[data-bs-theme=dark] .card,
[data-bs-theme=dark] .info-box,
[data-bs-theme=dark] .small-box {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

[data-bs-theme=dark] .card {
  --bs-card-border-color: rgba(255, 255, 255, 0.06);
  --bs-card-cap-bg: transparent;
}

[data-bs-theme=dark] .table {
  --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
  --bs-table-hover-bg: rgba(var(--xt-green-rgb), 0.06);
  --bs-table-active-bg: rgba(var(--xt-green-rgb), 0.1);
  --bs-table-border-color: #3a424e;
}

[data-bs-theme=dark] .table > thead th {
  color: #fff;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------------ */
/* Navigation: tabs, pills, breadcrumbs, pagination, dropdowns         */
/* ------------------------------------------------------------------ */
[data-bs-theme=dark] .nav-tabs {
  --bs-nav-tabs-border-color: #3d4552;
  --bs-nav-tabs-link-hover-border-color: transparent;
  --bs-nav-tabs-link-active-color: #34ef35;
  --bs-nav-tabs-link-active-bg: transparent;
  --bs-nav-tabs-link-active-border-color: transparent;
  --bs-nav-link-color: #c9ced6;
  --bs-nav-link-hover-color: #fff;
}

[data-bs-theme=dark] .nav-tabs .nav-link.active {
  box-shadow: inset 0 -3px 0 #34ef35;
  font-weight: 600;
}

[data-bs-theme=dark] .nav-pills {
  --bs-nav-pills-link-active-color: #22272f;
  --bs-nav-pills-link-active-bg: #34ef35;
}

[data-bs-theme=dark] .breadcrumb-item.active {
  color: var(--bs-secondary-color);
}

[data-bs-theme=dark] .pagination {
  --bs-pagination-color: #c9ced6;
  --bs-pagination-bg: #2a3039;
  --bs-pagination-border-color: #3d4552;
  --bs-pagination-hover-color: #fff;
  --bs-pagination-hover-bg: #313843;
  --bs-pagination-hover-border-color: #3d4552;
  --bs-pagination-focus-color: #fff;
  --bs-pagination-focus-bg: #313843;
  --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(52, 239, 53, 0.25);
  --bs-pagination-active-color: #22272f;
  --bs-pagination-active-bg: #34ef35;
  --bs-pagination-active-border-color: #34ef35;
  --bs-pagination-disabled-color: rgba(241, 243, 245, 0.35);
  --bs-pagination-disabled-bg: #2a3039;
  --bs-pagination-disabled-border-color: #3d4552;
}

[data-bs-theme=dark] .dropdown-menu {
  --bs-dropdown-bg: #313843;
  --bs-dropdown-border-color: rgba(255, 255, 255, 0.08);
  --bs-dropdown-link-hover-bg: rgba(255, 255, 255, 0.06);
  --bs-dropdown-link-active-color: #22272f;
  --bs-dropdown-link-active-bg: #34ef35;
}

[data-bs-theme=dark] .list-group {
  --bs-list-group-active-color: #22272f;
  --bs-list-group-active-bg: #34ef35;
  --bs-list-group-active-border-color: #34ef35;
}

[data-bs-theme=dark] .progress,
[data-bs-theme=dark] .progress-stacked {
  --bs-progress-bar-bg: #34ef35;
  --bs-progress-bar-color: #22272f;
}

[data-bs-theme=dark] .badge.text-bg-warning,
[data-bs-theme=dark] .badge.bg-warning {
  color: #22272f !important;
}

/* ------------------------------------------------------------------ */
/* Forms                                                               */
/* ------------------------------------------------------------------ */
[data-bs-theme=dark] .form-control,
[data-bs-theme=dark] .form-select,
[data-bs-theme=dark] .input-group-text {
  background-color: #22272f;
  border-color: #454e5c;
}

[data-bs-theme=dark] .input-group-text {
  color: #c9ced6;
}

[data-bs-theme=dark] .form-control:disabled,
[data-bs-theme=dark] .form-select:disabled,
[data-bs-theme=dark] .form-control[readonly] {
  background-color: #313843;
}

[data-bs-theme=dark] .form-control::placeholder {
  color: rgba(241, 243, 245, 0.38);
}

[data-bs-theme=dark] .form-control:focus,
[data-bs-theme=dark] .form-select:focus,
[data-bs-theme=dark] .form-check-input:focus {
  border-color: rgba(52, 239, 53, 0.65);
  box-shadow: 0 0 0 0.25rem rgba(52, 239, 53, 0.2);
}

[data-bs-theme=dark] .form-check-input {
  background-color: #22272f;
  border-color: #5a6372;
}

[data-bs-theme=dark] .form-check-input:checked {
  background-color: #34ef35;
  border-color: #34ef35;
}

[data-bs-theme=dark] .form-check-input:checked[type=checkbox] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2322272f' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

[data-bs-theme=dark] .form-check-input:checked[type=radio] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%2322272f'/%3e%3c/svg%3e");
}

[data-bs-theme=dark] .form-switch .form-check-input:focus:not(:checked) {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2385f586'/%3e%3c/svg%3e");
}

[data-bs-theme=dark] .form-switch .form-check-input:checked {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2322272f'/%3e%3c/svg%3e");
}

[data-bs-theme=dark] .form-range::-webkit-slider-thumb {
  background-color: #34ef35;
}

[data-bs-theme=dark] .form-range::-moz-range-thumb {
  background-color: #34ef35;
}

/* ------------------------------------------------------------------ */
/* Third-party widgets                                                 */
/* ------------------------------------------------------------------ */

/* Select2 (default theme) */
[data-bs-theme=dark] .select2-container--default .select2-selection--single,
[data-bs-theme=dark] .select2-container--default .select2-selection--multiple {
  background-color: #22272f;
  border-color: #454e5c;
}

[data-bs-theme=dark] .select2-container--default.select2-container--focus .select2-selection--multiple,
[data-bs-theme=dark] .select2-container--default.select2-container--open .select2-selection--single {
  border-color: rgba(52, 239, 53, 0.65);
}

[data-bs-theme=dark] .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: #f1f3f5;
}

[data-bs-theme=dark] .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: rgba(241, 243, 245, 0.38);
}

[data-bs-theme=dark] .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-top-color: #c9ced6;
}

[data-bs-theme=dark] .select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: #313843;
  border-color: #454e5c;
  color: #f1f3f5;
}

[data-bs-theme=dark] .select2-dropdown {
  background-color: #313843;
  border-color: #454e5c;
  color: #f1f3f5;
}

[data-bs-theme=dark] .select2-container--default .select2-search--dropdown .select2-search__field,
[data-bs-theme=dark] .select2-container--default .select2-search--inline .select2-search__field {
  background-color: #22272f;
  border-color: #454e5c;
  color: #f1f3f5;
}

[data-bs-theme=dark] .select2-container--default .select2-results__option--selected,
[data-bs-theme=dark] .select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #3d4552;
}

[data-bs-theme=dark] .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
[data-bs-theme=dark] .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #34ef35;
  color: #22272f;
}

/* SweetAlert2 */
[data-bs-theme=dark] .swal2-popup {
  background: #2a3039;
  color: #f1f3f5;
}

[data-bs-theme=dark] .swal2-title,
[data-bs-theme=dark] .swal2-html-container {
  color: inherit;
}

[data-bs-theme=dark] .swal2-styled.swal2-confirm {
  color: #22272f;
  font-weight: 600;
}

/* Tempus Dominus date picker (dark theme) */
html[data-bs-theme=dark] {
  --td-dark-widget-background: #313843;
  --td-dark-font-color: #f1f3f5;
  --td-dark-active-bg: #34ef35;
  --td-dark-active-color: #22272f;
  --td-dark-active-border-color: #313843;
  --td-dark-range-bg: #1f8a2a;
  --td-dark-btn-hover-bg: #3d4552;
  --td-dark-primary-border-color: #313843;
  --td-dark-text-shadow: none;
}

/* Dropzone */
[data-bs-theme=dark] .dropzone {
  background: #22272f;
  border: 2px dashed #454e5c;
  border-radius: 0.375rem;
}

[data-bs-theme=dark] .dropzone:hover {
  border-color: rgba(52, 239, 53, 0.65);
}

/* ------------------------------------------------------------------ */
/* Login                                                               */
/* ------------------------------------------------------------------ */
[data-bs-theme=dark] .login-page .login-logo {
  color: #fff;
}

[data-bs-theme=dark] .login-page .card {
  background-color: #313843;
}

/* ------------------------------------------------------------------ */
/* Warning (edit) buttons: blue instead of yellow, both themes         */
/* ------------------------------------------------------------------ */
.btn-warning {
  --bs-btn-color: #fff;
  --bs-btn-bg: #1e88e5;
  --bs-btn-border-color: #1e88e5;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #1976d2;
  --bs-btn-hover-border-color: #1976d2;
  --bs-btn-focus-shadow-rgb: 30, 136, 229;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #1565c0;
  --bs-btn-active-border-color: #1565c0;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #1e88e5;
  --bs-btn-disabled-border-color: #1e88e5;
}

.btn-warning.text-white,
.btn-warning.text-dark {
  color: #fff !important;
}

.btn-outline-warning {
  --bs-btn-color: #1e88e5;
  --bs-btn-border-color: #1e88e5;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #1e88e5;
  --bs-btn-hover-border-color: #1e88e5;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #1e88e5;
  --bs-btn-active-border-color: #1e88e5;
}

/* Action buttons: keep a gap when they wrap onto a second row */
td.action {
  white-space: normal;
}

td.action > .btn {
  margin: 0 0.15rem 0.3rem 0;
  vertical-align: top;
}
