@font-face {
    font-family: "Varela Round";
    src: url("/Hacktiv8or-Storage/assets/resources/fonts/VarelaRound-Regular.ttf");
}

* {
    margin: 0px;
    padding: 0px;
    text-decoration: none;
    list-style: none;
    font-family: var(--font-family);
}

html, body { height: 100%; }

body {
    background-color: var(--body-bg);
    /* overflow: hidden; */

    > span#auth_fail,
    > span#empty_folder {
        display: none;
        color: var(--item-size-color);
        position: absolute;
        top: 50%; left: 50%; gap: 20px;
        transform: translate(-50%, -50%);
        font-size: var(--item-name-size);
        text-align: center;
        flex-direction: column;
        align-items: center;
    }

    > span#loading_icon {
        position: absolute;
        top: 50%; left: 50%; gap: 10px;
        transform: translate(-50%, -50%);
        color: var(--item-size-color);
        display: none; align-items: center;
        z-index: 110;

        &:not([style*="display: none"]) > svg {
            animation: loadingRotation 2s linear infinite forwards;
        }
    }
}

header {
    background-color: var(--item-bg);
    padding: 15px; z-index: 10;
    display: flex; position: fixed;
    align-items: center;
    width: -webkit-fill-available;
    box-shadow: 0px 10px 10px 0px var(--color-primary);

    > input {
        flex-grow: 1;
        margin: 0px 7px; height: 30px;
        padding: 0px 10px;
        color: var(--font-color);
        border-radius: 1000px;
        border: none; outline: none;
        background-color: var(--color-primary);
    }

    > button {
        background: transparent;
        border: none; margin: 0px 7px;
    }

    > h1#_title {
        display: none;
        color: var(--font-color);
        text-align: center;
        flex-grow: 1;
    }
}

div#main {
    padding: 75px 10px 40px 10px;
    display: grid; grid-gap: 15px;
    grid-template-columns: repeat(auto-fill, minmax(var(--item-minmax-width), 1fr));

    > div.item {
        padding: 15px; border-radius: 10px;
        background-color: var(--item-bg);
        display: flex; cursor: default;
        align-items: center;
        text-wrap: nowrap;

        > i.item_icon { font-size: var(--item-icon-size); }

        > span.item_name {
            margin: 0px 10px 0px 15px;
            font-weight: var(--item-name-weight);
            flex-grow: 1;
            color: var(--item-name-color);
            font-size: var(--item-name-size);
            text-overflow: ellipsis;
            overflow: hidden;
            text-wrap: nowrap;
        }

        > span.item_size {
            font-size: var(--item-size-size);
            color: var(--item-size-color);
        }

        > input.item_name {
            background: transparent;
            border: none; width: 80%;
            outline: none; color: white;
            font-size: 18px; padding-left: 5px;

            &:focus-visible { border-bottom: 1px solid darkgray; }
        }

        &:hover { background-color: var(--item-hover-bg); }

        &.item-new-folder {
            svg.item_icon {
                width: 25px; height: 25px;
                color: white; padding-right: 15px;
            }
        }
    }

    > div.hidden_item { opacity: 0.4; }
}

div.template { display: none; }

footer {
    position: fixed;
    bottom: 0px;
    padding: 3px;
    width: -webkit-fill-available;
    background-color: var(--color-secondary);
    box-shadow: 0px -10px 10px 0px var(--color-primary);
    display: flex;
    color: var(--font-color);
    justify-content: center;

    > span#path {
        display: block;
        text-align: center;
        color: var(--font-color);
    }

    > span#icon {
        display: block;
        text-align: center;
        color: var(--font-color);
        margin-right: 5px;
    }
}

div#file_updown {
    position: absolute;
    top: 50%; left: 50%;
    translate: -50% -50%;
    background: var(--item-hover-bg);
    width: 70%; padding: 50px;
    justify-content: center;
    align-items: center;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    box-shadow: 0px 0px 20px 0px black;
    color: white;
    visibility: hidden;
    z-index: 90;

    > div#updown_files {
        gap: 20px;
        display: flex;
        justify-content: center;
        align-items: center;
        max-width: 100%;

        > h1#updown_filename {
            max-width: 90%;
            text-wrap: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }

    > div#updown_total {
        display: flex;
        height: 20px;
        background: var(--body-bg);
        width: 70%;
        border-radius: 100px;
        margin: 10px;
        overflow: hidden;

        > div#updown_progress {
            width: 0%;
            height: 100%;
            background: var(--font-color);
            border-radius: 100px;
            transition: 0.1s linear;
        }
    }
}

ul.context-menu {
    display: none;
    z-index: 100;
    position: fixed;
    background: var(--color-secondary);
    color: darkgray;
    padding: 5px;
    list-style: none;
    border-radius: 10px;
    width: 150px;
    font-size: 16px;
    box-shadow: 0px 0px 10px 0px black;

    > li {
        padding: 5px 10px;
        border-radius: 5px;
        cursor: default;

        > svg {
            padding-right: 5px;
            position: relative;
            top: 2px;
        }

        &:hover { background: var(--item-hover-bg); }
    }

    > hr {
        margin: 5px 0px; border: none;
        border-bottom: 1px solid gray;
    }
}

div#preview_popup {
    position: absolute;
    visibility: hidden;
    height: 100%; width: 100%;
    z-index: 100; top: 0px;
    background: var(--body-bg);
    color: var(--font-color);

    > div#preview_popup_header {
        display: flex; height: auto;
        padding: 10px 15px;
        box-shadow: 0px 0px 10px 0px black;

        > h2#preview_name {
            flex-grow: 1;
            text-align: center;
            overflow: hidden;
            text-overflow: ellipsis;
            text-wrap: nowrap;
            padding: 0px 10px;
        }

        > button {
            background-color: transparent;
            border: none;
            margin: 0px 8px;
            color: darkgray;
        }
    }

    > div#preview_container {
        position: absolute;
        width: -webkit-fill-available;
        height: -webkit-fill-available;

        > img {
            display: none;
            position: absolute;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            max-height: 100%;
            max-width: 100%;
        }
    }
}

div#login_page {
    color: var(--item-size-color);
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    max-width: 55%;
    /* display: none; */

    > span#login_text {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px; margin: 10px;
    }

    > input#password_input {
        margin: 10px; height: 30px;
        padding: 0px 10px;
        text-align: center;
        color: var(--font-color);
        border-radius: 1000px;
        border: none; outline: none;
        background-color: var(--color-secondary);
        width: -webkit-fill-available;

        &.wrong {
            animation: wrongPasswordShake 0.5s linear 0s 2;
            box-shadow: 0px 0px 7px 0px red;
        }

        &::-ms-reveal { filter: invert(100%); }
    }
}

@keyframes loadingRotation {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
    100% { transform: rotate(360deg); }
}

@keyframes wrongPasswordShake {
    0% { transform: translateX(0px); }
    20% { transform: translateX(5px); }
    40% { transform: translateX(-5px); }
    60% { transform: translateX(5px); }
    80% { transform: translateX(-5px); }
    100% { transform: translateX(0px); }
}