/* SQL-Aufgaben (Thema Datenbanken). Farben der Einfaerbung wie in den OOPventure-Heften. */
.sql-task { --sql-border: #cbd5dd; --sql-soft: #f4f7fa; --sql-error: #a12b2b; min-width: 0; }
.sql-muted { color: #667078; font-size: .88rem; }
.sql-db-badge { font-size: .8rem; background: #eef3f8; color: #34474f; border: 1px solid var(--sql-border);
  border-radius: 999px; padding: .1rem .55rem; }
.sql-status { margin-left: auto; }

/* Schema */
.sql-schema { margin: .6rem 0; border: 1px solid var(--sql-border); border-radius: 8px; background: var(--sql-soft); }
.sql-schema summary { cursor: pointer; padding: .4rem .7rem; font-weight: 600; font-size: .92rem; }
.sql-schema > .sql-muted { margin: 0 .7rem .5rem; }
.sql-schema-tables { display: flex; flex-wrap: wrap; gap: .6rem; padding: 0 .7rem .5rem; }
.sql-schema-table { background: #fff; border: 1px solid var(--sql-border); border-radius: 6px; min-width: 11rem;
  font-size: .86rem; }
.sql-schema-name { background: #34474f; color: #fff; font-weight: 700; padding: .2rem .5rem; border-radius: 5px 5px 0 0; }
.sql-schema-name .sql-muted { color: #d6dee4; font-weight: 400; font-size: .78rem; }
.sql-schema-table ul { list-style: none; margin: 0; padding: .25rem .5rem .35rem; }
.sql-schema-table li { display: flex; gap: .35rem; align-items: baseline; flex-wrap: wrap; }
.sql-attr { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sql-pk .sql-attr { text-decoration: underline; font-weight: 700; }
.sql-typ { color: #7a8790; font-size: .78rem; }
.sql-fk { color: #2f6db5; font-size: .78rem; }

/* Editor: eingefaerbtes <pre> unter einem durchsichtigen Textfeld (gleiche Schrift, gleiche Abstaende) */
.sql-editor { position: relative; margin: .5rem 0; border: 1.5px solid var(--sql-border); border-radius: 8px;
  background: #fff; }
.sql-editor:focus-within { border-color: #4a90d9; box-shadow: 0 0 0 2px rgba(74, 144, 217, .2); }
.sql-highlight, .sql-input { margin: 0; padding: .55rem .7rem; border: 0; font-family: ui-monospace, SFMono-Regular,
  Menlo, Consolas, monospace; font-size: .95rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
  tab-size: 2; letter-spacing: 0; }
.sql-highlight { position: absolute; inset: 0; overflow: hidden; color: #26333a; pointer-events: none; }
.sql-input { position: relative; display: block; width: 100%; box-sizing: border-box; resize: vertical;
  background: transparent; color: transparent; caret-color: #26333a; outline: none; min-height: 6.5rem; }
.sql-input::placeholder { color: #a6b1b9; }
.sql-input::selection { background: rgba(74, 144, 217, .3); color: transparent; }
.sql-t-kw { color: #7b3fb4; font-weight: 700; }
.sql-t-fn { color: #2f6db5; }
.sql-t-str { color: #b5422f; }
.sql-t-num { color: #c26a00; }
.sql-t-comment { color: #7a8790; font-style: italic; }
.sql-t-op { color: #34474f; }

.sql-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.sql-actions .btn:disabled { opacity: .5; cursor: progress; }
.sql-message { min-height: 1.4rem; margin-top: .4rem; font-size: .93rem; }
.sql-message-error, .sql-error { color: var(--sql-error); font-weight: 600; }
.sql-message-warn { color: #8a5a00; font-weight: 600; }
.sql-message-done { color: #1d6b3a; font-weight: 600; }
.sql-message-info, .sql-info { color: #34474f; }

/* Ergebnistabelle */
.sql-table-wrap { max-height: 24rem; overflow: auto; border: 1px solid var(--sql-border); border-radius: 6px;
  margin-top: .3rem; }
.sql-table { border-collapse: collapse; font-size: .88rem; width: max-content; min-width: 100%; }
.sql-table th { position: sticky; top: 0; background: #eef3f8; text-align: left; font-weight: 700; }
.sql-table th, .sql-table td { border-bottom: 1px solid #e3e8ec; padding: .22rem .6rem; white-space: nowrap; }
.sql-table tbody tr:nth-child(even) { background: #fafbfc; }
.sql-num { text-align: right; font-variant-numeric: tabular-nums; }
.sql-null { color: #a6b1b9; font-style: italic; }
.sql-count { color: #667078; font-size: .85rem; margin: .25rem 0 0; }
.sql-table .sql-wrong { background: #fff0bd; box-shadow: inset 0 0 0 2px #c28a00; }
.sql-table .sql-row-wrong td { background: #fbe0de; box-shadow: inset 0 0 0 1px #b8493f; }

.sql-solution { margin-top: .8rem; border: 1px dashed #8bb48f; border-radius: 8px; padding: .4rem .7rem;
  background: #f5fbf5; }
.sql-solution summary { cursor: pointer; font-weight: 600; }
.sql-solution-code { background: #fff; border: 1px solid var(--sql-border); border-radius: 6px; padding: .5rem .7rem;
  white-space: pre-wrap; font-size: .9rem; }

/* Abbildungen in Info-Bloecken: Tabellen aus der Datenbank */
.sql-example { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--sql-soft, #f4f7fa);
  border-left: 4px solid #7b3fb4; padding: .5rem .8rem; white-space: pre; overflow-x: auto; }

.info-content .material-table { border-collapse: collapse; margin: .8rem 0; font-size: .92rem; }
.info-content .material-table th, .info-content .material-table td { border: 1px solid #cbd5dd; padding: .25rem .6rem;
  text-align: left; }
.info-content .material-table th { background: #f4f7f8; }
.sql-reset { background: none; color: #54636c; }
.sql-reset:hover { color: #26333a; text-decoration: underline; }

@media (max-width: 640px) {
  .sql-schema-table { min-width: 0; flex: 1 1 100%; }
  .sql-status { margin-left: 0; }
}

.sql-struktur { display: inline-flex; gap: .3rem; align-items: center; margin-left: auto; }
.sql-markieren.active { background: #fff0bd; border-color: #c28a00; }
.sql-markieren[hidden] { display: none; }
