/**
 * CA11 post-upgrade — Bootstrap 4.0-beta markup compat on BS 4.6.2 + Tailwind preflight undo.
 * Loaded after style.min.css so these rules win over stale minified globals.
 */

/* --- Custom controls (beta markup: indicator + description spans) --- */
.custom-control {
  position: relative;
  display: inline-flex;
  min-height: 1.5rem;
  padding-left: 1.5rem;
  margin-right: 1rem;
  align-items: flex-start;
}

.custom-control-input {
  position: absolute;
  z-index: -1;
  opacity: 0;
}

.custom-control-input:checked ~ .custom-control-indicator {
  color: #fff;
  background-color: #1c67d8;
  border-color: #1c67d8;
}

.custom-control-input:focus ~ .custom-control-indicator {
  box-shadow: 0 0 0 1px #fff, 0 0 0 0.2rem rgba(28, 103, 216, 0.25);
}

.custom-control-input:active ~ .custom-control-indicator {
  color: #fff;
  background-color: #b3d7ff;
  border-color: #b3d7ff;
}

.custom-control-input:disabled ~ .custom-control-indicator {
  background-color: #e9ecef;
  border-color: #e9ecef;
}

.custom-control-input:disabled ~ .custom-control-description {
  color: #868e96;
}

.custom-control-indicator {
  position: absolute;
  top: 0.25rem;
  left: 0;
  display: block;
  width: 1rem;
  height: 1rem;
  pointer-events: none;
  user-select: none;
  background-color: #ddd;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 50% 50%;
}

.custom-checkbox .custom-control-indicator {
  border-radius: 0.25rem;
}

/* Official BS 4.6.2 checkmark path */
.custom-checkbox .custom-control-input:checked ~ .custom-control-indicator {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3e%3c/svg%3e");
}

.custom-checkbox .custom-control-input:indeterminate ~ .custom-control-indicator {
  background-color: #1c67d8;
  border-color: #1c67d8;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'%3e%3cpath stroke='%23fff' d='M0 2h4'/%3e%3c/svg%3e");
}

.custom-radio .custom-control-indicator {
  border-radius: 50%;
}

.custom-radio .custom-control-input:checked ~ .custom-control-indicator {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.custom-controls-stacked {
  display: flex;
  flex-direction: column;
}

.custom-controls-stacked .custom-control {
  margin-right: 0;
}

/* --- Form controls: match project body (~14px), undo Tailwind preflight --- */
.form-control:not(.bootstrap-tagsinput),
select.form-control,
textarea.form-control {
  padding: 0.375rem 0.75rem;
  font-size: 14px;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
}

input.form-control:not(textarea):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="date"]):not([type="time"]):not([type="datetime-local"]) {
  height: calc(1.5em + 0.75rem + 2px);
  max-height: 38px;
}

input.form-control[type="file"] {
  height: auto;
  max-height: none;
  padding: 0.375rem 0.75rem;
  line-height: 1.5;
}

/* Flex row filters: .form-control { width:100% } collapses select — let it grow */
#users-filter-form .d-flex > select.form-control {
  width: auto !important;
  min-width: 180px;
  flex: 1 1 auto !important;
}

.form-control-sm {
  padding: 0.25rem 0.5rem;
  font-size: 12px;
  line-height: 1.5;
}

input.form-control-sm:not(textarea) {
  height: calc(1.5em + 0.5rem + 2px);
  max-height: 31px;
}

textarea.form-control {
  height: auto;
  max-height: none;
  font-size: 14px;
}

/* tagsinput: plugin builds a sibling .bootstrap-tagsinput without form-control;
   default CSS is inline-block → sits beside the label and stays narrow */
.bootstrap-tagsinput {
  display: block !important;
  width: 100% !important;
  max-width: 100%;
  min-height: calc(1.5em + 0.75rem + 2px);
  box-sizing: border-box;
  font-size: 14px;
  background-color: #fff;
}

.bootstrap-tagsinput.form-control,
.bootstrap-tagsinput.form-control-sm {
  display: block !important;
  width: 100% !important;
}

.bootstrap-tagsinput input {
  background-color: transparent;
  font-size: 14px;
  width: auto !important;
  max-width: 100%;
}

/* Keep label above tags field without breaking inline filter labels (Del:/Al:) */
.form-group:has(> .bootstrap-tagsinput) > label,
.form-group:has(> input[data-role="tagsinput"]) > label {
  display: block;
  width: 100%;
}

.input-group > .form-control {
  position: relative;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
}

#homeTabsPublishContent .bootstrap-select > .dropdown-toggle,
#homeTabsPublishContent .form-control {
  font-size: 12px;
}

/* Datepicker popup must sit above admin panels / modals; keep compact like legacy UI */
.datepicker.datepicker-dropdown {
  z-index: 2000 !important;
  font-size: 13px;
  padding: 4px;
}

.datepicker.datepicker-dropdown table tr td,
.datepicker.datepicker-dropdown table tr th {
  width: 28px;
  height: 28px;
  line-height: 28px;
  padding: 0;
  font-size: 12px;
}

.datepicker.datepicker-dropdown table tr td span {
  height: 36px;
  line-height: 36px;
  font-size: 12px;
}

.datepicker.datepicker-dropdown .datepicker-switch {
  width: 120px;
  font-size: 13px;
}

/* --- Legacy Bootstrap 3/4-alpha utility aliases --- */
.visible-xs {
  display: none !important;
}

@media (max-width: 575.98px) {
  .visible-xs {
    display: inline !important;
  }
  .hidden-xs {
    display: none !important;
  }
}

.btn.btn-xs {
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  line-height: 1.5;
  border-radius: 0.2rem;
}

/*
 * SweetAlert2 v11 uses :where(.swal2-container) (specificity 0).
 * Tailwind / other utilities override the backdrop to transparent and
 * can drop z-index below custom modals (#second-modal is 9999).
 */
body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container,
.swal2-container.swal2-backdrop-show {
  background-color: rgba(0, 0, 0, 0.45) !important;
  z-index: 10050 !important;
  pointer-events: auto !important;
}

body.swal2-toast-shown .swal2-container,
body.swal2-no-backdrop .swal2-container {
  background-color: transparent !important;
}

