/* Table Simulator — JS-style layout */

.table-app {
  display: grid;
  grid-template-areas:
    "header header"
    "side center"
    "side code";
  grid-template-columns: 280px 1fr 320px;
  gap: 20px;
  min-height: calc(100vh - 120px);
}

.table-main {
  display: contents;
}

.table-side {
  grid-area: side;
  height: fit-content;
  position: sticky;
  top: 20px;
}

.table-center {
  grid-area: center;
}

.table-code {
  grid-area: code;
  height: fit-content;
  position: sticky;
  top: 20px;
}

.table-viz {
  min-height: 200px;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

table th,
table td {
  padding: 12px 16px;
  text-align: center;
  border: 1px solid var(--border-strong);
}

table th {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

table td {
  background: var(--surface-solid);
  color: var(--text);
}

table tr:hover td {
  background: var(--bg-page);
}

.code-box {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 1024px) {
  .table-app {
    grid-template-areas:
      "header"
      "side"
      "center"
      "code";
    grid-template-columns: 1fr;
  }
  
  .table-side,
  .table-center,
  .table-code {
    position: static;
  }
}