/*
*
* @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.
*
*/

#io-ox-appcontrol #io-ox-toprightbar #io-ox-notifications-display {

    color: #333;
    font-size: 14px;
    background-color: @notification-pane-background;
    background-clip: padding-box;

    overflow: auto;

    min-height: 200px;

    &:focus {
        outline: 0;
    }

    // brackets needed or addition will not perform correctly. => Rule is ignored
    @media (min-width: (@smartphone-breakpoint + 1)) {
        width: 21.875rem;
    }

    @media (max-width: @smartphone-breakpoint), (max-device-width: @smartphone-breakpoint) and (orientation: portrait) {
        width: 100%;
        right: 0;
        bottom: 0;
        top: @appcontrol-height-smartphone;
        position: fixed;
    }

    padding: 24px 14px;
    list-style-type: none; //no dots here

    // special screenreader class as divs gets read everytime and spans don't...so we use spans that behave like divs
    .span-to-div {
        display: block;
        line-height: 24px;

        &.location,&.title {
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }

    .items{
        //prevent busy spinner from overlapping
        min-height: 20px;
        margin-bottom: 8px;
    }

    .desktop-notification-info {
        padding: 5px 14px 10px 14px;
        background-color: rgba(0, 0, 0, 0.05);

        .button-wrapper {
            display: flex;
            justify-content: space-between;
        }
        .enable-button, .disable-button, .later-button {
            // smaller padding so all buttons fit into one line
            padding: 4px 8px;
        }
        &.clickable {
            cursor: pointer;
            &:hover {
                background-color: rgba(0, 0, 0, 0.08);
            }
        }
    }
    .notification-area-header {
        margin: 0 0 9px 0;
    }

    .notification-area-title {
        font-weight: 300;
        font-size: 16px;
        line-height: 20px;
        margin: 0;
        padding: 0 14px;
        border: 0;
        display: inline-block;
    }

    .clear-area-button {
         float: right;
         line-height: 20px;
         margin: 0 14px 0 0;
         padding: 0;
         color: #696969;
         font-size: 18px;
    }

    .hide-area-button {
        padding: 3px 14px 0 14px;
        display: block;
        text-align: left;
    }

    .section-title {

        font-family: @light-font-family;
        font-weight: 300;
        font-size: 16px;
        line-height: 24px;
        margin: 15px 0 1px 0;
        padding: 0 14px;
        border: 0;
        display: inline-block;

        &.no-news-message {
            line-height: 20px;
            margin: 0;
        }
    }

    .clear-button {
         float: right;
         line-height: 24px;
         margin: 14px 14px 0 0;
         padding: 0;
         color: #696969;
         font-size: 18px;
    }

    .notifications:first-child {
        margin-top: 0;
    }

    .item {
        .notification-info {
            display: block;
            color: #696969;
        }

        .notification-item-actions {
            height: 16px;

            .clear-single-button {
                float: right;
                width: 12px;
                line-height: 13px;
                padding: 0;
                color: #696969;
                font-size: 14px;
                display: none;

                &:focus {
                    display: inline-block;
                    text-decoration: underline;
                }

                &:hover {
                    display: inline-block;
                    text-decoration: underline;
                }
            }
        }

        color: #696969;
        padding: 8px 14px;

        &:last-child {
            border-bottom: 0;
        }

        &.has-focus {
            outline: 1px solid rgba(0, 0, 0, 0.30);
            background-color: rgba(0, 0, 0, 0.05);
            .clear-single-button {
                display: inline-block;
            }
        }

        &:hover {
            background-color: rgba(0, 0, 0, 0.05);
            .clear-single-button {
                display: inline-block;
            }
        }

        .title {
            color: #333;
            pointer-events: none;
            font-weight: bold;
            .ellipsis();
        }

        .subject {
            .ellipsis();
            pointer-events: none;
        }

        .empty {
            font-style: italic;
            color: #aaa;
        }

        .content {
            color: #aaa;
            line-height: 16px;
            max-height: 5 * 16px; /* 5 rows */
            margin-top: 3px;
            .ellipsis();
        }

        .time {
            float: right;
        }

        .location {
            color: #666;
        }

        .actions {
            text-align: right;
            margin: 5px 0;
        }
        .open-in-calendar {
            padding: 0;
        }
    }

    .open-app {
        padding: 7px 14px;
    }
}

@media (max-width: @smartphone-breakpoint), (max-device-width: @smartphone-breakpoint) and (orientation: portrait) {

    #io-ox-notifications-sidepopup {
        width: 100%;
        bottom: 0;
        top: @appcontrol-height-smartphone;
        position: fixed;
    }

    #io-ox-notifications-display {
        padding: 8px 14px 14px 14px;

        .notification-area-title {
            font-size: 20px;
        }

        .item {
            background-color: rgba(0, 0, 0, 0.05);
            margin-bottom: 8px;
            .clear-single-button {
                display: inline-block;
            }
        }
    }
}

.touch #io-ox-notifications-display .item .clear-single-button {
     //no hover on touch devices, so always show single hide buttons
     display: inline-block;
}

.notifications-icon {
    opacity: 1;
    transition: opacity 0.2s linear;
    &.no-notifications {
        opacity: 0;
        visibility: hidden;
    }
}

#io-ox-notifications-popups {
    position: absolute;
    top: 48px;
    width: 400px;
    right: 10px;
    z-index: 65201; /* above modal dialog; above relogin screen */

    .alert {
        margin-bottom: 0.5em;
        box-shadow: 1px 1px 3px -1px rgba(0, 0, 0, 0.80);
    }
}

// small screens (mobile)
// note that we have to target max-width and max-device-width
// to target all devices which don't support the max-device-width
// property
@media(max-width: @smartphone-breakpoint) and (orientation: portrait), (max-height: @smartphone-breakpoint) and (orientation: landscape) {
    #io-ox-notifications-popups {
        top: -80px;
        left: 10px;
        right: 10px;
        width: auto;
        margin: 0;
    }
}
