/************************** GLOBAL STYLES ******************************/

/* Fix dropdown item active/focus to use selected theme color in ACTION Button*/
.dropdown-menu .dropdown-item:active,
.dropdown-menu .dropdown-item:focus {
    background-color: rgba(var(--bs-theme-rgb), 0.15);
    color: var(--bs-theme);
}
.dropdown-menu .dropdown-item:hover {
    background-color: rgba(var(--bs-theme-rgb), 0.08);
    color: var(--bs-inverse);
}

/**/
.disabled {
    cursor: not-allowed !important;
    opacity: 0.4 !important;
}
/**/
.cursor-pointer {
    cursor: pointer;
}

.loadable-card .card-body {
    min-height: 100px;
}

.text-muted {
    color: var(--bs-text-secondary) !important;
    opacity: 0.6 !important;
}
/**/
.search-highlight {
    background-color: rgba(255, 255, 0, 0.4);
    padding: 0px 0px;
    border-radius: 3px;
    font-weight: 600;
}
[data-bs-theme="dark"] .search-highlight {
    background-color: rgba(255, 193, 7, 0.3);
}
/**/
.dt-search-highlight {
    background-color: rgba(255, 255, 0, 0.4);
    padding: 0px 0px;
    border-radius: 3px;
    font-weight: 600;
}
[data-bs-theme="dark"] .dt-search-highlight {
    background-color: rgba(255, 193, 7, 0.3);
}
/**/
.shortcut-icon {
    transition: transform 0.3s ease;
    display: inline-block;
}
a.card:hover .shortcut-icon {
    transform: scale(1.3);
}
/**/
.bg-mode {
    background-color: var(--bs-app-header-bg);
    color: var(--bs-text-color);
}
/************************** TOM Select ******************************/
.ts-dropdown-content .active {
    background-color: var(--bs-border-color) !important;
    color: var(--bs-text-color) !important;
}
.ts-control {
    background-color: var(--bs-app-header-bg) !important;
    border: 0px solid var(--bs-border-color) !important;
    min-height: 36px !important;
    color: var(--bs-text-color) !important;
}
 .ts-dropdown-content{
    background-color: var(--bs-app-header-bg) !important;
    color: var(--bs-text-color) !important;
    opacity: 1 !important;
 }

.ts-dropdown{
    background-color: var(--bs-app-header-bg) !important;
    color: var(--bs-text-color) !important;
    opacity: 1 !important;
}

.ts-control input {
    color: var(--bs-text-color) !important;
}

/************************** Datatables ******************************/
/* Fix dt-buttons text not visible in light mode (btn-secondary overrides outline color) */
.dt-buttons .btn.btn-outline-default {
    --bs-btn-color: #798e98;
    --bs-btn-border-color: #798e98;
    --bs-btn-bg: transparent;
}
/* Fix missing right border on header/filter rows when scrollX clips the last th */
.dt-scroll-head {
    border-inline-end: 1px solid var(--bs-border-color) !important;
}
/* Processing overlay - must be above card-arrow elements */
.dataTables_wrapper {
    position: relative;
}
.dt-processing {
    background-color: var(--bs-app-header-bg) !important;
    color: var(--bs-text-color) !important;
    border: 1px solid var(--bs-border-color) !important;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1050 !important; /* Above card-arrow elements */
}

.dt-processing > div > div {
    background-color: var(--bs-theme) !important;
}

/* Ensure card-arrow doesn't overlap processing */
.card-table .card-arrow {
    z-index: 1 !important;
}

.table td,
.table th {
    vertical-align: middle !important;
}
/********************** HIGHLIGHT JS ******************************/
.hljs-container {
    border: 1px solid var(--bs-border-color);
    /* border-radius: 0.5rem; */
}
/************************** LOADER ******************************/
.card.card-loading .card-body {
    position: relative;
    z-index: 0;
    overflow: hidden
}
.card.card-loading .card-body .card-loader {
    position: absolute;
    margin: 3px;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background: var(--bs-app-header-bg);
    opacity: 0.6;
    z-index: 1030;
    animation: fadeIn .2s;
    border-radius: 0 0 4px 4px;
    display: flex;
    justify-content: center;
    align-items: center
}
/****************************** SWAL2 ******************************/
.swal2-popup {
    background: var(--bs-app-header-bg) !important;
    color: var(--bs-text-color) !important;
}
.swal2-confirm{
    background-color: var(--bs-theme) !important;
}
.swal2-confirm:hover,
.swal2-confirm:focus,
.swal2-confirm:active {
    background-color: var(--bs-theme) !important;
    filter: brightness(0.9);
}
.swal2-confirm.swal2-info{
    background-color: var(--bs-theme) !important;
}
.swal2-confirm.swal2-error{
    background-color: var(--bs-danger) !important;
}
.swal2-confirm.swal2-warning{
    background-color: var(--bs-warning) !important;
}
.swal2-cancel{
    background-color: var(--bs-secondary) !important;
}
.swal2-loader {
    border-color: var(--bs-theme) transparent var(--bs-theme) transparent !important;
}
.swal2-container {
    z-index: 10500 !important;
}
/****************************** MODALS ******************************/
.modal {
    z-index: 10000 !important;
}
.modal-backdrop {
    z-index: 9999 !important;
}
/****************************** PARSLEY ******************************/
/* Style invalid input */
input.parsley-error,
select.parsley-error,
textarea.parsley-error {
  border-color: #ff2a40 !important; /* Bootstrap's red */
  box-shadow: none;
}

/* Style error messages */
.parsley-errors-list {
  color: #ff2a40;
  list-style-type: none;
  padding-left: 0;
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

/* Optional: add space below inputs */
.form-group .parsley-errors-list {
  margin-bottom: 0.5rem;
}
/******************************* Select2 ******************************/
.select2-container--default .select2-selection--multiple,
.select2-container--default .select2-selection--single {
    background-color: var(--bs-app-header-bg) !important;
    border: 1px solid var(--bs-border-color) !important;
    min-height: 36px !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice,
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--bs-body-color) !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: var(--bs-component-bg) !important;
    border-color: var(--bs-border-color) !important;
}
/* Colored select2 choices */
.select2-container--default .select2-selection--multiple .select2-selection__choice.select2-colored-choice {
    background-color: var(--choice-color) !important;
    border-color: var(--choice-color) !important;
    color: #fff !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice.select2-colored-choice .select2-selection__choice__remove {
    color: #fff !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice.select2-colored-choice .select2-selection__choice__remove:hover {
    color: rgba(255,255,255,0.7) !important;
    background-color: rgba(0,0,0,0.1) !important;
}
/* Colored dot in dropdown options */
.select2-colored-option {
    display: flex;
    align-items: center;
}
.select2-colored-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: var(--bs-body-color) !important;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: var(--bs-danger) !important;
    background-color: transparent !important;
}
.select2-dropdown {
    background-color: var(--bs-app-header-bg) !important;
    border-color: var(--bs-border-color) !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--bs-app-header-bg) !important;
    border-color: var(--bs-border-color) !important;
    color: var(--bs-body-color) !important;
}
.select2-container--default .select2-results__option {
    color: var(--bs-body-color) !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--bs-theme) !important;
    color: #fff !important;
}
.select2-container--default .select2-results__option--selected {
    background-color: rgba(var(--bs-theme-rgb), 0.15) !important;
    color: var(--bs-body-color) !important;
}
.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: rgba(var(--bs-theme-rgb), 0.15) !important;
    color: var(--bs-body-color) !important;
}
/* X-editable Bootstrap 5 styling */
.editable-container.editable-inline {
    display: inline-flex !important;
    align-items: center;
}
.editable-input input.form-control,
.editable-input input {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.875rem !important;
    border-radius: 0.25rem !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    background-color: rgba(255,255,255,0.1) !important;
    color: inherit !important;
    min-width: 250px;
    height: 32px !important;
    line-height: 1.5 !important;
}
.editable-input input:focus {
    border-color: var(--bs-theme) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-theme-rgb), 0.25) !important;
    outline: none !important;
}
.editable-buttons {
    display: inline-flex !important;
    margin-left: 0.3rem !important;
    gap: 0.25rem;
}
.editable-buttons .editable-submit,
.editable-buttons .editable-cancel {
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    border-radius: 0.25rem !important;
    border: none !important;
    cursor: pointer;
    margin-left: 5px !important;
}
.editable-buttons .editable-submit {
    background-color: var(--bs-theme) !important;
    color: #fff !important;
    height: 32px !important;
    line-height: 1.5 !important;
}
.editable-buttons .editable-submit:hover {
    opacity: 0.9;
}
.editable-buttons .editable-cancel {
    background-color: transparent !important;
    color: inherit !important;
    border: 1px solid rgba(128,128,128,0.3) !important;
    height: 32px !important;
    line-height: 1.5 !important;
}
.editable-buttons .editable-cancel:hover {
    background-color: rgba(128,128,128,0.1) !important;
}
/* Dark mode cancel button */
[data-bs-theme="dark"] .editable-buttons .editable-cancel {
    border-color: rgba(255,255,255,0.2) !important;
}
[data-bs-theme="dark"] .editable-buttons .editable-cancel:hover {
    background-color: rgba(255,255,255,0.1) !important;
}
.editable-click {
    border-bottom: 1px dashed currentColor !important;
    cursor: pointer;
}
.editable-click:hover {
    color: var(--bs-theme) !important;
}
/* Hide jQuery UI icons completely */
.editable-buttons button .ui-icon,
.editable-buttons .ui-icon,
.ui-icon-circle-check,
.ui-icon-circle-close {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}
/* Hide empty error div */
.editable-error-block:empty,
.editable-error:empty {
    display: none !important;
}
.editable-error-block,
.editable-error {
    display: none !important;
}
/* Fix number input spinner buttons - add space for buttons */
.editable-input input[type="number"] {
    padding-right: 1.5rem !important;
    min-width: 100px;
}
/************************** VirtualSelect ******************************/
.vscomp-toggle-button {
    background-color: var(--bs-app-header-bg) !important;
    color: var(--bs-text-color) !important;
    border: 0px solid var(--bs-border-color) !important;
    /* border-radius: 0.2rem !important; */
    width: 220px !important;
}

.vscomp-arrow::after {
    display: none !important;
}
.vscomp-value {
    color: var(--bs-default) !important;
}
.vscomp-dropbox {
    background-color: var(--bs-app-header-bg) !important;
    color: var(--bs-default) !important;
}
.vscomp-option.focused {
    background-color: var(--bs-app-header-bg) !important;
}
.vscomp-option.selected {
    background-color: var(--bs-app-header-bg) !important;
    color: var(--bs-default) !important;
}

/*********************** Disable Inputs ******************************/
input:disabled:hover,
select:disabled:hover,
textarea:disabled:hover,
button:disabled:hover,
fieldset:disabled:hover,
option:disabled:hover,
optgroup:disabled:hover {
  cursor: not-allowed;
}