/*
*
* @copyright Copyright (c) Open-Xchange GmbH, Germany <info@open-xchange.com>
* @license AGPL-3.0
*
* This code 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 OX App Suite. If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>.
*
* Any use of the work other than as authorized under this license or copyright law is prohibited.
*
*/


.floating-body .io-ox-sidepopup.first {
     max-width: none;
}

.io-ox-sidepopup {
    background-color: white;
    z-index: 3; /* above .window-content */

    @shadowColor: rgba(0, 0, 0, 0.50);
    @margin: 50px;

    top: @margin;
    right: @margin;
    bottom: @margin;
    left: @margin;

    // shadow for better contrast

    &.right {
        left: 49.5%;
        box-shadow: +20px 0 100px 0 @shadowColor;
    }

    &.left {
        right: 49.5%;
        box-shadow: -20px 0 100px 0 @shadowColor;
    }

    &.first {
        left: auto;
        right: auto;
        // 600px
        width: 37.5rem;
        max-width: 45%;
    }

    // no margins inside notifications overlay
    .notifications-overlay & {
        top: 0; right: 0; bottom: 0; left: 0;
    }

    // smaller screens, including tablet
    @media (max-width: 900px) {
        &.right, &.left {
            left: 8px;
            right: 8px;
            //border-left: 0 none; border-right: 0 none;
        }
    }

    // smartphones
    @media (max-width: 540px), (max-device-width: 540px) {
        & { top: 0; right: 0; bottom: 0; left: 0; }
        &.first { max-width: 100%; }
        &.right, &.left {
            left: 0;
            right: 0;
            border-left: 0 none; border-right: 0 none;

        }
    }

     // larger popups for notification overlay
    @media (min-width: @smartphone-breakpoint), (min-device-width: @smartphone-breakpoint) {
        .notifications-overlay &.right { left: 39.5%; }
        .notifications-overlay &.left { right: 39.5%; }
    }
}

.io-ox-sidepopup-arrow {
    position: absolute;
    z-index: 4;

    .border, .triangle {
        position: absolute;
        height: 0;
        width: 0;
        border: 20px solid transparent;
        top: -20px;
    }

    &.left {
        left: 0;
        right: 49.5%;
        .border {
            border-left-color: #eee;
            right: -40px;
        }
        .triangle {
            border-left-color: #fff;
            right: -39px;
        }
    }

    &.right {
        left: 49.5%;
        right: 0;
        .border {
            border-right-color: #eee;
            left: -40px;
        }
        .triangle {
            border-right-color: #fff;
            left: -39px;
        }
    }

    // larger popups for notification overlay
    .notifications-overlay &.right { left: 39.5%; }
    .notifications-overlay &.left { right: 39.5%; }
}

.content-v-shift .io-ox-sidepopup {
    padding-top: 40px;
    // see https://bugs.open-xchange.com/show_bug.cgi?id=30833
    // .io-ox-sidepopup-close {
    //     background-color: #eee;
    //     margin: 0;
    //     padding-left: 14px;
    //     border-bottom: 1px solid #ccc;
    //     text-align: left;
    // }
}

.io-ox-sidepopup-overlay {
    z-index: 3;
    background-color: rgba(0, 0, 0, 0.5);
}

.io-ox-sidepopup-pane {
    top: 45px;
    padding-top: 0;
    outline: 0;
}

.io-ox-sidepopup-close {
    padding: 10px 15px;
    text-align: right;
    margin: 10px 10px 0;

    .btn {
        margin-left: 13px;
        .user-select(none);
    }

    .btn-sidepopup {
        display: inline-block;
        background-color: #eee;
        color: #676767;
        padding: 6px 13px;
        margin-left: 7px;
        border-radius: 0 0 @border-radius-base @border-radius-base;
        cursor: pointer;

        &:hover, &:focus {
            background-color: #676767;
            color: #eee;
            text-decoration: none;
        }
    }
}

@media (max-width: 900px) {

    .io-ox-sidepopup-arrow {
        display: none;
    }

    .io-ox-sidepopup-pane {
        top: 35px;

        .default-content-padding {
            padding: 0 13px 13px 13px;
        }
    }

    .io-ox-sidepopup-close {
        margin: 0 13px;
    }

    .simple-window {

        .io-ox-sidepopup {
            position: static;
            min-height: 200px;
        }

        .io-ox-sidepopup-pane {
            position: static;

            .io-ox-busy {
                min-height: 20px;
            }

            .default-content-padding {
                padding-top: 7px;
            }
        }
    }
}
@media all and (max-width: @smartphone-breakpoint), all and (max-device-width: @smartphone-breakpoint) {
    .io-ox-sidepopup-close {
        margin: 0;
        .close {
            float: none;
        }
    }
}
