/* =====================================================================
   Compact display: denser tables and smaller action buttons, app-wide.
   Loaded after assets/css/style.css (includes/head.php + pages with their own <head>).
   To keep the old size on one element/table: add class="no-compact".
   ===================================================================== */

:root {
  --cp-font: 0.84rem;       /* table text           */
  --cp-font-head: 0.78rem;  /* table headings       */
  --cp-pad-y: 0.38rem;      /* cell padding         */
  --cp-pad-x: 0.55rem;
  --cp-btn-font: 0.8rem;    /* page action buttons  */
}/* ---------- Tables (Bootstrap,
DataTables,
simple-datatables) ---------- */
#main table:not(.no-compact),
#main .datatable-table:not(.no-compact),
#main .dataTable-table:not(.no-compact) {
  font-size: var(--cp-font);
  line-height: 1.35;
}
#main table:not(.no-compact) > :not(caption) > * > *,
#main .datatable-table:not(.no-compact) > thead > tr > th,
#main .dataTable-table:not(.no-compact) > thead > tr > th,
#main .datatable-table:not(.no-compact) > tbody > tr > td,
#main .dataTable-table:not(.no-compact) > tbody > tr > td {
  padding: var(--cp-pad-y) var(--cp-pad-x);
  vertical-align: middle;
}
#main table:not(.no-compact) thead th {
  font-size: var(--cp-font-head);
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
}/* sort arrows (simple-datatables / DataTables) take less room */
#main .datatable-sorter,
/* sort arrows (simple-datatables / DataTables) take less room */
#main .dataTable-sorter { padding-right: 1.1rem; }
#main .datatable-sorter::before,
#main .dataTable-sorter::before,
#main .datatable-sorter::after,
#main .dataTable-sorter::after { right: 2px; }
#main table.dataTable > thead > tr > th { padding-right: 1.4rem; }

/* secondary lines inside cells (model, location, "x weeks ago"...) */
#main table:not(.no-compact) td small,
#main table:not(.no-compact) td .small,
#main table:not(.no-compact) td .text-muted { font-size: .78rem; line-height: 1.25; }
#main table:not(.no-compact) td br + small { display: inline-block; margin-top: 1px; }
#main table:not(.no-compact) .badge { font-size: .7rem; padding: .28em .5em; font-weight: 600; }
#main table:not(.no-compact) td i.bi { font-size: .95em; }
#main table:not(.no-compact) td img { max-height: 36px; width: auto; }

/* ---------- Action buttons inside tables (view / edit / delete / stock out...) ---------- */
#main table:not(.no-compact) .btn:not(.no-compact) {
  padding: .16rem .42rem;
  font-size: .76rem;
  line-height: 1.25;
  border-radius: .3rem;
}
#main table:not(.no-compact) .btn i { font-size: .85rem; line-height: 1; vertical-align: -1px; }
#main table:not(.no-compact) .btn-group,
#main table:not(.no-compact) td:has(> .btn),
#main table:not(.no-compact) td:has(> .btn-group),
#main table:not(.no-compact) td:has(> div > .btn) { white-space: nowrap; }
#main table:not(.no-compact) td > .btn + .btn,
#main table:not(.no-compact) td > a.btn + a.btn,
#main table:not(.no-compact) td > .btn + a.btn,
#main table:not(.no-compact) td > a.btn + .btn { margin-left: .2rem; }

/* ---------- Visible page action buttons (toolbars, card headers, filters) ---------- */
#main .btn:not(.btn-lg):not(.btn-close):not(.no-compact) {
  --bs-btn-padding-y: .3rem;
  --bs-btn-padding-x: .7rem;
  --bs-btn-font-size: var(--cp-btn-font);
}
#main .btn-sm:not(.no-compact) {
  --bs-btn-padding-y: .2rem;
  --bs-btn-padding-x: .5rem;
  --bs-btn-font-size: .76rem;
}
#main .btn i.bi { line-height: 1; }/* DataTables / simple-datatables controls around the table */
#main .dataTables_wrapper,
#main .datatable-wrapper,
#main .dataTable-wrapper { font-size: var(--cp-font); }
#main .dataTables_wrapper .form-select,
#main .dataTables_wrapper .form-control,
#main .datatable-selector,
#main .dataTable-selector,
#main .datatable-input,
#main .dataTable-input {
  padding: .25rem .5rem;
  font-size: var(--cp-font);
  min-height: 0;
}
#main .datatable-selector,
#main .dataTable-selector { padding-right: 1.6rem; }
#main .datatable-top,
#main .dataTable-top,
#main .datatable-bottom,
#main .dataTable-bottom { padding: 4px 0 8px; }
#main .dataTables_wrapper .dataTables_paginate .page-link,
#main .datatable-pagination a,
#main .dataTable-pagination a,
#main .datatable-pagination button,
#main .dataTable-pagination button { padding: .2rem .55rem; font-size: .8rem; }
#main .pagination { --bs-pagination-padding-y: .2rem; --bs-pagination-padding-x: .55rem; --bs-pagination-font-size: .8rem; }

/* Small screens: let wide tables scroll inside their card instead of squashing */
@media (max-width: 768px) {
  #main table:not(.no-compact) { font-size: .8rem; }
  #main table:not(.no-compact) > :not(caption) > * > * { padding: .3rem .4rem; }
}

/* ---------- Table pagination (assets/js/table-pager.js) ---------- */
.tp-hidden { display: none !important; }
.tp-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.tp-pager.tp-off { display: none; }
#main .tp-pager { font-size: .8rem; padding: .45rem .1rem .1rem; border-top: 1px solid #eef0f4; margin-top: -1px; }
#main .tp-pager .form-select-sm { font-size: .78rem; padding: .15rem 1.6rem .15rem .45rem; min-height: 0; }
#main .tp-pager .pagination { --bs-pagination-padding-y: .18rem; --bs-pagination-padding-x: .5rem; --bs-pagination-font-size: .78rem; }
#main .tp-pager .page-link { min-width: 1.9rem; text-align: center; }
@media print { #main .tp-pager { display: none !important; } #main .tp-hidden { display: table-row !important; } }

/* Page links never spill under neighbouring panels: wrap onto a second line instead */
#main .pagination { flex-wrap: wrap; row-gap: 4px; }
