/* ============================================================
   EDITORUM MANAGE — TABLES
   Core table chrome, sticky columns, and row layout.
   Rich cell content lives in manage-table-content.css.
   ============================================================ */

/* ---- TABLES ---- */
.table {
  background: var(--ed-white);
  border-collapse: separate;
  border-radius: var(--ed-radius);
  border-spacing: 0;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.06);
  font-family: var(--ed-font);
  font-size: 13px;
  white-space: normal;
  width: 100%;
}

.table > tbody > tr > th,
.table > tbody > tr.bigTr > th,
.table th,
.bigTr th,
.colorTr th {
  background: var(--ed-bg);
  border-top: 1px solid var(--ed-border);
  border-bottom: 1px solid var(--ed-border);
  border-right: 1px solid var(--ed-border);
  color: var(--ed-muted);
  font-family: var(--ed-font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
  padding: 10px 12px;
  text-align: left;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

.table th.text-center,
.bigTr th.text-center,
.colorTr th.text-center {
  text-align: center;
}

/* Bootstrap's `.table > thead > tr > th` rule is more specific than the
   shared admin header styles above, so list-page headers can collapse back
   to tighter default padding and line-height. Re-assert the intended header
   spacing on the actual thead cells so sticky headers don't look clipped. */
.table > thead > tr > th,
.table > thead > tr > td {
  line-height: 1.4;
  padding: 10px 12px;
  vertical-align: middle;
}

th a.sortable,
th a.asc,
th a.desc,
.bigTr th a,
.scrollable-table-thead th a {
  color: inherit;
  display: inline-block;
  line-height: inherit;
  text-decoration: none;
  vertical-align: middle;
}

.table > thead > tr > th > span,
.scrollable-table-thead th > span {
  align-items: center;
  display: inline-flex;
  line-height: inherit;
  min-height: 16px;
}

.table > tbody > tr > td,
.table td {
  background: var(--ed-white);
  border-bottom: 1px solid var(--ed-border);
  border-right: 1px solid var(--ed-border);
  color: var(--ed-body);
  font-family: var(--ed-font);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  white-space: normal;
}

.table > tbody > tr > th:last-child,
.table > tbody > tr > td:last-child,
.table > thead > tr > th:last-child {
  border-right: none;
}

/* Keep the divider on sticky column edges so it stays visible while the
   neighboring scrollable column moves underneath the sticky overlay. */
.table-scroll-wrapper .table:not(.no-sticky-cols) > tbody > tr:not(.collapse) > th:first-child,
.table-scroll-wrapper .table:not(.no-sticky-cols) > tbody > tr:not(.collapse) > td:first-child,
.table-scroll-wrapper .table:not(.no-sticky-cols) > thead > tr > th:first-child {
  border-right: 1px solid var(--ed-border);
}

.table-scroll-wrapper .table:not(.no-sticky-cols) > tbody > tr:not(.collapse) > th:nth-last-child(2),
.table-scroll-wrapper .table:not(.no-sticky-cols) > tbody > tr:not(.collapse) > td:nth-last-child(2),
.table-scroll-wrapper .table:not(.no-sticky-cols) > thead > tr > th:nth-last-child(2) {
  border-right: none;
}

.table-scroll-wrapper .table:not(.no-sticky-cols) > tbody > tr:not(.collapse) > th:last-child:not(:first-child),
.table-scroll-wrapper .table:not(.no-sticky-cols) > tbody > tr:not(.collapse) > td:last-child:not(:first-child),
.table-scroll-wrapper .table:not(.no-sticky-cols) > thead > tr > th:last-child:not(:first-child) {
  border-left: 1px solid var(--ed-border);
}

.table > tbody > tr:last-child > td {
  border-bottom: 0;
}

.table > tbody > tr:hover > td {
  background: #f0f9ff;
}

/* ---- INLINE EDITABLE FIELDS ---- */
.table .editable-table-link,
.table .editable-table-link.editable-click,
.table button.editable-table-link,
.table button.editable-table-link.editable-click,
.table a.editable-table-link,
.table a.editable-table-link.editable-click,
.table a.editable-table-link:hover,
.table a.editable-table-link.editable-click:hover {
  align-items: center;
  appearance: none;
  background: none;
  border-bottom: none !important;
  border: 0;
  border-radius: 3px;
  color: var(--ed-body, #334155) !important;
  cursor: text;
  display: inline-flex;
  font: inherit;
  gap: 6px;
  overflow-wrap: anywhere;
  padding: 0;
  text-align: left;
  text-decoration: none;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
  vertical-align: middle;
}

.table .editable-table-link::after,
.table .editable-table-link.editable-click::after,
.table button.editable-table-link::after,
.table button.editable-table-link.editable-click::after,
.table a.editable-table-link::after,
.table a.editable-table-link.editable-click::after {
  background: center / 14px 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.121 2.121 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5z'/%3E%3C/svg%3E");
  content: "";
  flex: 0 0 14px;
  height: 14px;
  opacity: 0.72;
  transition: opacity 0.18s ease;
  width: 14px;
}

.table .editable-table-link:hover,
.table .editable-table-link:focus,
.table .editable-table-link.editable-click:hover,
.table .editable-table-link.editable-click:focus,
.table button.editable-table-link:hover,
.table button.editable-table-link:focus,
.table button.editable-table-link.editable-click:hover,
.table button.editable-table-link.editable-click:focus {
  background: rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
  color: var(--ed-body, #0f172a) !important;
  text-decoration: none;
}

.table .editable-table-link:hover::after,
.table .editable-table-link:focus::after,
.table .editable-table-link.editable-click:hover::after,
.table .editable-table-link.editable-click:focus::after,
.table button.editable-table-link:hover::after,
.table button.editable-table-link:focus::after,
.table button.editable-table-link.editable-click:hover::after,
.table button.editable-table-link.editable-click:focus::after {
  opacity: 1;
}

.table .editable-table-link:focus-visible,
.table button.editable-table-link:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.28);
  outline-offset: 2px;
}

.table .editable-table-link.editable-disabled,
.table button.editable-table-link.editable-disabled,
.table a.editable-table-link.editable-disabled,
.table a.editable-table-link.editable-disabled:hover {
  background: transparent;
  border-bottom: none !important;
  box-shadow: none;
  color: var(--ed-muted) !important;
  cursor: default;
}

.table .editable-table-link.editable-disabled::after,
.table button.editable-table-link.editable-disabled::after,
.table a.editable-table-link.editable-disabled::after,
.table a.editable-table-link.editable-disabled:hover::after {
  opacity: 0.35;
}

.table .editable-table-link.editable-empty,
.table .editable-table-link.editable-empty:hover,
.table .editable-table-link.editable-empty:focus,
.table button.editable-table-link.editable-empty,
.table button.editable-table-link.editable-empty:hover,
.table button.editable-table-link.editable-empty:focus {
  color: #b54708 !important;
}

.table .workspace-badge-toggle {
  margin: 0;
}

.table td > .workspace-badge-toggle,
.table td > .js-archive.workspace-badge-toggle {
  max-width: 100%;
}

.table th.status-column,
.table td.status-column {
  text-align: center;
}

.table td.status-column > .workspace-badge-toggle {
  margin-left: auto;
  margin-right: auto;
}

.table .editable-container,
.table .editableform,
.table .editable-input,
.table .editable-input .form-control {
  max-width: 100%;
}

.table .editable-inline,
.table .editableform,
.table .editableform .control-group,
.table .editableform .control-group > div:first-child {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 0;
  width: 100%;
}

.table .editable-inline,
.table .editableform {
  margin: -4px 0;
}

.table .editable-container.editable-inline {
  display: block;
  max-width: none;
  width: 100%;
}

.table .editable-input {
  flex: 1 1 auto;
  margin-bottom: 0;
  max-width: none;
  min-width: 0;
  position: relative;
}

.table .editable-input input,
.table .editable-input textarea,
.table .editable-input select,
.table .editable-input .form-control {
  background: var(--ds-color-white, #fff);
  border: 1px solid var(--ds-color-border-strong, #d1d5db) !important;
  border-radius: var(--ds-radius-md, 6px) !important;
  box-shadow: none !important;
  color: var(--ds-color-heading, #111827);
  font-family: var(--ed-font);
  font-size: 13px !important;
  height: 28px !important;
  line-height: 20px !important;
  min-height: 28px !important;
  padding: 3px 10px !important;
  transition:
    border-color var(--ds-transition-fast, 0.15s ease),
    box-shadow var(--ds-transition-fast, 0.15s ease);
  width: 100%;
}

.table .editable-input input:focus,
.table .editable-input textarea:focus,
.table .editable-input select:focus,
.table .editable-input .form-control:focus {
  border-color: var(--ds-color-link, #1a56db) !important;
  box-shadow: var(--ds-focus-ring, 0 0 0 2px rgba(26, 86, 219, 0.15)) !important;
  outline: 0;
}

.table .editable-clear-x {
  background: center / 12px 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M2.5 2.5 9.5 9.5'/%3E%3Cpath d='M9.5 2.5 2.5 9.5'/%3E%3C/svg%3E") !important;
  border-radius: 999px;
  height: 16px !important;
  margin-top: 0;
  opacity: 1;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%);
  transition:
    background-color var(--ds-transition-fast, 0.15s ease),
    box-shadow var(--ds-transition-fast, 0.15s ease);
  width: 16px !important;
}

.table .editable-clear-x:hover,
.table .editable-clear-x:focus {
  background-color: var(--ds-color-bg, #f9fafb);
  box-shadow: var(--ds-focus-ring, 0 0 0 2px rgba(26, 86, 219, 0.15));
  outline: 0;
}

.table .editable-buttons {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  margin-left: 0;
  white-space: nowrap;
}

.table .editable-submit,
.table .editable-cancel {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-btn, 5px);
  display: inline-flex;
  font-size: 0;
  font-weight: 500;
  height: 28px;
  justify-content: center;
  line-height: 1;
  min-height: 28px;
  overflow: hidden;
  padding: 0;
  position: relative;
  text-indent: -9999px;
  transition:
    background-color var(--ds-transition-fast, 0.15s ease),
    border-color var(--ds-transition-fast, 0.15s ease),
    box-shadow var(--ds-transition-fast, 0.15s ease),
    color var(--ds-transition-fast, 0.15s ease);
  width: 28px;
}

.table .editable-submit {
  background: var(--ds-color-link, #1a56db);
  border-color: var(--ds-color-link, #1a56db);
  color: var(--ds-color-white, #fff);
}

.table .editable-submit:hover,
.table .editable-submit:focus {
  background: var(--ds-color-link-hover, #1e429f);
  border-color: var(--ds-color-link-hover, #1e429f);
  box-shadow: var(--ds-focus-ring, 0 0 0 2px rgba(26, 86, 219, 0.15));
  color: var(--ds-color-white, #fff);
  outline: 0;
}

.table .editable-cancel {
  background: var(--ds-color-white, #fff);
  border-color: var(--ds-color-border-strong, #d1d5db);
  color: var(--ds-color-body, #374151);
}

.table .editable-cancel:hover,
.table .editable-cancel:focus {
  background: var(--ds-color-bg, #f9fafb);
  border-color: var(--ds-color-border-strong, #d1d5db);
  box-shadow: var(--ds-focus-ring, 0 0 0 2px rgba(26, 86, 219, 0.15));
  color: var(--ds-color-heading, #111827);
  outline: 0;
}

.table .editable-submit::before,
.table .editable-cancel::before {
  background-position: center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
  content: "";
  display: block;
  height: 14px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
}

.table .editable-submit > *,
.table .editable-cancel > * {
  display: none !important;
}

.table .editable-submit::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.table .editable-cancel::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E");
}

.table .editable-error-block {
  color: var(--ds-color-danger, #dc2626);
  font-size: 12px;
  line-height: 1.4;
  margin: 4px 0 0;
}

/* Neutralize legacy bg-smuth/tablesorter striping inside the refactored
   scrollable shell until the shared Twig markup can drop those legacy classes. */
.scrollable-table-body .table.bg-smuth,
.scrollable-table-body .table.bg-smuth.tablesorter-default {
  background: var(--ed-white) !important;
}

.scrollable-table-body .table.bg-smuth > tbody > tr > td,
.scrollable-table-body .table.tablesorter-default > tbody > tr > td,
.scrollable-table-body .table.tablesorter-default > tbody > tr.odd > td,
.scrollable-table-body .table.tablesorter-default > tbody > tr.even > td,
.scrollable-table-body .table.tablesorter-default > tbody > tr > td.primary,
.scrollable-table-body .table.tablesorter-default > tbody > tr > td.secondary,
.scrollable-table-body .table.tablesorter-default > tbody > tr > td.tertiary {
  background: var(--ed-white) !important;
  color: var(--ed-body) !important;
}

.scrollable-table-body .table.tablesorter-default > tbody > tr:hover > td,
.scrollable-table-body .table.bg-smuth > tbody > tr:hover > td {
  background: #f0f9ff !important;
  color: var(--ed-body) !important;
}

/* `no-sticky-cols` disables horizontal sticky edge columns for body cells,
   but its edge reset must not break vertical sticky table headers. */
.scrollable-table-body .table.no-sticky-cols > thead.scrollable-table-thead > tr > th,
.scrollable-table-body .table.no-sticky-cols > thead.scrollable-table-thead > tr > th:first-child,
.scrollable-table-body .table.no-sticky-cols > thead.scrollable-table-thead > tr > th:last-child {
  left: auto !important;
  position: sticky !important;
  right: auto !important;
  top: 0 !important;
  z-index: 7 !important;
}

/* ---- TABLE: allow text wrap in headers ---- */
.table > tbody > tr > th,
.table th {
  white-space: normal;
}

.table > tbody > tr > th.request-actions-header,
.table th.request-actions-header,
.bigTr th.request-actions-header,
.table th.list-action-column-header,
.scrollable-table-body .scrollable-table-thead th.request-actions-header {
  text-align: center;
  min-width: 104px;
}

.scrollable-table-body .table:not(.no-sticky-cols) > thead.scrollable-table-thead > tr > th:first-child,
.scrollable-table-body .table:not(.no-sticky-cols) > thead.scrollable-table-thead > tr > th:last-child {
  background: var(--ed-bg) !important;
  background-clip: padding-box !important;
  z-index: 10 !important;
}

.scrollable-table-body .table > tbody > tr:has(.btn-group.open),
.scrollable-table-body .table > tbody > tr:has(.admin-list-action-menu-group.open) {
  position: relative;
  z-index: 14;
}

/* ---- COLUMN VISIBILITY ---- */
th[data-col-hidden="true"],
td[data-col-hidden="true"] {
  display: none;
}

@media (max-width: 768px) {
  .table > tbody > tr > th,
  .table > tbody > tr > td,
  .table th,
  .table td {
    padding: 10px 8px;
  }
}
