/* TansiJobs.Web/wwwroot/css/tansi-table.css
   Grid styling for the CRM Table View.

   Colours come from MudBlazor's own custom properties so the grid inherits light and dark
   themes for free. Note the spelling: Mud's variables use "gray", not "grey", and they fail
   SILENTLY when misspelled — a wrong name renders as transparent, not as an error. */

.tt {
  --tt-border: var(--mud-palette-lines-default, rgba(0, 0, 0, .12));
  --tt-head-bg: var(--mud-palette-background-gray, #f5f5f5);
  --tt-row-bg: var(--mud-palette-surface, #fff);
  --tt-alt-bg: var(--mud-palette-background-gray, #fafafa);
  --tt-text: var(--mud-palette-text-primary, #1f1f1f);
  --tt-muted: var(--mud-palette-text-secondary, #6b6b6b);
  --tt-accent: var(--mud-palette-primary, #0FA8D2);
  --tt-sel-bg: var(--mud-palette-action-default-hover, rgba(0, 0, 0, .04));

  position: relative;
  border: 1px solid var(--tt-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--tt-row-bg);
  color: var(--tt-text);
  font-size: 13px;
}

.tt-scroll {
  position: relative;
  overflow: auto;
  max-height: 70vh;
  outline: none;
}

.tt-scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--tt-accent); }

/* ── header ─────────────────────────────────────────────────────────────── */

.tt-head {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 36px;
  background: var(--tt-head-bg);
  border-bottom: 1px solid var(--tt-border);
}

.tt-hcell {
  position: absolute;
  top: 0;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  box-sizing: border-box;
  border-right: 1px solid var(--tt-border);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.tt-hcell.tt-gutter { z-index: 4; background: var(--tt-head-bg); justify-content: center; cursor: default; }
.tt-htxt { overflow: hidden; text-overflow: ellipsis; }
.tt-sortmark, .tt-fmark { color: var(--tt-accent); font-size: 11px; }

.tt-hmenu {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--tt-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.tt-hmenu:hover { background: var(--tt-sel-bg); color: var(--tt-text); }
.tt-hmenu:focus-visible { outline: 2px solid var(--tt-accent); outline-offset: 1px; }

.tt-resizer {
  position: absolute;
  right: -3px;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
}

/* ── body ───────────────────────────────────────────────────────────────── */

.tt-body { position: relative; }

.tt-row { position: absolute; left: 0; display: flex; background: var(--tt-row-bg); }
.tt-row.is-alt { background: var(--tt-alt-bg); }
.tt-row.is-sel { background: var(--tt-sel-bg); }

.tt-cell {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 8px;
  box-sizing: border-box;
  border-right: 1px solid var(--tt-border);
  border-bottom: 1px solid var(--tt-border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
}

.tt-cell.tt-gutter {
  position: sticky;
  left: 0;
  z-index: 2;
  background: inherit;
  gap: 6px;
  justify-content: flex-start;
}

.tt-cell.is-readonly { color: var(--tt-muted); background-image: linear-gradient(transparent, transparent); }
.tt-cell.in-range { background: var(--tt-sel-bg); }
.tt-cell.is-active { box-shadow: inset 0 0 0 2px var(--tt-accent); z-index: 1; }
.tt-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--tt-accent); }

.tt-cell a { color: var(--tt-accent); text-decoration: none; }
.tt-cell a:hover { text-decoration: underline; }

.tt-rownum { color: var(--tt-muted); font-variant-numeric: tabular-nums; font-size: 11px; }

.tt-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--tt-sel-bg);
  font-size: 11px;
  font-weight: 600;
}

/* ── groups ─────────────────────────────────────────────────────────────── */

.tt-grouprow {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  background: var(--tt-head-bg);
  border-bottom: 1px solid var(--tt-border);
  font-weight: 600;
}

.tt-glabel {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0 12px;
  min-width: 240px;
  text-align: left;
}
.tt-glabel:focus-visible { outline: 2px solid var(--tt-accent); outline-offset: -2px; }
.tt-gmeta { color: var(--tt-muted); font-weight: 400; }
.tt-gagg { padding: 0 8px; text-align: right; color: var(--tt-muted); font-weight: 400; box-sizing: border-box; }

/* ── editor ─────────────────────────────────────────────────────────────── */

.tt-editor {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: var(--tt-row-bg);
  color: inherit;
  font: inherit;
  outline: none;
}

.tt-editor-long { min-height: 60px; resize: vertical; padding: 4px 0; }

/* ── column menu ────────────────────────────────────────────────────────── */

.tt-menu {
  position: absolute;
  z-index: 1400;
  min-width: 190px;
  padding: 4px;
  border: 1px solid var(--tt-border);
  border-radius: 8px;
  background: var(--mud-palette-surface, #fff);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  display: flex;
  flex-direction: column;
}

.tt-menu button {
  border: 0;
  background: transparent;
  color: var(--mud-palette-text-primary, #1f1f1f);
  font: inherit;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.tt-menu button:hover { background: var(--mud-palette-action-default-hover, rgba(0, 0, 0, .06)); }
.tt-menu button:focus-visible { outline: 2px solid var(--tt-accent); outline-offset: -2px; }

/* ── utilities ──────────────────────────────────────────────────────────── */

/* Off-screen but still announced; visually-hidden must not be display:none. */
.tt-live {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tt-probe {
  position: absolute;
  visibility: hidden;
  white-space: nowrap;
  font-size: 13px;
  left: -9999px;
}

/* Phone width: the grid keeps its own horizontal scroll rather than forcing the page wide. */
@media (max-width: 600px) {
  .tt-scroll { max-height: 60vh; }
}

@media (prefers-reduced-motion: reduce) {
  .tt * { transition: none !important; animation: none !important; }
}
