@import "../../../GSMyAdmin/WebRoot/CSS/Colors";
@import "../../../GSMyAdmin/WebRoot/CSS/Sizes";
@import "../../../GSMyAdmin/WebRoot/CSS/Queries";

#tab_FileManagerPlugin_FileManager {
    overflow: initial;
    display: flex;
    flex-direction: column;
}

#TargetDirectoryList {
    height: 500px;
    overflow: auto;
    margin-bottom: 16px;
}

.ace_search {
    button {
        color: black;
        border-radius: 0;
        box-shadow: none;
        min-width: 0;
    }
}

#editorFileWarning {
    display: flex;
    flex-direction: row;
    align-items: center;
    grid-gap: 8px;
    background-color: @EditedAttention;
    padding: 4px 10px;

    &.canImport {
        background-color: @panelActive;
    }
}

#fileManagerHeader {
    z-index: 10;
    overflow: hidden;
}

.fmPathSegment {
    display: inline-block;
    cursor: pointer;
    font-size: 12pt;
    background-color: @panelsBack;
    padding-left: 20px;
    line-height: 32px;
    margin-left: -4px;

    &#editorFilename {
        pointer-events: none;
        display: none;
        background-color: @ItemSelected;
        color: white;

        &::after {
            border-left-color: @ItemSelected;
        }

        &.dirty {
            background-color: @EditedAttention;
            color: white;
        }

        &.dirty::after {
            border-left-color: @EditedAttention
        }
    }

    &::after {
        width: 0;
        height: 0;
        border-top: 16px solid transparent;
        border-bottom: 16px solid transparent;
        border-left: 10px solid @panelsBack;
        content: ' ';
        display: inline-block;
        float: right;
        position: relative;
        left: 10px;
    }

    &:nth-child(even) {
        background-color: @panelsBack + 15%;
    }

    &:nth-child(even)::after {
        border-left-color: @panelsBack + 15%;
    }

    &:hover {
        background-color: @accent;
    }

    &:hover::after {
        border-left-color: @accent;
    }

    &:active {
        background-color: @panelsBack;
    }

    &:active::after {
        border-left-color: @panelsBack;
    }

    &.disabled {
        cursor: default;
        background-color: dimgray;

        &::after {
            border-left-color: dimgray;
        }

        &:nth-child(even) {
            background-color: #444;
        }

        &:nth-child(even)::after {
            border-left-color: #444;
        }

        &:hover {
            background-color: dimgray;
        }

        &:hover::after {
            border-left-color: dimgray;
        }

        &:active {
            background-color: dimgray;
        }

        &:active::after {
            border-left-color: dimgray;
        }
    }
}

#fileManagerList {
    top: 32px;


    &.compact {
        .fileManagerEntry {
            min-height: 0;
            padding: 2px 8px;

            .iconContainer .mat-icon {
                font-size: 18px;
                padding: 0;
            }

            .subIcon {
                display: none;
            }

            .fmEntryContent {
                flex-direction: row;
                align-items: center;
                gap: 12px;
            }

            .fileEntrySubtitle {
                flex-direction: row;
                gap: 8px;
                white-space: nowrap;

                .fmSubtitleModified {
                    display: none;
                }
            }

            .fileEntryKebab {
                font-size: initial;
            }
        }
    }

    &.gridView {
        grid-template-columns: repeat(auto-fill, minmax(320px, 2fr));
        display: grid;
        align-content: start;

        .fileManagerEntry {
            border-bottom: none;
            height: 50px;
        }
    }
}

.fileManagerEntry {
    display: flex;
    align-items: center;
    gap: @halfMargin;
    border-bottom: 1px solid @semiWhite;
    padding: 5px 8px;
    cursor: pointer;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    min-height: 48px;

    .iconContainer {
        position: relative;
        flex-shrink: 0;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .fmMainIcon {
        font-size: 32px;
        padding: 2px;
    }

    .subIcon {
        position: absolute;
        bottom: 5px;
        right: 8px;
        font-size: 16px;
        padding: 2px;

        &.folder {
            bottom: 7px;
        }
    }

    .fmEntryContent {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .fileEntryTitle {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 11pt;
        line-height: 1.3;
    }

    .fileEntrySubtitle {
        font-size: 9.5pt;
        color: @subtitleText;
        display: flex;
        flex-direction: column;
        gap: 1px;
        overflow: hidden;
    }

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

    .fmSubtitleModified {
        font-size: 8.5pt;
        opacity: 0.6;
        white-space: nowrap;
    }

    .fileEntryKebab {
        font-size: 18pt;
        flex-shrink: 0;
        padding: 0 4px;
        opacity: 0.5;
        line-height: 1;

        &:hover {
            opacity: 1;
        }
    }

    &:hover {
        background: @panelHover;

        .fileEntryKebab {
            opacity: 0.8;
        }
    }

    &:active {
        background: @panelActive;
    }

    &.selected {
        background-color: @ItemSelected;
    }

    &.fmIsDirectory {
        .fmMainIcon, .subIcon { color: #f5c542; }
        .fileEntryTitle { font-weight: 500; }
    }

    &.fmIsVirtual {
        .fmMainIcon, .subIcon { color: #4dd0e1; }
    }

    &.fmIsArchive:not(.fmIsDirectory) {
        .fmMainIcon, .subIcon { color: #ff9800; }
    }
}

#fmEmptyState {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 16px;
    color: @subtitleText;
    opacity: 0.6;

    .mat-icon {
        font-size: 48px;
        margin-bottom: 8px;
    }

    p {
        margin: 0;
        font-size: 11pt;
    }
}

#fileManagerInfo {
    top: 32px;

    .fmInfoHeader {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 10px 8px;
        border-bottom: 1px solid @semiWhite;
        margin-bottom: 6px;

        h3 {
            margin: 0;
            line-break: anywhere;
            font-size: 11pt;
            font-weight: 500;
            flex: 1;
            min-width: 0;
        }
    }

    .fmInfoIcon {
        font-size: 36px;
        flex-shrink: 0;
    }

    .fmInfoIcon.fmIsDirectory { color: #f5c542; }
    .fmInfoIcon.fmIsVirtual   { color: #4dd0e1; }
    .fmInfoIcon.fmIsArchive:not(.fmIsDirectory) { color: #ff9800; }

    table {
        width: 100%;
        border-collapse: collapse;
    }

    tr:nth-child(even) {
        background-color: @hintWhite;
    }

    th {
        padding: 5px 8px;
        text-align: left;
        font-weight: normal;
        color: @subtitleText;
        white-space: nowrap;
        width: 1%;
    }

    td {
        padding: 5px 8px;
    }
}


#editorFilenameChanges {
    display: none;
    background-color: @EditedAttention;
    color: white;
    border-radius: 8px;
    padding: 2px 4px 2px 4px;
    margin-left: 16px;
    font-size: 10pt;
    margin-top: 6px;
}

#editorButtons {
    position: absolute;
    top: 0px;
    right: 0px;
    display: none;

    button {
        margin-right: 0;
        float: right;
        box-shadow: none;
        border-radius: 0;
    }
}

#fmDisplaySwitcher {
    float: right;
}

#editorContainer {
    display: none;
    flex-grow: 1;

    #editor {
        height: 100%;
    }
}

.uploadArrow, .uploadOK, .uploadFail {
    font-size: 50pt;
    height: 64px;
    width: 64px;
    text-align: center;
}

.uploadOK {
    color: #00ee00;
}

.uploadFail {
    color: #ee0000;
}

.uploadArrow {
    transform: rotate(-90deg) translate(-4px,-14px);
    animation-duration: 0.5s;
    animation-name: bounce;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}

.uploadAnim {
    border-top: 4px solid white;
    height: 66px;
    width: 66px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 32px;
}

@keyframes bounce {
    from {
        transform: rotate(-90deg) translate(-4px,-14px);
    }

    to {
        transform: rotate(-90deg) translate(-18px,-14px);
    }
}

#fileManagerDropNotice {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #555;
    width: 50%;
    height: 256px;
    text-align: center;
    box-shadow: @darkSemiBlack 0px 8px 8px;
    pointer-events: none;
}
