/*
 * SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

@import (reference) '../../customize/src/less2/include/framework.less';
@import (reference) '../../customize/src/less2/include/sidebar-layout.less';
@import (reference) '../../customize/src/less2/include/variables.less';
@import (reference) '../../customize/src/less2/include/badges.less';
@import (reference) '../../customize/src/less2/include/avatar.less';
@import (reference) "../../customize/src/less2/include/markdown.less";

&.cp-app-profile {

    .framework_min_main();
    .sidebar-layout_main();

    @cp-profile-is-your-friend: @cp_profile-hint;

    display: flex;
    flex-flow: column;

    #cp-sidebarlayout-leftside {
        display: none !important;
    }
    div#cp-sidebarlayout-container #cp-sidebarlayout-rightside {
        padding: 1rem 2rem;
    }

    .cp-app-profile-section:first-child {
        margin-top: 1rem;
    }

    #cp-app-profile-header {
        display: flex;
        flex-flow: row wrap;
        justify-content: center;
        gap: 2rem;
        #cp-app-profile-rightside {
            flex: 1;
            display: flex;
            flex-flow: column;
            align-items: start;
            max-width: 100%;
        }
    }
    #cp-app-profile-avatar {
        margin-right: 20px;
        text-align: center;
        max-width: 300px;
        max-height: 300px;
        margin-bottom: 3.5rem;
        margin-right: 0;
        &> span {
            .avatar_main(300px);
            display: flex;
            text-align: center;
            border-radius: 4px;
            overflow: visible;
            position: relative;
            i.cp-badge {
                border-width: 3px;
            }
            .cp-app-profile-avatar-delete {
                right: 0;
                top: 0;
                position: absolute;
                opacity: 1;
                &:hover {
                    opacity: 0.7;
                }
            }
        }
        img {
            max-width: 100%;
            max-height: 100%;
            vertical-align: top;
            border-radius: @variables_radius_L;
        }
        .cp-avatar-default {
            border-radius: @variables_radius_L;
        }
        media-tag {
            height: 100%;
            width: 100%;
            display: inline-flex;
            justify-content: center;
            align-items: center;
            img {
                min-width: 100%;
                min-height: 100%;
                max-width: none;
                max-height: none;
                flex: 1;
            }
        }
        button {
            min-width: 40px;
            height: 40px;
            margin: 5px !important;
        }
    }
    .cp-markdown-toggle-row {
        margin-bottom: 0.5rem;
        .btn.cp-markdown-toggle-button {
            .markdown-toolbar-button-style() !important;
        }
    }

    .cp-app-profile-resizer {
        text-align: center;
    }
    .cp-app-profile-displayname {
        margin-top: 1rem;
    }
    .cp-app-profile-section:empty {
        display: none;
    }
    .cp-app-profile-displayname, .cp-app-profile-link, .cp-app-profile-section {
        margin-bottom: 1rem;
        input {
            width: 100%;
            font-size: 20px;
            box-sizing: border-box;
            padding-right: 30px;
        }
        input:focus ~ .edit {
            display: none;
        }
        .cp-app-profile-input-edit {
            position: absolute;
            margin-left: -25px;
            margin-top: 8px;
        }
        .cp-app-profile-input-temp {
            font-weight: 400;
            font-family: sans-serif;
        }
        .cp-app-profile-displayname {
            font-weight: bold;
            font-size: 30px;
        }
        .cp-app-profile-link {
            font-size: 25px;
            display: inline;
            overflow-wrap: anywhere;
        }
        .cp-app-profile-displayname, .cp-app-profile-link {
            line-height: 40px;
        }
        .cp-app-profile-link-code {
            display: none;
            min-width: 500px;
            input {
                flex: 1;
                min-width: 0;
            }
            button {
                height: 38px !important;
            }
        }
        & > button:empty {
            margin-left: 25px !important;
        }
        @media screen and (max-width: @browser_media-medium-screen) {
            .cp-app-profile-link-code {
                min-width: 0;
            }
        }
    }

    div.cp-app-profile-mute-container.cp-app-profile-section {
        p {
            margin-bottom: 0;
        }
    }
    .cp-app-profile-friend {
        display: flex;
        align-items: center;
        color: @cp-profile-is-your-friend;
        .fa {
            margin-right: 0.2em;
        }
    }
    .cp-app-profile-friend-request {
        flex: 0;
        margin-top: 10px;
    }

    // I tried using flexbox but messed with how the pencil icon was displayed
    #cp-app-profile-invite-button {
        float: right;
    }
    #cp-app-profile-description {
        position: relative;
        font-size: 16px;
        max-width: 100%;
        //margin-bottom: 20px;
        .markdown_cryptpad();
        .cp-app-profile-description-code {
            display: none;
            .cp-markdown-toolbar {
                max-width: 31rem;
                background-color: @cp_toolbar-bg;
                border-radius: @variables_radius @variables_radius 0 0;
            }
        }
        #cp-app-profile-description-info {
            overflow-wrap: anywhere;
            margin-top: 1rem;
        }
        .cp-app-profile-description-ok, .cp-app-profile-description-spin {
            position: absolute;
            bottom: 2px;
            right: 2px;
            display: none;
            z-index: 1000;
        }
        textarea {
            width: 100%;
            height: 300px;
        }
        .CodeMirror {
            font-family: monospace;
            font-size: 16px;
            line-height: initial;
            max-width: 31rem;
            border-radius: 0 0 @variables_radius @variables_radius;
            pre {
                margin: 0;
                font-family: inherit;
                font-size: inherit;
                line-height: inherit;
            }
        }
    }
    #cp-app-profile-create {
        height: 100%;
        display: flex;
        flex-flow: column;
        align-items: center;
        justify-content: center;
    }
    .cp-app-profile-mute-container {
        p {
            margin-top: 5px;
            font-size: 13px;
        }
    }
}

