/* =========================================================
   System-wide UI fixes — loaded after the theme stylesheet
   via assets/css/custom.css (auto-injected by Perfex CRM
   when the file exists).
   ========================================================= */

/* ---------------------------------------------------------
   1. Restore spacing between cards/panels and DataTables
      for pages that still use the .panel-table-full helper.
      The helper was pulling tables to the card edges with
      negative horizontal margins; we neutralise that so the
      normal .panel-body padding (and the card border radius)
      stays visible everywhere.
   --------------------------------------------------------- */
.panel-table-full .dataTables_wrapper .table-responsive,
.panel-table-full > .table-responsive,
.panel_s.panel-table-full .table-responsive {
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-bottom-width: 0 !important;
}

/* Put back the default bottom padding that the :has() rule
   was reducing only for panels containing panel-table-full. */
.panel-body:has(.panel-table-full) {
    padding-bottom: 1.5rem !important;
}

/* ---------------------------------------------------------
   2. Add spacing between action icons (edit / trash / etc.)
      inside DataTables option cells.

      Many option cells use the Tailwind pattern:
      <div class="tw-flex tw-items-center tw-space-x-2">...
      which breaks in RTL because space-x uses physical
      margins. We turn that into a real gap only inside
      table cells.
   --------------------------------------------------------- */
table.dataTable td .tw-flex.tw-items-center.tw-space-x-2,
table.dataTable td .tw-flex.tw-items-center.tw-space-x-2.rtl\:tw-space-x-reverse {
    gap: 0.5rem !important;
}

table.dataTable td .tw-flex.tw-items-center.tw-space-x-2 > :not([hidden]) ~ :not([hidden]),
table.dataTable td .tw-flex.tw-items-center.tw-space-x-2.rtl\:tw-space-x-reverse > :not([hidden]) ~ :not([hidden]) {
    margin-left: 0 !important;
    margin-right: 0 !important;
    --tw-space-x-reverse: 0 !important;
}

/* Fallback for option cells that render icons as plain links
   without the tw-flex wrapper. */
table.dataTable td a[href] > i.fa-pen-to-square,
table.dataTable td a[href] > i.fa-trash-can,
table.dataTable td a[href] > i.fa-trash,
table.dataTable td a[href] > i.fa-trash-o,
table.dataTable td a[href] > i.fa-pencil,
table.dataTable td a[href] > i.fa-pencil-square,
table.dataTable td a[href] > i.fa-pencil-square-o,
table.dataTable td a[href] > i.fa-edit,
table.dataTable td button > i.fa-pen-to-square,
table.dataTable td button > i.fa-trash-can,
table.dataTable td button > i.fa-trash,
table.dataTable td button > i.fa-trash-o,
table.dataTable td button > i.fa-pencil,
table.dataTable td button > i.fa-pencil-square,
table.dataTable td button > i.fa-pencil-square-o,
table.dataTable td button > i.fa-edit {
    margin-inline-start: 0.25rem;
    margin-inline-end: 0.25rem;
}
