/* Copyright (c) Sunmara GmbH. All rights reserved. */
/* Marken-Token als CSS-Variablen (sunmara-brand Brand Guide V2). Quelle der
   Wahrheit, damit eigene Komponenten (Markdown-Vorschau, Code-Highlighting)
   mit dem MudBlazor-Theme mitziehen. Hell-Werte sind im Brand Guide
   abschliessend definiert; Dunkel-Werte sind VORLAEUFIG (CLAUDE.md 8.1). */

:root {
    --sl-ink: #141414;
    --sl-white: #ffffff;
    --sl-nebel-100: #a6b4b8;
    --sl-nebel-300: #8a9ca0;
    --sl-nebel-600: #5e7077;
    --sl-gray-700: #475159;
    --sl-gray-300: #dce2e5;
    --sl-gray-100: #f6f8f9;
    --sl-error: #9b3d4a;
    --sl-error-bg: #f8f1f2;
    --sl-success: #3d6b5c;
    --sl-success-bg: #eef3f1;

    /* Funktionale Rollen (Hell). */
    --sl-bg: var(--sl-white);
    --sl-surface: var(--sl-gray-100);
    --sl-text: var(--sl-gray-700);
    --sl-heading: var(--sl-ink);
    --sl-functional: var(--sl-nebel-600);
    --sl-line: var(--sl-gray-300);
}

/* Dunkelmodus: MudBlazor setzt diese Klasse am Body. Funktionale Rolle
   uebernimmt Nebelblau 300 (dokumentierte Ausnahme, nur auf dunklen Flaechen). */
.mud-dark-mode {
    --sl-bg: #141414;
    --sl-surface: #1c2123;
    --sl-input: #181b1d;
    --sl-text: #c7ced1;
    --sl-heading: #ffffff;
    --sl-functional: var(--sl-nebel-300);
    --sl-line: #2b3134;
}

html, body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Buttons als Pill, primaer schwarz (sunmara-brand). */
.mud-button-root.mud-button-filled {
    border-radius: 999px;
}

/* Kopfzeile: dezente Trennlinie statt Schatten. */
.sl-appbar {
    border-bottom: 1px solid var(--sl-line);
}

.sl-appname {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sl-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Footer mit Signet (Mindesthoehe 30 px laut sunmara-brand, daher nicht kleiner;
   dezenter gehalten durch weniger Abstand und leicht reduzierte Deckkraft). */
.sl-footer {
    margin-top: auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: center;
    border-top: 1px solid var(--sl-line);
}

.sl-signet {
    height: 30px;
    width: auto;
    opacity: 0.75;
}

/* Schlichte, zentrierte Anmeldeseite (DNA UI/UX). */
.sl-auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--sl-surface);
}

.sl-auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--sl-bg);
    border: 1px solid var(--sl-line);
    border-radius: 12px;
    padding: 2.5rem 2rem;
}

.sl-auth-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--sl-heading);
}

.sl-auth-subtitle {
    margin: 0.25rem 0 1.75rem;
    color: var(--sl-text);
    font-size: 0.9rem;
}

.sl-field {
    margin-bottom: 1.1rem;
    display: flex;
    flex-direction: column;
}

    .sl-field label {
        font-size: 0.85rem;
        font-weight: 500;
        color: var(--sl-functional);
        margin-bottom: 0.35rem;
    }

    .sl-field input {
        font: inherit;
        padding: 0.6rem 0.75rem;
        border: 1px solid var(--sl-line);
        border-radius: 8px;
        background: var(--sl-bg);
        color: var(--sl-heading);
    }

    .sl-field input:focus {
        outline: 2px solid var(--sl-functional);
        outline-offset: 1px;
    }

/* Primaerer Button als Pill, schwarz (sunmara-brand). */
.sl-auth-submit {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.7rem 1rem;
    font: inherit;
    font-weight: 500;
    color: #fff;
    background: var(--sl-ink);
    border: none;
    border-radius: 999px;
    cursor: pointer;
}

    .sl-auth-submit:hover {
        opacity: 0.92;
    }

.sl-auth-error {
    color: var(--sl-error);
    font-size: 0.85rem;
}

/* Markdown-Vorschau und gerenderte Notizen (CLAUDE.md 6.3). */
.sl-markdown {
    color: var(--sl-text);
    line-height: 1.6;
    word-break: break-word;
}

    .sl-markdown h1, .sl-markdown h2, .sl-markdown h3 {
        color: var(--sl-heading);
        margin: 0.6em 0 0.3em;
    }

    .sl-markdown a {
        color: var(--sl-functional);
    }

    .sl-markdown code {
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: 0.9em;
        background: var(--sl-surface);
        padding: 0.1em 0.35em;
        border-radius: 6px;
    }

    .sl-markdown pre {
        background: var(--sl-surface);
        border: 1px solid var(--sl-line);
        border-radius: 8px;
        padding: 0.9em 1em;
        overflow-x: auto;
    }

        .sl-markdown pre code {
            background: none;
            padding: 0;
        }

    .sl-markdown blockquote {
        border-left: 3px solid var(--sl-line);
        margin: 0.5em 0;
        padding-left: 1em;
        color: var(--sl-text);
    }

.sl-notes {
    max-width: 100%;
}

/* Seitenkopf mit Titel links und Aktionen rechts. Bricht auf schmalen Schirmen
   um, damit nichts abgeschnitten wird (mobiltauglich, CLAUDE.md 6.9). */
.sl-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .sl-page-header {
        align-items: stretch;
    }
}

/* Lernpfad-Items (Drag-and-Drop). */
.sl-path-item {
    cursor: grab;
}

    .sl-path-item:active {
        cursor: grabbing;
    }

.mud-drop-item-preview {
    opacity: 0.6;
}

/* Wiedergabe: responsives 16:9-Verhaeltnis (mobiltauglich, CLAUDE.md 6.9). */
.sl-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

    .sl-player > div,
    .sl-player iframe {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
    }

/* Video-Karten in der Bibliothek. */
.sl-video-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

    .sl-video-card .mud-card-content {
        flex-grow: 1;
    }

.sl-video-title {
    font-weight: 600;
    line-height: 1.3;
    /* Titel auf zwei Zeilen begrenzen. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#blazor-error-ui {
    background: var(--sl-error-bg);
    color: var(--sl-error);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: var(--sl-error);
    padding: 1rem;
    color: white;
}

/* Diagnostic-Seite: Label-Wert-Zeilen und Log-Liste (nur Developer). */
.sl-diag-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--sl-line);
}

.sl-diag-row:last-child {
    border-bottom: none;
}

.sl-diag-label {
    color: var(--sl-functional);
    font-weight: 500;
}

.sl-diag-value {
    color: var(--sl-text);
    text-align: right;
    word-break: break-word;
}

.sl-diag-logs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 28rem;
    overflow-y: auto;
}

.sl-diag-log {
    border-bottom: 1px solid var(--sl-line);
    padding-bottom: 0.4rem;
}

.sl-diag-time {
    font-family: monospace;
    color: var(--sl-functional);
    margin-right: 0.5rem;
}

.sl-diag-cat {
    color: var(--sl-text);
    margin-left: 0.5rem;
    font-size: 0.85em;
}

.sl-diag-msg {
    color: var(--sl-heading);
    margin-top: 0.2rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.sl-diag-ex {
    background: var(--sl-surface);
    border: 1px solid var(--sl-line);
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.3rem;
    font-size: 0.8em;
    overflow-x: auto;
    color: var(--sl-text);
}
