/* =========================================================
   PARAMETERS THEME
   ---------------------------------------------------------
   Adapted from stylesSupplies.css
   Grid-safe, no layout assumptions
   ========================================================= */

/* ---------------------------------------------------------
   Theme palette
   --------------------------------------------------------- */
:root {
  --parameters-bg: #f7f9ff;
  --parameters-border: #cfd6f3;
  --parameters-hover: #eef1ff;
  --parameters-active: #e3e8ff;
  --parameters-text: #222;
}

/* ---------------------------------------------------------
   Section background & anchor
   --------------------------------------------------------- */
.theme-parameters {
  background: var(--parameters-bg);
  color: var(--parameters-text);
}

/* ---------------------------------------------------------
   Full-width layout rows (GRID OVERRIDE)
   --------------------------------------------------------- */
.theme-parameters .section-body > .input-row,
.theme-parameters .section-body > .action-row,
.theme-parameters .section-body > .table-wrap {
  grid-column: 1 / -1;
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */
.theme-parameters .section-header {
  border-bottom: 1px solid var(--parameters-border);

  /* 🔑 spacing fix: separates header from first field */
  margin-bottom: 18px;
}

.theme-parameters .section-header h2 {
  margin: 0;
}

/* Optional: tiny separation between title and back button */
.theme-parameters .section-actions {
  margin-top: 6px;
}

/* ---------------------------------------------------------
   Input rows (base contract)
   label + ONE field OR label + field-group
   --------------------------------------------------------- */
.theme-parameters .input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.theme-parameters .input-row label {
  flex: 0 0 140px;
  font-weight: 500;
}

/* Single-control rows (Key, Type, etc.) */
.theme-parameters .input-row input,
.theme-parameters .input-row select {
  flex: 1 1 auto;
  max-width: 320px;
}

/* ---------------------------------------------------------
   Field group (input + button, future dropdowns, etc.)
   --------------------------------------------------------- */
.theme-parameters .input-field-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0; /* critical for flex shrink */
}

.theme-parameters .input-field-group input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.theme-parameters .input-field-group button {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Limit Expression field width */
.theme-parameters #inpParamExpr {
  flex: 0 1 60%;
}

/* ---------------------------------------------------------
   Description textarea
   --------------------------------------------------------- */
.theme-parameters .input-row textarea#inpParamDescription {
  flex: 1 1 auto;
  max-width: 700px;
  resize: vertical;
}

/* ---------------------------------------------------------
   Action buttons
   --------------------------------------------------------- */
.theme-parameters .action-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--parameters-border);
}

.theme-parameters .action-row button {
  white-space: nowrap;
}

/* ---------------------------------------------------------
   Parameters table – scroll body with frozen header
   --------------------------------------------------------- */
.theme-parameters #parametersTableWrap {
  max-height: 420px; /* tweak as desired */
  overflow-y: auto;
  border: 1px solid var(--parameters-border);
  margin-top: 12px;
}

.theme-parameters .parameters-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--parameters-hover);
}

/* ---------------------------------------------------------
   Parameters table – scroll both directions with frozen header
   --------------------------------------------------------- */
.theme-parameters #parametersTableWrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--parameters-border);
  margin-top: 12px;
}

.theme-parameters .parameters-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--parameters-hover);
}

.theme-parameters .parameters-table th,
.theme-parameters .parameters-table td {
  white-space: nowrap;
}
/* ---------------------------------------------------------
   Freeze first column (Key)
   --------------------------------------------------------- */

/* Header cell in first column */
.theme-parameters .parameters-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 3; /* above other header cells */
  background: var(--parameters-hover);
}

/* Body cells in first column */
.theme-parameters .parameters-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1; /* above other body cells */
  background: #fff; /* MUST be opaque */
}

/* Optional: subtle divider so it feels intentional */
.theme-parameters .parameters-table th:first-child,
.theme-parameters .parameters-table td:first-child {
  box-shadow: 2px 0 0 rgba(0, 0, 0, 0.08);
}
/* ---------------------------------------------------------
   Parameters table – enforce left alignment everywhere
   --------------------------------------------------------- */
.theme-parameters .parameters-table th,
.theme-parameters .parameters-table td {
  text-align: left;
}
.theme-parameters .parameters-table td.expression {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ---------------------------------------------------------
   Preserve row-selected highlight with sticky first column
   --------------------------------------------------------- */
.theme-parameters .parameters-table tbody tr.row-selected td {
  background: #fff6cc;
}

.theme-parameters .parameters-table tbody tr.row-selected:hover td {
  background: #ffefaa;
}

/* Ensure sticky first column respects selection */
.theme-parameters .parameters-table tbody tr.row-selected td:first-child {
  background: #fff6cc;
}

.theme-parameters .parameters-table tbody tr.row-selected:hover td:first-child {
  background: #ffefaa;
}
/* ----------------------------------------------------------------
  Padding
  ----------------------------------------------------------------- */
.theme-parameters .parameters-table th,
.theme-parameters .parameters-table td {
  padding: 4px 10px; /* vertical | horizontal */
}
