/**
 * Стили таблиц (tables & rows)
 * Файл: public/css/tables.css
 */

.orders-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
}

.orders-table thead th {
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  position: sticky;
  top: 0;
  z-index: 10;
  user-select: none;
}
.orders-table thead th.sortable { cursor: pointer; }
.orders-table thead th.sortable:hover { color: var(--brand); }
.sort-arrow { opacity: 0.3; font-size: 10px; }
.orders-table thead th.sort-asc  .sort-arrow,
.orders-table thead th.sort-desc .sort-arrow { opacity: 1; color: var(--brand); }
 
.orders-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.orders-table tbody tr:hover    { background: var(--bg-hover); }
.orders-table tbody tr.selected { background: rgba(79, 142, 247, 0.07); }
 
.orders-table td {
  padding: 6px 4px;
  vertical-align: middle;
  color: var(--text-primary);
  font-size: 12px;
  min-width: 0;
  max-width: 0;
  overflow: hidden;
}

/* Overlay-select: не обрезать бейдж и нативный список по рамке ячейки */
.orders-table td.col-status,
.orders-table td.col-payment,
.orders-table td.col-source,
.orders-table td.col-delivery-method {
  overflow: visible;
}

.orders-table tbody tr:has(.table-select-wrap.is-open),
.orders-table tbody tr:has(.status-select-wrap:focus-within),
.orders-table tbody tr:has(.payment-select-wrap:focus-within),
.orders-table tbody tr:has(.source-select-wrap:focus-within),
.orders-table tbody tr:has(.delivery-select-wrap:focus-within) {
  position: relative;
  z-index: 22;
}

.orders-table thead th[class*="col-"] {
  min-width: 0;
}

/* Column widths — soft hints for table-layout:fixed (table always 100% of viewport) */
th.col-check        { width: 2.5%; }
th.col-id           { width: 3%; }
th.col-date         { width: 5.5%; }
th.col-client       { width: 6%; }
th.col-rating       { width: 4%; }
th.col-rcs          { width: 2.5%; }
th.col-phone        { width: 7%; }
th.col-items        { width: 7.5%; }
th.col-sum          { width: 4%; }
th.col-payment      { width: 5.5%; }
th.col-payment-status { width: 5%; }
th.col-delivery-method { width: 3%; }
th.col-delivery-addr { width: 11%; }
th.col-source       { width: 4.5%; }
td.col-source       { min-width: 0; }
th.col-status       { width: 5%; }
th.col-comment      { width: 5%; }
th.col-external-id  { width: 4.5%; }
.external-id-link {
  color: var(--text-link);
  text-decoration: none;
  font-weight: 500;
}
.external-id-link:hover { text-decoration: underline; }
th.col-delivery-cost{ width: 4%; }
th.col-profit       { width: 4%; }
th.col-commission   { width: 3.5%; }
th.col-discount     { width: 3.5%; }
th.col-expenses     { width: 4%; }
th.col-adv-campaign { width: 5%; }
th.col-actions      { width: 3.5%; }

/* Alignments (applied to both th and td) */
.col-check, .col-id, .col-rating, .col-rcs, .col-source, .col-status, .col-payment, .col-external-id, .col-payment-status, .col-delivery-method, .col-actions { text-align: center; }

/* Status Row Backgrounds */
.orders-table tbody tr.tr-status-new             { background-color: var(--status-new-bg); }
.orders-table tbody tr.tr-status-processing      { background-color: var(--status-proc-bg); }
.orders-table tbody tr.tr-status-to_ship         { background-color: var(--status-toship-bg); }
.orders-table tbody tr.tr-status-shipped         { background-color: var(--status-ship-bg); }
.orders-table tbody tr.tr-status-delivered       { background-color: var(--status-delivered-bg); }
.orders-table tbody tr.tr-status-issued          { background-color: var(--status-issued-bg); }
.orders-table tbody tr.tr-status-done            { background-color: var(--status-done-bg); }
.orders-table tbody tr.tr-status-refused         { background-color: var(--status-refused-bg); }
.orders-table tbody tr.tr-status-returned        { background-color: var(--status-returned-bg); }
.orders-table tbody tr.tr-status-security_cancel { background-color: var(--status-seccancel-bg); }
.orders-table tbody tr.tr-status-deleted         { background-color: var(--status-deleted-bg); }

/* Highlight row on hover with subtle overlay */
.orders-table tbody tr:hover {
  box-shadow: inset 0 0 100px rgba(255, 255, 255, 0.05) !important;
}
[data-theme="light"] .orders-table tbody tr:hover {
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.03) !important;
}

.orders-table th, .orders-table thead th {
  position: relative;
}
