/* Global variables. */
:root,
::backdrop {
  /* Set sans-serif & mono fonts */
  --sans-font: -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir,
    "Nimbus Sans L", "Segoe UI", Arial, Helvetica,
    "Helvetica Neue", sans-serif;
  --mono-font: Consolas, Menlo, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  --standard-border-radius: 5px;

  /* Default (light) theme */
  --bg: #fff;
  --bg-body: #eee;
  --bg-nav-active: #ddd;
  --bg-nav: #343131;
  --bg-alert: #F8D7DA;
  --bg-info: #D1E7DD;
  --bg-lernziele: #f9f6bf;
  --border-alert: #F1AEB5;
  --border-info: #A3CFBB;
  --border-lernziele: #fff30c;
  --accent-bg: #f5f7ff;
  --text: #212121;
  --text-light: #585858;
  --text-white: #fff;
  --border: #898EA4;
  --accent: #0d47a1;
  --accent-hover: #1266e2;
  --accent-text: var(--bg);
  --code: #0d47a1;
  --preformatted: #444;
  --marked: #ffdd33;
  --disabled: #efefef;
}

html {
    /* Set the font globally */
    font-family: var(--sans-font);
    font-weight: 300;
    scroll-behavior: smooth;
    padding: 0px 8px;
}

body {
    display: grid;
    /* grid-template-columns: 1fr 3fr 1fr; */
    grid-template-columns: minmax(280px, 0.5fr) 1fr 1fr 1fr 1fr;
    grid-template-rows: auto;
    grid-template-areas: 
        "hh hh hh hh hh hh"
        "xx xx xx xx xx xx"
        "nn cc cc cc cc cc"
        "nn cc cc cc cc cc"
        "nn cc cc cc cc cc"
        "ff ff ff ff ff ff"
        ;
    gap: 2px;
    background-color: var(--bg-body);
}

body.nav-collapsed {
  grid-template-columns: 0px 1fr 1fr 1fr 1fr; /* nav deutlich schmaler */
}

body.nav-collapsed nav ul {
  display: none;
}

header {
    grid-area: hh;
    font-size: 1.5rem;
    text-align: center;
    background-color: var(--accent-bg);
}

/* Horizontale Navigation oben */
.top-nav {
    display: grid;
    grid-area: xx;
    grid-template-areas: "xx aa aa aa aa aa aa aa aa uu bb h";
    background-color: var(--bg-nav);
    color: var(--text);
    grid-template-columns: 
        auto                     /* xx  */
        repeat(8, minmax(0, 1fr))/* aa  */
        2fr                     /* uu, 2fr, sonst zu schmal  */
        1fr                     /* bb  */
        max-content;             /* h -> so schmal wie der Button */
    align-items: center;
}

.top-nav .course-select {
    grid-area: xx;
    align-items: center;
    display: flex;
    justify-content: flex-start;
    position: relative;
}

#btnGotoBookmark {
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1rem;
    padding: 2px 2px 2px 2px;
    margin: 0px 0px 3px 0px;
    cursor: pointer;
    transition: opacity 0.2s ease-in-out;
}

#btnGotoBookmark:hover {
    opacity: 0.5;
}

#btnGotoBookmark.hidden {
    visibility: hidden;
}

#toggle-nav {
    background: none;
    border: none;
    padding: 4px 4px 0px 4px;
    cursor: pointer;
    text-align: left;
}

#btnHelp {
    grid-area: h;
    transform: translateY(2px);
}

.plain-icon {
    background: none;
    border: none;
    padding: 4px 4px 0px 4px;
    cursor: pointer;
    text-align: left;
}

/* .center {
    align-items: center;
    vertical-align: middle;
    margin-top: auto;
} */

#dlgHelp[open] {
    position: relative;
    background-color: white;
    width: 80%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 1000px;
    height: 60%;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    /* overflow-y: auto; */

    h2 {
        margin: 0;
        text-align: left;
        flex: 1;
    }
}

#dlgHelp .header{
    display: flex;
    width: 100%;
    justify-content: space-between;
}

#dlgHelp .close-button {
    background-color: transparent;
    color: black;
    height: 2rem;
    vertical-align: middle;

    &:hover {
        background-color: #0056b3;
        color: white;
    }
}

#help-content {
    flex: 1 1 auto;
    text-align: left;
    overflow-y: auto;
    width: 100%;
    padding: 0px 15px 0px 15px;
    min-height: 0;
}


.course-title {
    color: var(--text-light);
    text-align: center;
    font-size: 48px;
    font-weight: 700;
    padding: 32px 32px 32px 32px;
}

/* h2 ist Kapitelüberschrift, allenfalls mit Checkbox */
h2 {
    font-size: 2rem;
}
/* Restliche Überschriften sind in markdown_styles.css */

/* Speziell für learning goals collections */
h4.learning_goals {
    font-size: small;
    font-weight: normal;
    margin-bottom: 0px;
}


main {
    background-color: var(--bg);
    grid-area: cc;
    padding: 0px 28px; /* #done: grösseres padding für Bookmark */
    line-height: 1.5rem;
}

footer {
    grid-area: ff;
    text-align: center;
    background-color: var(--accent-bg);
}

nav {
    /* display: none; */
    background-color: var(--bg-nav);
    color: var(--text);
    grid-area: nn;
    padding: 5px;
}

nav > ul {
    margin: 0;
    padding: 0;
}
nav > ul > li {
    position: relative;
    color: var(--text-white);
    list-style: none;
    line-height:2rem;
    justify-content: space-between;
    align-items: center;
    /* padding: 5px; */
}

nav > ul > li > a {
    text-decoration: none;
    background-color: transparent;
    color: var(--text-white);
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1; /* damit der Link überhaupt anklickbar ist */
}


nav > ul > li > .nav-content {
    position: relative;
    display: flex;
    justify-content: space-between;
    padding: 5px; 
}

nav > ul > li > .nav-content.indent {
    padding-left: 25px; /* neu ein wenig eingerückt, wenn page.indent */
}


nav > ul > li > .nav-heading {
    font-weight: 700;
    position: relative;
    display: flex;
    justify-content: space-between;
    padding: 15px 5px 5px 5px;
}

/* Entscheidet, ob Icon im Menü angezeigt werden oder nicht
ob Checkbox oder nicht ausgefülltes Quadrat, muss mit PHP entschieden werden */

/* nav > ul > li > .nav-content > .nav-icons > .nok{
    opacity: 0;
    color: red;
}

nav > ul > li > .nav-content > .nav-icons > .ok{
    opacity: 1;

} */

nav > ul > li:has(.nav-content):hover {
    color: var(--text);
    background-color: var(--bg-body);
}

nav > ul > li > a.active{
    background-color: var(--bg-nav-active);
    /* z-index: 1; */ /* den braucht es glaub ich nicht */
}

nav > ul > li > a.active + .nav-content{
    color: #000;
    font-weight: bold;
    z-index: 2; /* dieser ist aber wichtig, sonst wird der Text verdeckt */
}

nav > ul > li > div.nav-content > span.nav-text > i.hidden {
    display: none;
}

.top-nav > a {
    grid-area: bb;
    text-decoration: none;
    color: var(--text-white);
    display: block;
    text-align: center;
    padding: 5px;
    font-size: 0.8rem;
}

.top-nav > a:hover {
    color: var(--text-light);
    background-color: var(--bg-body);
}

.top-nav > .user {
    grid-area: uu;
    text-decoration: none;
    color: var(--text-white);
    display: block;
    text-align: center;
    padding: 5px;
    font-size: 0.8rem;
}

/* a.button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    text-align: center;
    margin-bottom: 10px;
}

a.button:hover {
    background-color: #0056b3;
} */

button {
    appearance: none;
    display: inline-block;
    padding: 10px 20px;
    font-weight: 100;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    text-align: center;
    margin-bottom: 10px;
}

.top-nav .course-select button {
    margin: 2px 2px 2px 6px;
    padding: 2px 16px 2px 16px;
    background-color: var(--bg-body);
    text-align: left;
    max-width: 300px;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
    vertical-align: middle;
}

#dlgRefreshPassword .buttons{
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 0px 20px 0px 20px;
}
.result-buttons button {
    background-color: rgb(99, 98, 98);
}

button.disabled:hover {
    cursor: initial;
}

button.ask-ai-button {
    font-size: 0.8em;
    padding: 4px;
    align-self: center;
    margin: 0px 5px 0px 0px;
    background-color: #007bff;
    width: 100px;
}

button.ask-teacher-button {
    font-size: 0.8em;
    padding: 4px;
    align-self: center;
    margin-bottom: 0;
    background-color: #28a745;
}

button:hover {
    background-color: #0056b3;
}

button.disabled {
    background-color: gray;
}

button.primary {
  padding: .5rem .9rem; border-radius: 4px; border: 0;
}

img {
    max-width: 100%;
    height: auto;
}

.noChapterAccess {
    background: repeating-linear-gradient(
        45deg,
        #f6ff00,
        #f6ff00 10px,
        #fff 10px,
        #fff 20px
    );
    padding: 20px;
    font-size: 1.5rem;
    text-align: center;
    width: 60%;
    color: var(--text);
    font-weight: bold;
    border-radius: 5px;
    border-style: solid;
    border-width: 1px;
    margin: 10px 20%;
    box-shadow: 4px 4px 4px rgb(2 2 2 / 80%);
}

.noAdminAccess {
    background: repeating-linear-gradient(
        45deg,
        #910106,
        #910106 10px,
        #ed2424 10px,
        #ed2424 20px
    );
    padding: 20px;
    font-size: 1.5rem;
    text-align: center;
    width: 60%;
    color: var(--bg);
    font-weight: bold;
    border-radius: 5px;
    border-style: solid;
    border-width: 1px;
    margin: 10px 20%;
    box-shadow: 4px 4px 4px rgb(2 2 2 / 80%);
}

.noAccessDueAdmin {
    background: repeating-linear-gradient(
        45deg,
        #1e02f6,
        #1e02f6 10px,
        #8880f3 10px,
        #8880f3 20px
    );
    padding: 20px;
    font-size: 1.5rem;
    text-align: center;
    width: 60%;
    color: var(--bg);
    font-weight: bold;
    border-radius: 5px;
    border-style: solid;
    border-width: 1px;
    margin: 10px 20%;
    box-shadow: 4px 4px 4px rgb(2 2 2 / 80%);
}

.noCourseAccess {
    background: repeating-linear-gradient(
        45deg,
        #bbbabc,
        #cdccce 10px,
        #e9e9ec 10px,
        #e9e9ec 20px
    );
    padding: 20px;
    font-size: 1.5rem;
    text-align: center;
    width: 60%;
    color: var(--text);
    font-weight: bold;
    border-radius: 5px;
    border-style: solid;
    border-width: 1px;
    margin: 10px 20%;
    box-shadow: 4px 4px 4px rgb(2 2 2 / 80%);
}

.pageIsDraft {
    background: repeating-linear-gradient(
        45deg,
        #3d3d3d,
        #3d3d3d 10px,
        #7d7d7d 10px,
        #7d7d7d 20px
    );
    padding: 20px;
    font-size: 1.5rem;
    text-align: center;
    width: 60%;
    color: var(--text-white);
    font-weight: bold;
    border-radius: 5px;
    border-style: solid;
    border-width: 1px;
    margin: 10px 20%;
    box-shadow: 4px 4px 4px rgb(2 2 2 / 80%);
}

.lernziele { /* gelber Kasten */
    padding: 5px;
    background-color: var(--bg-lernziele);
    border-color: var(--border-lernziele);
    border-radius: 5px;
    border-style: solid;
    border-width: 1px;
    margin: 5px;
    box-shadow: 4px 4px 4px rgb(2 2 2 / 80%);
}

.debug {
    font-size: 0.7rem;
    text-align: left;
}


th, td {
    padding: 0px 5px;
}
table th {
    background-color: #0d47a1;
    color: white;
    font-size: 0.9rem;
}

h3.backend {
    margin-top: 2rem;
}

.header1 {
    display: flex;
    position: relative;
    align-items: center;
}

.header1 input[type="checkbox"] {
    margin-top: 10px;
    margin-right: 8px;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
}

.reflection {
    background-color: lightgrey;
    padding: 5px;
    display: block;
}

.reflection h5 {
    margin-bottom: 0px;
    margin-top: 2px;
}

.reflection #reflectionText {
    width: 100%;
    box-sizing: border-box;
}

.ul-lernziele {
    list-style-type: none;
}

dt {
    float: left;
}

dd {
    margin-bottom: 0.5em;
    font-style: italic;
}
d
.LZNoteContainer {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.lznotes-visible {
    display: block;
}

.lznotes-unvisible {
    display: none;
}

.lz-visible {
    display: inline-block;
}

.lz-unvisible {
    display: none;
}

.LZNoteContainer .lzbutton {
    width: 50px;
    vertical-align: top;
    margin: 2px 5px 0px 26px;
    flex-shrink: 0;
}

.LZNoteContainer textarea {
    width: calc(100% - 90px);
}

/* speziell für die Lernziel-Checkboxen, falls Lernziel = disabled */
.unvisible {
    visibility: hidden;
}
dialog {
    background-color: white;
    color: black;
    align-items: center;
    text-align: center;
    border-style: none;
    border-radius: 10px;
    max-width: 330px;
    box-shadow: 4.0px 8.0px 8.0px hsl(0deg 0% 0% / 0.38);
}

dialog::backdrop {
    opacity: 0.4;
    background-color: #000;
}
dialog .courseList {
    list-style-type: none;
    padding: 10px;
}

dialog .courseList > li > a:link, dialog .courseList > li > a:visited {
    background-color: lightgray;
    /* font-weight: bold; */
    color: black;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    width: 250px;
    margin: 2px;
}

dialog .courseList > li > a:hover, dialog .courseList > li > a:active {
    background-color: #888;
    color: white;
    font-weight: bold;
    padding: 10px 0px;
    width: 290px;
    opacity: 0.7;
  }

.settings {
    width: 99%;
    border-collapse: collapse;
    table-layout:fixed;
}

.settings th {
    position: relative;
    padding-right: 20px;
    text-align: left;
}

.settings .column-title {
    display: inline;
    word-break: break-word;
    margin-right: 10px;
}

span.column-title {
    font-size: 0.7em;
}
.settings .sort-icons {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.settings th, .settings td {
    border: 1px solid #ddd;
    margin: 2px;
    position: relative;
    overflow: hidden;
}

.settings input[type="text"], textarea {
    box-sizing: border-box;
    width: 100%;
}

.settings th:hover {
    cursor: pointer;
}

th.delete-row {
    visibility: hidden;
    border: 0px;
    width: 8px;
}
td.delete-row {
    width: 8px;
    border: 0px;
}

.delete-button:hover {
    cursor: pointer;
}

#dlgNewRecord {
    width: 800px;
    max-width: 90%;
}

.newRecord {
    width: 100%;
    table-layout: fixed;
}

.newRecord .attr_name {
    text-align: left;
    width: 15%;
}

.newRecord input[type="text"], textarea{
    width: 100%;
}

.form-container {
    display: flex;
    flex-direction: row;
    gap: 20px; /* Abstand zwischen Auswahlliste und Formular */
    align-items: flex-start;
    max-width: 100%;
}

.course-selection2 {
    flex: 0 0 300px; /* Feste Breite für die Auswahlliste */
}

.scrollable-container {
    flex: 1;
    overflow-y: auto; /* Scrollbar für das Formular */
    max-height: 80vh; /* Höhe, um Scrollen zu ermöglichen */
    padding: 10px;
    border: 1px solid #ccc;
    background-color: #f9f9f9;
}

.left-container {
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.course-selection {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.label-select-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
}

.label-select-wrapper2 {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gui_warning {
    color: red;
    font-size: 0.8em;
}

.has-tooltip {
    position: relative;
    cursor: pointer;
}

.result-buttons {
    display: flex;
    gap: 10px;
}

.has-tooltip::before,
.has-tooltip::after {
    --scale: 0;
    --arrow-size: 10px;
    --tooltip-color: black;

    position: absolute;
    left: 0;
    transform: translateY(var(--translate-y, 0)) scale(var(--scale));
    transition: 50ms transform;
    transform-origin: bottom center;
}

.has-tooltip::before {
    --translate-y: calc(-100% - var(--arrow-size));
    content: attr(data-tooltip);
    display: block;
    color: white;
    padding: .5rem;
    font-size: 0.8rem;
    font-weight: 400;
    text-align: left;
    border-radius: .3rem;
    width: max-content;
    max-width: 400px;
    background: var(--tooltip-color);
}

.has-tooltip:hover::before,
.has-tooltip:hover::after{
    --scale: 1;
    opacity: 0.8;
}

.has-tooltip::after {
    --translate-y: calc(-1 * var(--arrow-size));
    content: '';
    border: var(--arrow-size) solid transparent;
    border-top-color: var(--tooltip-color);
    transform-origin: top center;
  }

/* Mastery Check */
pre.inline-pre {
    all: initial;
    display: inline-block;
    margin: 0;
    color: #1e02f6;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
}

.legende {
    background-color: #d3e0fa;
    padding-left: 5px;
    padding-bottom: 5px;
    border-radius: 4px;
}

.legende_content {
    display: flex;
    gap: 50px;
}

.legende h5 {
    margin: 0px 5px 0px 5px;
}

.legende icon {
    gap: 50px;
}

/* =========== Mastery Check ========= */
ol.question > li {
    border-top: 1px solid #000;
    margin-top: 3rem;
    margin-bottom: 1rem;
    line-height: 1rem;
}

ol.question > li.right{
    border-left: 15px solid lightgreen;
}

ol.question > li.wrong{
    border-left: 15px solid red;
}


ol.question > li >div.question{
    position: relative;
}

ol.question > li >div.question > p{
    width: 90%;
    /* border: 1px solid red; */
}

ol.question > li >div.question >span.question-id{
    position: absolute;
    right: 0;
    top: 0;
}


ul.answers {
    margin-left: 0;
    padding-left: 0;
}

ul.answers li input[type="radio"]{
    margin-right: 10px;
}

ul.answers li:nth-child(odd) {
  background-color: #f0f0f0; /* z.B. hellgrau */
}



li.answer {
    list-style-type: none;
    display: flex;
}

li.answer_in_result {
    display: flex;
    align-items: center;
}

.answer_in_result .icon {
    width: 2em;
    margin-right: 0.5em;
    text-align: center;
    flex-shrink: 0;
    line-height: 0;
}

.icon.green {
    color: green;
}

.icon.red {
    color: red;
    font-size: 1.1em;
}

.answer_in_result p {
    line-height: 1.12;
    margin: 5px 0;
}

.answer_content_in_results {
    flex: 1;
}

.feedback-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
  padding: 2px;
}

.feedback-container h5 {
    margin: 0;
}

.feedback-container p {
    line-height: 1.1rem;
}

.feedback-ai {
  flex: 1 1 45%;
  background: #f3f3fc;
  padding: 0.5rem;
  border-left: 4px solid #3b82f6;
  border-radius: 4px;
}

.feedback-teacher {
  flex: 1 1 45%;
  background: #f4fdf6;
  padding: 0.5rem;
  border-left: 4px solid #28A745;
  border-radius: 4px;
}

.dh-spin5 {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

span.highlight1 {
    font-weight: 800;
}

.heading,
.heading_h1,
.heading_h1woStatus {
    position: relative;
}

.heading i,
.heading_h1 i,
.heading_h1woStatus i {
    position: absolute;
    top: 2px;
    font-size: large;
    opacity: 0;
}

.heading i { /* für h2 und tiefer */
    left: -25px;
}

.heading_h1 i { /* für h1 mit PageStatus */
    left: -60px;
}

.heading_h1woStatus i { /* für Seiten ohne PageStatus */
    left: -30px;
}

i.bookmark-filled.bookmark { /* done: angepasst */
    opacity: 1;
}

.user-view .heading:hover .bookmark-empty,
.user-view .heading_h1:hover .bookmark-empty,
.user-view .heading_h1woStatus:hover .bookmark-empty {
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}




.goto-bookmark {
    color: white;
    font-size: small;
    vertical-align:middle;
}

/* Tabelle auf Resultatseite nach einem Test */
table.ergebnis-tabelle {
    border-collapse: collapse;
    width: 50%;
    margin-top: 10px;
    margin-bottom: 3rem;
    font-family: Arial, sans-serif;
}
.ergebnis-tabelle th, .ergebnis-tabelle td {
    border: 1px solid #ccc;
    padding: 8px 12px;
    text-align: left;
}
.ergebnis-tabelle th {
    background-color: #f2f2f2;
}
.ergebnis-tabelle tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* #done  (2025-05-14 12:12:22) Erweitert für eine schönere Gestaltung */
div.corrective {
    background-color:#d7cceb;
    border-radius: 5px;
}

div.corrective .corrective-heading {
    background-color: rgb(86, 59, 235);
    padding: 2px 2px;
    border-radius: 5px;
}

div.corrective h2{
    font-style: italic;
    color: white;
    padding-left: 10px;
}

div.corrective-content {
    padding: 10px;
}

/* Tooltip, aktuell nur für Backend */
#global-tooltip {
  position: absolute;
  background-color: #333;
  color: white;
  padding: 6px 10px;
  border-radius: 5px;
  white-space: normal;
  font-size: 0.9rem;
  font-weight: 400;
  z-index: 9999;
  display: none;
  pointer-events: none;
  max-width: 300px;
}

#global-warning-tooltip {
  position: absolute;
  color: white;
  padding: 6px 10px;
  border-radius: 5px;
  white-space: normal;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.5s ease;
  z-index: 9999;
  display: none;
  pointer-events: none;
  max-width: 300px;
  opacity: 1;

  &.fadeout{
    opacity: 0;
  }

  &.warning {
    background-color: darkred;
  }

  &.ok {
    background-color: green;
  }
}

/* Für alle Icons, welche irgendwo inline vorhanden sind (nicht Icons für Checkbox oder Notizen oder so) */
i.inline {
    all: unset;
}

@media only screen and (max-width: 720px) {
    body {
        display: grid;
        /* grid-template-columns: 1fr 3fr 1fr; */
        grid-template-columns: minmax(200px, 1fr) 1fr 1fr 1fr 1fr;
        grid-template-rows: auto;
        grid-template-areas: 
            "hh hh hh hh hh"
            "nn nn nn nn nn"
            "cc cc cc cc cc"
            "cc cc cc cc cc"
            "cc cc cc cc cc"
            "ff ff ff ff ff"
            ;
        grid-gap: 4px;
        background-color: var(--bg-body);
    }
}