@import "../../../../css/static/mixin";
@import "../../../../css/static/properties";

html:root {
    --modal-transfer-refresh-hover: #ffffff0e;
    --modal-transfer-path-hover: #E6E6E6;

    --modal-transfer-error-overlay-text: #9e9494;

    --modal-transfer-filelist: #28292b;
    --modal-transfer-filelist-border: #161616;

    --modal-transfer-entry-hover: #2c2d2f;
    --modal-transfer-entry-selected: #1a1a1b;

    --modal-transfer-indicator-red: #a10000;
    --modal-transfer-indicator-red-end: #e60000;

    --modal-transfer-indicator-blue: #005fa1;
    --modal-transfer-indicator-blue-end: #007acc;

    --modal-transfer-indicator-green: #389738;
    --modal-transfer-indicator-green-end: #4ecc4e;

    --modal-transfer-indicator-hidden: #28292b00;
    --modal-transfer-indicator-hidden-end: #28292b00;
}

.container {
    position: relative;
    padding: 1em 1em 4em; /* 4em for the transfer info */

    display: flex;
    flex-direction: column;
    justify-content: stretch;

    flex-shrink: 1;
    flex-grow: 1;

    width: 90em;
    min-width: 10em;
    max-width: 100%;

    height: 55em;
    max-height: 100%;
    min-height: 10em;
}

.arrow {
    width: 1em;

    flex-shrink: 0;
    flex-grow: 0;

    display: flex;
    flex-direction: column;
    justify-content: center;

    .inner {
        flex-grow: 0;
        flex-shrink: 0;

        align-self: center;
        margin-left: -.09em;

        transform: rotate(-45deg);
        -webkit-transform: rotate(-45deg);

        display: inline-block;
        border: solid var(--text);

        border-width: 0 0.125em 0.125em 0;
        padding: 0.15em;

        height: 0.15em;
        width: .15em;
    }
}

.navigation {
    flex-grow: 0;
    flex-shrink: 0;

    .containerIcon {
        margin: auto .25em;
        padding: .2em;

        display: flex;
        flex-direction: column;
        justify-content: center;

        cursor: pointer;

        > div {
            padding: .1em;
        }
    }

    .refreshIcon {
        border-radius: 1px;

        @include transition(background-color $button_hover_animation_time ease-in-out);

        > div {
            padding: .1em;
        }

        &.enabled {
            cursor: pointer;

            &:hover {
                background-color: var(--modal-transfer-refresh-hover);
            }
        }
    }

    .directoryIcon {
        margin-right: -.25em;
    }

    input {
        margin-left: .5em;
    }

    .containerPath {
        @include user-select(none);

        display: flex;
        flex-direction: row;
        justify-content: flex-start;

        overflow: hidden;
        white-space: nowrap;

        width: calc(100% - 1em); /* some space for the text editing */

        a.pathShrink {
            flex-shrink: 1;
            min-width: 5em;

            @include text-dotdotdot();
        }

        a {
            cursor: pointer;

            @include transition(color $button_hover_animation_time ease-in-out);

            &:hover, &.hovered {
                color: var(--modal-transfer-path-hover);
            }
        }
    }
}

.fileTable {
    min-height: 5em;

    flex-grow: 1;
    flex-shrink: 1;

    border: 1px var(--modal-transfer-filelist-border) solid;
    border-radius: 0.2em;
    background-color: var(--modal-transfer-filelist);

    .header {
        z-index: 1;
        padding-top: .2em;
        padding-bottom: .2em;

        background-color: var(--modal-transfer-filelist);

        .columnName, .columnSize, .columnType, .columnChanged {
            position: relative;

            display: flex;
            flex-direction: row;
            justify-content: center;

            .separator {
                position: absolute;
                right: .2em;
                top: .2em;
                bottom: .2em;

                width: .1em;
                background-color: var(--text);
            }
        }

        .columnSize {
            width: 8em;
            text-align: end;
        }

        .columnName {
            padding-left: .5em;
        }

        > div:last-of-type {
            .separator {
                display: none;
            }
        }
    }

    .body {
        @include user-select(none);
        @include chat-scrollbar-vertical();

        .columnName {
            padding-left: .5em;

            display: flex;
            flex-direction: row;
            justify-content: flex-start;

            a, div, img {
                align-self: center;
                margin-right: .5em;

                @include text-dotdotdot();
            }

            img, div {
                flex-shrink: 0;

                height: 1em;
                width: 1em;
            }

            input {
                height: 1.3em;
                align-self: center;

                flex-grow: 1;
                margin-right: .5em;

                border-style: inherit;
                padding: .1em;
            }
        }

        .overlay {
            position: absolute;

            top: 0;
            left: 0;
            right: 0;
            bottom: 0;

            display: flex;
            flex-direction: column;
            justify-content: center;

            a {
                text-align: center;
            }
        }

        .overlayError {
            a {
                font-size: 1.2em;
                color: var(--modal-transfer-error-overlay-text);
            }
        }

        .overlayEmptyFolder {
            align-self: center;
            margin-top: 1em;
        }

        .directoryEntry {
            cursor: pointer;

            &:hover {
                background-color: var(--modal-transfer-entry-hover);
            }

            &.selected {
                background-color: var(--modal-transfer-entry-selected);
            }

            /* drag hovered overrides selected */
            &.hovered {
                background-color: var(--modal-transfer-entry-hover);
            }

            $indicator_transform_time: .5s;

            .indicator {
                position: absolute;

                left: 0;
                right: 30%;
                top: 0;
                bottom: 0;

                opacity: .4;
                margin-right: 10px; /* for the gradient at the end */

                .status {
                    position: absolute;

                    left: 0;
                    top: 0;
                    bottom: 0;

                    width: 2px;
                    @include transition(all $indicator_transform_time ease-in-out);
                }

                &:after {
                    content: ' ';

                    position: absolute;

                    top: 0;
                    right: 0;
                    bottom: 0;

                    height: 100%;
                    width: 10px;

                    background-image: linear-gradient(to right, var(--modal-transfer-filelist), var(--modal-transfer-filelist));
                    @include transition(all $indicator_transform_time ease-in-out);
                }

                @include transition(all $indicator_transform_time ease-in-out);

                @mixin define-indicator($color, $colorLight) {
                    background-color: $color;

                    .status {
                        background-color: $colorLight;

                        -webkit-box-shadow: 0 0 12px 3px $colorLight;
                        -moz-box-shadow: 0 0 12px 3px $colorLight;
                        box-shadow: 0 0 12px 3px $colorLight;
                    }

                    &:after {
                        background-image: linear-gradient(to right, $color, var(--modal-transfer-filelist));
                    }
                }

                &.red {
                    @include define-indicator(var(--modal-transfer-indicator-red), var(--modal-transfer-indicator-red-end));
                }

                &.blue {
                    @include define-indicator(var(--modal-transfer-indicator-blue), var(--modal-transfer-indicator-blue-end));
                }

                &.green {
                    @include define-indicator(var(--modal-transfer-indicator-green), var(--modal-transfer-indicator-green-end));
                }

                &.hidden {
                    @include define-indicator(var(--modal-transfer-indicator-hidden), var(--modal-transfer-indicator-hidden-end));
                }
            }
        }
    }

    .columnSize {
        text-align: end;

        a {
            margin-right: 1em;
        }
    }

    .columnType {
        text-align: center;
    }
}