html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: sans-serif;
    overflow: hidden;

    /* Standard-Werte (iPad / kleiner Laptop) */
    --base-font-size: 14px;
    --tree-item-padding: 6px 10px;
    --sidebar-width: 280px;
    --header-padding: 15px;
}

/* SMARTBOARD OPTIMIERUNG:
   Ab 1200px Breite (typische Desktop/Smartboard Auflösung)
   skalieren wir die UI-Elemente hoch */
@media (min-width: 1200px) {

    html,
    body {
        --base-font-size: 18px !important;
        /* Größere Schrift */
        --tree-item-padding: 10px 14px !important;
        /* Mehr Platz für Touch */
        --sidebar-width: 340px !important;
        /* Breitere Sidebar */
        --header-padding: 20px !important;
    }
}

#app-wrapper {
    width: 100%;
    height: 100%;
    /* Zoom/Transform origin oben links */
    transform-origin: top left;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: #2d3748;
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-left 0.3s ease, width 0.3s ease;
    font-size: var(--base-font-size);
}

.sidebar.hidden {
    margin-left: calc(var(--sidebar-width) * -1);
}

.sidebar-header {
    padding: 15px;
    background: #1a202c;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
}

.sidebar-show-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 100;
    background: #2d3748;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 20px;
}

.sidebar-actions {
    padding: 10px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    border-bottom: 1px solid #4a5568;
}

.sidebar-actions button {
    font-size: 12px;
    padding: 5px 8px;
    cursor: pointer;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.file-tree,
.file-tree ul {
    list-style: none;
    padding-left: 15px;
    margin: 0;
    /* Dropzone Optimierung: Margin am Ende, um darunter zu droppen (Sibling) */
    padding-bottom: 5px;
    margin-bottom: 20px;
}

/* Nested lists border und padding adjustment */
.file-tree ul {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    /* Dezente Linie */
    margin-left: 5px;
    padding-top: 2px;
}

.file-tree {
    padding-left: 0;
}

.tree-item {
    margin-bottom: 2px;
}

.tree-item-content {
    display: flex;
    align-items: center;
    padding: var(--tree-item-padding);
    cursor: pointer;
    border-radius: 4px;
}

.tree-item-content:hover {
    background-color: #4a5568;
}

.tree-item-content.active {
    background-color: #3182ce;
    color: white;
}

/* Custom Drag Ghost: Soll wie eine Linie aussehen */
.sortable-ghost-custom {
    height: 4px;
    background-color: #3182ce;
    overflow: hidden;
    padding: 0 !important;
    margin: 2px 0;
    opacity: 1;
    border-radius: 2px;
}

.sortable-ghost-custom * {
    display: none;
    /* Inhalt verstecken, nur Balken zeigen */
}

.tree-toggle {
    display: inline-block;
    width: 20px;
    text-align: center;
    cursor: pointer;
    margin-right: 5px;
    font-size: 10px;
}

.folder-icon::before {
    content: "📁 ";
    margin-right: 5px;
}

.doc-icon::before {
    content: "📄 ";
    margin-right: 5px;
}

/* **NEU: Lösch-Button Styling** */
/* **NEU: Action-Buttons (Delete / Rename)** */
.action-btn {
    margin-left: 5px;
    padding: 2px 4px;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 3px;
    color: #ccc;
}

.action-btn:hover {
    background-color: #4a5568;
    color: white;
}

.delete-btn:hover {
    background-color: #ff4444;
}

.rename-btn:hover {
    background-color: #3182ce;
}

/* Delete Button soll ganz rechts sein, Rename davor? margin-left: auto beim ERSTEN Button */
/* Wir machen Rename als erstes. Also muss Rename margin-left: auto haben */
.rename-btn {
    margin-left: auto;
}

.tree-item-content:hover .action-btn {
    opacity: 1;
}

/* --- EDITOR --- */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    min-width: 0;
    position: relative;
}

/*
HIER: Titel-Abstand deutlich erhöht (70px padding-left).
Das sorgt dafür, dass der Button (der ca 40-50px breit ist)
den Text nicht verdeckt.
*/
#current-doc-title {
    margin: 0;
    padding: 15px 20px;
    padding-left: 70px !important;
    /* Deutlich mehr Abstand links */
    background: #f3f4f6;
    border-bottom: 1px solid #ddd;
    font-size: 1.2rem;
    color: #333;
}

.editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.tox-tinymce {
    flex: 1;
    border: none !important;
}

/* --- ZOOM CONTROLS --- */
.zoom-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
}

.zoom-wrapper-label {
    font-size: 10px;
    color: #666;
    margin-bottom: 2px;
    text-transform: uppercase;
    font-weight: bold;
    text-align: center;
}

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

.zoom-btn {
    width: 40px;
    height: 40px;
    font-size: 24px;
    font-weight: bold;
    color: #555;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.zoom-btn.small-btn {
    width: 32px;
    height: 32px;
    font-size: 18px;
}

.zoom-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.zoom-btn:active {
    background: #e0e0e0;
}

/* --- GLOBAL SCALE CONTROLS (Top Right) --- */
.global-scale-controls {
    position: fixed;
    /* Fixed damit es nicht mitzoomt */
    top: 15px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    /* Sehr hoch, über allem */
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 1px solid #ccc;
}

.scale-label {
    font-size: 12px;
    font-weight: bold;
    color: #444;
    margin-right: 4px;
}

/* Auf Smartboards Zoom-Buttons noch etwas größer machen */
@media (min-width: 1200px) {
    .zoom-btn {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }

    .zoom-btn.small-btn {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    .scale-label {
        font-size: 14px;
    }

    .zoom-wrapper-label {
        font-size: 12px;
    }
}