/* ---------------------------------------------------------
   Globale Einstellungen
   --------------------------------------------------------- */
:root {
    --blue-900: #0d2b52;
    --blue-800: #123a6b;
    --blue-700: #1b4f8a;
    --blue-600: #2563a8;
    --blue-500: #2f7ac4;
    --blue-accent: #4da3ff;
    --surface: #ffffff;
    --text-white: #ffffff;
    --text: #0d2b52;
    --text-muted: #6b7c93;
    --sidebar-width: 96px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

/* Blauer Hintergrund */
body {
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    background: linear-gradient(160deg, var(--blue-800) 0%, var(--blue-600) 60%, var(--blue-500) 100%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------
   Layout: Sidebar links + Content rechts
   --------------------------------------------------------- */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ---------------------------------------------------------
   Linkes Menu
   --------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: rgba(9, 32, 62, 0.55);
    backdrop-filter: blur(4px);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    padding: 20px 10px;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 6px;
    border: none;
    border-radius: 14px;
    background: transparent;
    color: #dce8f7;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.menu-item:active {
    transform: scale(0.96);
}

.menu-item.is-active {
    background: var(--blue-accent);
    color: #062038;
}

.menu-item .material-symbols-rounded {
    font-size: 30px;
    line-height: 1;
}

.menu-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Ohne Anmeldung ausgeblendete Menuepunkte (Buch / Author) */
.menu-item[hidden],
.menu-card[hidden] {
    display: none;
}

/* Einstellungen: fest unten links in der Ecke */
.settings-btn {
    position: fixed;
    left: 10px;
    bottom: 16px;
    width: calc(var(--sidebar-width) - 20px);
    z-index: 30;
}

/* Angemeldeter Benutzer: unten links ueber dem Zahnrad */
.user-badge {
    position: fixed;
    left: 10px;
    bottom: 80px;
    width: calc(var(--sidebar-width) - 20px);
    padding: 6px 4px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    color: var(--text-white);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 30;
}

.user-badge[hidden] {
    display: none;
}

/* ---------------------------------------------------------
   Dialog (z. B. Einstellungen)
   --------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(6, 22, 43, 0.6);
    backdrop-filter: blur(3px);
    animation: fade-in 0.18s ease;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 18px;
    padding: 22px 24px 24px;
    box-shadow: 0 24px 60px rgba(4, 18, 38, 0.45);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--blue-900);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: #eef4fb;
    color: var(--blue-800);
    cursor: pointer;
    transition: background 0.18s ease;
}

.modal-close:hover {
    background: #dbe7f6;
}

.field {
    display: block;
    margin-bottom: 14px;
}

.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--blue-800);
}

.field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cddcee;
    border-radius: 10px;
    background: #f7fafd;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input:focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(47, 122, 196, 0.18);
    background: #ffffff;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.modal-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-status {
    margin-right: auto;
    font-size: 13px;
    font-weight: 600;
    color: #1a7f47;
}

.modal-status.is-error {
    color: #c0392b;
}

.login-text {
    margin-bottom: 4px;
    font-size: 15px;
    color: var(--text);
}

.login-text strong {
    color: var(--blue-800);
}

/* Passwort aendern (im angemeldeten Zustand) */
.password-form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2ecf7;
}

.modal-subtitle {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--blue-900);
}

.btn-primary,
.btn-ghost {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
}

.btn-primary {
    background: var(--blue-600);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--blue-700);
}

.btn-ghost {
    background: #eef4fb;
    color: var(--blue-800);
}

.btn-ghost:hover {
    background: #dbe7f6;
}

.btn-primary:active,
.btn-ghost:active {
    transform: scale(0.97);
}

/* Hamburger-Toggle ganz oben, mit Trennlinie zum uebrigen Menu */
.menu-toggle {
    width: 100%;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px 14px 0 0;
}

/* ---------------------------------------------------------
   Startseite: die Bereiche als groessere Icons
   --------------------------------------------------------- */
.start {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fade-in 0.25s ease;
}

.start-header {
    text-align: center;
}

.start-header h1 {
    font-size: 24px;
    color: var(--text-white);
}

.menu-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.menu-card {
    flex: 1 1 170px;
    max-width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 26px 12px;
    border: 2px solid #e2ecf7;
    border-radius: 18px;
    background: #f8fbff;
    color: var(--blue-800);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.menu-card:hover {
    background: #eaf3ff;
    border-color: var(--blue-accent);
    transform: translateY(-2px);
}

.menu-card .material-symbols-rounded {
    font-size: 52px;
    line-height: 1;
}

.menu-card-label {
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 480px) {
    .menu-card {
        flex: 1 1 100%;
        max-width: none;
    }
}

/* ---------------------------------------------------------
   Content-Bereich
   --------------------------------------------------------- */
.content {
    flex: 1;
    padding: 32px;
    display: flex;
    justify-content: center;
}

.content-inner-menu {
    width: 100%;
    max-width: 820px;
    border-radius: 20px;
    padding: 36px 40px;
}

.content-inner {
    width: 100%;
    max-width: 820px;
    background: var(--surface);
    border-radius: 20px;
    padding: 36px 40px;
    box-shadow: 0 18px 50px rgba(4, 18, 38, 0.35);
}

/* ---------------------------------------------------------
   Geladene Content-Seiten
   --------------------------------------------------------- */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 22px;
    border-bottom: 2px solid #e7eef7;
}

.page-icon {
    font-size: 34px;
    color: var(--text-white);
}

.page-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-white);
}

.todo {
    color: var(--text-muted);
    font-style: italic;
}

/* ---------------------------------------------------------
   Folien-Modus (PowerPoint)
   --------------------------------------------------------- */

/* Werkzeugleiste */
.deck-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 10px;
    border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.tool-group:last-child {
    border-right: none;
    padding-right: 0;
}

.tool-group-right {
    margin-left: auto;
}

.tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--text-white);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.tool:hover {
    background: rgba(255, 255, 255, 0.32);
}

.tool:active {
    transform: scale(0.94);
}

.tool.is-active {
    background: var(--blue-accent);
    color: var(--blue-900);
}

.tool .material-symbols-rounded {
    font-size: 20px;
}

.tool-color {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--text-white);
    cursor: pointer;
    overflow: hidden;
}

.tool-color.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tool-color input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    opacity: 0;
    cursor: pointer;
}

/* Farbvorschau unter dem Symbol */
.tool-color-swatch {
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 3px;
    height: 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

/* Auswahlfeld in der Werkzeugleiste (z. B. Folienuebergang) */
.tool-select {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.16);
    color: var(--text-white);
    font-size: 13px;
    font-weight: 600;
}

.tool-select .material-symbols-rounded {
    font-size: 20px;
}

.tool-select select {
    padding: 4px 6px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--blue-900);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

/* Leinwand (die Folie selbst) */
.slide-wrap {
    position: relative;
}

.slide-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    container-type: inline-size;
}

/* Objekte auf der Folie */
.slide-object {
    position: absolute;
    box-sizing: border-box;
    touch-action: none;
    user-select: none;
    cursor: move;
}

.slide-text {
    white-space: pre-wrap;
    overflow: hidden;
    overflow-wrap: break-word;
    line-height: 1.25;
}

/* Bilder */
.slide-image {
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.slide-object.is-selected {
    outline: 2px solid var(--blue-accent);
    outline-offset: 2px;
}

.slide-object.is-editing {
    cursor: text;
    outline-style: dashed;
}

/* Beim Schreiben Textauswahl wieder erlauben */
.slide-object[contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
    overflow: visible;
}

/* Anfasser zum Groessenaendern (unten rechts) */
.obj-handle {
    position: absolute;
    right: -8px;
    bottom: -8px;
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: var(--blue-accent);
    cursor: nwse-resize;
}

.slide-object.is-selected .obj-handle {
    display: block;
}

/* Hinweis bei leerer Folie */
.slide-hint {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 0 20px;
    color: #93a3b8;
    font-size: 14px;
    text-align: center;
    pointer-events: none;
}

.slide-hint[hidden] {
    display: none;
}

/* Gestrichelte Hilfslinien in der Mitte der Folie (Einrasten) */
.slide-guides {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
}

.slide-guide {
    position: absolute;
    display: none;
}

.slide-guide.is-visible {
    display: block;
}

/* senkrechte Linie: Mitte der x-Achse */
.slide-guide-v {
    top: 0;
    bottom: 0;
    left: 50%;
    border-left: 2px dashed #ff2d78;
}

/* waagerechte Linie: Mitte der y-Achse */
.slide-guide-h {
    left: 0;
    right: 0;
    top: 50%;
    border-top: 2px dashed #ff2d78;
}

/* Beim Handout und beim Praesentieren keine Hilfslinien */
.deck.is-simple .slide-guides,
.deck.is-presenting .slide-guides {
    display: none;
}

/* Beim Handout (Word-artig) gibt es kein Objekt-Ausrichten,
   sondern nur die Text-Ausrichtung (links/zentriert/rechts). */
.deck.is-simple .tool-group-align {
    display: none;
}


/* Steuerleiste unter der Folie */
.deck-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 18px;
    margin-top: 16px;
    border-top: 2px solid #e7eef7;
}

.deck-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.deck-counter {
    min-width: 58px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
}

.deck-status {
    margin-left: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
}

.deck-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 10px;
    background: #eef4fb;
    color: var(--blue-800);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
}

.deck-btn:hover {
    background: #dbe7f6;
}

.deck-btn:active {
    transform: scale(0.97);
}

.deck-btn .material-symbols-rounded {
    font-size: 22px;
}

.deck-present .material-symbols-rounded {
    font-size: 20px;
}

/* Praesentieren-Modus: nur die Folie zeigen */
.deck.is-presenting .deck-toolbar,
.deck.is-presenting .slide-hint {
    display: none;
}

.deck.is-presenting .slide-object {
    outline: none;
    pointer-events: none;
    cursor: default;
}

/* Nur ansehen (nicht angemeldet): kein Bearbeiten moeglich */
.deck.is-readonly .deck-toolbar {
    display: none;
}

.deck.is-readonly .slide-object {
    outline: none;
    pointer-events: none;
    cursor: default;
}

/* Referenten-Ansicht (beim Praesentieren): Vorschau + Hinweise.
   Das Zuschauer-Fenster zeigt nur die Folie. */
.presenter {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 2px solid #e7eef7;
}

.presenter[hidden] {
    display: none;
}

.presenter-preview {
    flex: 0 0 300px;
}

.presenter-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
}

.presenter-canvas {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(4, 18, 38, 0.35);
}

.presenter-side {
    flex: 1 1 260px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
}

.presenter-hint {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
}

.presenter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.deck-readonly {
    margin-left: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #ffd166;
}

.deck-readonly[hidden] {
    display: none;
}


/* Einblend-Animation beim Laden */
.page {
    animation: fade-in 0.25s ease;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------------------------------------------------------
   Responsiv
   --------------------------------------------------------- */
@media (max-width: 600px) {
    .content {
        padding: 16px;
    }

    .content-inner {
        padding: 22px;
    }

    .menu-label {
        display: none;
    }

    :root {
        --sidebar-width: 70px;
    }
}

/* ---------------------------------------------------------
   Handout: weisses, deutlich kuerzeres Papier (210 mm breit)
   --------------------------------------------------------- */
.content-inner-menu.is-a4 {
    max-width: none;
    width: 210mm;
    min-height: auto;
    padding: 10mm 8mm;
}

/* Papier: kein A4-Hochformat mehr, sondern deutlich kuerzer */
.content-inner-menu.is-a4 .slide-canvas {
    aspect-ratio: auto;
    height: clamp(260px, calc(100vh - 360px), 520px);
    border-radius: 18px;
}

/* Auf dem Handout-Papier soll kein Hilfetext stehen */
.content-inner-menu.is-a4 .slide-hint {
    display: none;
}

/* Beim Handout gibt es keinen Praesentieren-Modus */
.content-inner-menu.is-a4 .deck-present {
    display: none;
}

/* Auf schmalen Bildschirmen nicht breiter als der Viewport */
@media (max-width: 900px) {
    .content-inner-menu.is-a4 {
        width: 100%;
    }
}

/* Beim Drucken nur das Blatt ausgeben */
@media print {
    .sidebar,
    .editor-bar {
        display: none;
    }

    .content {
        padding: 0;
    }

    .content-inner {
        box-shadow: none;
    }
}

