/**
 * OpenThink SAS — Bootstrap 2 → Tabler/BS5 Compatibility Bridge
 *
 * This file ensures legacy BS2 content templates render correctly
 * inside the modern Tabler/BS5 layout.
 */

/* ==========================================================================
   1. GRID — .row-fluid / .span*
   ========================================================================== */

.row-fluid {
  display: flex;
  flex-wrap: nowrap;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

.row-fluid > [class*="span"] {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  box-sizing: border-box;
  min-height: 1px;
  min-width: 0;
}

/* Allow tables/content inside spans to scroll if too wide */
.row-fluid > [class*="span"] > .table-responsive,
.row-fluid > [class*="span"] > table {
  overflow-x: auto;
}

.span1  { flex: 0 0 8.333%;  max-width: 8.333%; }
.span2  { flex: 0 0 16.666%; max-width: 16.666%; }
.span3  { flex: 0 0 25%;     max-width: 25%; }
.span4  { flex: 0 0 33.333%; max-width: 33.333%; }
.span5  { flex: 0 0 41.666%; max-width: 41.666%; }
.span6  { flex: 0 0 50%;     max-width: 50%; }
.span7  { flex: 0 0 58.333%; max-width: 58.333%; }
.span8  { flex: 0 0 66.666%; max-width: 66.666%; }
.span9  { flex: 0 0 75%;     max-width: 75%; }
.span10 { flex: 0 0 83.333%; max-width: 83.333%; }
.span11 { flex: 0 0 91.666%; max-width: 91.666%; }
.span12 { flex: 0 0 100%;    max-width: 100%; }

/* Fieldset needs min-width:0 to prevent flex overflow */
fieldset {
  min-width: 0;
}

@media (max-width: 767px) {
  .row-fluid {
    flex-wrap: wrap;
  }
  .row-fluid > [class*="span"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* ==========================================================================
   2. FORMS — .control-group / .controls / .form-horizontal
   ========================================================================== */

.control-group {
  margin-bottom: 0.875rem;
}

.control-group::after {
  content: "";
  display: table;
  clear: both;
}

.control-label {
  display: block;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--ots-text-primary, #1e293b);
  margin-bottom: 0.25rem;
}

.form-horizontal .control-label {
  padding-top: 0.375rem;
  text-align: right;
  width: 140px;
  float: left;
  margin-right: 1rem;
}

.form-horizontal .controls {
  margin-left: 160px;
}

.controls {
  position: relative;
}

.controls input[type="text"],
.controls input[type="password"],
.controls input[type="email"],
.controls input[type="number"],
.controls input[type="tel"],
.controls input[type="url"],
.controls input[type="date"],
.controls textarea,
.controls select {
  display: block;
  width: 100%;
  padding: 0.4375rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--ots-font-family, 'Inter', sans-serif);
  color: var(--ots-text-primary, #1e293b);
  background-color: var(--ots-bg-surface, #fff);
  border: 1px solid var(--ots-border-color, #e2e8f0);
  border-radius: 0.375rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  box-sizing: border-box;
}

.controls input:focus,
.controls textarea:focus,
.controls select:focus {
  border-color: var(--ots-brand-primary, #0d6eaa);
  box-shadow: 0 0 0 3px rgba(13, 110, 170, 0.12);
}

.controls input[readonly] {
  background-color: var(--ots-bg-surface-secondary, #f1f5f9);
  cursor: default;
}

/* Input sizing (BS2 legacy) */
.input-mini { width: 60px !important; display: inline-block !important; }
.input-small { width: 90px !important; display: inline-block !important; }
.input-medium { width: 150px !important; display: inline-block !important; }
.input-large { width: 210px !important; display: inline-block !important; }
.input-xlarge { width: 270px !important; display: inline-block !important; }
.input-xxlarge { width: 530px !important; display: inline-block !important; }
.input-super-small { width: 40px !important; display: inline-block !important; }

/* Help text */
.help-block {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--ots-text-muted, #94a3b8);
}

.help-inline {
  display: inline-block;
  padding-left: 0.5rem;
  font-size: 0.75rem;
  color: var(--ots-text-muted, #94a3b8);
  vertical-align: middle;
}

/* Form actions */
.form-actions {
  padding: 1rem 1.25rem;
  margin: 1.25rem -1.5rem -1.5rem;
  background: var(--ots-bg-surface-secondary, #f8fafc);
  border-top: 1px solid var(--ots-border-color, #e2e8f0);
  border-radius: 0 0 0.5rem 0.5rem;
}

/* ==========================================================================
   3. BUTTONS
   ========================================================================== */

.ots-content .btn {
  display: inline-block;
  padding: 0.4375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--ots-border-color, #e2e8f0);
  border-radius: 0.375rem;
  background-color: #fff;
  color: var(--ots-text-primary, #1e293b);
  transition: all 0.15s ease;
  vertical-align: middle;
  white-space: nowrap;
}

.ots-content .btn:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  text-decoration: none;
}

.ots-content .btn-primary {
  background: linear-gradient(135deg, #0d6eaa, #094d78);
  border-color: #0d6eaa;
  color: #fff !important;
}
.ots-content .btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 2px 8px -2px rgba(13, 110, 170, 0.4);
}

.ots-content .btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-color: #22c55e;
  color: #fff !important;
}

.ots-content .btn-danger,
.ots-content .btn-error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #ef4444;
  color: #fff !important;
}

.ots-content .btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #f59e0b;
  color: #fff !important;
}

.ots-content .btn-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: #3b82f6;
  color: #fff !important;
}

.ots-content .btn-inverse {
  background: linear-gradient(135deg, #334155, #1e293b);
  border-color: #334155;
  color: #fff !important;
}

.ots-content .btn-large,
.ots-content .btn-lg {
  padding: 0.5625rem 1.25rem;
  font-size: 0.875rem;
}

.ots-content .btn-small,
.ots-content .btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.ots-content .btn-mini,
.ots-content .btn-xs {
  padding: 0.125rem 0.375rem;
  font-size: 0.6875rem;
}

.ots-content .btn i,
.ots-content .btn .icon-plus,
.ots-content .btn .icon-edit,
.ots-content .btn .icon-trash,
.ots-content .btn .icon-search {
  margin-right: 0.25rem;
}

/* ==========================================================================
   4. ALERTS
   ========================================================================== */

.ots-content .alert {
  padding: 0.875rem 1.125rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.ots-content .alert-error,
.ots-content .alert-danger {
  background-color: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.ots-content .alert-success {
  background-color: #f0fdf4;
  border-color: #bbf7d0;
  color: #16a34a;
}

.ots-content .alert-warning {
  background-color: #fffbeb;
  border-color: #fde68a;
  color: #d97706;
}

.ots-content .alert-info {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

/* ==========================================================================
   5. TABLES
   ========================================================================== */

.ots-content .table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

.ots-content .table th {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  font-weight: 600;
  color: var(--ots-text-primary, #1e293b);
  border-bottom: 2px solid #e2e8f0;
  padding: 0.625rem 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ots-content .table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--ots-text-primary, #1e293b);
  vertical-align: middle;
}

.ots-content .table-striped tbody tr:nth-child(even) td {
  background-color: #f8fafc;
}

.ots-content .table-hover tbody tr:hover td {
  background-color: rgba(13, 110, 170, 0.04);
}

.ots-content .table-bordered {
  border: 1px solid #e2e8f0;
}

.ots-content .table-bordered th,
.ots-content .table-bordered td {
  border: 1px solid #e2e8f0;
}

.ots-content .table-condensed th,
.ots-content .table-condensed td {
  padding: 0.3125rem 0.5rem;
}

/* ==========================================================================
   6. LABELS & BADGES (BS2)
   ========================================================================== */

.ots-content .label {
  display: inline-block;
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 1rem;
  color: #fff;
  background-color: #94a3b8;
  white-space: nowrap;
  vertical-align: baseline;
}

.ots-content .label-success { background-color: #22c55e; }
.ots-content .label-warning { background-color: #f59e0b; }
.ots-content .label-important,
.ots-content .label-danger { background-color: #ef4444; }
.ots-content .label-info { background-color: #3b82f6; }
.ots-content .label-inverse { background-color: #1e293b; }

.ots-content .badge {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0.1875rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  border-radius: 1rem;
  color: #fff;
  background-color: #94a3b8;
}

.ots-content .badge-success { background-color: #22c55e; }
.ots-content .badge-warning { background-color: #f59e0b; }
.ots-content .badge-important { background-color: #ef4444; }
.ots-content .badge-info { background-color: #3b82f6; }
.ots-content .badge-inverse { background-color: #1e293b; }

/* ==========================================================================
   7. TABS — nav-tabs (horizontal) & nav-stacked (vertical sidebar tabs)
   ========================================================================== */

/* --- Horizontal Tabs --- */
.ots-content .nav-tabs {
  border-bottom: 2px solid #e2e8f0;
  padding: 0;
  margin: 0 0 1.25rem;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.ots-content .nav-tabs > li {
  margin-bottom: -2px;
  list-style: none;
}

.ots-content .nav-tabs > li > a {
  display: block;
  padding: 0.625rem 1.125rem;
  color: #64748b;
  text-decoration: none;
  border: 2px solid transparent;
  border-bottom: none;
  border-radius: 0.5rem 0.5rem 0 0;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.ots-content .nav-tabs > li > a:hover {
  color: #0d6eaa;
  background: rgba(13, 110, 170, 0.04);
}

.ots-content .nav-tabs > li.active > a,
.ots-content .nav-tabs > li > a.active {
  color: #0d6eaa;
  background: #fff;
  border-color: #e2e8f0 #e2e8f0 #fff;
  font-weight: 600;
}

/* --- Vertical/Stacked Tabs (used in ESS Identitas Diri, etc.) --- */
.ots-content .nav-tabs.nav-stacked {
  display: flex;
  flex-direction: column;
  border-bottom: none;
  border-right: 2px solid #e2e8f0;
  gap: 0.125rem;
  padding-right: 0;
}

.ots-content .nav-tabs.nav-stacked > li {
  margin-bottom: 0;
  margin-right: -2px;
}

.ots-content .nav-tabs.nav-stacked > li > a {
  border: none;
  border-radius: 0.375rem 0 0 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  border-right: 2px solid transparent;
  display: block;
  text-decoration: none;
  color: #64748b;
  transition: all 0.15s ease;
}

.ots-content .nav-tabs.nav-stacked > li > a:hover {
  color: #0d6eaa;
  background: rgba(13, 110, 170, 0.04);
}

.ots-content .nav-tabs.nav-stacked > li.active > a,
.ots-content .nav-tabs.nav-stacked > li > a.active {
  color: #0d6eaa;
  background: rgba(13, 110, 170, 0.06);
  border-right-color: #0d6eaa;
  font-weight: 600;
}

/* Also handle [name="ajax-link"] which uses li.active pattern */
.ots-content [name="ajax-link"] > a {
  display: block;
  padding: 0.5rem 1rem;
  color: #64748b;
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  transition: all 0.15s ease;
  cursor: pointer;
}

.ots-content [name="ajax-link"] > a:hover {
  color: #0d6eaa;
  background: rgba(13, 110, 170, 0.04);
}

.ots-content [name="ajax-link"].active > a {
  color: #0d6eaa;
  background: linear-gradient(135deg, rgba(13, 110, 170, 0.08), rgba(13, 110, 170, 0.04));
  font-weight: 600;
  border-left: 3px solid #0d6eaa;
}

/* Tab content */
.ots-content .tab-content > .tab-pane { display: none; }
.ots-content .tab-content > .tab-pane.active { display: block; }

/* ==========================================================================
   8. WELL, FIELDSET, LEGEND — Card-like styling
   ========================================================================== */

.ots-content .well {
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
}

.ots-content fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

.ots-content legend {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ots-text-primary, #1e293b);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
  width: auto;
  border-bottom: none;
  background: #fff;
}

.ots-content legend small {
  font-weight: 400;
  color: #64748b;
  font-size: 0.8125rem;
  margin-left: 0.5rem;
}

/* ==========================================================================
   9. PAGINATION
   ========================================================================== */

.ots-content .pagination ul {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  gap: 0.25rem;
}

.ots-content .pagination ul li a,
.ots-content .pagination ul li span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  text-decoration: none;
  color: #64748b;
  background: #fff;
  transition: all 0.15s ease;
}

.ots-content .pagination ul li a:hover {
  background: #f1f5f9;
  color: #0d6eaa;
}

.ots-content .pagination ul li.active a,
.ots-content .pagination ul li.active span {
  background: #0d6eaa;
  border-color: #0d6eaa;
  color: #fff;
}

/* ==========================================================================
   10. UTILITY CLASSES (BS2)
   ========================================================================== */

.pull-left { float: left !important; }
.pull-right { float: right !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-muted { color: #94a3b8 !important; }
.muted { color: #94a3b8 !important; }
.clearfix::after { content: ""; display: table; clear: both; }
.invisible { visibility: hidden; }

/* ==========================================================================
   11. BS2 DROPDOWN
   ========================================================================== */

.ots-content .btn-group {
  position: relative;
}

.ots-content .btn-group.open {
  z-index: 1050;
}

.ots-content .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1060;
  display: none;
  min-width: 10rem;
  padding: 0.375rem 0;
  margin: 0.125rem 0 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  list-style: none;
}

.ots-content .dropdown-menu > li > a {
  display: block;
  padding: 0.4375rem 1rem;
  color: #1e293b;
  text-decoration: none;
  font-size: 0.8125rem;
  transition: all 0.1s ease;
}

.ots-content .dropdown-menu > li > a:hover {
  background: #f1f5f9;
  color: #0d6eaa;
}

.ots-content .dropdown.open > .dropdown-menu,
.ots-content .btn-group.open > .dropdown-menu,
.ots-content .dropdown-menu.show {
  display: block;
}

.ots-content .divider,
.ots-content .dropdown-divider {
  height: 0;
  margin: 0.375rem 0;
  overflow: hidden;
  border-top: 1px solid #e2e8f0;
}

/* ==========================================================================
   12. BLOCKQUOTE
   ========================================================================== */

.ots-content blockquote {
  border-left: 3px solid #0d6eaa;
  padding: 0.75rem 1.25rem;
  margin: 0 0 1rem;
  background: #f8fafc;
  border-radius: 0 0.5rem 0.5rem 0;
  font-size: 0.8125rem;
  color: #64748b;
}

/* ==========================================================================
   13. MODAL — BS2 jQuery modal full compatibility
   ========================================================================== */

/*
 * BS2 modal HTML structure (NO .modal-dialog wrapper!):
 *   <div class="modal hide fade">
 *     <div class="modal-header">...</div>
 *     <div class="modal-body">...</div>
 *     <div class="modal-footer">...</div>
 *   </div>
 *
 * BS2 jQuery .modal('show') → removes .hide, adds .in
 */

.modal {
  position: fixed;
  top: 5vh; /* 5% from top, safe from clipping */
  left: 50%;
  transform: translateX(-50%); /* Only center horizontally */
  z-index: 1050;
  display: none;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.3);
  outline: 0;
}

.modal.hide {
  display: none !important;
}

/* When BS2 jQuery .modal('show') is called, it removes .hide and adds .in */
.modal.in,
.modal.show,
.modal.fade.in {
  display: block !important;
}

/* Override body .modal from main.css */
body .modal {
  width: 90%;
  max-width: 700px;
  left: 50%;
  top: 5vh !important;
  bottom: auto !important;
  height: auto !important;
  transform: translateX(-50%);
  margin-left: 0;
  margin-right: 0;
}

/* Modal backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.modal-backdrop.fade {
  opacity: 0;
}

.modal-backdrop.fade.in,
.modal-backdrop.show {
  opacity: 1;
}

/* Modal header */
.modal .modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 0.75rem 0.75rem 0 0;
}

.modal .modal-header::after {
  content: "";
  display: table;
  clear: both;
}

.modal .modal-header h3,
.modal .modal-header h4,
.modal .modal-header h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}

.modal .modal-header .close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #94a3b8;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  float: right;
  margin-top: -2px;
}

.modal .modal-header .close:hover {
  opacity: 1;
  color: #ef4444;
}

/* Modal body */
.modal .modal-body {
  padding: 1.25rem;
  background: #fff;
  overflow-y: auto;
  height: auto !important;
  max-height: calc(90vh - 140px);
}

/* Form actions inside modal body need fix so they stick to bottom 
   since many legacy templates omit .modal-footer and just put .form-actions at bottom of body */
.modal .modal-body .form-actions {
  margin: 1.25rem -1.25rem -1.25rem -1.25rem; /* pull tight to body edges */
  border-radius: 0 0 0.75rem 0.75rem; /* round bottom corners */
}

/* Modal footer */
.modal .modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 0 0 0.75rem 0.75rem;
  text-align: right;
}

.modal .modal-footer::after {
  content: "";
  display: table;
  clear: both;
}

/* BS5-style modals (with .modal-dialog wrapper, used in layout_modern.php) */
.modal .modal-dialog {
  width: 100%;
  height: 100%;
  max-width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.modal .modal-content {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* BS5 modal dismiss */
.modal .btn-close {
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  border: 0;
  border-radius: 0.375rem;
  opacity: 0.5;
  padding: 0.5rem;
  cursor: pointer;
  width: 1.5rem;
  height: 1.5rem;
}

.modal .btn-close:hover {
  opacity: 1;
}

/* ==========================================================================
   14. CONTAINER-FLUID (legacy wrapper)
   ========================================================================== */

.ots-content .container-fluid {
  padding: 0;
  margin: 0;
}

.ots-content .container {
  max-width: 100%;
  padding: 0;
}

/* ==========================================================================
   15. BROKEN IMAGE PLACEHOLDER
   ========================================================================== */

/* Hide broken images and show a placeholder */
.ots-content img {
  max-width: 100%;
  height: auto;
}

.ots-content img[src=""],
.ots-content img:not([src]) {
  display: none;
}

/* ==========================================================================
   16. ICONS (BS2 glyphicons / Glyphicons Extended)
   ========================================================================== */

.ots-content [class^="icon-"],
.ots-content [class*=" icon-"] {
  display: inline-block;
  vertical-align: middle;
}

/* ==========================================================================
   17. NAV PILLS (BS2)
   ========================================================================== */

.ots-content .nav-pills {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  gap: 0.25rem;
}

.ots-content .nav-pills > li > a {
  display: block;
  padding: 0.4375rem 1rem;
  border-radius: 2rem;
  color: #64748b;
  text-decoration: none;
  font-size: 0.8125rem;
  transition: all 0.15s ease;
}

.ots-content .nav-pills > li > a:hover {
  background: rgba(13, 110, 170, 0.06);
  color: #0d6eaa;
}

.ots-content .nav-pills > li.active > a {
  background: #0d6eaa;
  color: #fff;
}

/* ==========================================================================
   18. ACCORDION (BS2)
   ========================================================================== */

.ots-content .accordion-group {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.ots-content .accordion-heading .accordion-toggle {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: #1e293b;
  font-weight: 500;
  background: #f8fafc;
}

.ots-content .accordion-body {
  padding: 1rem;
}

/* ==========================================================================
   19. DARK MODE — legacy element adjustments
   ========================================================================== */

[data-bs-theme="dark"] .controls input,
[data-bs-theme="dark"] .controls textarea,
[data-bs-theme="dark"] .controls select {
  background-color: var(--ots-bg-surface, #1e293b);
  color: var(--ots-text-primary, #f1f5f9);
  border-color: var(--ots-border-color, #334155);
}

[data-bs-theme="dark"] .ots-content .table th {
  background: linear-gradient(135deg, #334155, #293548) !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .ots-content .table td {
  color: #f1f5f9 !important;
  border-color: #334155 !important;
  background-color: transparent;
}

/* Force dark backgrounds on striped tables (overriding legacy BS2 CSS rules) */
[data-bs-theme="dark"] .ots-content .table-striped tbody tr:nth-child(odd) td,
[data-bs-theme="dark"] .ots-content .table-striped tbody tr:nth-child(odd) th {
  background-color: #1e293b !important; /* Subtle dark for odd */
}

[data-bs-theme="dark"] .ots-content .table-striped tbody tr:nth-child(even) td,
[data-bs-theme="dark"] .ots-content .table-striped tbody tr:nth-child(even) th {
  background-color: #0f172a !important; /* Darker for even */
}

/* Hover effect */
[data-bs-theme="dark"] .ots-content .table-hover tbody tr:hover td,
[data-bs-theme="dark"] .ots-content .table-hover tbody tr:hover th {
  background-color: rgba(255, 255, 255, 0.08) !important;
}

[data-bs-theme="dark"] .ots-content .table-bordered {
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .ots-content .table-bordered th,
[data-bs-theme="dark"] .ots-content .table-bordered td {
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .ots-content .well {
  background-color: #334155;
  border-color: #334155;
}

[data-bs-theme="dark"] .ots-content fieldset {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .ots-content legend {
  color: #f1f5f9;
  background: #1e293b;
}

/* Logo override for dark mode (since it has hardcoded white background) */
[data-bs-theme="dark"] .ots-sidebar-brand img {
  background-color: #ffffff;
  border-radius: 6px;
  padding: 3px;
}

/* Button & Header Toggle overrides globally for dark mode */
[data-bs-theme="dark"] .btn,
[data-bs-theme="dark"] .ots-content .btn,
[data-bs-theme="dark"] .ots-header .btn,
[data-bs-theme="dark"] .ots-header .ots-sidebar-toggle {
  background-color: #334155 !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
  background-image: none !important;
  text-shadow: none !important;
  box-shadow: none !important;
}

[data-bs-theme="dark"] .btn:hover,
[data-bs-theme="dark"] .ots-content .btn:hover,
[data-bs-theme="dark"] .ots-header .btn:hover,
[data-bs-theme="dark"] .ots-header .ots-sidebar-toggle:hover {
  background-color: #475569 !important;
  border-color: #475569 !important;
  color: #ffffff !important;
}

/* Dropdown overrides for dark mode */
[data-bs-theme="dark"] .dropdown-menu {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5) !important;
}

[data-bs-theme="dark"] .dropdown-menu > li > a {
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .dropdown-menu > li > a:hover,
[data-bs-theme="dark"] .dropdown-menu > li > a:focus,
[data-bs-theme="dark"] .dropdown-menu > .active > a,
[data-bs-theme="dark"] .dropdown-menu > .active > a:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.1) !important;
  background-image: none !important;
}

/* Select2 overrides for dark mode */
[data-bs-theme="dark"] .select2-container .select2-choice,
[data-bs-theme="dark"] .select2-drop,
[data-bs-theme="dark"] .select2-drop-active {
  background-color: #1e293b !important;
  background-image: none !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .select2-container .select2-choice span,
[data-bs-theme="dark"] .select2-container .select2-choice div b {
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .select2-results {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .select2-results .select2-highlighted {
  background-color: #334155 !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .select2-search input {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

[data-bs-theme="dark"] .ots-content blockquote {
  background: #334155;
  color: #94a3b8;
}

[data-bs-theme="dark"] .ots-content .nav-tabs.nav-stacked > li > a,
[data-bs-theme="dark"] .ots-content [name="ajax-link"] > a {
  color: #94a3b8;
}

[data-bs-theme="dark"] .ots-content .nav-tabs.nav-stacked > li.active > a,
[data-bs-theme="dark"] .ots-content [name="ajax-link"].active > a {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border-left-color: #60a5fa;
}

[data-bs-theme="dark"] .modal {
  background: #1e293b;
  box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.6);
}

[data-bs-theme="dark"] .modal .modal-header,
[data-bs-theme="dark"] .modal .modal-body {
  background: #1e293b;
  border-color: #334155;
}

[data-bs-theme="dark"] .modal .modal-footer {
  background: #0f172a;
  border-color: #334155;
}

[data-bs-theme="dark"] .modal .modal-content {
  background: #1e293b;
  border-color: #334155;
}

[data-bs-theme="dark"] .modal .modal-header h3,
[data-bs-theme="dark"] .modal .modal-header h4,
[data-bs-theme="dark"] .modal .modal-header h5 {
  color: #f1f5f9;
}

[data-bs-theme="dark"] .ots-content .alert-error,
[data-bs-theme="dark"] .ots-content .alert-danger {
  background-color: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

[data-bs-theme="dark"] .ots-content .alert-success {
  background-color: rgba(22, 163, 74, 0.15);
  border-color: rgba(22, 163, 74, 0.3);
  color: #86efac;
}

/* ==========================================================================
   19. JQUERY UI ACCORDION MODERNIZATION
   ========================================================================== */

.ots-content .ui-accordion .ui-accordion-header {
  display: block;
  cursor: pointer;
  position: relative;
  margin: 0.5rem 0 0 0;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  outline: none;
}

.ots-content .ui-accordion .ui-accordion-header a {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1e293b;
  text-decoration: none;
  display: block;
}

/* Remove crazy jQuery UI gradients and stripes */
.ots-content .ui-widget-header,
.ots-content .ui-accordion .ui-accordion-header,
.ots-content .ui-state-default,
.ots-content .ui-widget-content .ui-state-default {
  background-image: none !important;
}

.ots-content .ui-accordion .ui-accordion-header.ui-state-active,
.ots-content .ui-accordion .ui-accordion-header:hover {
  background: #ffffff;
  border-color: #0d6eaa;
}

.ots-content .ui-accordion .ui-accordion-header.ui-state-active a,
.ots-content .ui-accordion .ui-accordion-header:hover a {
  color: #0d6eaa;
}

.ots-content .ui-accordion .ui-accordion-content {
  padding: 1.25rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top: 0;
  border-radius: 0 0 0.5rem 0.5rem;
  margin-top: -1px; /* overlap border */
}

.ots-content .ui-accordion .ui-accordion-header.ui-state-active {
  border-radius: 0.5rem 0.5rem 0 0;
  border-bottom-color: transparent;
}

/* Hide legacy icons */
.ots-content .ui-accordion .ui-accordion-header .ui-icon {
  display: none !important;
}

[data-bs-theme="dark"] .ots-content .ui-accordion .ui-accordion-header {
  background: #1e293b;
  border-color: #334155;
}

[data-bs-theme="dark"] .ots-content .ui-accordion .ui-accordion-header a {
  color: #94a3b8;
}

[data-bs-theme="dark"] .ots-content .ui-accordion .ui-accordion-header.ui-state-active,
[data-bs-theme="dark"] .ots-content .ui-accordion .ui-accordion-header:hover {
  background: #1e293b;
  border-color: #3b82f6;
}

[data-bs-theme="dark"] .ots-content .ui-accordion .ui-accordion-header.ui-state-active a,
[data-bs-theme="dark"] .ots-content .ui-accordion .ui-accordion-header:hover a {
  color: #60a5fa;
}

[data-bs-theme="dark"] .ots-content .ui-accordion .ui-accordion-content {
  background: #0f172a;
  border-color: #334155;
}

/* ==========================================================================
   20. PRINT FIXES
   ========================================================================== */

@media print {
  .ots-sidebar,
  .ots-header,
  .ots-sidebar-overlay,
  .ots-theme-toggle {
    display: none !important;
  }

  .ots-content-wrapper {
    margin-left: 0 !important;
    padding-top: 0 !important;
  }

  .ots-content {
    padding: 0 !important;
  }
}
