@import (reference) "./colortheme-all.less";
@import (reference) "./browser.less";
@import (reference) "./variables.less";
@import (reference) "./avatar.less";
@import (reference) "./tools.less";
@import (reference) "./buttons.less";

.alertify_main() {
    --LessLoader_require: LessLoader_currentFile();
};
& {
    @max-z-index: 2147483647;
    @alertify-fore: @colortheme_modal-fg;
    @alertify-base: @colortheme_modal-bg;

    @alertify-dialog-bg: @alertify-base;
    @alertify-dialog-fg: @alertify-fore;

    @alertify-btn-fg: @alertify-fore;

    @alertify-light-bg: fade(@alertify-fore, 25%);
    @alertify-bg: @colortheme_modal-dim;
    @alertify-fg: @alertify-fore;

    @alertify-input-bg: @colortheme_modal-input;
    @alertify-input-fg: @colortheme_modal-input-fg;

    @alertify_padding-base: @variables_padding;
    @alertify_box-shadow: @variables_shadow;

    // Logs to show that something has happened
    // These show only once


    .alertify-logs {
        z-index: 100001; // alertify logs should be in front of alertify modals
        @media print {
            visibility: hidden;
        }
        > * {
            padding: @alertify_padding-base @alertify_padding-base * 4;
            color: @colortheme_notification-color;

            font-family: @colortheme_font;
            font-size: large;

            box-shadow: @alertify_box-shadow;
            &, &.default {
                // FIXME
                background: @colortheme_notification-log;
            }
            &.error {
                font-weight: bold;
                background: @colortheme_notification-warn;
            }
            &.success {
                background: @colortheme_notification-log;
            }
        }
    }

    .alertify {
        position: fixed;
        background-color: @alertify-bg;
        color: @alertify-fg;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        z-index: 100000; // alertify container
        font: @colortheme_app-font;

        .cp-inline-alert-text {
            flex: 1;
        }

        &.forefront {
            z-index: @max-z-index; // alertify max forefront
        }

        .message {
            h1, h2, h3, h4, h5, h6 {
                color: @alertify-fg;
            }
        }

        h1, h2, h3 {
            margin-top: 0;
        }

        &.hide {
            opacity: 0;
            pointer-events: none;
        }

        &, &.show {
            box-sizing: border-box;
            transition: all .33s cubic-bezier(.25, .8, .25, 1);
        }

        &, * {
            box-sizing: border-box;
        }

        .dialog {
            padding: 12px;
/*
            div.tokenfield {
                .token {
                    //border: 1px solid red;
                    //color: red;
                }

                color: @colortheme_light-base;
                background-color: @alertify-dialog-bg;

                input[id$="tokenfield"][type="text"].token-input {
                    background-color: @alertify-dialog-bg !important;
                }
            }*/
        }

        .dialog {
            & > div {
                background-color: @alertify-dialog-bg;
                &.half {
                    width: 50%;
                    max-width: 50%;
                    @media (max-width: @browser_media-medium-screen) {
                        width: 100%;
                    }
                }
                display: flex;
                flex-flow: column;
            }

            width: 100%;
            margin: 0 auto;
            position: relative;
            top: 50%;
            transform: translateY(-50%);
            max-height: 100%;
            display: flex;

            > * {
                width: 100%;
                min-width: 260px;
                max-width: 500px;
                margin: 0 auto;
                text-align: left;
                padding: @alertify_padding-base;
                background: #fff;
                box-shadow: @alertify_box-shadow;
                &.wide {
                    width: 1000px;
                    max-width: 70%;
                }
            }

            .msg {
                padding: @alertify_padding-base;
                margin-bottom: @alertify_padding-base;
                margin: 0;
                overflow: auto;
                :last-child {
                    margin-bottom: 0;
                }
            }
            .alertify-tabs {
                max-height: 100%;
                display: flex;
                flex-flow: column;
                .alertify-tabs-titles {
                    height: 40px;
                    display: flex;
                    border-bottom: 1px solid @alertify-fore;
                    margin-bottom: 10px;
                    box-sizing: content-box;
                    span {
                        font-size: 20px;
                        height: 40px;
                        line-height: 40px;
                        box-sizing: border-box;
                        padding: 0 15px;
                        border-left: 1px solid lighten(@alertify-base, 10%);
                        border-right: 1px solid lighten(@alertify-base, 10%);
                        cursor: pointer;
                        &:hover {
                            background-color: @alertify-light-bg;
                        }
                    }
                    span.alertify-tabs-active {
                        background-color: @alertify-fore;
                        border-left: 1px solid @alertify-fore;
                        border-right: 1px solid @alertify-fore;
                        color: @alertify-base;
                        cursor: default;
                    }
                }
                .alertify-tabs-contents {
                    flex: 1 1 auto;
                    min-height: 0;
                    & > div {
                        max-height: 100%;
                        display: none;
                        overflow: auto;
                    }
                    & > div.alertify-tabs-content-active {
                        display: block;
                        &.cp-share-columns {
                            display: flex;
                        }
                    }
                }
            }

            ::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
                color: @cryptpad_color_grey;
                opacity: 1; /* Firefox */
            }
            :-ms-input-placeholder { /* Internet Explorer 10-11 */
                color: @cryptpad_color_grey;
            }
            ::-ms-input-placeholder { /* Microsoft Edge */
                color: @cryptpad_color_grey;
            }

            span.cp-password-container {
                display: flex;
                align-items: center;
                margin-bottom: 15px;
                justify-content: space-between;
                & > * {
                    margin-bottom: 0 !important;
                }
                button {
                    margin: 0 !important;
                }
            }

            .fa-question-circle { // help links to FAQ
                color: @colortheme_logo-2;
                &:hover {
                    text-decoration: none;
                }
            }

            input[type="checkbox"], input[type="radio"] {
                width: auto;
                padding: 0;
                margin-right: 0.5em;
                margin-top: 1px;
                margin-bottom: 5px;
                vertical-align: middle;
                & + label {
                    margin-bottom: 0;
                    margin-right: 2em;
                }
            }

            .buttons_main();
            input:not(.form-control), textarea {
                margin-bottom: 15px;
            }

            button {
                display: inline-block;
                position: relative;
                margin: 6px 8px;
                min-height: 36px;
                min-width: 88px;
            }

            nav {
                padding: @alertify_padding-base;
                text-align: right;
                button {
                    margin: 0px !important;
                    &:not(:first-child) {
                        margin-left: @alertify_padding-base !important;
                      }
                }
            }
        }
    }

    .alertify-logs {

        position: fixed;
        z-index: 100001; // alertify logs (just in front of alertify modals

        &.bottom, &:not(.top) {
            bottom: 16px;
            /* // Bottom left placement. Default. Use for transitions.
            &.left, &:not(.right) {
                > * {

                }
            }
            // Top right placement
            &.right {
                > * {

                }
            }*/
        }

        // All left positions.
        &.left, &:not(.right) {
            left: 16px;
            > * {
                float: left;
                transform: translate3d(0, 0, 0);
                height: auto;

                &.show {
                    left: 0;
                }
                &, &.hide {
                    left: -110%;
                }
            }
        }

        &.right {
            right: 16px;
            > * {
                float: right;
                transform: translate3d(0, 0, 0);
                &.show {
                    right: 0;
                    opacity: 1;
                }
                &, &.hide {
                    right: -110%;
                    opacity: 0;
                }
            }
        }

        &.top {
            top: 0;
            /* // Top left placement, use for transitions.
            &.left, &:not(.right) {
                > * {

                }
            }
            // Top right placement, use for transitions
            &.right {
                > * {

                }
            }*/
        }

        > * {
            box-sizing: border-box;
            transition: all .4s cubic-bezier(.25, .8, .25, 1);
            position: relative;
            clear: both;
            backface-visibility: hidden;
            perspective: 1000;

            & {
                max-height: 0;
                margin: 0;
                padding: 0;
                overflow: hidden;
                opacity: 0;
                pointer-events: none;
            }

            &.show {
                margin-top: @alertify_padding-base;
                opacity: 1;
                max-height: 1000px;
                padding: @alertify_padding-base;
                pointer-events: auto;
            }
        }
    }
    div.wide {
        div.alertify-tabs {
            p.msg:not(:last-child) {
                border-bottom: 1px solid @alertify-fore;
            }
        }
        .cp-share-columns {
            display: flex;
            flex-flow: row;

            & > .cp-share-column {
                width: 50%;
                padding: 0 10px;
                position: relative;
                &.contains-nav {
                    nav {
                        position: relative;
                        bottom: 0;
                        right: 0;
                        button {
                            margin: 0 !important;
                            &:not(:first-child) {
                                margin-left: 8px !important;
                                margin-top: 6px !important;
                            }
                        }
                    }
                }
                &:first-child {
                    border-right: 1px solid @alertify-fore;
                }
            }
        }
        .cp-ownership {
            & > label {
                font-weight: bold;
            }
        }
    }
    .cp-share-column {
        .cp-usergrid-grid {
            max-height: 225px;
            overflow-x: auto;
        }
    }
    // Bootstrap Alerts
    .alert {
        margin: 0px 0px @alertify_padding-base 0px;
        font-size: 12px;
        padding: 5px;
        border-radius: 0px;
        i {
            margin-right: 10px;
        }
        &.alert-primary {
            background-color: @alertify-base;
            color: @alertify-fg;
            border-color: @alertify-fg;
            a {
                color: @alertify-fg;
                text-decoration: underline;
            }
        }
        &.dismissable {
            display: flex;
            align-items: center;
            span.fa-times {
                font-size: @colortheme_app-font-size;
                margin-left: 20px;
                cursor: pointer;
            }
        }
    }
}

