/* Bausteine, die auf mehreren Seiten vorkommen. Mobil zuerst, siehe style.css. */

/* ---------- Lektionsliste (Lernpfad, Modul) ---------- */

.today-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lesson-item {
    display: flex;
    flex-wrap: wrap;               /* auf schmalen Bildschirmen rutscht die Markierung nach unten */
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1rem;
    min-height: 56px;
    padding: 0.9rem 1rem;
    border-radius: var(--radius);
    background: var(--color-card);
    box-shadow: var(--shadow);
    color: inherit;
    text-decoration: none;
}

.lesson-item:hover {
    box-shadow: var(--shadow-hover);
}

.lesson-item .module-name {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.badge.new {
    background-color: #e0f0ff;
    color: #0d47a1;
}

.badge.review {
    background-color: #fff3e0;
    color: #a63f00;
}

.badge.done {
    background-color: #e8f5e9;
    color: #1b5e20;
}

/* ---------- Auswahlliste mit Karten-Optik (Themenwahl, Quiz-Themen) ---------- */

.topic-label {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 0.5rem;
}

.module-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.module-checkbox-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    min-height: 52px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: var(--color-card);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.module-checkbox-item input {
    width: 22px;
    height: 22px;
    min-height: 0;
    flex: none;
}

.module-checkbox-item:has(input:focus-visible) {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
}

.module-checkbox-item .count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--color-muted);
}

.module-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.module-title {
    line-height: 1.2;
}

/* ---------- Quiz (Lektion und Quiz-Builder) ---------- */

.quiz-question {
    margin-bottom: 1.25rem;
}

.quiz-option {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    min-height: 48px;
    margin: 0.35rem 0;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text);
    text-align: left;
}

.quiz-option:hover:not([aria-disabled="true"]) {
    background: #f0f0f0;
}

/* Beantwortete Fragen: Knöpfe bleiben fokussierbar (aria-disabled statt disabled),
   damit der Tastatur-Fokus nach dem Antworten nicht verloren geht */
.quiz-option[aria-disabled="true"] {
    cursor: default;
}

.quiz-option.correct {
    background: #d4edda;
    border-color: var(--color-success);
}

.quiz-option.wrong {
    background: #f8d7da;
    border-color: #dc3545;
}

/* Erklärung nach dem Antworten: steht immer im Dokument (leer), damit Screenreader sie vorlesen */
.quiz-explanation {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #6B6355;
}

.quiz-suggestion {
    margin-top: 0.75rem;
    padding: 0.9rem;
    border: 1px solid #ffe082;
    border-radius: 6px;
    background: #fff8e1;
    color: #5d4a00;
    font-size: 0.85rem;
}

.quiz-suggestion p {
    margin-bottom: 0.6rem;
}

.quiz-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
}

/* ---------- Verwandte Begriffe / Querverweise ---------- */

.related-terms {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.related-label {
    font-size: 0.8rem;
    color: var(--color-muted);
}

.related-chip {
    display: inline-flex;
    align-items: center;
    min-height: var(--tap-size);
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--color-chip-border);
    border-radius: 22px;
    background: var(--color-chip);
    color: var(--color-primary);
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
}

.related-chip:hover {
    background: var(--color-chip-hover);
}

/* ---------- Suchergebnisse (Startseite, Glossar, Bibliothek) ---------- */

.results-area {
    margin-bottom: 1rem;
}

.result-section {
    margin-bottom: 1.5rem;
}

.result-section-title {
    margin-bottom: 0.5rem;
    color: var(--color-muted);
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.result-item {
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 1rem;
    border-radius: 6px;
    background: var(--color-card);
    box-shadow: var(--shadow);
    color: inherit;
    text-align: left;
    text-decoration: none;
}

.result-item:hover {
    box-shadow: var(--shadow-hover);
}

/* Karte, die als Ganzes anklickbar ist (Maus-Komfort). Für die Tastatur gibt es darin
   einen echten Button bzw. Link; die Karte selbst ist kein Bedienelement. */
.result-item.clickable {
    cursor: pointer;
}

a.result-item:hover,
.result-item.clickable:hover {
    background-color: #FFFBF7;
}

/* Button, der wie die Überschrift aussieht: für den Titel in anklickbaren Karten */
.link-button {
    display: inline;
    min-height: 0;
    padding: 0.25rem 0;
    background: none;
    color: var(--color-primary);
    font: inherit;
    font-weight: bold;
    text-align: left;
}

.link-button:hover {
    background: none;
    text-decoration: underline;
}

.result-item h3 {
    margin-bottom: 0.25rem;
    color: var(--color-primary);
}

.result-item .tags {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    color: var(--color-muted);
}

.result-item pre {
    margin-top: 0.5rem;
    padding: 0.75rem;
}

.type-badge {
    display: inline-block;
    margin-bottom: 0.4rem;
    padding: 0.15rem 0.6rem;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: bold;
}

.type-badge.begriff {
    background-color: #e0f0ff;
    color: #0d47a1;
}

.type-badge.snippet {
    background-color: #e8f5e9;
    color: #1b5e20;
}

.type-badge.lektion {
    background-color: #fff3e0;
    color: #a63f00;
}

.type-badge.quiz {
    background-color: #f3e5f5;
    color: #6a1b9a;
}

.term-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.term-actions button {
    background-color: #eee;
    color: #333;
    font-size: 0.85rem;
}

.term-actions button:hover {
    background-color: #ddd;
}

.term-actions .delete-term-btn:hover {
    background-color: #c0392b;
    color: #fff;
}

/* ---------- Aufklappbare Gruppen (Glossar nach Thema, Sammlungen) ---------- */

.theme-group {
    margin-bottom: 0.75rem;
    border-radius: var(--radius);
    background: var(--color-card);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.theme-group summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 52px;
    padding: 0.75rem 1rem;
    color: var(--color-primary);
    font-weight: bold;
    list-style: none;
    cursor: pointer;
}

.theme-group summary::-webkit-details-marker {
    display: none;
}

.theme-group summary::before {
    content: "▸";
}

.theme-group[open] summary::before {
    content: "▾";
}

.theme-count {
    font-weight: normal;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.theme-terms {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1rem 1rem;
}

.theme-terms .result-item {
    margin-bottom: 0;
    border: 1px solid #eee;
    box-shadow: none;
}

.delete-collection-btn {
    margin-left: auto;
    min-width: var(--tap-size);
    padding: 0.25rem 0.5rem;
    background: none;
    color: #6b6b6b;
    font-size: 1.4rem;
}

.delete-collection-btn:hover {
    background: #fbeaea;
    color: #b02a37;
}

@media (min-width: 700px) {
    .theme-group summary {
        padding: 1rem 1.25rem;
    }

    .theme-terms {
        padding: 0 1.25rem 1rem;
    }
}

/* Link ins Glossar unter der Erklärung einer Quizfrage */
.quiz-deepdive {
    margin: 0.5rem 0 0;
}
