/*
xleb - web-based remote file manager
Copyright (C) 2024  bitrate16

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/


/* Root elements */

:root {
    --font: 'Courier New', Courier, monospace;
    --font-size: 0.9rem;
    --white: #FFFFFF;
    --black: #000000;
    --dirty: #f1f1f1;
    --red: #d76767;
    --green: #76d767;
    --yellow: #d7d367;
    --blue: #676DD7;
    --light-blue: #a1a4d9;
    --input-radius: 0.25rem;
    --input-padding: 0.25rem;
    --item-padding: 0.25rem;
    --item-attr-padding: 0.25rem;
    --progress-popup-radius: 1rem;
    --gap: 0.25rem;
}

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

* {
    box-sizing: border-box;
}

.vertical {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.horisontal {
    display: flex;
    flex-direction: row;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.gap {
    gap: var(--gap);
}


/* Element-specific */

.fine-input {
    border: none;
    border-radius: var(--input-radius);
    padding: var(--input-padding);

    background-color: var(--dirty);

    font-family: var(--font);
    font-size: var(--font-size);
    line-height: 1;
    height: calc(var(--font-size) + 2 * var(--input-padding));
}

.fine-button {
    border: thin solid var(--blue);
    border-radius: var(--input-radius);
    padding: var(--input-padding);

    background-color: var(--blue);
    color: var(--white);

    cursor: pointer;

    font-family: var(--font);
    font-size: var(--font-size);
    line-height: 1;
    height: calc(var(--font-size) + 2 * var(--input-padding));
}

.fine-button.red {
    border: thin solid var(--red);

    background-color: var(--red);
}

.fine-button.green {
    border: thin solid var(--green);

    background-color: var(--green);
}

.fine-button:hover {
    opacity: 0.8;
}

.fine-button:active {
    opacity: 1.0;
    color: var(--blue);
    background-color: var(--white);
}

.fine-button.red:active {
    color: var(--red);
    background-color: var(--white);
}

.fine-button.green:active {
    color: var(--green);
    background-color: var(--white);
}


/* auth page only */

.auth-title {
    padding: 0.25rem;
    margin: 0 0 1rem 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    text-align: center;
}


/* index page only */

.file-list {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    justify-content: center;

    gap: var(--gap);
}

.file-list > .item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: var(--gap);
    width: 100%;

    padding: var(--item-padding)
}

.file-list > .item:nth-of-type(2n) {
    background-color: var(--dirty)
}

.file-list > .item > * {
    border-radius: var(--input-radius);

    padding: var(--item-attr-padding);

    font-family: var(--font);
    font-size: var(--font-size);
    line-height: 1;
    height: calc(var(--font-size) + 2 * var(--item-attr-padding));
}

.file-list > .item > .type.file {
    border: thin solid var(--red);
    padding: var(--input-padding);

    background-color: var(--red);
}

.file-list > .item > .type.dir {
    border: thin solid var(--blue);

    background-color: var(--blue);
}

.file-list > .item > .type.nav {
    border: thin solid var(--yellow);

    background-color: var(--yellow);
}

.file-list > .item > .name {
    border: thin solid var(--blue);

    background-color: var(--white);

    text-decoration: none;

    color: var(--black);
}

.file-list > .item > .size {
    border: thin solid var(--blue);

    background-color: var(--white);

    text-decoration: none;
}

.file-list > .item > .move {
    margin-left: auto;
}

.file-list > .item > .delete {
}

.file-list > .item > .upload {
    margin-left: auto;
}

.file-list > .item > .mkdir {
}


/* Progress popup */

.progress-popup {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;

    background-color: #0007;
}

.progress-popup > .content {
    width: 10rem;
    height: 10rem;

    position: relative;

    top: calc(50% - 5rem);
    left: calc(50% - 5rem);

    border-radius: var(--progress-popup-radius);
    background-color: var(--white);
}

.progress-popup > .content .text {

    font-family: var(--font);
    font-size: var(--font-size);
    line-height: 1;
    height: calc(var(--font-size) + 2 * var(--input-padding));
}

@keyframes spinner {
    0% {
        transform: translate3d(-50%, -50%, 0) rotate(0deg);
    }
    100% {
        transform: translate3d(-50%, -50%, 0) rotate(360deg);
    }
}

.spinner {
    position: relative;

    width: 4rem;
    height: 4rem;
}

.spinner::before {
    animation: 1.5s linear infinite spinner;
    animation-play-state: inherit;
    border: solid 0.5rem var(--dirty);
    border-bottom-color: var(--blue);
    border-radius: 50%;
    content: "";
    height: 2rem;
    width: 2rem;
    position: absolute;
    top: 2rem;
    left: 2rem;
    transform: translate3d(-50%, -50%, 0);
    will-change: transform;
}