/* Laboratorio SQL y PL/SQL (ASGBD) — usa las variables de color de styles.css (tema claro/oscuro) */
.sqll { --code-bg: #0f172a; --code-text: #e2e8f0; --code-gutter: #64748b; }
:root[data-theme="light"] .sqll { --code-bg: #f8fafc; --code-text: #0f172a; --code-gutter: #94a3b8; }

.sqll-header { align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.sqll-header-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.sqll-progress { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.sqll-bar { width: 120px; height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.sqll-bar > div { height: 100%; background: var(--success); transition: width 0.4s; }
.sqll-tabs { margin-bottom: 1rem; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 600px) { .sqll-tabs { grid-template-columns: repeat(2, 1fr); } }
.sqll-code, .sqll-editor, .sqll-out, .sqll-table-wrap, .sqll-side { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, 0.45) transparent; }

.sqll-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1rem; align-items: start; }
.sqll-exercise { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; min-width: 0; }
.sqll-console { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1rem; align-items: start; }
@media (max-width: 1280px) { .sqll-exercise { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .sqll-layout, .sqll-console { grid-template-columns: minmax(0, 1fr); }
  .sqll-side { max-height: 260px; overflow: auto; }
}

/* lateral */
.sqll-side { padding: 0.75rem; position: sticky; top: 0.5rem; max-height: calc(100vh - 140px); overflow: auto; }
.sqll-mod { border-bottom: 1px solid var(--border); padding: 0.35rem 0; }
.sqll-mod:last-child { border-bottom: 0; }
.sqll-mod summary { cursor: pointer; font-weight: 700; font-size: 0.86rem; display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.35rem 0.25rem; list-style: none; }
.sqll-mod summary::-webkit-details-marker { display: none; }
.sqll-mod-count { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; }
.sqll-side ol { list-style: none; padding: 0; margin: 0.2rem 0; }
.sqll-step { width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; font-size: 0.84rem; padding: 0.38rem 0.45rem; border-radius: 8px; cursor: pointer; display: flex; gap: 0.5rem; align-items: center; }
.sqll-step:hover { background: var(--bg-hover); }
.sqll-step.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.sqll-step-dot { flex: 0 0 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; color: #fff; }
.sqll-step.done .sqll-step-dot { background: var(--success); border-color: var(--success); }
.sqll-step-txt { flex: 1; min-width: 0; }
.sqll-level { font-size: 0.68rem; padding: 0.05rem 0.4rem; border-radius: 99px; background: var(--bg-hover); color: var(--text-muted); white-space: nowrap; }
.sqll-level-facil { background: var(--success-soft); color: var(--success); }
.sqll-level-medio { background: var(--warning-soft); color: var(--warning); }
.sqll-level-dificil { background: var(--danger-soft); color: var(--danger); }
.sqll-chips { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.sqll-chip { border: 1px solid var(--border); background: var(--bg-card); color: var(--text); border-radius: 99px; padding: 0.35rem 0.8rem; font: inherit; font-size: 0.82rem; cursor: pointer; }
.sqll-chip span { color: var(--text-muted); margin-left: 0.25rem; }
.sqll-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sqll-chip.active span { color: rgba(255, 255, 255, 0.85); }

/* lección */
.sqll-lesson { padding: 1.1rem 1.2rem; min-width: 0; }
.sqll-lesson-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sqll-done-badge { background: var(--success-soft); color: var(--success); font-weight: 700; font-size: 0.78rem; padding: 0.2rem 0.6rem; border-radius: 99px; }
.sqll-title { margin: 0.6rem 0 0.7rem; font-size: 1.2rem; }
.sqll-theory, .sqll-task { font-size: 0.92rem; line-height: 1.55; }
.sqll-theory p, .sqll-task p { margin: 0.45rem 0; }
.sqll-theory ul, .sqll-task ul, .sqll-help-list { margin: 0.4rem 0 0.4rem 1.2rem; }
.sqll-theory li, .sqll-help-list li { margin: 0.2rem 0; font-size: 0.9rem; }
.sqll code, .sqll-theory code { background: var(--bg-hover); border: 1px solid var(--border); border-radius: 5px; padding: 0.05rem 0.35rem; font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace; font-size: 0.85em; }
.sqll-task { margin-top: 0.9rem; padding: 0.8rem 0.9rem; border-left: 4px solid var(--primary); background: var(--primary-soft); border-radius: 8px; }
.sqll-task-label { font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 0.2rem 0 0.35rem; }
.sqll-tests { margin-top: 0.9rem; }
.sqll-tests ul { list-style: none; padding: 0; }
.sqll-test { display: flex; gap: 0.55rem; align-items: flex-start; font-size: 0.87rem; padding: 0.28rem 0; }
.sqll-test-ico { flex: 0 0 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; border: 2px solid var(--border); color: var(--text-muted); }
.sqll-test-ok .sqll-test-ico { background: var(--success); border-color: var(--success); color: #fff; }
.sqll-test-bad .sqll-test-ico { background: var(--danger); border-color: var(--danger); color: #fff; }
.sqll-test-ok { color: var(--text); }
.sqll-help-row, .sqll-nav-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.9rem; align-items: center; }
.sqll-nav-row { justify-content: space-between; border-top: 1px solid var(--border); padding-top: 0.8rem; }
.sqll-hint, .sqll-sol { margin-top: 0.7rem; padding: 0.7rem 0.8rem; border-radius: 8px; background: var(--warning-soft); font-size: 0.88rem; }
.sqll-sol { background: var(--bg-hover); }
.sqll-sol .btn { margin-top: 0.5rem; }

/* código y editor */
.sqll-code { background: var(--code-bg); color: var(--code-text); border-radius: 8px; padding: 0.7rem 0.85rem; font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace; font-size: 0.82rem; line-height: 1.5; overflow-x: auto; white-space: pre; margin: 0.5rem 0; border: 1px solid var(--border); }
.sqll-work { min-width: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.sqll-toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.sqll-toolbar kbd { font-size: 0.66rem; opacity: 0.75; margin-left: 0.3rem; font-family: inherit; border: 1px solid currentColor; border-radius: 4px; padding: 0 0.25rem; }
.sqll-spinner { font-size: 0.82rem; color: var(--text-muted); animation: sqllpulse 1s infinite; }
@keyframes sqllpulse { 50% { opacity: 0.4; } }
.sqll-select { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 0.35rem 0.5rem; font: inherit; font-size: 0.84rem; }
.sqll-editor { display: flex; background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; height: 340px; resize: vertical; min-height: 160px; }
.sqll-gutter { flex: 0 0 auto; padding: 0.75rem 0.45rem 0.75rem 0.6rem; text-align: right; color: var(--code-gutter); font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace; font-size: 0.85rem; line-height: 1.5; overflow: hidden; user-select: none; border-right: 1px solid rgba(148, 163, 184, 0.2); }
.sqll-gutter span { display: block; }
.sqll-edit-area { position: relative; flex: 1; min-width: 0; }
.sqll-hl, .sqll-ta { position: absolute; inset: 0; margin: 0; padding: 0.75rem 0.85rem; font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace; font-size: 0.85rem; line-height: 1.5; white-space: pre; overflow: auto; tab-size: 2; border: 0; }
.sqll-hl { color: var(--code-text); pointer-events: none; overflow: hidden; }
.sqll-ta { background: transparent; color: transparent; caret-color: var(--code-text); resize: none; outline: none; }
.sqll-ta::selection { background: rgba(59, 130, 246, 0.35); color: transparent; }
.hl-kw { color: #c084fc; font-weight: 600; }
.hl-type { color: #38bdf8; }
.hl-str { color: #86efac; }
.hl-num { color: #fbbf24; }
.hl-com { color: #64748b; font-style: italic; }
.hl-bind { color: #f472b6; font-weight: 600; }
.hl-fn { color: #fb923c; }
:root[data-theme="light"] .hl-kw { color: #7c3aed; }
:root[data-theme="light"] .hl-type { color: #0369a1; }
:root[data-theme="light"] .hl-str { color: #15803d; }
:root[data-theme="light"] .hl-num { color: #b45309; }
:root[data-theme="light"] .hl-bind { color: #be185d; }
:root[data-theme="light"] .hl-fn { color: #c2410c; }

/* resultados */
.sqll-results { display: flex; flex-direction: column; gap: 0.55rem; }
.sqll-results-title { font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.sqll-empty { color: var(--text-muted); font-size: 0.88rem; padding: 0.9rem; border: 1px dashed var(--border); border-radius: 10px; text-align: center; }
.sqll-res { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.7rem; min-width: 0; }
.sqll-res-err { border-color: var(--danger); background: var(--danger-soft); }
.sqll-stmt { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 0.76rem; color: var(--text-muted); margin-bottom: 0.4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sqll-err { white-space: pre-wrap; color: var(--danger); font-family: 'JetBrains Mono', Consolas, monospace; font-size: 0.82rem; margin: 0; }
.sqll-tip { margin-top: 0.45rem; font-size: 0.84rem; color: var(--text); }
.sqll-ok-msg { color: var(--success); font-weight: 600; font-size: 0.86rem; }
.sqll-out-label { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em; color: var(--text-muted); }
.sqll-out { background: var(--code-bg); color: #a7f3d0; font-family: 'JetBrains Mono', Consolas, monospace; font-size: 0.82rem; padding: 0.55rem 0.7rem; border-radius: 8px; margin: 0.25rem 0 0.45rem; white-space: pre-wrap; max-height: 320px; overflow: auto; }
:root[data-theme="light"] .sqll-out { color: #065f46; }
.sqll-table-wrap { overflow: auto; max-height: 340px; border: 1px solid var(--border); border-radius: 8px; }
.sqll-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.sqll-table th { position: sticky; top: 0; background: var(--bg-hover); text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; font-weight: 700; }
.sqll-table td { padding: 0.32rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sqll-table tr:last-child td { border-bottom: 0; }
.sqll-null { color: var(--text-muted); font-style: italic; font-size: 0.75rem; }
.sqll-meta { font-size: 0.76rem; color: var(--text-muted); margin-top: 0.3rem; }
.sqll-muted { color: var(--text-muted); font-size: 0.82rem; }
.sqll-check { padding: 0.75rem 0.9rem; border-radius: 10px; font-weight: 600; font-size: 0.9rem; line-height: 1.45; }
.sqll-check-ok { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.sqll-check-bad { background: var(--danger-soft); color: var(--text); border: 1px solid var(--danger); }
.sqll-details { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 0.7rem; }
.sqll-details summary { cursor: pointer; font-weight: 600; font-size: 0.86rem; }
.sqll-details[open] summary { margin-bottom: 0.5rem; }

/* consola y esquema */
.sqll-session-bar { display: flex; justify-content: space-between; gap: 0.6rem; align-items: center; flex-wrap: wrap; font-size: 0.85rem; padding: 0.55rem 0.75rem; border-radius: 10px; background: var(--primary-soft); }
.sqll-history { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.sqll-history button { width: 100%; text-align: left; background: var(--bg-hover); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 0.3rem 0.5rem; font-family: 'JetBrains Mono', Consolas, monospace; font-size: 0.74rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sqll-schema { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.sqll-schema > .card { padding: 1rem; min-width: 0; }
.sqll-er { grid-column: 1 / -1; }
.sqll-cols { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; margin: 0.4rem 0 0.7rem; }
@media (max-width: 480px) {
  .sqll-editor { height: 280px; }
  .sqll-lesson { padding: 0.9rem; }
  .sqll-toolbar kbd { display: none; }
}
