/* ============================================================
   SNIPPET-ATTEMPT.CSS — the SQL answer boxes
   ------------------------------------------------------------
   Only the editor region. Everything else on this screen is the practice
   layout's own CSS, reused as-is.
   ============================================================ */

.sqa-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.9rem 1rem 2rem;
  background: var(--editor-bg, #0d1117);
}

.sqa-scroll.hidden { display: none; }

/* ── One test case ─────────────────────────────────────────── */

.sqa-case + .sqa-case { margin-top: 1.1rem; }

.sqa-case-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.sqa-case-head {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #e6edf3;
}

/* Dim until the case is hovered — one per box would otherwise put a row of
   identical icons down the page competing with the questions. */
.sqa-expand {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #6e7681;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.sqa-expand svg { width: 13px; height: 13px; }
.sqa-case:hover .sqa-expand,
.sqa-expand:focus-visible { opacity: 1; }
.sqa-expand:hover {
  color: #e6edf3;
  background: rgba(255, 255, 255, 0.06);
  border-color: #30363d;
}

.sqa-case-prompt {
  margin: 0 0 0.45rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #8b949e;
}

/* The box itself: a gutter and the code, sharing one border. */
.sqa-box {
  display: flex;
  align-items: stretch;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.sqa-box:focus-within { border-color: var(--color-primary); }

/* Numbers for every line, so an answer that runs to several is still readable
   as a statement rather than a paragraph. */
.sqa-lines {
  --sqa-mark-tri: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M3.4 3.6 L9.1 7 L3.4 10.4 Z' fill='%23fff' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E");
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.5rem 0.5rem 0.65rem;
  background: #0d1117;
  border-right: 1px solid #21262d;
  user-select: none;
  min-width: 3rem;
}

/* A row per line: a marker column on the left, the digit on the right. The
   editor's gutter is built the same way, so the two read as one control. */
.sqa-line-num {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: #484f58;
  cursor: pointer;
  border-radius: 2px;
  transition: color 0.14s ease, background-color 0.14s ease;
}

.sqa-line-num:hover { color: #8b949e; }

.sqa-line-num.marked {
  color: #7fe6f5;
  background: rgba(34, 211, 238, 0.09);
}

.sqa-mark-col {
  position: relative;
  flex: 0 0 auto;
  width: 10px;
  height: 1.55em;
}

.sqa-ln-no { flex: 1 1 auto; text-align: right; }

/* The same triangle the code editor marks a line with, so the gesture reads as
   the one students already know. */
.sqa-line-mark,
.sqa-line-num:hover .sqa-mark-col::before {
  position: absolute;
  left: 0;
  top: 50%;
  width: 9px;
  height: 10.5px;
  transform: translateY(-50%);
  -webkit-mask: var(--sqa-mark-tri) no-repeat center / contain;
  mask: var(--sqa-mark-tri) no-repeat center / contain;
  pointer-events: none;
}

.sqa-line-mark {
  background: linear-gradient(135deg, #d8fdff 0%, #5ce7f7 30%, #16b6d8 60%, #06718c 100%);
  filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.55));
}

/* Ghost on hover, previewing where a mark would land. */
.sqa-line-num:hover .sqa-mark-col::before {
  content: '';
  background: #22d3ee;
  opacity: 0.3;
}
.sqa-line-num.marked:hover .sqa-mark-col::before { content: none; }

/* The code column. The highlighted <pre> and the transparent <textarea> are
   stacked and must agree on every metric, or the caret drifts from the glyphs.
   Same trick the main editor uses. */
.sqa-code-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.sqa-pre,
.sqa-ta {
  margin: 0;
  padding: 0.5rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.55;
  white-space: pre;
  overflow-wrap: normal;
  tab-size: 2;
  border: none;
}

.sqa-pre {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  color: #c9d1d9;
}

.sqa-ta {
  position: relative;
  display: block;
  width: 100%;
  background: transparent;
  /* Transparent text over the highlighted copy beneath; the caret stays. */
  color: transparent;
  caret-color: #58a6ff;
  resize: none;
  outline: none;
  overflow-x: auto;
  overflow-y: hidden;
}

.sqa-ta::selection { background: rgba(88, 166, 255, 0.32); }
.sqa-ta::placeholder { color: #484f58; }

/* ── The dialect chip on the tab row ───────────────────────── */

.sqa-dialect {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  padding: 0.2rem 0.55rem;
  border: 1px solid #21262d;
  border-radius: var(--radius-full, 999px);
  background: #0d1117;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #8b949e;
  flex-shrink: 0;
}

.sqa-dialect svg { width: 12px; height: 12px; color: var(--color-primary); }

/* ── File tabs ─────────────────────────────────────────────
   The bar and the tabs are the coding attempt's own .file-tab-bar/.file-tab
   (css/layout.css). Only the lock badge is added here. */

.sqa-tab-lock {
  width: 11px;
  height: 11px;
  color: var(--color-warning);
  flex-shrink: 0;
}

/* ── The read-only schema tab ──────────────────────────────── */

.sqa-init-pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #c9d1d9;
  white-space: pre;
  overflow-x: auto;
}

/* ── Run Code, locked ──────────────────────────────────────── */

/* Kept in place and legible rather than dimmed to nothing: it has to read as
   "not yet", not as a broken button. */
.pp-runcode-btn.is-unavailable {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.pp-runcode-btn.is-unavailable:hover { opacity: 0.7; }

/* ── Authoring the set, in the snippets admin ──────────────── */

.sqladm-top {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.sqladm-top > div:first-child { flex: 0 0 150px; }

.sqladm-num {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.sqladm-case + .sqladm-case { margin-top: 0.6rem; }

.sqladm-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.4rem 1rem;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  text-align: center;
}

.sqladm-empty svg { width: 22px; height: 22px; opacity: 0.6; }
.sqladm-empty p { margin: 0; font-size: 0.8125rem; }

@media (max-width: 720px) {
  .sqladm-top { flex-direction: column; }
  .sqladm-top > div:first-child { flex: 1 1 auto; width: 100%; }
}

/* ── One answer, full screen ──────────────────────────────── */

.sqa-expand-modal {
  width: min(1000px, 94vw);
  max-width: min(1000px, 94vw);
  height: min(80vh, 780px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.3rem 1.3rem;
  text-align: left;
}

.sqa-expand-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.sqa-expand-title h2 {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 1rem;
}

.sqa-expand-title p {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-tertiary);
}

/* The box is the same element, moved — it just fills the overlay while here. */
.sqa-expand-slot {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: auto;
}

.sqa-box.is-expanded {
  flex: 1 1 auto;
  align-items: flex-start;
}

.sqa-box.is-expanded .sqa-ta,
.sqa-box.is-expanded .sqa-pre { font-size: 0.875rem; }

/* The language note and the comparison note under the case fields. */
.sqladm-hint {
  margin: 0.3rem 0 0;
  font-size: 0.7rem;
  line-height: 1.45;
  color: var(--text-tertiary);
}

/* Left/right, because the cases run along a tab strip rather than down a list. */
.af-move button svg { width: 11px; height: 11px; }

/* A case the attempt will skip. Amber rather than red: it is unfinished work,
   not an error. */
.sqladm-warn {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0;
  padding: 0.5rem 0.6rem;
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.08);
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.sqladm-warn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--color-warning);
}

/* ============================================================
   SNIPPET ANALYTICS
   ============================================================ */

.an-sn-page {
  height: 100%;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 3rem;
}

.an-sn-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.an-sn-body { display: flex; flex-direction: column; gap: 1rem; }

/* ── The four leading numbers ─────────────────────────────── */

.an-sn-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
}

.an-sn-tile {
  position: relative;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  overflow: hidden;
}

/* A tone strip rather than a coloured card: four saturated tiles in a row
   compete with each other and with the panels underneath. */
.an-sn-tile::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--text-tertiary);
  opacity: 0.5;
}
.an-sn-tile.good::before { background: var(--color-success); opacity: 1; }
.an-sn-tile.mid::before  { background: var(--color-primary); opacity: 1; }
.an-sn-tile.low::before  { background: var(--color-danger);  opacity: 1; }
.an-sn-tile.warn::before { background: var(--color-warning); opacity: 1; }

.an-sn-tile > svg {
  width: 15px;
  height: 15px;
  color: var(--text-tertiary);
  margin-bottom: 0.35rem;
}

.an-sn-tile-v { font-size: 1.65rem; font-weight: 800; line-height: 1.1; color: var(--text-primary); }
.an-sn-tile-l { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-secondary); margin-top: 0.15rem; }
.an-sn-tile-s { font-size: 0.7rem; color: var(--text-tertiary); margin-top: 0.15rem; }

/* ── Panels ───────────────────────────────────────────────── */

.an-sn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.an-sn-card {
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

.an-sn-card h3 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.3rem;
  padding: 0;
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.an-sn-card h3 svg { width: 15px; height: 15px; color: var(--color-accent); }

.an-sn-note { margin: 0 0 0.7rem; font-size: 0.75rem; line-height: 1.5; color: var(--text-tertiary); }
.an-sn-legend { margin: 0.55rem 0 0; font-size: 0.68rem; color: var(--text-tertiary); }

/* ── Language rows ────────────────────────────────────────── */

.an-sn-rows { display: flex; flex-direction: column; gap: 0.4rem; }

.an-sn-row {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) 2fr auto auto;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
}

.an-sn-row-k { font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-sn-row-v { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.an-sn-row-x { color: var(--text-tertiary); font-variant-numeric: tabular-nums; min-width: 2.6rem; text-align: right; }

.an-sn-bar {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-surface-hover);
  overflow: hidden;
}
.an-sn-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}

/* ── The two modes ────────────────────────────────────────── */

.an-sn-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }

.an-sn-mode {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface-hover);
}

.an-sn-mode-h { display: flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }
.an-sn-mode-h svg { width: 13px; height: 13px; }
.an-sn-mode-v { font-size: 1.4rem; font-weight: 800; margin-top: 0.3rem; color: var(--text-primary); }
.an-sn-mode-s { font-size: 0.7rem; color: var(--text-tertiary); }
.an-sn-mode-u { font-size: 0.66rem; color: var(--text-tertiary); font-style: italic; margin-top: 0.2rem; }
.an-sn-mode-none { font-size: 0.78rem; color: var(--text-tertiary); margin-top: 0.5rem; }

/* ── Lists ────────────────────────────────────────────────── */

.an-sn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }

.an-sn-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-hover);
  font-size: 0.78rem;
}

.an-sn-list-links li { cursor: pointer; align-items: center; justify-content: space-between; transition: background 0.15s ease; }
.an-sn-list-links li:hover { background: var(--color-primary-subtle); }
.an-sn-list-links svg { width: 13px; height: 13px; color: var(--text-tertiary); flex-shrink: 0; }

.an-sn-list-t { flex: 1; min-width: 0; line-height: 1.4; color: var(--text-primary); }
.an-sn-list-t em { display: block; font-style: normal; font-size: 0.68rem; color: var(--text-tertiary); margin-top: 0.1rem; }

.an-sn-miss {
  flex-shrink: 0;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
  font-size: 0.68rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ── The log ──────────────────────────────────────────────── */

.an-sn-wide { grid-column: 1 / -1; }

.an-sn-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.an-sn-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-color);
}
.an-sn-table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--border-color-subtle, var(--border-color)); color: var(--text-secondary); }
.an-sn-table tr:last-child td { border-bottom: none; }
.an-sn-table td.ok { color: var(--color-success); font-weight: 700; }
.an-sn-table td.mid { color: var(--color-warning); font-weight: 700; }
.an-sn-table td.bad { color: var(--color-danger); font-weight: 700; }
.an-sn-sub { color: var(--text-tertiary); font-weight: 400; }

.an-sn-chip {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-hover);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}
.an-sn-chip.sql { border-color: rgba(6, 182, 212, 0.4); color: var(--color-accent); }

/* ── Nothing to show ──────────────────────────────────────── */

.an-sn-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 3rem 1rem;
  color: var(--text-tertiary);
  text-align: center;
}
.an-sn-empty svg { width: 28px; height: 28px; opacity: 0.55; }
.an-sn-empty h4 { margin: 0; font-size: 0.95rem; color: var(--text-secondary); }
.an-sn-empty p { margin: 0; font-size: 0.8125rem; max-width: 34ch; }

@media (max-width: 640px) {
  .an-sn-modes { grid-template-columns: 1fr; }
  .an-sn-page { padding: 1rem 0.9rem 2.5rem; }
}
