:root {
    --color-active-window: #2b77a0;
    --color-inactive-window: #808080;
    --toolbar-height: 50px;
    --max-page-width: 1000px;
    --tree-le-height: 30px;
    --bg-color: #313e2a;
    --bg-color-out: color-mix(in srgb, color-mix(in srgb, var(--bg-color) 80%, black 20%) 40%, transparent 60%);
    --out-width: 100px;
    --divider: #0002;
    --tree-line-width: 2px;
    --tree-line: var(--tree-line-width) solid #9f9f9f;
    --window-radius: 12px;
    --toolbar-radius: 10px;
    --le-min-width: 150px;
    --win-header-height: 32px;
    --progress-percent: 10%;
}

* {
    margin: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    /*padding: 0;*/

    &::before,
    &::after {
        content: '';
        position: fixed;
        top: 0;
        bottom: 0;
        width: calc((100vw - min(100vw, var(--max-page-width))) / 2);
        z-index: 1100;
        backdrop-filter: blur(8px);
    }

    &::before {
        left: 0;
        background: linear-gradient(to left, var(--bg-color-out) 0px, var(--bg-color) var(--out-width));
    }

    &::after {
        right: 0;
        background: linear-gradient(to right, var(--bg-color-out) 0px, var(--bg-color) var(--out-width));
    }
}

#bgnd-img {
    width: var(--max-page-width);
    margin: 0 auto;
    height: 100%;
    z-index: -1;
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background-image: url('img/bgnd.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
}

#desktop, #toolbar {
    max-width: var(--max-page-width);
    width: 100%;
    box-sizing: border-box;
}

#desktop {
    position: relative;
    height: 100vh;
    padding-bottom: var(--toolbar-height);
    /*overflow: hidden;*/
    user-select: none;

    & > .progress-circle{
        position: absolute;
        /*width: 10px;*/
        /*height: 20px;*/
        left: 4px;
        top: 4px;
    }

    #sse{
        position: absolute;
        right: 0;
        &.htmx-settling{
            width: 10px;
            height: 10px;
            background-color: red;
        }
    }
}

#toolbar {
    position: fixed;
    bottom: 0;
    height: var(--toolbar-height);
    background: darkslategray;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    border-radius: var(--toolbar-radius) var(--toolbar-radius) 0 0;

    .width-handle {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        cursor: ew-resize;
        background: #ffffff08;
        transition: background 0.2s;
        display: flex;
        align-items: center;
        justify-content: center;

        &:hover {
            background: #fff1;
        }

        &:active {
            background: #fff2;
        }

        &::before {
            content: '⋮';
            color: #fff4;
            font-size: 18px;
            font-weight: bold;
        }
    }

    .taskbar-separator {
        width: 2px;
        height: 75%;
        background: #fff1;
    }

    #taskbar-windows {
        display: flex;
        gap: 8px;
        align-items: center;
        flex: 1;
        overflow-x: auto;

        .taskbar-window-item {
            background: #fff1;
            border: none;
            padding: 8px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            display: flex;
            width: 160px;
            align-items: center;
            gap: 8px;
            transition: background 0.2s;
            white-space: nowrap;
            color: white;

            &:hover {
                background: #fff2;
            }

            &.activated {
                background: var(--color-active-window);
            }

            .icon {
                font-size: 16px;
            }

            .title {
                max-width: 150px;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }
    }

    .width-handle-left {
        left: 0;
        border-radius: var(--toolbar-radius) 0 0 0;
    }

    .width-handle-right {
        right: 0;
        border-radius: 0 var(--toolbar-radius) 0 0;
    }
}

body:has(#desktop .window.maximized) .no-maximized-radius {
    border-radius: 0;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.1s, box-shadow 0.1s;

    &:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    &:active {
        transform: translateY(0);
    }
}

.window {
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: absolute;
    border-radius: var(--window-radius); /* for clip of box shadow */
    /*overflow: hidden;*/

    .init{
        width: 100%;
        background-color: white;
        border-radius: 0 0 var(--window-radius) var(--window-radius);

        .progress-circle{
            --sz: 40px;
            width: var(--sz);
            height: var(--sz);
            margin-top: calc(var(--sz) * -.5);
            margin-left: calc(var(--sz) * -.5);
            position: absolute;
            top: 50%;
            left: 50%;
            /*transform: translate(-50%, -50%);*/
        }
    }

    .resize-handle {
        position: absolute;
        bottom: 0;
        right: 0;
        width: 20px;
        height: 20px;
        cursor: nwse-resize;
        border-radius: 0 0 var(--window-radius) 0;
        /*background: linear-gradient(135deg, transparent 50%, var(--color-inactive-window) 50%);*/
        transition: background 0.2s;
        opacity: .1;

        &:hover {
            opacity: 1;
        }
    }

    &.maximized {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: calc(100% - var(--toolbar-height)) !important;
        border-radius: 0;
        box-shadow: none;

        .window-header {
            cursor: default;
            border-radius: 0;
        }

        .resize-handle {
            display: none;
        }
    }

    &.minimized {
        display: none;
    }

    &.activated {
        .window-header, .resize-handle {
            background: var(--color-active-window);
        }

        .resize-handle {
            background: linear-gradient(135deg, transparent 50%, var(--color-active-window) 50%);
        }
    }

    .window-header {
        background: var(--color-inactive-window);
        color: white;
        padding: 0 12px;
        cursor: move;
        display: flex;
        justify-content: space-between;
        align-items: center;
        /*user-select: none;*/
        flex-shrink: 0;
        border-radius: var(--window-radius) var(--window-radius) 0 0;
        height: var(--win-header-height);
        transition: background 0.2s;

        .title {
            font-weight: 600;
            font-size: 14px;
        }

        .window-controls {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .progress-circle{
            position: absolute;
            width: 10px;
            height: 10px;
            left: 4px;
            top: 4px;
        }
    }
}

.window-content {
    /*display: flex;*/
    /*flex: 1;*/
    border-radius: 0 0 var(--window-radius) var(--window-radius);
    /*padding: 8px;*/
    /*overflow: hidden;*/
    /*background: white;*/
    /*flex-direction: column;*/
    min-height: 0; /* Allow flex child to shrink */
}

.window-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;

    &:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

.drag-scroll{
    width: 100%;
    /*left: 0;*/
    /*right: 0;*/
    height: var(--win-header-height);
    position: absolute;
    /*background-color: red;*/
    z-index: -1;

    &:first-child{
        top: calc(-1 * var(--win-header-height));
    }
    &:last-child{
        bottom: calc(-1 * var(--win-header-height));
    }
}

.file-manager-container {
    display: flex;
    width: 100%;
    height: 100%;

    .dir-tree {
        width: 30%;
        min-width: 180px;
        max-width: 260px;
        /*border-right: 1px solid #ccc;*/
        max-height: 100%;
        /*box-sizing: border-box;*/
        /*padding: 8px;*/
        border-radius: 0 0 0 var(--window-radius);
        background-color: #e1e1e1;
        border-right: 3px solid var(--divider);
        position: relative;

        .tree-scroll {
            overflow: auto;
            max-height: 100%;
            padding-right: 10px;

            .le {
                /*
                .dir_size {
                    left: 54px;
                }
                */
                /*display: inline-flex;
                flex-direction: column;*/
                min-width: var(--le-min-width);
                /*vertical-align: top;*/

                .le_in {
                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    height: var(--tree-le-height);
                    /*align-items: stretch;*/
                    /*justify-content: flex-start;*/
                    /*padding: 4px 4px;*/
                    /*justify-items: center;*/

                    .icon {
                        width: 20px;
                        height: 20px;
                        margin-right: 5px;
                    }

                    .title {
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        padding-right: 4px;
                    }

                    .mark {
                        right: 0;
                        width: 20px;
                        height: 16px;
                        padding: 6px;
                    }

                    .exp {
                        visibility: hidden;
                        height: 100%;
                        border-radius: 4px;

                        &:not([data-expanded]) {
                            background-image: url("img/collapsed.png");
                            visibility: inherit;
                        }

                        &[data-expanded=true] {
                            background-image: url("img/expanded.png");
                            visibility: inherit;
                        }

                        z-index: 2;
                        /*transition: background-color 100ms linear;*/

                        &:hover {
                            background-color: rgba(0, 153, 204, 0.5);
                        }

                        &:active {
                            background-color: #ff8800;
                            transition: background-color 0ms linear;
                        }
                    }

                    .title {
                        margin-left: 4px;
                    }
                }

                &[data-active] {
                    background-color: white;
                    min-width: var(--le-min-width);
                    /*&::before {
                        content: '';
                        position: absolute;
                        left: 0;
                        right: 0;
                        top: 0;
                        bottom: 0;
                        border: 2px solid red; !*@activeItemOutlineColor;*!
                    }*/

                    box-shadow: 0 0 5px 2px rgba(0, 0, 0, 0.2);
                    border-radius: 4px;
                    /*border: 1px solid rgba(51, 136, 44, 0.24);*/

                    /*.le:last-child .le_in { !*last child in active block has no separator*!
                        border-bottom: 0;
                    }*/

                    .le_in {
                        border-bottom: 1px solid var(--divider);
                    }
                }

                & > .le_dir,
                &.le_volume {
                    margin-left: 15px; /* tree level indent */
                }

                /* drawing tree lines - two lines from expand mark up to upper entry's expand mark */

                & > &.le_dir .le_in::before,
                & > &.le_volume .le_in::before {
                    content: '';
                    height: var(--tree-le-height);
                    width: calc(var(--tree-le-height) * 0.5);
                    position: absolute;
                    left: 0;
                    bottom: calc(calc(var(--tree-le-height) - var(--tree-line-width)) / 2);
                    border-left: var(--tree-line);
                    border-bottom: var(--tree-line);
                    visibility: visible;
                    /*&.dragged-clone{
                        visibility: hidden;
                    }*/
                }

                /* drawing tree lines - long connections to up */

                &::after {
                    content: '';
                    width: var(--tree-line-width);
                    position: absolute;
                    left: 0;
                    top: calc(var(--tree-le-height) * 0.5);
                    bottom: 15px;
                    border-left: var(--tree-line);
                }

                &:last-child::after {
                    visibility: hidden;
                }

                &:not([data-active]) > .le_in .mark {
                    visibility: hidden;
                    /*background-color: red;*/
                }

                &[data-active] .le_in .mark {
                    visibility: inherit;
                }

                /*& .dragged-clone .le_in::before {
                    visibility: hidden;
                }*/
                /*&.dragged-clone{
                    .le_in::before{
                        visibility: hidden;
                    }
                }*/
            }

            & > .le::after {
                border-left: none;
            }
        }
    }

    .file-list-panel {
        width: 100%;
        /*overflow-y: auto;*/
        height: 100%;
        display: flex;
        flex-direction: column;
        border-radius: 0 0 var(--window-radius) 0;
        /*padding: 8px;*/
        overflow-x: hidden;
        position: relative;
        background: white;
        /*padding: 8px;*/

        .file-list-header {
            background: #f5f5f5;
            margin: 0 5px;
            /*border-radius: 3px;*/
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;

            /*.title {
                font-weight: bold;
                font-size: 11px;
            }*/

            .file-list-info {
                display: flex;
                gap: 4px;
                /*margin-top: 4px;*/
                margin: 5px 0;
                font-size: 12px;
                text-wrap: nowrap;
                color: #444;

                .num_folders::before {
                    content: '📁';
                }

                .num_files::before {
                    content: '📄';
                }

                .num_marked::before {
                    content: '✓';
                }

                .num_hidden::before {
                    content: '👁';
                    color: royalblue;
                }

                * {
                    display: flex;
                    gap: 3px;
                    background: #fff;
                    padding: 2px 4px;
                    border-radius: 2px;
                    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
                }
            }

            .file-upload {
                display: flex;
                align-items: center;
                gap: 4px;
                margin: 1px 0;
                font-size: 11px;
                background: #fff;
                padding: 2px 4px;
                border-radius: 2px;
                box-shadow: 0 1px 3px #0001;

                .upload-icon {
                    font-size: 16px;
                }

                .upload-content {
                    display: flex;
                    flex-direction: column;
                    gap: 1px;
                    min-width: 0;
                    flex: 1;
                    width: 90px;

                    .upload-filename {
                        overflow: hidden;
                        white-space: nowrap;
                        text-overflow: ellipsis;
                    }

                    .upload-progress-bar {
                        position: relative;
                        width: 100%;
                        height: 9px;
                        background: #888;
                        border-radius: 2px;
                        overflow: hidden;

                        .upload-progress-fill {
                            position: absolute;
                            top: 0;
                            left: 0;
                            height: 100%;
                            width: var(--progress-percent, 0%);
                            background: #419344;
                            transition: width .3s ease;
                        }

                        .upload-progress-text {
                            position: absolute;
                            top: 0;
                            left: 0;
                            width: 100%;
                            height: 100%;
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            font-size: 9px;
                            font-weight: 600;
                            color: #fff;
                        }
                    }
                }
            }
        }

        .fm-toolbar {
            flex: none;
            display: flex;
            /*flex-direction: row;*/
            /*align-items: center;*/
            gap: 4px;
            padding: 4px;
            padding-right: 10px;
            overflow-x: auto;
            flex-wrap: nowrap;

            p {
                flex: 1;
            }

            .MARK {
                .icon {
                    filter: grayscale(100%);
                }

                &[data-markstate="SOME"] .icon {
                    filter: sepia(100%) saturate(200%) hue-rotate(0deg) brightness(1);
                }

                &[data-markstate="ALL"] .icon {
                    filter: none;
                }
            }

            .SHOW_HIDDEN {
                &[data-active]::after {
                    content: '';
                    position: absolute;
                    right: 3px;
                    bottom: 3px;
                    width: 5px;
                    height: 5px;
                    background: #0078D4;
                    border-radius: 50%;
                }
            }

            .showHidden:not([enabled]) .icon {
                filter: grayscale(100%);
            }

            /*.in_upload {
                display: none;
            }*/
        }

        .file-list {
            /*border-left: 1px solid var(--divider);*/
            /*position: relative;*/
            overflow: hidden;

            .file-scroll {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
                margin-right: 8px;
                border-top: 1px solid var(--divider);
                overflow-y: auto;
                max-height: 100%;
                box-sizing: border-box;
                padding-right: 12px; /* For scrollbar */
                margin-bottom: 4px; /* For not touching bottom */
                padding-bottom: 8px; /* Virtual space at bottom of items */

                .le {
                    /*width: 100%;*/
                    /*box-sizing: border-box;*/
                    border-right: 1px solid var(--divider);
                    /*margin: 0;*/
                    /*transition: all 1s ease-out;*/

                    .time {
                        color: #666666;
                    }

                    .file_size {
                        right: 4px;
                    }

                    /*~ .break{
                        border-top: 1px solid red;
                    }*/

                    .mark {
                        top: 0;
                        right: 0;
                        width: 30px;
                        height: 24px;
                        padding: 6px;
                    }

                    &[data-marked] .le_in::before {
                        content: '';
                        position: absolute;
                        left: 1px;
                        top: 1px;
                        right: 1px;
                        bottom: 1px;
                        border: 2px solid #f008;
                    }
                }

                .le_in {
                    display: flex;
                    flex-direction: column;
                    align-items: stretch;
                    justify-content: flex-start;
                    padding: 4px 4px;
                }

                .le_dir,
                .le_file {
                    .icon {
                        width: 50px;
                        height: 50px;
                        margin: 0 auto;
                    }
                }

                .le_dir,
                .le_file,
                .le_media {
                    .title {
                        overflow: hidden;
                        left: 4px;
                        right: 4px;
                        /*position: absolute;*/
                        max-width: 100%;
                        text-overflow: ellipsis;
                        white-space: nowrap;
                    }

                    /*.dir_size {
                        left: 6px;
                        bottom: 2px;
                    }*/

                    .exp {
                        background-image: url("img/collapsed.png");
                        position: absolute;
                        left: 4px;
                        top: 10px;
                    }
                }

                .le_file .icon {
                    background-image: url("img/le_unknown.png");
                    width: 50px;
                    height: 50px;
                }

                .le_dir .icon {
                    display: flex;
                    flex-direction: column;
                    justify-content: end;
                    font-size: 9px;
                    color: grey;

                    * {
                        padding-left: 4px;

                        &:last-child {
                            padding-bottom: 6px;
                        }
                    }
                }

                .le_media {
                    .icon {
                        border: 1px inset #aaa8;
                        background: #0003 center no-repeat;
                        /*background-image: url("img/le_unknown.png");*/
                        background-size: contain;
                        width: 100%;
                        /*height: 70px;*/
                        aspect-ratio: 1.6;

                        position: relative;

                        &.htmx-request {
                            &::after {
                                content: '• • •';
                                position: absolute;
                                display: flex;
                                justify-content: center;
                                font-size: 12px;
                                inset: 0;
                                align-items: center;
                                color: lightgray;
                                text-shadow: black 0 0 3px;
                            }
                        }
                    }

                    /*.title {
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        position: absolute;
                        left: 4px;
                        max-width: 100%;
                        bottom: 18px;
                    }*/
                }
            }
        }

        .empty {
            text-align: center;
            padding: 20px;
            color: #999;
        }

        .mid-line {
            /*background: var(--divider);*/
            width: 100%;
            border-bottom: 1px solid var(--divider);
            height: 10px;
            grid-column: 1 / -1;
        }
    }
}

.le {
    position: relative;
    cursor: pointer;
    transition: background-color .3s ease-in;
    will-change: background-color;

    &.htmx-added {
        background-color: rgba(0, 128, 255, .3);
    }

    .le_in {
        width: 100%;

        /*gap: 4px;*/
        box-sizing: border-box;
        position: relative;
        /*height: 30px;*/
        border-bottom: 1px solid var(--divider);
        /*.le[data-active] + & {  !*no entry separator below shadow*!
            border: 0;
        }*/

        /** {
            display: block;
            margin: 0;
            position: relative;
        }*/

        .icon {
            background-size: 100% 100%;
        }

        &:hover {
            border-radius: 3px;
            background-color: rgba(0, 128, 255, 0.23);
            transition: background-color .2s;
        }

        .exp {
            width: 30px;
            height: 30px;
            background: no-repeat center;
            background-size: 10px 10px;
        }

        .mark {
            position: absolute;
            background-image: url("img/check_marker_off.png");
            background-repeat: no-repeat;
            background-origin: content-box;
            background-size: 100% 100%;
            visibility: hidden;
            opacity: 0.5;

            &:hover {
                opacity: 1;
            }
        }

        .progress-container{
            position: absolute;
            width: 12px;
            height: 12px;
            right: 1px;
            bottom: 1px;
            overflow: hidden;
            .progress-circle{
                width: 100%;
                height: 100%;
            }
        }
    }

    &:hover .mark {
        visibility: inherit;
    }

    &[data-marked] .mark {
        visibility: inherit;
        background-image: url("img/check_marker_on.png");
        opacity: 1;
    }

    &[le_hidden] .le_in {
        opacity: 0.5;
    }

    .no_separator {
        border: 0;
    }

    .title {
        font-size: 14px;
    }

    .file_size,
    .time,
    .dir_size {
        font-size: 10px;
        /*position: absolute;*/
        /*bottom: -1px;*/
    }

    .file_size {
        color: #333333;
        font-weight: bold;
        align-self: end;
        /*right: 2px;*/
    }

    /*.dir_size {
        color: #666666;
    }*/

    &.dragged {
        visibility: hidden;
        /*opacity: .1;*/
    }
    /*.dragged.drag-target-invalid {
        cursor: no-drop;
    }*/

    /*.dragged.drag-target-invalid .le_in,
    .dragged.drag-target-invalid .le_in:hover {
        background-color: red;
    }*/
}

/*.dragged-clone::after{
    visibility: hidden;
}*/

.dragged-clone{
    z-index: 1000;
    position: fixed;
    /*background-color: white;*/

    /*box-shadow: 0 2px 12px 2px rgba(0, 0, 0, 0.4);*/
    pointer-events: none;
    opacity: .5;

    .le{
        /*pointer-events: none;*/
        cursor: move;
        /*background-color: rgb(184, 233, 253);*/
        background-color: lightgoldenrodyellow;
        &::before, &::after {
            display: none;
        }
    }

    .le_in, .le{
        /*pointer-events: none;*/
        /*background-color: transparent;*/
        /*&:hover {
            background-color: inherit;
        }*/

        &::before, &::after {
            display: none;
        }
        /*.mark{
            display: none;
        }*/
    }
}

.debug {
    outline: 2px dashed red;
}

/*#title_bar {
    padding: 4px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    position: relative;
    margin: 0 auto;
    .title {
        text-shadow: 2px 2px 3px #222222;
        vertical-align: middle;
        font-size: 24px;
        color: #fff;
        margin: 8px 0 6px 8px;
    }
    .icon {
        width: 32px;
        height: 32px;
        vertical-align: middle;
        margin: 5px;
    }
    .win-but {
        float: right;
        margin-left: 5px;
    }
    .device_name {
        text-shadow: 2px 2px 2px #222222;
        vertical-align: middle;
        font-size: 18px;
        color: #fff;
        margin: 8px 20px 6px 0;
        float: right;
    }
}*/

@keyframes rot360 {
    100% {
        transform: rotate(360deg);
    }
}

/*.but.drag-hover,
.grid_in.drag-hover,
.le_in.drag-hover {
    box-shadow: inset 0 0 0 4px rgba(0, 128, 0, 0.5);
}*/

.le_volume .icon {
    background-image: url("img/le_sdcard.png");
}

.le_dir .icon {
    background-image: url("img/le_folder_x.png");
}

.le_dir, .le_volume {
    &.drop-hover > .le_in{
        background-color: rgba(0, 128, 0, 0.29);
    }
    &.drop-hover-invalid > .le_in{
        background-color: rgba(255, 0, 0, 0.29);
    }
}

.fm-toolbar {
    .win-but {
        width: 32px;
        height: 32px;
        /*float: left;*/
        /*margin-right: 4px;*/

        .icon {
            width: 80%;
            height: 80%;
        }
    }

    .onRight {
        float: right;
    }
}

/*#browser_pane {
    top: 80px;
    border: 1px solid #444444;
    margin: 0;
    border-radius: 8px;
    box-shadow: 2px 2px 5px 2px rgba(0, 0, 0, 0.4);
    background-color: rgba(0, 0, 0, 0.3);
    position: absolute;
    padding: 12px;
     #clear{
        clear: both;
        height: 1px;
        overflow: hidden;
        font-size:0pt;
        margin-top: -1px;
     }

    tr {
        height: 100%;
    }

    td {
        vertical-align: top;
        overflow: hidden;
    }

    .files_pane {
        border: 1px solid #556666;
        box-shadow: 2px 2px 3px 1px rgba(0, 0, 0, 0.4);
        background-color: #aacccc;
    }

    #tree_list {
        height: 100%;
        overflow: auto;
    }

    .drag_scroll {
        position: absolute;
        left: 0;
        width: 260px;
        height: 50px;
    }

    .drag_scroll#up {
        top: -50px;
    }

    .drag_scroll#down {
        bottom: -50px;
    }

    #separator {
        max-width: 12px;
    }

    #grid_list {


        #grid_scroll {
            overflow-y: auto;
            overflow-x: hidden;
        }

        #grid_in {
            width: 524px;
            min-height: 100%;
            overflow: auto;
        }

        .le {
            float: left;
        }
    }

    #read_only {
        position: absolute;
        right: 15px;
        bottom: 2px;
        font-size: 11px;
        color: #eee;
        cursor: default;
    }

    .progress-circle {
        top: 1px;
    }

    .worktable {
        display: none;
        z-index: 5;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 12px;

        #canvas, .fm-toolbar {
            position: absolute;
            left: 0;
            right: 0;
        }

        #canvas {
            bottom: 0;
            top: 45px;
        }

        .fm-toolbar {
            top: 0;
            padding: 6px;
            background-color: #222222;
            border-top: 1px solid #000;
            border-left: 1px solid #000;
            border-bottom: 1px solid #333;
            border-right: 1px solid #333;
            box-sizing: content-box;
            color: #ccc;
            font-size: 12px;

            #info {
                float: left;
                width: 300px;
                height: 100%;

                #name {
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }

                #media_info {
                    margin-top: 4px;
                }
            }

            #controls {
                float: left;
            }
        }
    }

    #media_viewer {
        #canvas {
            background-color: #000;
             &.chessboard{
                 background: url("img/chessboard.png") repeat;
             }

            .canvas {
                background-color: #000;
                position: absolute;
                width: 100%;
                height: 100%;

                .error {
                    color: #f00;
                    text-align: center;
                }

                .error,
                img,
                video {
                    position: absolute;
                    top: 0;
                    bottom: 0;
                    left: 0;
                    right: 0;
                    margin: auto;
                }
            }

            .progress-circle {
                right: 10px;
                top: 10px;
                z-index: 12;
            }
        }

        .fm-toolbar {
            #info #counter {
                float: left;
                margin-right: 10px;
                font-style: italic;
                 position: absolute;
                             left: 5px;
                             top: 4px;
            }

            #controls #next {
                margin-right: 20px;
            }
        }

        &.fullscreen {
            position: fixed;
            margin: 0;

            #canvas {
                top: 0;
            }

            .fm-toolbar {
                opacity: 0;
                background-color: rgba(34, 34, 34, 0.5);
                border: none;
                border-bottom: 1px solid #333;
                transition: opacity 100ms linear;

                &:hover {
                    opacity: 1;
                    transition: opacity 100ms linear;
                }

                #edit_info {
                    margin-left: 20px;
                }

            }
        }
    }

    #text_view {
        &.dirty #edit_info {
            color: #f00;
        }

        #canvas {
            background-color: #fff;
            padding: 4px;
            box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, 0.4) inset;

            .text {
                width: 100%;
                height: 100%;
                background-color: transparent;
                resize: none;
                border: none;
            }
        }
    }
}

.text-no-wrap {
    white-space: pre;
}


.drag-toast {
    position: fixed;
    border-radius: 4px;
    background-color: #fff;
    color: #000;
    border: 1px solid #000;
    padding: 2px 5px;
    z-index: 12;
}
*/

.progress-circle {
    width: 16px;
    height: 16px;
    background-size: 100% 100%;
    background-image: url("img/circle_progress.png");
    visibility: hidden;
    opacity: 0;
    transition: opacity 250ms ease, visibility 250ms ease;

    &.htmx-request {
        animation: rot360 1s linear infinite;
        visibility: visible;
        opacity: 1;
        transition-delay: 250ms;
    }
}

.htmx-request .progress-circle{
    animation: rot360 1s linear infinite;
    visibility: visible;
    opacity: 1;
    transition-delay: 250ms;
}

.but_bgnd,
.win-but {
    cursor: pointer;
    /*user-select: none;*/
    background-color: rgba(0, 153, 204, 0.2);
    transition: background-color 100ms linear;
    border-radius: 3px;
    border: none;
    flex-shrink: 0;

    &:hover {
        background-color: #0099cc;
    }

    &:active {
        background-color: #ff8800;
        transition: background-color 0ms linear;
    }

    &[disabled] {
        background-color: #68686833;
        cursor: default;

        .icon {
            opacity: .5;
        }
    }
}

.win-but {
    width: 40px;
    height: 40px;
    position: relative;

    .icon {
        width: 60%;
        height: 60%;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        margin: auto;
        background-size: 100% 100%;
    }
}

.cover {
    background-color: #000;
    opacity: 0.5;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1200;

    &.htmx-request {
        opacity: 0.6;
    }
}

/*#menu {
    #submenu {
        background-color: #eeeeee;
        position: absolute;
        top: 39px;
        right: 0;
        font-size: 16px;
        color: #000000;

        p {
            margin: 0;
            padding: 5px 15px 5px 25px;
            border-top: 1px solid #d6d6d6;
            white-space: nowrap;

            &:first-child {
                border-top: 0;
            }

            &:hover {
                background-color: #111111;
                color: #ffffff;
            }

            * {
                vertical-align: middle;
            }

            img {
                width: 16px;
                height: 16px;
                margin: 0 5px 0 -20px;
            }

            &[type=checkbox] {
                width: 22px;
                height: 18px;
                display: inline-block;
                background-image: url("img/check_marker_off.png");
                background-size: 100% 100%;
                margin: 0 -10px 0 10px;

                &[checked] {
                    background-image: url("img/check_marker_on.png");
                }
            }
        }
    }
}*/

.dlg {
    min-width: 240px;
    position: fixed;
    border: 1px solid #cccccc;
    margin: 0;
    border-radius: 8px;
    box-shadow: 2px 2px 5px 2px rgba(0, 0, 0, 0.4);
    background-color: #ffffff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    z-index: 1201;
    /*padding-bottom: 20px;*/

    .title {
        display: flex;
        padding: 8px;
        border-bottom: 1px solid #e6e6e6;

        .icon {
            width: 24px;
            height: 24px;
            float: left;
            background-size: 100% 100%;
            vertical-align: middle;
            margin-right: 10px;
        }

        .text {
            text-shadow: 2px 2px 4px #808080;
            vertical-align: middle;
            font-size: 18px;
            color: #000000;
        }

        .progress-circle {
            margin-left: auto;
        }
    }

    .in {
        margin: 5px 20px;
        color: #000000;
        font-size: 14px;

        .msg {
            margin: 10px 0;
        }

        input[type=text]{
            width: 100%;
            box-sizing: border-box;
            padding: 6px;
            font-size: 14px;
        }
    }

    .error {
        margin-top: 5px;
        color: darkred;
        font-size: 12px;

        &:empty::before {
            content: '\00A0';
        }
    }

    fieldSet {
        border: none;
        padding: 0;
        margin: 0;
        min-width: 0;
    }

    .buttons {
        display: flex;
        margin: 20px 0;
        gap: 10px;
        justify-content: right;

        button, input {
            background: #444;
            color: white;
            border: none;
            padding: 8px 4px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
            transition: transform 0.1s, box-shadow 0.1s;
            min-width: 80px;

            &:not(:disabled) {
                &:hover {
                    transform: translateY(-1px);
                    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
                }

                &:active {
                    transform: translateY(0);
                }
            }

            &:disabled {
                opacity: .5;
                cursor: default;
            }
        }
    }
}

/*
#dlgEnterName,
#dlgCancelable {
    min-width: 240px;

    .text {
        width: 100%;
    }
}

#dlgCancelable {
    width: 320px;

    .msg {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

#bottom_bar {
    #info_line {
        .in {
            text-shadow: 1px 1px 1px #222;
            color: #fff;
            padding: 5px 10px;
            background-color: rgba(0, 0, 0, 0.3);
            border-radius: 8px;
            border: 1px solid #444;

            .icon {
                width: 16px;
                height: 16px;
                background-size: 100% 100%;
                margin-right: 5px;
                background-image: url("img/op_news.png");

                &[err='1'] {
                    background-image: url("img/ic_error.png");
                }
            }

            .msg {
                vertical-align: middle;
            }
        }

        * {
            float: left;
        }
    }

    #uploads {
        width: 45%;
        color: #000000;
        padding: 5px 22px 5px 10px;
        background-color: #cadfdf;
        border-radius: 8px;
        border: 1px solid #444;

        .title {
            text-shadow: 1px 1px 2px #222222;
            vertical-align: middle;
            font-size: 16px;
            margin-bottom: 8px;
        }

        #queue {
            clear: both;
            position: relative;
            margin-bottom: 10px;
            border-bottom: 2px groove rgba(204, 204, 204, 0.3);

            .title {
                cursor: pointer;
            }

            .in {
                max-height: 300px;
                overflow: auto;

                .file {
                    margin: 2px 0;
                    border-bottom: 1px solid rgba(128, 128, 128, 0.2);
                }
            }

            #cancel_all {
                width: 200px;
                left: 0;
                right: 0;
                margin: 4px auto;

                div {
                    font-size: 18px;
                    text-align: center;
                    vertical-align: middle;
                }

                &:hover {
                    color: #ffffff;
                }
            }

            #remain_time {
                position: absolute;
                bottom: 8px;
                right: 0;
            }
        }

        #counter {
            float: left;
            margin: 0 8px 0 4px;
            font-weight: bold;
            color: #3d4343;
            margin-top: 2px;
        }

        .file {
            height: 20px;

            &:hover {
                border-radius: 2px;
                background-color: #ffffff;
            }

            #cancel {
                float: right;
                width: 18px;
                height: 18px;
                margin: 1px 1px 0 0;

                .icon {
                    width: 80%;
                    height: 80%;
                    background-image: url("img/ic_close.png");
                }
            }

            #size {
                float: right;
                margin-right: 5px;
                padding-top: 2px;
                font-style: italic;
            }

            #name {
                margin-left: 5px;
                padding-top: 2px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }

        #progress {
            position: relative;
            float: right;
            width: 100px;
            height: 16px;
            margin: 1px 2px 0 8px;

            #bar {
                position: absolute;
                left: 0;
                right: 0;
                top: 0;
                height: 6px;
                background-color: #a2b3b3;
                border: 1px inset rgba(202, 223, 223, 0.5);

                #pos {
                    width: 70%;
                    height: 100%;
                    background-color: #f80;
                }

                &, #pos {
                    box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.4) inset;
                }
            }

            #percent, #stat {
                position: absolute;
                bottom: -4px;
                font-size: 10px;
            }

            #percent {
                left: 0;
            }

            #stat {
                right: 0;
            }
        }

        .progress-circle {
            right: 7px;
            bottom: 10px;
        }
    }
}

#dlgAudioPlay {
    width: 500px;

    .title .but {
        float: right;
        width: 32px;
        height: 32px;
        top: -4px;
        background-color: rgba(0, 0, 0, 0);

        &:hover {
            background-color: #0099cc;
        }
    }

    .in {
        #counter {
            margin-right: 8px;
            font-weight: bold;
            color: rgba(0, 0, 0, 0.7);
        }

        #name {
            width: 100%;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        audio {
            width: 100%;
            margin-top: 10px;
        }
    }

    .fm-toolbar {
        top: 0;
        padding: 4px;

        #close .icon {
            background-image: url("img/ic_close.png");
        }

        .checkbox {
            .icon {
                height: 50%;
                top: -8px;
            }

            &::after {
                content: '';
                position: absolute;
                left: 10%;
                right: 10%;
                top: 70%;
                bottom: 10%;
                border-radius: 5px;
                border: 1px solid #aaa;
                background-color: #ccc;
            }

            &[checked]::after {
                background-color: #0c0;
            }
        }
    }
}

*/
#popup {
    overflow: hidden;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    position: absolute;
    border-radius: 4px;

    z-index: 1201;
    outline: none;

    .title {
        color: white;
        padding: 5px 10px;
        background-color: var(--color-active-window);
        position: relative;
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .item {
        background: white;
        display: flex;
        gap: 8px;
        cursor: pointer;
        padding: 5px 10px;
        border-top: 1px solid #d6d6d6;
        white-space: nowrap;

        &:first-of-type {
            border-top: none;
        }

        &:hover {
            background-color: lightgray;
        }

        &:focus {
            background-color: #99ddf7;
            outline: none;
        }

        img {
            width: 20px;
            height: 20px;
        }

        .text {
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .char-icon{
            width: 20px;
            font-size: 18px;
        }
    }
}

.error-message {
    position: fixed;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    border: 2px solid indianred;
    border-radius: 4px;
    padding: 8px 12px;
    color: darkred;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 13000;
    min-width: 200px;
    max-width: 600px;
    text-align: center;
    font-size: 14px;
    /*animation: slideDownAndFadeOut 3s ease-out forwards;*/
}

@keyframes slideDownAndFadeOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    10%, 90% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

#connection-lost-overlay {
    visibility: hidden;
    /*display: none;*/
    /*display: flex;*/
    position: fixed;
    margin: 4px 10px;
    padding: 2px 10px;
    background: #0008;
    border-radius: 18px;
    color: white;
    z-index: 9999;
    font-size: 12px;
    pointer-events: none;
}

body.sse-error #connection-lost-overlay {
    visibility: visible;
}
