/* 
    Custom Dashboard Overrides
    Professionally developed and maintained
*/

:root {
  --bs-font-sans-serif: 'Outfit', sans-serif;
  --bs-body-font-family: 'Outfit', sans-serif;
  --iq-font-family: 'Outfit', sans-serif;
  --select2-choice-bg: #5f60b9;
  --select2-choice-color: #ffffff;
}

/* --- SELECT2 ENHANCEMENTS & BUG FIXES --- */

/* Fix: Choice tags overlapping remove button */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--select2-choice-bg) !important;
  border: none !important;
  color: var(--select2-choice-color) !important;
  border-radius: 6px !important;
  padding: 4px 10px 4px 28px !important; /* Extra left padding for the 'x' button */
  margin-top: 6px !important;
  margin-right: 6px !important;
  position: relative !important;
  font-weight: 500 !important;
  font-size: 0.85rem !important;
  box-shadow: 0 2px 4px rgba(95, 96, 185, 0.2) !important;
}

/* Positioning the 'x' button correctly */
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: rgba(255, 255, 255, 0.8) !important;
  border: none !important;
  border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 0 !important;
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 24px !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  transition: all 0.2s ease !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
}

/* RTL Support for Select2 Choices */
[dir="rtl"] .select2-container--default .select2-selection--multiple .select2-selection__choice {
  padding: 4px 28px 4px 10px !important; /* Flip padding for RTL */
  margin-right: 0 !important;
  margin-left: 6px !important;
}

[dir="rtl"] .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  left: auto !important;
  right: 0 !important;
  border-right: none !important;
  border-left: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Ensure container has enough height and padding */
.select2-container--default .select2-selection--multiple {
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  min-height: 48px !important; /* Increased height */
  padding-top: 4px !important;  /* Added top padding */
  padding-bottom: 6px !important;
  padding-left: 6px !important;
  padding-right: 6px !important;
  transition: all 0.3s ease !important;
}

/* --- FORM CHECKBOX (CHECKBOX) VISIBILITY FIX --- */
.form-check-input, 
input[type="checkbox"].form-check-input,
.custom-control-input {
  width: 1.25rem !important;
  height: 1.25rem !important;
  margin-top: 0.125em !important;
  vertical-align: top !important;
  background-color: #fff;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: 1px solid rgba(0,0,0,.25);
  appearance: none;
  print-color-adjust: exact;
  transition: background-color .15s ease-in-out, background-position .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
  cursor: pointer !important;
  position: relative !important;
}

/* Prevent clipping in tables */
table.dataTable td:first-child,
table.dataTable th:first-child {
  overflow: visible !important;
  padding-left: 15px !important;
  padding-right: 15px !important;
}

.table td, .table th {
    vertical-align: middle !important;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: #5f60b9 !important;
  box-shadow: 0 0 0 3px rgba(95, 96, 185, 0.1) !important;
}

/* Ensure the search input inside multi-select isn't clipped or awkward */
.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
    margin-top: 6px !important;
    margin-bottom: 6px !important;
    padding-left: 10px !important;
    width: 100% !important;
    min-height: 28px !important; /* Standard height for the search rectangle */
}

/* Fix: Global overflow hidden on cards can clip shadows and Select2 borders */
.card, .iq-card {
    overflow: visible !important; /* Allow focus rings and dropdowns to bloom */
}

/* Re-apply hidden only where absolutely critical (like images at top) */
.card-header-image {
    overflow: hidden !important;
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--multiple {
  background-color: #3f3f46 !important;
  border-color: #52525b !important;
}

/* Dashboard Global Responsiveness Fixes */
@media (max-width: 768px) {
  .card-body {
    padding: 15px !important;
  }

  /* Stack the Bulk Action / Search / Filter rows vertically on mobile */
  .d-flex.justify-content-between.align-items-center.flex-wrap {
    flex-direction: column !important;
    align-items: stretch !important;
    /* Stretch to full width */
    gap: 15px !important;
    padding: 10px !important;
  }

  .d-flex.align-items-center.gap-3 {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 10px !important;
  }

  form.form-disabled.d-flex {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 10px !important;
  }

  form.form-disabled.d-flex .select2-container,
  form.form-disabled.d-flex .btn,
  .datatable-filter,
  .datatable-filter .select2-container,
  .input-group-search {
    width: 100% !important;
    min-width: 100% !important;
  }

  .data_table_widgets {
    padding: 15px !important;
    flex-direction: column !important;
    gap: 15px !important;
  }
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
strong,
b,
em,
i:not(.fa):not(.las):not(.la):not(.ri):not(.ph):not(.lucide),
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  font-family: 'Outfit', sans-serif;
}

/* Professional Calendar Today Highlight (FullCalendar v4 - Stable Fix) */
.fc-unthemed td.fc-today,
td.fc-today,
.fc-today.fc-widget-content,
.fc-today.alert {
  background: rgba(95, 96, 185, 0.05) !important;
  border-style: solid !important;
}

/* Ensure the day top container and all children don't have a background capsule */
.fc-today .fc-day-top,
.fc-today .fc-day-number,
.fc-today.alert-primary,
.fc-today.alert {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* --- FULLCALENDAR TODAY SPACING BALANCE --- */
.fc-day-top.fc-today {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: flex-end !important;
  /* Force badge to the bottom line */
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-right: 5px !important;
  height: 16px !important;
  /* Ultra-compact height */
}

.fc-today .fc-day-number {
  background-color: #5f60b9 !important;
  color: #ffffff !important;
  border-radius: 50% !important;
  width: 16px !important;
  /* Smallest size for ultra-compact fit */
  height: 16px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 4px rgba(95, 96, 185, 0.15) !important;
  float: none !important;
  margin: 0 0 -4px 0 !important;
  /* Nudging further down to submerge in the line */
  padding: 0 !important;
  line-height: 1 !important;
  z-index: 2;
}

/* Keep the space for content below the line */
.fc-today .fc-content-skeleton {
  padding-top: 8px !important;
}

/* Sidebar Smoothness & Premium Transitions */
.iq-sidebar,
.content-page,
.side-menu-bt-sidebar.wide-device-toggle,
.iq-sidebar .iq-sidebar-logo,
.iq-sidebar .iq-sidebar-logo a span,
.iq-sidebar-menu .side-menu li a span {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Sidebar Toggle Alignment & Centering */
.iq-sidebar .side-menu-bt-sidebar.wide-device-toggle {
  z-index: 999 !important;
  right: -15px !important;
  background: #ffffff !important;
  box-shadow: 0 0 15px rgba(95, 96, 185, 0.2) !important;
  border: 1px solid rgba(95, 96, 185, 0.1) !important;
  display: grid !important;
  place-items: center !important;
  cursor: pointer !important;
  padding: 0 !important;
  transform: rotate(45deg) !important;
  border-radius: 6px !important;
  width: 32px !important;
  height: 32px !important;
}

[dir='rtl'] .iq-sidebar .side-menu-bt-sidebar.wide-device-toggle {
  right: auto !important;
  left: -15px !important;
}

.iq-sidebar .side-menu-bt-sidebar.wide-device-toggle .iq-toggle-arrow {
  color: #5f60b9 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* --- ARROW ROTATION LOGIC --- */
body:not(.sidebar-main) .side-menu-bt-sidebar.wide-device-toggle .iq-toggle-arrow {
  transform: rotate(-45deg) translate(1px, -1px) !important;
}

body.sidebar-main .side-menu-bt-sidebar.wide-device-toggle .iq-toggle-arrow {
  transform: rotate(135deg) translate(-1px, 1px) !important;
}

[dir='rtl'] body:not(.sidebar-main) .side-menu-bt-sidebar.wide-device-toggle .iq-toggle-arrow {
  transform: rotate(135deg) translate(-1px, 1px) !important;
}

[dir='rtl'] body.sidebar-main .side-menu-bt-sidebar.wide-device-toggle .iq-toggle-arrow {
  transform: rotate(-45deg) translate(2px, -1px) !important;
}

.iq-sidebar .side-menu-bt-sidebar.wide-device-toggle .iq-toggle-arrow svg {
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
  filter: drop-shadow(0 0 1px rgba(95, 96, 185, 0.1));
}

/* --- COLLAPSED SIDEBAR OVERHAUL (80px Width + Tiles) --- */
@media (min-width: 1300px) {
  body.sidebar-main .iq-sidebar {
    width: 80px !important;
  }

  body.sidebar-main .content-page {
    margin-left: 80px !important;
  }

  body.sidebar-main .iq-top-navbar {
    width: calc(100% - 80px) !important;
  }

  /* Logo Scaling */
  body.sidebar-main .iq-sidebar-logo img {
    height: 32px !important;
    width: 32px !important;
    margin: 0 !important;
  }

  body.sidebar-main .iq-sidebar-logo {
    padding: 15px 0 !important;
    justify-content: center !important;
    border-bottom: none !important;
  }

  /* Icon Tiles */
  body.sidebar-main .iq-sidebar-menu .side-menu li a {
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    width: 50px !important;
    height: 50px !important;
    margin: 5px auto !important;
    padding: 0 !important;
    border-radius: 12px !important;
    transition: all 0.3s ease !important;
    background: transparent !important;
  }

  /* Hide empty spaces and category titles in collapsed mode */
  body.sidebar-main .iq-sidebar-menu .side-menu li.category-main,
  body.sidebar-main .iq-sidebar-menu .side-menu li hr,
  body.sidebar-main .iq-sidebar-menu .side-menu li.header-title {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Bulletproof Unified Layout: Apply offsets to the main content area itself 
   to handle pages with varying or broken container structures. */
  .content-page {
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-top: 80px !important;
  }

  /* Neutralize container-fluid so it doesn't add redundant double-padding */
  .content-page .container-fluid {
    padding-left: 0px !important;
    padding-right: 0px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Balance row margins within this new unified spacing model */
  .content-page .container-fluid>.row {
    margin-left: -15px !important;
    margin-right: -15px !important;
  }

  /* Ensure LI doesn't add extra space */
  body.sidebar-main .iq-sidebar-menu .side-menu li {
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hover effect on Tiles */
  body.sidebar-main .iq-sidebar-menu .side-menu li a:hover {
    background: rgba(95, 96, 185, 0.1) !important;
    color: #5f60b9 !important;
  }

  /* Active Tile State */
  body.sidebar-main .iq-sidebar-menu .side-menu li.active>a,
  body.sidebar-main .iq-sidebar-menu .side-menu li.active-menu>a {
    background: rgba(95, 96, 185, 0.15) !important;
    color: #5f60b9 !important;
    box-shadow: 0 4px 10px rgba(95, 96, 185, 0.1) !important;
  }

  /* Center the icon inside the tile */
  body.sidebar-main .iq-sidebar-menu .side-menu li a i {
    margin: 0 !important;
    font-size: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  body.sidebar-main .iq-sidebar-menu .side-menu li a svg {
    width: 20px !important;
    height: 20px !important;
  }
}

/* --- FILTER BADGE REFINEMENT (Ultra-Clear & Prominent) --- */
.filter-count {
  background-color: #ffffff !important;
  color: #5f60b9 !important;
  border: 2px solid #5f60b9 !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 3px 10px rgba(95, 96, 185, 0.4) !important;
  position: absolute !important;
  top: -10px !important;
  right: -10px !important;
  border-radius: 50% !important;
  z-index: 2 !important;
  line-height: 1 !important;
}

/* --- DATATABLES GLOBAL PREMIUM STYLING --- */

/* Widgets Layout Container */
.data_table_widgets {
  padding: 20px 40px !important;
  border-top: 1px solid #f1f5f9 !important;
  margin-top: 10px !important;
}

/* "Show X entries" Styling */
.dataTables_length {
  display: flex !important;
  align-items: center !important;
  font-weight: 500 !important;
}

.dataTables_length label {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-bottom: 0 !important;
}

/* --- CLEAN SEARCH BAR FIX --- */
.input-group-search .input-group-text {
  display: none !important;
  /* Hide the broken icon box */
}

.input-group-search .dt-search {
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  background-color: #f8fafc !important;
  padding: 10px 15px !important;
  color: #1e293b !important;
  font-size: 14px !important;
  transition: all 0.3s ease !important;
  box-shadow: none !important;
  width: 100% !important;
}

.input-group-search .dt-search:focus {
  border-color: #5f60b9 !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(95, 96, 185, 0.1) !important;
  outline: none !important;
}

/* Ensure pagination and other table widgets stay clean */
.dataTables_paginate .page-item .page-link {
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  color: #64748b !important;
  font-weight: 500 !important;
  background: white !important;
}

.dataTables_paginate .page-item.active .page-link {
  background-color: #5f60b9 !important;
  border-color: #5f60b9 !important;
  color: white !important;
}

.dataTables_length select {
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 12px !important;
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 4px 28px 4px 12px !important;
  color: #1e293b !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  min-width: 60px !important;
}

.dataTables_length select:focus {
  outline: none !important;
  border-color: #5f60b9 !important;
  box-shadow: 0 0 0 2px rgba(95, 96, 185, 0.1) !important;
}

/* "Showing X to Y of Z entries" Styling */
.dataTables_info {
  color: #94a3b8 !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  padding-top: 0 !important;
}

/* Pagination Buttons Styling */
.dataTables_paginate {
  margin-top: 0 !important;
}

.dataTables_paginate .pagination {
  gap: 5px !important;
  justify-content: flex-end !important;
}

.dataTables_paginate .page-item .page-link {
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  color: #64748b !important;
  font-weight: 500 !important;
  padding: 8px 14px !important;
  font-size: 13px !important;
  transition: all 0.2s ease !important;
  background: white !important;
}

.dataTables_paginate .page-item.active .page-link {
  background-color: #5f60b9 !important;
  border-color: #5f60b9 !important;
  color: white !important;
  box-shadow: 0 4px 10px rgba(95, 96, 185, 0.2) !important;
}

.dataTables_paginate .page-item:not(.active):hover .page-link {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

.dataTables_paginate .page-item.disabled .page-link {
  opacity: 0.5 !important;
  background: #f8fafc !important;
  cursor: not-allowed !important;
}

/* Fix for Previous/Next overlapping icons */
.dataTables_paginate .page-item.previous .page-link,
.dataTables_paginate .page-item.next .page-link {
  font-size: 0 !important;
  /* Hide the text if icons are being forced */
  position: relative !important;
  width: 40px !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
}

.dataTables_paginate .page-item.previous .page-link::after,
.dataTables_paginate .page-item.next .page-link::after,
.dataTables_paginate .page-item.previous .page-link::before,
.dataTables_paginate .page-item.next .page-link::before {
  display: none !important;
  /* Hide extra theme-added icons */
}

/* Add custom clean icons for Prev/Next */
.dataTables_paginate .page-item.previous .page-link::after {
  content: '\f053' !important;
  /* FontAwesome Chevron Left */
  font-family: "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
  font-size: 12px !important;
  display: block !important;
}

.dataTables_paginate .page-item.next .page-link::after {
  content: '\f054' !important;
  /* FontAwesome Chevron Right */
  font-family: "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
  font-size: 12px !important;
  display: block !important;
}

/* Handle case where text is preferred or icons are different */
.dataTables_paginate .page-item.previous .page-link,
.dataTables_paginate .page-item.next .page-link {
  font-size: 13px !important;
  /* Restore font size if we want text */
  width: auto !important;
  min-width: 40px !important;
  padding: 8px 15px !important;
}

/* Final cleanup for overlapping */
.paginate_button.previous::before,
.paginate_button.next::after {
  display: none !important;
}

/* Notification Dropdown Helpers */
.hover-bg-light:hover {
  background-color: rgba(95, 96, 185, 0.05) !important;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 5px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}

/* --- CLEAN SORTING ICONS FIX (Removes "Â" characters) --- */
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after,
table.dataTable thead th.sorting::before,
table.dataTable thead th.sorting_asc::before,
table.dataTable thead th.sorting_desc::before {
  display: none !important;
  content: "" !important;
}

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
  position: relative !important;
  padding-right: 30px !important;
}

/* Base Arrow (Neutral) */
table.dataTable thead th.sorting::after {
  content: '\f0dc' !important;
  /* fa-sort */
  font-family: "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  opacity: 0.2 !important;
  font-size: 12px !important;
  display: block !important;
}

/* Ascending Arrow */
table.dataTable thead th.sorting_asc::after {
  content: '\f0de' !important;
  /* fa-sort-up */
  font-family: "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  opacity: 1 !important;
  color: #5f60b9 !important;
  font-size: 12px !important;
  display: block !important;
}

/* Descending Arrow */
table.dataTable thead th.sorting_desc::after {
  content: '\f0dd' !important;
  /* fa-sort-down */
  font-family: "Font Awesome 5 Free" !important;
  font-weight: 900 !important;
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  opacity: 1 !important;
  color: #5f60b9 !important;
  font-size: 12px !important;
  display: block !important;
  z-index: 5;
}

[dir='rtl'] table.dataTable thead th.sorting::after,
[dir='rtl'] table.dataTable thead th.sorting_asc::after,
[dir='rtl'] table.dataTable thead th.sorting_desc::after {
  right: auto !important;
  left: 10px !important;
}

/* --- FIX SIDEBAR ICONS IN DARK MODE --- */
[data-bs-theme="dark"] .iq-sidebar-menu .side-menu li a svg path,
[data-bs-theme="dark"] .iq-sidebar-menu .side-menu li a svg rect,
[data-bs-theme="dark"] .iq-sidebar-menu .side-menu li a svg circle,
[data-bs-theme="dark"] .iq-sidebar-menu .side-menu li a svg ellipse {
  fill: none;
  stroke: currentColor;
}

/* Re-allow explicit fills so we don't break SVGs that actually need fill (like the Dashboard diamond) */
[data-bs-theme="dark"] .iq-sidebar-menu .side-menu li a svg [fill="currentColor"],
[data-bs-theme="dark"] .iq-sidebar-menu .side-menu li a svg [fill="#ffffff"],
[data-bs-theme="dark"] .iq-sidebar-menu .side-menu li a svg path[fill] {
  fill: currentColor !important;
}

[data-bs-theme="dark"] .iq-sidebar-menu .side-menu li.active a svg [fill] {
  fill: #ffffff !important;
}

/* --- PREMIUM ZINC DARK MODE OVERRIDES (Foolproof Fix) --- */
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] .content-page {
  background-color: #2d2d34 !important;
  color: #a1a1aa !important;
}

[data-bs-theme="dark"] .iq-sidebar,
[data-bs-theme="dark"] .iq-top-navbar,
[data-bs-theme="dark"] .navbar {
  background-color: #2d2d34 !important;
  border-color: #3f3f46 !important;
}

[data-bs-theme="dark"] #notification-dropdown,
[data-bs-theme="dark"] #languageDropdownMenu,
[data-bs-theme="dark"] .notification_list,
[data-bs-theme="dark"] .language-toggle {
  background-color: #2d2d34 !important;
  border-color: #383842 !important;
}

[data-bs-theme="dark"] #notification-dropdown svg,
[data-bs-theme="dark"] .notification_list svg {
  stroke: #a1a1aa !important;
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .iq-card,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .select2-container--default .select2-selection--single,
[data-bs-theme="dark"] .select2-dropdown,
[data-bs-theme="dark"] .select2-results__options,
[data-bs-theme="dark"] .datatable-filter,
[data-bs-theme="dark"] .card-block,
[data-bs-theme="dark"] .card-body,
[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer,
[data-bs-theme="dark"] .workflow-tabs,
[data-bs-theme="dark"] .nav-tabs,
[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .table-responsive,
[data-bs-theme="dark"] .data_table_widgets,
html[data-bs-theme="dark"] body .card,
html.dark .card,
html.dark .iq-card {
  background-color: #383842 !important;
  background: #383842 !important;
  border-color: #3f3f46 !important;
  overflow: hidden !important;
  border-radius: 12px !important;
}

[data-bs-theme="dark"] table.dataTable tbody tr,
[data-bs-theme="dark"] table.dataTable thead th,
[data-bs-theme="dark"] table.dataTable thead td,
[data-bs-theme="dark"] table.table thead th,
[data-bs-theme="dark"] table.table thead td,
[data-bs-theme="dark"] table.table tbody td,
[data-bs-theme="dark"] table.table tbody th,
[data-bs-theme="dark"] .table-responsive table,
[data-bs-theme="dark"] table.table {
  background-color: #383842 !important;
  border-color: #3f3f46 !important;
  color: #cbd5e1 !important;
  --bs-table-bg: #383842 !important;
  --bs-table-striped-bg: #323238 !important;
  --bs-table-accent-bg: transparent !important;
}

[data-bs-theme="dark"] .table-striped>tbody>tr:nth-of-type(odd)>*,
[data-bs-theme="dark"] .table-striped>tbody>tr:nth-of-type(even)>*,
[data-bs-theme="dark"] .table-hover>tbody>tr:hover>* {
  background-color: transparent !important;
  box-shadow: inset 0 0 0 9999px #383842 !important;
}

[data-bs-theme="dark"] .table-striped>tbody>tr:nth-of-type(odd)>* {
  box-shadow: inset 0 0 0 9999px #323238 !important;
}

[data-bs-theme="dark"] table.dataTable {
  background-color: #2d2d34 !important;
}

[data-bs-theme="dark"] .table thead th {
  background-color: #2d2d34 !important;
  background: #2d2d34 !important;
  border-bottom: 1px solid #383842 !important;
}

[data-bs-theme="dark"] .nav-tabs .nav-link,
[data-bs-theme="dark"] .workflow-tab {
  border-color: transparent !important;
  color: #a1a1aa !important;
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active,
[data-bs-theme="dark"] .workflow-tab.active {
  background-color: #383842 !important;
  color: #ffffff !important;
  border-bottom: 2px solid #5f60b9 !important;
}

[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer {
  border-color: #383842 !important;
  background-color: transparent !important;
}

[data-bs-theme="dark"] .data_table_widgets,
[data-bs-theme="dark"] .dataTables_wrapper,
[data-bs-theme="dark"] div.dataTables_wrapper div.dataTables_info,
[data-bs-theme="dark"] div.dataTables_wrapper div.dataTables_length label,
[data-bs-theme="dark"] div.dataTables_wrapper div.dataTables_filter label {
  background-color: #383842 !important;
  color: #a1a1aa !important;
}

[data-bs-theme="dark"] div.dataTables_wrapper div.dataTables_length select,
[data-bs-theme="dark"] .input-group-search .dt-search {
  background-color: #3f3f46 !important;
  border-color: #52525b !important;
  color: #f8fafc !important;
  border-radius: 8px !important;
}

[data-bs-theme="dark"] .page-link {
  background-color: #3f3f46 !important;
  border-color: #52525b !important;
  color: #cbd5e1 !important;
}

[data-bs-theme="dark"] .page-item.active .page-link {
  background-color: #5f60b9 !important;
  border-color: #5f60b9 !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .page-item.disabled .page-link {
  background-color: #383842 !important;
  border-color: #3f3f46 !important;
  color: #52525b !important;
}

[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .iq-sub-dropdown.dropdown-menu {
  background-color: #383842 !important;
  border-color: #3f3f46 !important;
}

[data-bs-theme="dark"] .dropdown-menu .dropdown-item {
  color: #cbd5e1 !important;
  background-color: transparent !important;
}

[data-bs-theme="dark"] .dropdown-menu .dropdown-item:hover {
  background-color: #3f3f46 !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .iq-sidebar-menu .side-menu>li>a {
  color: #a1a1aa !important;
}

[data-bs-theme="dark"] .iq-sidebar-menu .side-menu>li>a:hover,
[data-bs-theme="dark"] .iq-sidebar-menu .side-menu>li.active>a {
  background-color: #383842 !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .iq-sidebar-menu .side-menu>li.active>a svg * {
  stroke: #ffffff !important;
}

[data-bs-theme="dark"] .card-title,
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
  color: #f8fafc !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text,
[data-bs-theme="dark"] div.dataTables_wrapper div.dataTables_length select,
[data-bs-theme="dark"] .input-group-search .dt-search {
  background-color: #383842 !important;
  border-color: #3f3f46 !important;
  color: #f8fafc !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background-color: #383842 !important;
  border-color: #5f60b9 !important;
  box-shadow: 0 0 0 2px rgba(95, 96, 185, 0.2) !important;
}

/* --- FIX CHECKBOX VISIBILITY IN DARK MODE --- */
[data-bs-theme="dark"] .form-check-input {
  background-color: #3f3f46 !important;
  border: 1px solid #52525b !important;
  cursor: pointer;
}

[data-bs-theme="dark"] .form-check-input:checked {
  background-color: #5f60b9 !important;
  border-color: #5f60b9 !important;
}

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

[data-bs-theme="dark"] .form-check-input:checked[type=radio] {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2.5' fill='white'/%3e%3c/svg%3e") !important;
  background-size: 60% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

/* Ensure 'Select All' in table headers is also styled */
[data-bs-theme="dark"] th input[type="checkbox"].form-check-input {
  border: 2px solid #52525b !important;
}

[data-bs-theme="dark"] th input[type="checkbox"].form-check-input:checked {
  border-color: #5f60b9 !important;
}

[data-bs-theme="dark"] .workflow-tabs {
  background-color: #2d2d34 !important;
  border-bottom: 1px solid #383842 !important;
}

[data-bs-theme="dark"] .tab-count.badge {
  background-color: #383842 !important;
  color: #a1a1aa !important;
}

/* --- GLOBAL FIX FOR CONTACT NUMBER (INTL-TEL-INPUT) --- */
.iti {
  width: 100%;
}

.iti input {
  padding-left: 95px !important;
  height: 50px !important;
}

[dir="rtl"] .iti input {
  padding-left: 10px !important;
  padding-right: 95px !important;
}

.iti__selected-flag {
  background-color: transparent !important;
}

/* --- DARK MODE ONLY COLORS FOR CONTACT NUMBER --- */
[data-bs-theme="dark"] .iti input {
  background-color: #2d2d34 !important;
  color: #ffffff !important;
  border: 1px solid #3f3f46 !important;
  border-radius: 12px !important;
}

[data-bs-theme="dark"] .iti__country-list {
  background-color: #383842 !important;
  border: 1px solid #3f3f46 !important;
  color: #f8fafc !important;
  border-radius: 12px !important;
}

[data-bs-theme="dark"] .iti__country:hover {
  background-color: #383842 !important;
}

[data-bs-theme="dark"] .iti__arrow {
  border-top-color: #a1a1aa !important;
}

[data-bs-theme="dark"] .iti__arrow--up {
  border-bottom-color: #a1a1aa !important;
}

/* --- FIX SIDEBAR TOGGLE DIAMOND (Final Boss Fix) --- */
html[data-bs-theme="dark"] .iq-sidebar .side-menu-bt-sidebar.wide-device-toggle,
html[data-bs-theme="dark"] .side-menu-bt-sidebar.wide-device-toggle,
[data-bs-theme="dark"] .wide-device-toggle {
  background-color: #2d2d34 !important;
  background: #2d2d34 !important;
  border: 1px solid #383842 !important;
  box-shadow: none !important;
}

html[data-bs-theme="dark"] .side-menu-bt-sidebar .iq-toggle-arrow,
html[data-bs-theme="dark"] .wide-device-toggle i,
html[data-bs-theme="dark"] .wide-device-toggle svg {
  color: #ffffff !important;
}

/* --- SITE-WIDE RTL SELECT ARROW FIX --- */
[dir="rtl"] .form-select, 
html[lang="ar"] .form-select,
[dir="rtl"] select.form-control,
html[lang="ar"] select.form-control,
[dir="rtl"] select,
html[lang="ar"] select {
    background-position: left 0.75rem center !important;
    padding-left: 2.5rem !important;
    padding-right: 1.25rem !important;
    text-align: right !important;
}

/* Select2 Specific RTL Overrides */
[dir="rtl"] .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow,
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__arrow,
html[lang="ar"] .select2-container .select2-selection__arrow {
    left: 8px !important;
    right: auto !important;
}

[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered,
html[lang="ar"] .select2-container .select2-selection__rendered {
    padding-right: 1.25rem !important;
    padding-left: 2.5rem !important;
    text-align: right !important;
}

[dir="rtl"] .select2-container .select2-selection--single,
html[lang="ar"] .select2-container .select2-selection--single {
    background-position: left 0.75rem center !important;
}

/* Aggressive Catch-all for RTL Dropdown Arrows */
[dir="rtl"] .select2-selection__arrow,
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__arrow {
    left: 10px !important;
    right: auto !important;
}

[dir="rtl"] .select2-selection__rendered,
[dir="rtl"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 35px !important;
    padding-right: 12px !important;
    text-align: right !important;
}

[dir="rtl"] .form-select {
    background-position: left 0.75rem center !important;
    padding-left: 2.5rem !important;
    padding-right: 1rem !important;
}