/* =========================================================
   DataTables — SalesWiz house style
   Brings the index tables into line with the frosted-glass
   design language shared by the sidebar, toasts and login:
   soft neutral surfaces, hairline borders, small-caps column
   labels on a rounded band, rounded "floating" row hovers,
   compact ghost row menus, a frosted segmented pager whose
   current page mirrors the active sidebar item, and a frosted
   loading veil.
   DataTables 2 + its Bootstrap 5 integration render the
   toolbar and footer as `.dt-container > .row`s (start/end
   cells), each header as `.dt-column-title` + `.dt-column-order`,
   and — once Responsive collapses columns — a `td.dtr-control`
   toggle plus a `tr.child` holding `ul.dtr-details`. None of
   DataTables' own CSS is loaded; everything is drawn here.
   Rules are written to win over Tabler's table / pagination /
   form defaults, which load *after* this file.
   ========================================================= */

.dt-container {
  --dt-line: rgba(31, 41, 55, 0.07);        /* hairline row separators */
  --dt-line-strong: rgba(31, 41, 55, 0.12); /* controls */
  --dt-hover: rgba(var(--tblr-primary-rgb), 0.05);
  --dt-band: rgba(var(--tblr-primary-rgb), 0.05);
  --dt-radius: 0.7rem;
}

/* =========================================================
   Toolbar — page length + search
   ========================================================= */
.dt-container > .row { --tblr-gutter-x: 0.75rem; row-gap: 0.6rem; align-items: center; }
.dt-container > .row:first-child { margin-top: 0 !important; }
.dt-container > .row > [class*="dt-layout-"] { gap: 0.5rem; }

.dt-length,
.dt-search {
  display: inline-flex !important;
  align-items: center;
}
.dt-length label:empty { display: none; }

/* page-length select — soft field with a primary focus ring */
.dt-length select,
.dt-length select.dt-input {
  height: 2.375rem;
  padding: 0.42rem 2rem 0.42rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tblr-dark);
  border-radius: var(--dt-radius) !important;
  border: 1px solid var(--dt-line-strong) !important;
  background-color: rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.04);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.dt-length select:hover { border-color: rgba(var(--tblr-primary-rgb), 0.35) !important; }
.dt-length select:focus,
.dt-length select.dt-input:focus {
  border-color: rgba(var(--tblr-primary-rgb), 0.55) !important;
  box-shadow: 0 0 0 0.2rem rgba(var(--tblr-primary-rgb), 0.15);
  outline: none;
}

/* search — frosted flat input group, roomy enough to type a name into */
.dt-search label { margin: 0; }
.dt-search .input-group {
  height: 2.375rem;
  min-width: 18rem;
  flex-wrap: nowrap;
  border-radius: var(--dt-radius);
  border: 1px solid var(--dt-line-strong);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.04);
  overflow: hidden;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.dt-search .input-group:hover { border-color: rgba(var(--tblr-primary-rgb), 0.35); }
.dt-search .input-group:focus-within {
  border-color: rgba(var(--tblr-primary-rgb), 0.55);
  box-shadow: 0 0 0 0.2rem rgba(var(--tblr-primary-rgb), 0.15);
}
.dt-search span.input-group-text {
  background: transparent !important;
  border: 0 !important;
  color: var(--tblr-secondary);
}
.dt-search .input-group:focus-within span.input-group-text:first-child { color: var(--tblr-primary); }
.dt-search .input-group-text .material-symbols-outlined { font-size: 20px; }
.dt-search input[type="search"],
.dt-search input.dt-input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0.45rem 0.55rem;
  font-family: var(--tblr-body-font-face);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4285714286;
  color: var(--tblr-body-color);
}
.dt-search input[type="search"]:focus { outline: none; }
.dt-search kbd {
  font-size: 0.6875rem;
  color: var(--tblr-secondary);
  background: rgba(31, 41, 55, 0.06);
  border: 0;
  border-radius: 0.4rem;
  padding: 0.15rem 0.4rem;
}
/* no keyboard shortcut to advertise on touch screens */
@media (hover: none), (max-width: 767.98px) {
  .dt-search .input-group-text:has(kbd) { display: none; }
}

/* phones: the controls stack full-width instead of hugging their content */
@media (max-width: 767.98px) {
  .dt-container > .row:first-child > [class*="dt-layout-"] { width: 100%; }
  .dt-search,
  .dt-search label,
  .dt-search .btn-list,
  .dt-search .input-group { width: 100% !important; min-width: 0; }
}

/* right-aligned values line up with the header label, which sits left of the sort glyph */
table.dataTable tbody td.text-end { padding-right: 2.25rem; }

/* =========================================================
   Table
   ========================================================= */
table.dataTable {
  margin-top: 1rem !important;
  border-color: var(--dt-line);
  border-collapse: separate;
  border-spacing: 0;
}

/* header — small-caps muted labels on a rounded primary band */
table.dataTable thead th {
  padding: 0.7rem 0.85rem;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tblr-secondary) !important;
  background: var(--dt-band);
  border-bottom: 0 !important;
  white-space: nowrap;
  transition: color 0.16s ease;
}
table.dataTable thead th:first-child { border-radius: var(--dt-radius) 0 0 var(--dt-radius); }
table.dataTable thead th:last-child  { border-radius: 0 var(--dt-radius) var(--dt-radius) 0; }
table.dataTable thead th:only-child  { border-radius: var(--dt-radius); }

/* sort glyph sits right after the label: hidden until the header is
   hovered/focused, primary (and the label darkened) once sorted */
table.dataTable thead th:is(.dt-orderable-asc, .dt-orderable-desc) { cursor: pointer; }
table.dataTable thead th:is(.dt-orderable-asc, .dt-orderable-desc):hover { color: var(--tblr-dark) !important; }
table.dataTable thead th .dt-column-order {
  display: inline-flex;
  vertical-align: -0.2em;
  width: 1rem;
  margin-left: 0.2rem;
}
table.dataTable thead th:not(.dt-orderable-asc):not(.dt-orderable-desc) .dt-column-order { display: none; }
table.dataTable thead th .dt-column-order::before {
  font-family: 'Material Symbols Outlined';
  font-feature-settings: 'liga';
  content: 'unfold_more';
  font-size: 16px;
  line-height: 1;
  color: rgba(31, 41, 55, 0.4);
  opacity: 0;
  transition: opacity 0.16s ease, color 0.16s ease;
}
table.dataTable thead th:hover .dt-column-order::before,
table.dataTable thead th .dt-column-order:focus-visible::before { opacity: 1; }
table.dataTable thead th .dt-column-order:focus-visible { outline: none; }
table.dataTable thead th:is(.dt-ordering-asc, .dt-ordering-desc) { color: var(--tblr-dark) !important; }
table.dataTable thead th.dt-ordering-asc .dt-column-order::before  { content: 'arrow_upward'; }
table.dataTable thead th.dt-ordering-desc .dt-column-order::before { content: 'arrow_downward'; }
table.dataTable thead th:is(.dt-ordering-asc, .dt-ordering-desc) .dt-column-order::before {
  opacity: 1;
  color: var(--tblr-primary);
}

/* body — comfortable rows; hover lifts the row into a rounded tinted pill */
table.dataTable tbody td {
  padding: 0.7rem 0.85rem;
  border-top: 1px solid var(--dt-line);
  border-bottom: 0;
  color: var(--tblr-body-color);
  vertical-align: middle;
  transition: background-color 0.14s ease;
}
/* out-specifies the global `.page-wrapper .table tbody td` padding */
.dt-container table.dataTable tbody td { padding-top: 0.6rem; padding-bottom: 0.6rem; }
table.dataTable tbody td:is(.dt-type-numeric, .dt-type-date) { font-variant-numeric: tabular-nums; }
table.dataTable tbody tr:first-child td { border-top: 0; }
table.dataTable tbody tr:hover > td,
table.dataTable tbody tr:hover + tr > td { border-top-color: transparent; }
table.dataTable tbody tr:not(.child):hover > td { background-color: var(--dt-hover); }
table.dataTable tbody tr:hover > td:first-child { border-radius: var(--dt-radius) 0 0 var(--dt-radius); }
table.dataTable tbody tr:hover > td:last-child  { border-radius: 0 var(--dt-radius) var(--dt-radius) 0; }
table.dataTable tbody tr:hover > td:only-child  { border-radius: var(--dt-radius); }
/* Tabler's `.table-hover` paints its own inset hover fill over the cells
   (the orders table opts into it) — the row hover above already covers it */
table.dataTable { --tblr-table-hover-bg: transparent; }
/* row-selection checkboxes (orders) sit on the cell's centre line */
table.dataTable tbody td .form-check { margin: 0; min-height: 0; }

/* unread orders (orders_controller's rowCallback) — an unread-inbox row:
   tinted and bolder */
table.dataTable tbody tr.unopened-order > td {
  background-color: rgba(var(--tblr-primary-rgb), 0.06);
  color: var(--tblr-dark);
  font-weight: 600;
}
table.dataTable tbody tr.unopened-order > td:first-child { border-radius: var(--dt-radius) 0 0 var(--dt-radius); }
table.dataTable tbody tr.unopened-order > td:last-child { border-radius: 0 var(--dt-radius) var(--dt-radius) 0; }
table.dataTable tbody tr.unopened-order:hover > td { background-color: rgba(var(--tblr-primary-rgb), 0.1); }

/* the leading row counter reads as metadata, not data */
table.dataTable tbody td.dt-type-numeric:first-child {
  font-size: 0.8rem !important;
  color: var(--tblr-secondary);
}

/* row menu — the decorators' `actions` (dropdown_menu_helper): a quiet
   ghost icon button that firms up with its row and tints while open */
.btn.swz-row-menu {
  --tblr-btn-border-radius: 0.6rem;
  width: 1.875rem; height: 1.875rem;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--tblr-secondary);
  background: transparent;
  border: 0;
  box-shadow: none;
}
.btn.swz-row-menu .material-symbols-outlined { font-size: 1.3rem; line-height: 1; }
tr:hover .btn.swz-row-menu { color: var(--tblr-dark); background: rgba(31, 41, 55, 0.05); }
.btn.swz-row-menu:hover,
.btn.swz-row-menu:focus-visible { color: var(--tblr-dark); background: rgba(31, 41, 55, 0.09); }
.btn.swz-row-menu:focus-visible { box-shadow: 0 0 0 0.2rem rgba(var(--tblr-primary-rgb), 0.18); }
/* open — also under a hovered row, so it out-specifies the row rule above */
.btn.swz-row-menu:is(.show, [aria-expanded="true"]),
tr:hover .btn.swz-row-menu:is(.show, [aria-expanded="true"]) {
  color: var(--tblr-primary);
  background: rgba(var(--tblr-primary-rgb), 0.12);
  transform: none;
}

/* =========================================================
   Responsive — collapsed columns open into a detail panel
   ========================================================= */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control {
  position: relative;
  padding-left: 2.6rem;
  cursor: pointer;
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before {
  content: 'chevron_right';
  font-family: 'Material Symbols Outlined';
  font-feature-settings: 'liga';
  position: absolute;
  left: 0.7rem; top: 50%;
  width: 1.4rem; height: 1.4rem;
  margin-top: -0.7rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; line-height: 1;
  color: var(--tblr-primary);
  border-radius: 0.45rem;
  background: rgba(var(--tblr-primary-rgb), 0.1);
  transition: transform 0.2s ease, background-color 0.16s ease;
}
table.dataTable.dtr-inline.collapsed > tbody > tr:is(.dtr-expanded, .parent) > td.dtr-control::before {
  transform: rotate(90deg);
  color: #fff;
  background: linear-gradient(135deg, rgba(var(--tblr-primary-rgb), 0.95), rgba(var(--tblr-azure-rgb), 0.85));
}
table.dataTable.dtr-inline.collapsed > tbody > tr:is(.dtr-expanded, .parent) > td {
  background-color: var(--dt-hover);
}
table.dataTable.dtr-inline.collapsed > tbody > tr:is(.dtr-expanded, .parent) > td:first-child { border-radius: var(--dt-radius) 0 0 0; }
table.dataTable.dtr-inline.collapsed > tbody > tr:is(.dtr-expanded, .parent) > td:last-child  { border-radius: 0 var(--dt-radius) 0 0; }

table.dataTable > tbody > tr.child > td.child {
  padding: 0 0 0.6rem;
  border-top: 0;
  background: transparent;
}
table.dataTable > tbody > tr.child ul.dtr-details {
  display: block;
  margin: 0;
  padding: 0.3rem 0.85rem;
  list-style: none;
  border-radius: 0 0 var(--dt-radius) var(--dt-radius);
  background: var(--dt-hover);
}
table.dataTable > tbody > tr.child ul.dtr-details > li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--dt-line);
}
table.dataTable > tbody > tr.child ul.dtr-details > li:first-child { border-top: 0; }
table.dataTable > tbody > tr.child ul.dtr-details > li:has(.dtr-title:empty) { justify-content: flex-end; }
table.dataTable > tbody > tr.child .dtr-title {
  flex: none;
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--tblr-secondary);
}
table.dataTable > tbody > tr.child .dtr-title:empty { display: none; }
table.dataTable > tbody > tr.child .dtr-data {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
  color: var(--tblr-dark);
}

/* empty state — plain text while loading; once a draw comes back empty the
   cell hosts the shared `.swz-state` illustration (see datatables_config.js) */
.dt-empty {
  text-align: center;
  font-weight: 500;
  color: var(--tblr-secondary);
  padding: 2rem 1rem !important;
}
.dt-empty:has(.swz-state) {
  font-weight: 400;
  padding: 1rem !important;
}
/* it isn't a data row, so no hover tint (out-specifies both row-hover rules) */
.dt-container table.dataTable tbody tr:hover > td.dt-empty { background: transparent; }

/* =========================================================
   Footer — info + pagination
   ========================================================= */
.dt-container > .row:has(.dt-info, .dt-paging) { margin-top: 0.85rem !important; }

.dt-info {
  font-size: 0.8rem;
  color: var(--tblr-secondary);
  padding-top: 0 !important;
}
.dt-info strong { font-weight: 700; color: var(--tblr-dark); }
.dt-info .dt-info-filtered {
  margin-left: 0.35rem;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem; font-weight: 600;
  border-radius: 999px;
  color: var(--tblr-primary);
  background: rgba(var(--tblr-primary-rgb), 0.1);
}

/* pagination — a frosted segmented control; the current page borrows the
   primary→azure gradient + glow from the active sidebar item */
.dt-paging .pagination {
  display: inline-flex;
  gap: 0.15rem;
  margin: 0;
  padding: 0.2rem;
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  backdrop-filter: blur(12px) saturate(160%);
  box-shadow:
    0 0 0 1px rgba(31, 41, 55, 0.07),
    0 0.6rem 1.4rem -1rem rgba(31, 41, 55, 0.35);
}
.dt-paging .page-item .page-link {
  min-width: 2rem; height: 2rem;
  padding: 0 0.55rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0 !important;
  border-radius: 0.6rem !important;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tblr-secondary) !important;
  background: transparent !important;
  box-shadow: none !important;
  transition: color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}
.dt-paging .page-link .material-symbols-outlined { font-size: 1.15rem; line-height: 1; }
.dt-paging .page-item:not(.disabled):not(.active) .page-link:hover {
  color: var(--tblr-primary) !important;
  background: rgba(var(--tblr-primary-rgb), 0.09) !important;
}
.dt-paging .page-item:not(.disabled):not(.active) .page-link:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(var(--tblr-primary-rgb), 0.18) !important;
}
.dt-paging .page-item.active .page-link {
  color: #fff !important;
  background: linear-gradient(135deg,
    rgba(var(--tblr-primary-rgb), 0.95),
    rgba(var(--tblr-azure-rgb), 0.85)) !important;
  box-shadow:
    inset 0 0 0 1px rgba(var(--tblr-primary-rgb), 0.35),
    0 0.5rem 1.1rem -0.55rem rgba(var(--tblr-primary-rgb), 0.9) !important;
}
.dt-paging .page-item.disabled .page-link {
  color: rgba(31, 41, 55, 0.25) !important;
  background: transparent !important;
}

/* phones: info above a centred pager */
@media (max-width: 767.98px) {
  .dt-container > .row:has(.dt-info, .dt-paging) > [class*="dt-layout-"] {
    display: flex !important;
    width: 100%;
    justify-content: center !important;
  }
  .dt-info { text-align: center; }
}

/* =========================================================
   Processing veil — frosted card instead of a black block
   ========================================================= */
.dt-processing {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%);
  width: auto !important;
  margin: 0 !important;
  padding: 1rem 1.6rem !important;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--tblr-dark);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 1.25rem 2.5rem -1rem rgba(31, 41, 55, 0.35);
}
.dt-processing .spinner-border { color: var(--tblr-primary); }

@media (prefers-reduced-motion: reduce) {
  table.dataTable tbody td,
  table.dataTable thead th .dt-column-order::before,
  table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before { transition: none; }
}

