/* Sleek style */
:root {
  --radius: 10px;
  --border: 2px;
  --bg: #fff;
  --fg: #1f2328;
  --muted: #6a737d;
  --line: #eee;
  --accent: #3267e3;
  --hover: #f6f8fa;
  --row-hover: #f3f6ff;
  --selected: #e8f0ff;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.06);
  --cell-py: 5px;
  --cell-px: 12px;
  --font: system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Container */
.groggy-display-container {
  font-family: var(--mono);
  background: var(--bg);
  color: var(--fg);
  border: var(--border) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid #ccc;
}

/* Table */
.groggy-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  line-height: 1.4;
  background-color: #f8f9fa;
  min-width: fit-content;
}
.groggy-table th,
.groggy-table td {
  padding: var(--cell-py) var(--cell-px);
  border-right: var(--border) solid var(--line);
  border-bottom: var(--border) solid var(--line);
}
.groggy-table th:last-child,
.groggy-table td:last-child {
  border-right: none;
}

/* Sticky header */
.groggy-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fafafa;
  font-weight: 600;
  text-align: left;
  color: var(--fg);
}
.groggy-table thead th:first-child { border-top-left-radius: var(--radius); }
.groggy-table thead th:last-child  { border-top-right-radius: var(--radius); }

/* Rounded corners bottom */
.groggy-table tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
.groggy-table tbody tr:last-child td:last-child  { border-bottom-right-radius: var(--radius); }

/* Zebra striping + hover */
.groggy-table tbody tr:nth-child(even) td { background: #f9f9f9; }
.groggy-table tbody tr:hover td { background: var(--row-hover); }

/* Selection state */
.groggy-table tbody tr.is-selected td {
  background: var(--selected) !important;
}
.groggy-table tbody tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Column hover highlight (set via JS with --col) */
.groggy-table td:nth-child(var(--col)),
.groggy-table th:nth-child(var(--col)) {
  background: var(--hover);
}

/* Cell types */
.cell-num    { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.cell-bool   { text-align: center; }
.cell-str,
.cell-time   { text-align: left; }
.cell-ellipsis {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive hiding by priority */
@media (max-width: 820px) { [data-col-priority="low"] { display:none; } }
@media (max-width: 560px) { [data-col-priority="med"] { display:none; } }

/* Focus ring */
.groggy-table:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Transitions */
.groggy-table th,
.groggy-table td,
.groggy-table tbody tr {
  transition: background-color .18s ease, box-shadow .18s ease;
}

/* Table info section */
.groggy-display-container .table-info {
    margin-top: 0px;
    padding: 5px 12px 3px;
    border-radius: 4px;
    font-size: 12px;
    color: #6c757d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
}

.table-info .interactive-btn {
    background-color: #eee;
    color: #bbb;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: none;
}

.table-info .interactive-btn:hover {
    background-color: #0056b3;
}


/* Accessibility improvements */
.groggy-table:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.groggy-table th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Truncated content indicator */
.cell-truncated::after {
    content: "…";
    color: #6c757d;
    font-weight: normal;
}