html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.app-toolbar .toolbar-btn {
    margin-right: 6px;
    margin-top: 4px;
    margin-bottom: 4px;
}

#languageDropdown.toolbar-btn {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0.2rem;
}

#languageDropdown.toolbar-btn:hover,
#languageDropdown.toolbar-btn:focus {
    color: #fff;
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.1);
}

@media (max-width: 767.98px) {
    
    .app-toolbar .navbar-nav,
    .app-toolbar .nav-item {
        width: 100%;
    }

    .app-toolbar .toolbar-btn,
    #languageDropdown.toolbar-btn {
        display: block;
        width: 100%;
        margin: 2px 0;
    }

    .app-toolbar .dropdown-menu {
        width: 100%;
    }
}

.app-current-file {
    font-style: italic;
    opacity: 0.85;
}

.app-status-bar {
    min-height: 28px;
    padding: 4px 16px;
    font-size: 0.9rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.app-toast-container {
    position: fixed;
    top: 90px;
    right: 16px;
    left: 16px;
    z-index: 1080; 
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none; 
}

.app-toast-container .toast {
    pointer-events: auto;
    
    flex: 0 0 auto;
    max-width: 350px;
    width: 100%;
}

@media (max-width: 480px) {
    .app-toast-container {
        top: 60px;
        left: 8px;
        right: 8px;
    }

    .app-toast-container .toast {
        max-width: none;
    }
}

.app-main-area {
    flex: 1 1 auto;
    overflow: hidden;
    padding: 0;
}

.app-main-area .row {
    height: 100%;
    margin: 0;
}

.app-tree-panel {
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid #dee2e6;
    background-color: #fbfbfb;
    padding: 10px;
}

.app-editor-panel {
    height: 100%;
    overflow-y: auto;
    padding: 10px;
}

@media (max-width: 767.98px) {
    
    .app-main-area .row {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .app-tree-panel {
        flex: 0 0 auto;
        max-height: 40vh;
        overflow-y: auto;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }

    .app-editor-panel {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }
}

.notes-tree-widget {
    height: 100%;
}

.tree-toolbar {
    margin-bottom: 8px;
}

.tree-root,
.tree-children {
    list-style: none;
    margin: 0;
    padding-left: 18px;
}

.tree-root {
    padding-left: 0;
    min-height: 60px;
}

.tree-node-row {
    display: flex;
    align-items: center;
    padding: 3px 4px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}

.tree-node-row:hover {
    background-color: #eef3f8;
}

.tree-node-row.selected {
    background-color: #d3e6fb;
}

.tree-node-row.drag-over {
    outline: 2px dashed #007bff;
    outline-offset: -2px;
}

.tree-node.dragging > .tree-node-row {
    opacity: 0.4;
}

.tree-toggle {
    width: 16px;
    flex: 0 0 16px;
    text-align: center;
    color: #6c757d;
}

.tree-label {
    flex: 1 1 auto;
    padding: 0 4px;
    outline: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-label.editing {
    background-color: #fff;
    box-shadow: inset 0 0 0 1px #007bff;
    white-space: normal;
}

.tree-node-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.1s;
}

.tree-node-row:hover .tree-node-actions {
    opacity: 1;
}

.tree-btn {
    border: none;
    background: transparent;
    color: #6c757d;
    line-height: 1;
    padding: 2px 5px;
    font-size: 0.85rem;
    border-radius: 3px;
}

.tree-btn:hover {
    background-color: #dee6ee;
    color: #212529;
}

.tree-btn-delete:hover {
    color: #dc3545;
}

.tree-mobile-inner {
    padding: 4px 0;
}

.tree-combo-levels select {
    display: block;
}

.tree-mobile-actions .btn {
    margin: 2px 4px 2px 0;
    
    min-width: 44px;
    font-size: 1.15rem;
    line-height: 1;
    padding-top: 6px;
    padding-bottom: 6px;
}

.rich-editor-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 8px;
}

.rich-editor-btn {
    min-width: 34px;
}

.rich-editor-fontsize {
    width: auto;
    min-width: 72px;
}

.rich-editor-content {
    flex: 1 1 auto;
    min-height: 250px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    overflow-y: auto;
}

.rich-editor-content:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: none;
}

.rich-editor-disabled .rich-editor-content {
    background-color: #f8f9fa;
    color: #adb5bd;
}
