/* Palette */
$primary-color: #0067a6;
$danger-red: #f2545b;
$danger-red-dark: #611a15;
$danger-banner: #f44336;

/* Brand colors */
$google-red: #dd4b39;
$facebook-blue: #3b5999;
$linkedin-blue: #007bb6;
$twitter-blue: #00acee;
$github-black: #171515;

/* Links */
.__booya-link {
    color: $primary-color !important;

    &:focus,
    &:hover {
        text-decoration: underline;
    }
}

/* Buttons */
.__booya-btn,
.__booya-btn:link,
.__booya-btn:visited {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    line-height: 14px;
    text-align: center;
    text-decoration: none;
    color: #fff;
    background-color: $primary-color;
    padding: 12px 15px;
    margin: 10px 8px;
    border: 1px $primary-color solid;
    border-radius: 3px;
    cursor: pointer;
}

.__booya-btn:hover,
.__booya-btn:focus {
    color: #fff;
    background-color: $primary-color;
    border-color: $primary-color;
    opacity: 0.7;
    text-decoration: none;
}

.__booya-btn:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

.__booya-btn-outline,
.__booya-btn-outline:link,
.__booya-btn-outline:visited {
    color: $primary-color;
    background-color: #fff;
    border-color: $primary-color;
}

.__booya-btn-outline:hover,
.__booya-btn-outline:focus {
    color: $primary-color;
    background-color: #E2FAFF;
}

.__booya-btn-signin {
    display: block !important;
    margin: 10px 0 !important;
    background-color: #fff !important;

    img {
        height: 20px;
        vertical-align: middle;
        margin-right: 10px;
    }

    &.__booya-btn-signin-google {
        border-color: $google-red !important;
        color: $google-red !important;
    }

    &.__booya-btn-signin-facebook {
        border-color: $facebook-blue !important;
        color: $facebook-blue !important;
    }

    &.__booya-btn-signin-linkedin,
    &.__booya-btn-signin-linkedin2 {
        border-color: $linkedin-blue !important;
        color: $linkedin-blue !important;
    }

    &.__booya-btn-signin-twitter {
        border-color: $twitter-blue !important;
        color: $twitter-blue !important;
    }

    &.__booya-btn-signin-github {
        border-color: $github-black !important;
        color: $github-black !important;
    }

    &.__booya-btn-signin-email {
        border-color: #000 !important;
        color: #000 !important;
    }
}

/* Forms */
form.__booya-form {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;

    h3 {
        margin-bottom: 16px;
    }

    a:not(.__booya-btn) {
        text-decoration: underline;
    }

    fieldset {
        position: relative;
        padding: 0;
        border: none;
        margin-bottom: 25px;

        fieldset {
            margin-bottom: 10px;
        }

        .choice-options {
            margin-top: 5px;

            fieldset:last-child {
                margin-bottom: 0;
            }
        }

        &.checkbox, &.radio {
            position: relative;
            display: block;
            padding-left: 30px;
            margin-bottom: 8px;
            cursor: pointer;
            font-size: 22px;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;

            &:hover {
                input ~ .checkmark {
                    border-color: $primary-color;
                }
            }

            input {
                position: absolute;
                top: 0;
                bottom: 0;
                left: 0;
                right: 0;
                z-index: 1;
                opacity: 0;
                cursor: pointer;
                padding: 0;
                margin: 0;
                height: auto;
                min-height: auto;

                &:checked ~ .checkmark {
                    border-color: $primary-color;

                    &:after {
                        display: block;
                    }
                }
            }

            .checkmark {
                position: absolute;
                top: 0;
                left: 0;
                height: 20px;
                width: 20px;
                background-color: #fff;
                border: solid 1px #c7d0da;
                transform: translateY(25%);

                &:after {
                    content: "";
                    position: absolute;
                    display: none;
                }
            }

            label {
                font-weight: 400;

                a {
                    color: #00a4bd;
                    text-decoration: underline;
                }
            }

            &.checkbox {
                .checkmark {
                    border-radius: 2px;

                    &:after {
                        left: 6px;
                        top: 2px;
                        width: 5px;
                        height: 10px;
                        border: solid $primary-color;
                        border-width: 0 3px 3px 0;
                        -webkit-transform: rotate(45deg);
                        -ms-transform: rotate(45deg);
                        transform: rotate(45deg);
                    }
                }
            }

            &.radio {
                .checkmark {
                    border-radius: 50%;

                    &:after {
                        top: 5px;
                        left: 5px;
                        width: 10px;
                        height: 10px;
                        border-radius: 50%;
                        background: $primary-color;
                    }
                }
            }
        }

        label {
            font-size: 14px;
            font-weight: 600;
            margin-bottom: 10px;
            display: inline-block;

            span.optional {
                font-weight: 300;
                font-style: italic;
                letter-spacing: normal;
            }

            legend {
                font-size: 12px;
                font-weight: 300;
                color: #cbd6e2;
                margin-top: -4px;
            }
        }

        .input {
            position: relative;
        }

        p {
            margin-top: 0;
            margin-bottom: 0;
        }

        .error {
            font-size: 12px;
            font-weight: 300;
            color: $danger-red;
            top: calc(100% + 2px);
            position: absolute;

            &.info {
                color: #fff;
            }
        }
    }

    input, textarea, select {
        appearance: none;
        -webkit-appearance: none;
        -ms-appearance: none;
        -moz-appearance: none;
        resize: none;
        display: block;
        width: 100%;
        min-height: 40px;
        font-size: 16px;
        line-height: 22px;
        text-align: left;
        vertical-align: middle;
        color: #33475b;
        background-color: #f5f8fa;
        padding: 9px 10px;
        border-radius: 3px;
        border: 1px solid #cbd6e2;
        transition: all .15s ease-out;
        box-sizing: border-box;

        &:focus,
        &.focus {
            border-color: rgba(0,208,228,.5);
            box-shadow : 0 0 4px 1px rgba(0,208,228,.3), 0 0 0 1px #00d0e4;
            outline: 0;
        }
    }

    textarea {
        height: 120px;
        resize: none;
    }

    select {
        width: 100%;
        font-size: 16px;
        border-radius: 3px;
        border: solid 1px #cbd6e2;
        -webkit-appearance: none;
        -ms-appearance: none;
        -moz-appearance: none;
        background: #fff url(https://cdn.jsdelivr.net/npm/@inboundlabs/booya-ui@0.1/dist/images/dropdown.svg) no-repeat right center;
        background-position-x: calc(100% - 8px);
        color: #33475b;
        font-weight: 400;
    }

    /*input[type="checkbox"] {
        width: 20px;
        height: 20px;
        border-radius: 2px;
        border: solid 1px #c7d0da;
        background-color: #fff;
        padding: 0;
        vertical-align: middle;
        opacity: 0;
        position: absolute;
        left: 0;
        top: 0;
        z-index: 1;
        margin-right: 8px;

        & + span {
            position: absolute;
            left: 0;
            top: 0;

            &:before {
                position: absolute;
                content: '';
                width: 17px;
                height: 17px;
                border-radius: 2px;
                border: solid 1px #c7d0da;
                background-color: #ffffff;
                padding: 0;
                vertical-align: middle;
                z-index: 0;
            }
        }

        &:checked {
            & + span:before {
                border-color: #00a4bd;
                background-size: 106% 106%;
                background: url(https://cdn.jsdelivr.net/npm/@inboundlabs/booya-ui@0.1/dist/images/checkbox.svg) no-repeat;
                background-position-x: -1px;
                background-position-y: -1px;
            }
        }
    }
    */

    button {
        width: 100%;
        padding-left: 46px;
        padding-right: 46px;
        margin-top: 10px;

        &[disabled] {
            cursor: not-allowed;
        }
    }

    .has-error {
        input, input:focus,
        textarea, textarea:focus,
        select, select:focus {
            box-shadow: 0 0 0 1px $danger-red !important;
        }

        .error.multiple-errors {
            position: static;

            ul {
                padding-left: 25px;
                margin: 16px 0 -15px;
            }
        }
    }

    .upload-file.has-error {
        .file-widget-wrapper {
            .file-widget {
                box-shadow: 0 0 0 1px $danger-red !important;
            }
        }
    }

    .__booya-form-action {
        button {
            margin-left: 0;
            margin-right: 0;
        }
    }

    .form-success,
    .form-error,
    .form-validation-error,
    .form-info,
    .form-warn {
        font-size: 16px;
        background-color: #eee;
        padding: 8px 12px;
        margin: 20px 0;
        border-radius: 3px;
    }

    .form-success {
        color: #1e4620;
        background-color: #edf7ed;
    }

    .form-warn {
        color: #663c00;
        background-color: #fff4e5;
    }

    .form-info {
        color: #0d3c61;
        background-color: #e8f4fd;
    }

    .form-error,
    .form-validation-error {
        color: $danger-red-dark;
        background-color: #fdecea;
    }
}

/* Auth Widgets */
.__booya-auth-widgets-wrapper {
    border: 1px solid #ddd;
    width: 400px;
    margin: 0 auto;
    padding: 30px 40px;
    box-sizing: border-box;

    .__booya-auth-widget-section-switch-wrapper {
        margin-top: 30px;

        & + .__booya-auth-widget-section-switch-wrapper {
            margin-top: 8px;
        }
    }

    .__booya-form {
        padding: 0;
        border-width: 0;

        > h1, > h2, > h3, > h4, > h5, > h6 {
            text-align: center;
        }
    }
}

.__booya-section-separator {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    margin: 30px 0;

    .__booya-section-separator-line {
        flex-grow: 1;
        height: 1px;
        background-color: #cbd6e2;
    }

    .__booya-section-separator-text {
        padding: 0 10px;
    }
}


/* Modals */
.__booya-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    transition-property: none;
    transition-delay: 0ms;
    transition-duration: 100ms;
    background-color: rgba(45, 62, 80, 0.79);
    padding-bottom: 60px;
    padding-top: 60px;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 999997;
    box-sizing: border-box;

    &.__booya-modal-overlay-top {
        z-index: 999998;
    }

    &.__booya-modal-overlay-no-close {
        .__booya-close {
            display: none;
        }
    }

    .__booya-modal {
        width: 400px;
        max-width: 90%;
        opacity: 1;
        background-color: #fff;
        text-align: left;
        border-radius: 3px;
        margin: 0 auto;

        .__booya-modal-header {
            position: relative;
            font-weight: 600;
            font-size: 20px;
            text-align: center;
            color: $primary-color;
            background-color: transparent;
            padding: 20px 40px;
            border-top-left-radius: 3px;
            border-top-right-radius: 3px;

            & > *:not(.__booya-close) {
                color: $primary-color;
                margin: 0;
            }

            .__booya-close {
                position: absolute;
                right: 24px;
                top: 24px;
                width: 16px;
                height: 16px;
                cursor: pointer;
                color: #333;

                svg {
                    color: inherit;
                    display: block;

                    path {
                        fill: currentcolor;
                        stroke: currentcolor;
                        stroke-width: 2;
                    }
                }
            }
        }

        .__booya-modal-content {
            padding: 0 40px 40px;
            font-size: 14px;
        }

        form.__booya-form {
            .form-success,
            .form-error,
            .form-validation-error,
            .form-info,
            .form-warn {
                margin-top: 0;
            }
        }

        .__booya-auth-widgets-wrapper {
            width: auto;
            padding: 0;
            border: none;
        }
    }
}

/* Account Verification */
.__booya-email-verification-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    font-size: 14px;
    color: #fff;
    background-color: $danger-banner;
    margin: 0;
    padding: 20px;
    border-radius: 0;
    z-index: 999999;

    &.__booya-email-verification-banner-success {
        background-color: #4caf50;
    }

    .page-content {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
    }

    .__booya-email-verification-banner-message {
        flex-grow: 1;

        a {
            color: #fff;
            text-decoration: underline;
        }
    }

    .__booya-email-verification-banner-close {
        cursor: pointer;
    }
}

.__booya-verification-status {
    font-size: 16px;
    text-align: center;
    padding: 0 16px 16px;
    border-radius: 3px;

    img {
        display: block;
        height: 70px;
        margin: 0 auto 8px;
    }
}

.__booya-verification-status-error {
    color: $danger-red;
}

.__booya-verification-status-success {
    color: $primary-color;
}

/* User Widget */
.__booya-user-widget-wrapper {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

.__booya-user-widget {
    position: relative;
    display: inline-block;
    cursor: pointer;
    font-size: 16px;

    &:after {
        position: absolute;
        content: '';
        width: 8px;
        height: 8px;
        box-shadow: -7px -7px 18px 0 rgba(0,0,0,0.08);
        background: #fff;
        transform: rotate(45deg);
        right: 20px;
        top: calc(100% - 6px);
        z-index: 999999;
        opacity: 0;
        transition: all ease-in-out .3s;
        border-left: 1px solid #cbd6e2;
        border-top: 1px solid #cbd6e2;
    }

    &:hover:after,
    &:focus:after {
        opacity: 1;
    }

    & > img,
    & > div > img {
        height: 24px;
        width: 24px;
        margin-right: 4px;
        vertical-align: baseline;
        border-radius: 100%;
    }

    .__booya-user-name {
        display: inline-block;
        position: relative;
        top: 2px;
        max-width: 120px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
    }

    &:hover .__booya-user-widget-options,
    &:focus .__booya-user-widget-options {
        display: block;
    }

    .__booya-user-widget-options {
        display: none;
        position: absolute;
        top: calc(100% - 1px);
        right: 0;
        width: 160px;
        max-width: 100vw;
        max-height: 280px;
        text-align: left;
        color: #33475b;
        background-color: #fff;
        padding: 8px 0;
        border: 1px solid #cbd6e2;
        border-radius: 3px;
        box-shadow: 0 1px 24px 0 rgba(0,0,0,.08);
        overflow-y: auto;
        z-index: 4;

        .__booya-user-widget-option {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            padding: 10px 15px;
            margin: 0;
            cursor: pointer;
            box-sizing: border-box;

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

}

/* Banners */
.__booya-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    font-size: 16px;
    color: #fff;
    background-color: $primary-color;
    margin: 0;
    padding: 20px;
    border-radius: 0;
    z-index: 999999;

    &.__booya-banner-info {
        background-color: #2196f3; //$primary-color;
    }

    &.__booya-banner-success {
        background-color: #4caf50;
    }

    &.__booya-banner-warn {
        background-color: #ff9800;
    }

    &.__booya-banner-danger {
        background-color: $danger-banner;
    }

    .__booya-banner-content {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        max-width: 90%;
        margin: 0 auto;
    }

    .__booya-banner-message {
        flex-grow: 1;

        a {
            color: #fff !important;
            text-decoration: underline;
        }
    }

    .__booya-banner-close {
        cursor: pointer;

        img {
            width: 16px;
            vertical-align: middle;
        }
    }
}

/* Notices */
.__booya-notice,
.__booya-notice-info,
.__booya-notice-success,
.__booya-notice-danger,
.__booya-notice-warn {
    font-size: 16px;
    background-color: #eee;
    padding: 8px 12px;
    margin: 20px 0;
    border-radius: 3px;

    &.__booya-notice-info {
        color: #0d3c61;
        background-color: #e8f4fd;
    }

    &.__booya-notice-success {
        color: #1e4620;
        background-color: #edf7ed;
    }

    &.__booya-notice-warn {
        color: #663c00;
        background-color: #fff4e5;
    }

    &.__booya-notice-danger {
        color: $danger-red-dark;
        background-color: #fdecea;
    }
}