:root {
    --final-max-height: 500px;
    --input-primary-color: #744eb5;
    --background-focus-color: #00000011;
    --hover-color: #aab4bd48;
}

body {
    padding-top: 0px;
    margin: 0px;
    background-color: white;
    width: 100vw;
    height: 100vh;
}



/******* ここからメインエリアのスタイル ********/
main {
    text-align: center;
}

#header {
    background-color: transparent;
    box-shadow: none;
    padding-left: 10px;

    .app-title {
        h1 {
            color: var(--font-color);
        }
    }
}

.action-menu {
    background-color: transparent;
    position: fixed;
    width: 230px;
    height: calc(100vh - 60px);
    backdrop-filter: none;
    box-sizing: border-box;
    top: 60px;
    left: 0;
    display: flex;
    justify-content: start;
    flex-direction: column;
    padding-top: 30px;
    overflow: auto;

    >div {
        display: flex;
        justify-content: start;
        flex-direction: column;

        >p {
            padding-left: 20px;
            user-select: none;
        }

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

            p {
                text-align: center;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }
    }

    &.closing {
        animation: fadeOut 0.2s ease-out forwards;
    }
}

.main-view {
    background-color: #fafafa;
    position: relative;
    width: calc(100vw - 250px);
    height: calc(100vh - 80px);
    backdrop-filter: none;
    box-sizing: border-box;
    top: 60px;
    left: 230px;
    display: flex;
    justify-content: start;
    flex-direction: column;
    padding-top: 0px;
    border-radius: 15px;
    overflow: hidden;

    .progress {
        min-height: 8px;
    }

    .view-header {
        margin-top: 10px;
        min-height: 60px;
        padding-left: 10px;
        padding-right: 10px;
        display: flex;
        flex-direction: row;
        justify-content: start;
        align-items: center;

        .file-path {
            flex-grow: 1;

            .text-btn {
                font-size: x-large;
                margin: 0px;
                padding-left: 10px;
                padding-right: 10px;
                font-weight: 400;

                p {
                    color: var(--sub-font-color);
                }
            }

            .text-btn.selected {
                font-weight: 500;

                p {
                    color: var(--font-color);
                }
            }

            display: flex;
            flex-direction: row;
            justify-content: start;
            align-items: center;

            span {
                user-select: none;
                color: var(--font-color);
            }
        }

        .view-mode-toggle {
            gap: 4px;
            display: flex;
            flex-direction: row;
            align-items: center;

            .tile-view-mode {
                cursor: pointer;
                width: 40px;
                height: 35px;
                border-radius: 10px 0px 0px 10px;
                background-color: var(--background-color);
                color: var(--font-color);
                outline: 2px solid var(--sub-font-color);
                border: none;

                span {
                    font-size: x-large;
                }

                &:disabled {
                    outline: 2px solid var(--input-primary-color);
                    background-color: var(--input-primary-color);
                    color: white;
                }
            }

            .list-view-mode {
                cursor: pointer;
                width: 40px;
                height: 35px;
                border-radius: 00px 10px 10px 0px;
                background-color: var(--background-color);
                color: var(--font-color);
                outline: 2px solid var(--sub-font-color);
                border: none;

                span {
                    font-size: x-large;
                }

                &:disabled {
                    outline: 2px solid var(--input-primary-color);
                    background-color: var(--input-primary-color);
                    color: white;
                }
            }
        }
    }


    .files {
        flex-grow: 1;
        overflow: auto;

        .file-list {
            padding-left: 10px;
            padding-right: 10px;
            padding-top: 20px;
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-start;
            align-items: flex-start;
            gap: 10px;

            &.list-view {
                flex-direction: column;
                align-items: stretch;
                gap: 0px;

                .file-tile {
                    width: auto;
                    height: 50px;
                    border-radius: 0px;
                    flex-direction: row;
                    justify-content: start;
                    position: relative;

                    img {
                        width: 40px;
                        height: 40px;
                        margin-top: 0px;
                        margin-right: 15px;
                        margin-left: 15px;
                    }

                    p {
                        text-align: start;
                        margin: 0px;
                    }
                }

                .file-tile::before {
                    content: "";
                    position: absolute;
                    top: 0px;
                    left: 0;
                    width: 100%;
                    height: 0;
                    border-top: 1px solid gray;
                    pointer-events: none;
                }

                .file-tile:last-child::after {
                    content: "";
                    position: absolute;
                    bottom: 0px;
                    left: 0;
                    width: 100%;
                    height: 0;
                    border-bottom: 1px solid gray;
                    pointer-events: none;
                }
            }

            &.loading {
                justify-content: center;
                align-items: center;
            }

        }
    }

    &.closing {
        animation: fadeOut 0.2s ease-out forwards;
    }
}

.file-tile {
    width: 140px;
    height: 160px;
    background-color: transparent;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    user-select: none;
    overflow: auto;

    img {
        margin-top: 10px;
        width: 100px;
        height: 100px;
        pointer-events: none;
    }

    p {
        font-size: medium;
        margin-top: 10px;
        margin-bottom: 0px;
        margin-left: 0px;
        margin-right: 0px;
        width: 80%;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--font-color);
    }
}

.file-tile:hover {
    background-color: var(--background-focus-color);
}

.file-tile.selected {
    box-sizing: border-box;
    outline: #8b38d480 solid 3px;
}

.file-tile.selected+.file-tile::before {
    border-top: none !important;
}

.file-tile.selected+.file-tile::after {
    border-top: none !important;
}

.file-tile.selected::before {
    border: none !important;
}

.file-tile.selected::after {
    border: none !important;
}


.file-tile.dragging {
    background-color: transparent;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    overflow: hidden;
}

.drop-hover {
    outline: #8b38d480 dashed 3px;
}

.main-view::after {
    position: absolute;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    top: 0px;
    left: 0px;
    content: "";
    box-shadow: inset 0px 0px 8px #00000018;
    border-top-left-radius: 15px;
    border-radius: 15px;
    pointer-events: none;
}

.context-menu {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.719);
    border-radius: 5px;
    box-shadow: #24242429 0px 0px 10px 0px;
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    width: 240px;
    overflow: hidden;
    animation: verticalFadeIn 0.2s ease-out forwards;

    hr {
        border: 0px;
        border-top: 1px solid #cacaca;
        width: 95%;
        margin: 5px;
    }
}

.context-menu.closing {
    animation: verticalFadeOut 0.1s ease-out forwards;
}

.context-menu-item {
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    min-height: 40px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;

    p {
        color: var(--font-color);
    }

    span {
        color: var(--font-color);
    }

    span.left {
        margin-right: 10px;
    }

    span.right {
        margin-left: 10px;
    }

    p {

        padding-left: 10px;
        margin: 0px;
    }

    img {
        margin-left: 10px;
        width: 22px;
    }
}

.context-menu-item:hover {
    background-color: var(--hover-color);
}

.tab.left {
    background-color: transparent;
    width: 90%;
    height: 36px;
    border-radius: 18px 18px 18px 18px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;

    span.left {
        margin-right: 10px;
    }

    span.right {
        margin-left: 10px;
    }

    p {

        padding-left: 10px;
        margin: 0px;
    }
}


.upload {
    height: 0px;
    visibility: hidden;
}

.progress {
    width: 100%;
}

.progress.hidden-progress {
    background-color: transparent;

    div {
        display: none;
    }
}

.messages {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 4100;
    background-color: var(--body-background-color);
    padding: 10px;
    border-radius: 10px;
    box-shadow: #2424242c 0px 0px 5px 0px;

    max-height: calc(100vh - 100px);

    >p {
        font-size: medium;
    }

    >div {
        max-height: calc(100vh - 160px);
        overflow: auto;
        display: flex;
        flex-direction: column;
        gap: 2px;

        .alert {
            min-height: 60px;
            width: 300px;
            background-color: var(--background-color);
            border-radius: 10px;
            padding: 10px;
            overflow: hidden;
            margin-top: 5px;
            margin-bottom: 5px;
            border: #8b38d480 solid 3px;

            .alert-title {
                display: flex;
                flex-direction: row;
                align-items: center;
                gap: 20px;

                p {
                    color: var(--font-color);
                    font-size: large;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    margin-top: 10px;
                    margin-bottom: 15px;
                }

                span {
                    color: var(--font-color);
                    cursor: default;
                    user-select: none;
                }
            }



            .action-progress {
                height: 8px;
                width: 100%;
                background-color: #f3e6ff;
                border-radius: 4px;
                overflow: hidden;
                position: relative;

                .progress-value {
                    position: absolute;
                    animation: move 1s infinite alternate ease-in-out;
                    height: 8px;
                    background-color: #643291;
                    border-radius: 4px;
                    width: 20%;
                }

                .variable-progress-value {
                    position: absolute;
                    height: 8px;
                    background-color: #643291;
                    border-radius: 4px;
                    width: 0%;
                    transition: width 0.3s ease-in-out;
                }
            }
        }
    }

}

@keyframes move {
    0% {
        left: 0;
        width: 20%;
    }

    50% {
        width: 50%;
    }

    100% {
        left: 80%;
        width: 20%;
    }
}

.usage-progress {
    height: 8px;
    width: 80%;
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
    position: relative;

    .progress-value {
        position: absolute;
        height: 8px;
        background-color: #643291;
        border-radius: 4px;
        width: 0%;
    }
}

.comment {
    color: #676767;
}

.note {
    box-sizing: border-box;
    width: 100%;
    background-color: #f3e6ff;
    border-radius: 10px;
    padding: 10px;

    p {
        margin: 0px;
    }
}

#share-dialog {
    .text-btn {
        color: var(--primary-color);
    }

    >.dialog {
        >.column-body {
            margin-bottom: 20px;

            .outline-input-normal {
                margin: auto;
                width: 350px;
            }

            .section {
                display: flex;
                flex-direction: row;
                align-items: center;

                p {
                    font-size: large;
                    font-weight: 500;
                    margin: 10px 20px;
                }

                hr {
                    flex-grow: 1;
                    border-color: #f9f9f9;
                    height: 0px;
                    margin-right: 20px;
                }
            }

            .share-users {
                margin-left: 10px;

                .share-user {
                    border-radius: 10px;
                    background-color: transparent;
                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    justify-content: space-between;

                    .left {
                        display: flex;
                        flex-direction: row;
                        align-items: center;

                        img {
                            width: 40px;
                            border-radius: 50%;
                        }

                        .user-text {
                            max-width: 170px;
                            margin-left: 10px;

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

                            .user-name {
                                margin-top: 5px;
                                margin-bottom: 0px;
                            }

                            .user-email {
                                margin-top: 0px;
                                margin-bottom: 5px;
                                color: var(--sub-font-color);
                                font-size: 14px;
                            }
                        }
                    }

                    .right .dropdown-button:disabled {
                        cursor: not-allowed;
                    }

                    &:hover {
                        background-color: #00000008;
                    }
                }
            }

            .public-access {
                margin-left: 10px;

                .share-user {
                    border-radius: 10px;
                    background-color: transparent;
                    display: flex;
                    flex-direction: row;
                    align-items: center;
                    justify-content: space-between;

                    .left {
                        display: flex;
                        flex-direction: row;
                        align-items: center;

                        .user-text {
                            margin-left: 10px;
                            max-width: 170px;

                            p {
                                text-overflow: ellipsis;
                                overflow: hidden;
                                white-space: nowrap;
                                margin: 0px;
                            }
                        }
                    }

                    &:hover {
                        background-color: #00000008;
                    }
                }
            }
        }

        >.footer {
            justify-content: space-between;
        }
    }
}

.dropdown-dummy {
    cursor: not-allowed;
    background-color: var(--body-background-color);
    padding: 10px 15px;
    border: none;
    font-size: 16px;
    width: 120px;
    border-radius: 5px;
    color: var(--font-color);
    box-sizing: border-box;
    margin: 10px;

    p {
        margin: 0px;
        user-select: none;
        color: var(--sub-font-color);
    }
}

.share-inheritance {
    padding: 5px 6px;
    margin: 0px 25px 10px 25px;
    outline: solid 3px transparent;
    border-radius: 5px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    transition: outline 0.3s ease;

    &:has(input:checked) {
        outline: solid 3px #c4a0e3;
    }

    p {
        margin: 0px;
    }
}

#public-access-permission .dropdown-button:disabled {
    cursor: not-allowed;
}

#files-loading {
    position: absolute;
    left: calc(50% - 20px);
    animation: fadeIn 0.1s ease-out forwards;

    &.closing {
        animation: fadeOut 0.1s ease-out forwards;
    }
}

#settings-dialog {
    .setting {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
    }
}

.splash {
    position: fixed;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--background-color);
    z-index: 5000;
    top: 0px;
    left: 0px;

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

    &.closing {
        animation: fadeOut 0.2s ease-out forwards;

        img {
            animation: zoomInBig 0.15s ease-out forwards;
        }
    }
}

.preview {
    position: fixed;
    top: 0px;
    left: 0px;
    width: 100vw;
    height: 100vh;
    z-index: 4000;
    background-color: #0000008f;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    .icon-preview {
        display: flex;
        flex-direction: column;
        align-items: center;

        .file-icon-preview {
            width: 100px;
            height: 100px;
        }

        .file-name-preview {
            text-align: center;
        }
    }

    .content-preview {
        display: flex;
        flex-direction: column;
        align-items: center;

        >img,
        >video {
            max-width: 450px;
            max-height: 450px;
        }

        >iframe {
            width: calc(100vw - 100px);
            height: calc(100vh - 160px);
        }

        .text-view {
            background-color: var(--body-background-color);
            width: calc(100vw - 100px);
            height: calc(100vh - 160px);
            padding: 10px;
            overflow: auto;

            textarea {
                width: 100%;
                height: calc(100% - 5px);
                border: none;
                background-color: transparent;
                resize: none;
                padding: 0px;
                color: var(--font-color);
                font-family: 'Noto Sans', 'Noto Sans JP';
                text-align: left;

                &:focus {
                    outline: none;
                }
            }
        }

        p {
            text-align: center;
        }
    }

    animation: fadeIn 0.2s ease-in forwards;

    &.closing {
        animation: fadeOut 0.2s ease-out forwards;
    }
}

body.background-image-mode {
    .preview {
        backdrop-filter: blur(10px);
    }
}

.add-file-floating {
    display: none;
}

@media (prefers-color-scheme: light) {
    body.background-image-mode {
        background-repeat: no-repeat;
        background-position: center;
        background-size: cover;

        .main-view {
            background-color: #fafafa77;
            backdrop-filter: blur(10px);
        }

        #header {
            .app-title a h1 {
                color: white;
            }

            .actions .icon-button span {
                color: white;
            }
        }

        .action-menu {

            p,
            span {
                color: white;
            }

            .outline-transparent-btn {
                outline-color: white;
            }
        }
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --background-focus-color: #ffffff11;
    }

    body {
        background-color: #222222;
    }

    .main-view {
        background-color: #181818;
    }

    .action-menu>div>p {
        color: var(--font-color);
    }

    .context-menu {
        background-color: rgba(52, 52, 52, 0.719);

        hr {
            border-top: 1px solid #757575;
        }
    }

    body.background-image-mode {
        background-repeat: no-repeat;
        background-position: center;
        background-size: cover;

        .main-view {
            background-color: #18181877;
            backdrop-filter: blur(10px);
        }

        .action-menu {

            p,
            span {
                color: var(--font-color);
            }

            .outline-transparent-btn {
                outline-color: var(--font-color);
            }
        }
    }
}

@media (max-width:710px) {
    .main-view {
        width: 100vw;
        height: calc(100vh - 120px);
        left: 0px;
        border-radius: 0px;
    }

    .add-file-floating {
        cursor: pointer;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: fixed;
        right: 40px;
        bottom: 80px;
        height: 60px;
        width: 60px;
        border-radius: 50%;
        background-color: var(--input-primary-color);
        box-shadow: 2px 2px 4px 0px #0000003e;

        span {
            color: white;
            font-size: x-large;
        }

        &.closing {
            animation: fadeOut 0.2s ease-out forwards;
        }
    }

    .action-menu {
        width: calc(100vw - 40px);
        height: 60px;
        top: auto;
        bottom: 0px;
        left: 20px;
        padding: 0px;

        div {
            flex-direction: row;

            #add-file {
                display: none;
            }

            .folder-text {
                display: none;
            }

            .folders {
                flex-direction: row;
                align-items: center;
                height: 60px;

                .tab {
                    height: 50px;
                    justify-content: center;
                    border-radius: 25px;

                    span {
                        margin: 0px;
                    }
                }
            }
        }
    }
}

@keyframes verticalFadeIn {
    from {
        max-height: 0;
        opacity: 0;
    }

    to {
        max-height: var(--final-max-height);
        opacity: 1;
    }
}

@keyframes verticalFadeOut {
    from {
        max-height: var(--final-max-height);
        opacity: 1;
    }

    to {
        max-height: 0px;
        opacity: 0;
    }
}