/* ==========================================================================
   SPARQL Console & Syntax Highlighting
   ========================================================================== */

.sparql-grid {
  display: grid;
  grid-template-columns: 290px 1fr;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.sparql-sidebar {
  background: var(--md-surface);
  border-right: 1px solid var(--md-divider);
  padding: 18px;
  overflow-y: auto;
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.preset-card {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--md-divider);
  border-radius: 6px;
  background: #fafafa;
  font-family: inherit;
  color: var(--md-text);
  cursor: pointer;
}

.preset-card:hover {
  background: var(--md-primary-soft);
  border-color: var(--md-primary);
}

.preset-card strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2px;
}

.preset-card span {
  display: block;
  font-size: 0.8rem;
  color: var(--md-text-secondary);
}

.sparql-main {
  padding: 20px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.code-editor-wrap {
  position: relative;
  width: 100%;
  height: 420px;
  min-height: 360px;
  flex-shrink: 0;
  resize: vertical;
  border-radius: 6px;
  background: #212121;
  box-shadow: var(--md-elev-1);
  overflow: hidden;
}

.code-highlight,
#sparql-editor {
  margin: 0;
  padding: 16px 18px;
  width: 100%;
  height: 100%;
  min-height: 360px;
  font-family: "Roboto Mono", Consolas, Menlo, monospace;
  font-size: 0.94rem;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: auto;
  border: none;
}

.code-highlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: #f5f5f5;
  background: transparent;
}

#sparql-editor {
  position: relative;
  display: block;
  background: transparent;
  color: transparent;
  caret-color: #ff9800;
  resize: none;
}

#sparql-editor:focus {
  outline: none;
}

#sparql-editor::selection {
  background: rgba(255, 152, 0, 0.3);
}

.sp-kw  { color: #ffab40; font-weight: 500; }
.sp-var { color: #80d8ff; }
.sp-iri { color: #ffe57f; }
.sp-pfx { color: #a7ffeb; }
.sp-str { color: #ff8a80; }
.sp-num { color: #ea80fc; }
.sp-cmt { color: #9e9e9e; font-style: italic; }

.md-alert-error {
  padding: 12px 16px;
  border-radius: 4px;
  background: #ffebee;
  border-left: 4px solid #c62828;
  color: #b71c1c;
  font-size: 0.875rem;
}

/* ==========================================================================
   Material Data Tables & Pagination
   ========================================================================== */

.md-table-card {
  background: var(--md-surface);
  border-radius: var(--radius);
  box-shadow: var(--md-elev-1);
  flex-shrink: 0;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.md-table th,
.md-table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--md-divider);
  vertical-align: top;
}

.md-table th {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--md-text-secondary);
  background: #fafafa;
  white-space: nowrap;
}

.md-table tbody tr:hover {
  background: #fafafa;
}

.uri-pill {
  display: inline-block;
  font-family: "Roboto Mono", monospace;
  font-size: 0.78rem;
  color: var(--md-primary);
  background: var(--md-primary-soft);
  padding: 2px 8px;
  border-radius: 4px;
  text-decoration: none;
  word-break: break-all;
}

.uri-pill:hover {
  text-decoration: underline;
}

.md-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: #fafafa;
  border-top: 1px solid var(--md-divider);
  font-size: 0.9rem;
  color: var(--md-text-secondary);
  flex-wrap: wrap;
}

.md-pager-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.md-pager-page {
  font-weight: 500;
  color: var(--md-text);
  padding: 0 6px;
}
