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

// Bootstrap Tokenfield overrides

@tokenfield-menu-width: 320px;

.tokenfield {

    .drag-counter {
        top: -10px;
        bottom: auto;
        right: -16px;
        left: auto;
        min-width: 30px;
        width: auto;
    }

    &.form-control {
        padding: 0.1875rem 3px 0 3px;
        height: auto;
    }

    .token {
        margin: 0 5px 3px 0;
        border-radius: @border-radius-small;
        position: relative;
        // 22px at default 14px font-height
        height: 1.571em;

        &.ui-sortable-helper { background-color: @white; }

        .contact-image {
            display: inline-block;
            margin: 2px;
            .picture(16px, 16px);
        }

        .close {
            opacity: initial;
            color: rgba(0, 0, 0, 0.55);
        }

        &.placeholder {
            background-color: transparent;
            border: none;
        }

        &.grabbed {
            transform: rotate(2deg);
        }
    }

    // background color if dropable widget is active
    &.drophover {
        background-color: #eee;

        .token-input {
            display: none;
        }

    }

    .twitter-typeahead {
        // there is a special case where this is needed: chinese UI + firefox + mailto link registration bar open
        max-width: 100%;

        & > .token-input.tt-input,
        & > .token-input.tt-hint {
            // 22px at default 14px font-height
            height: 1.571em;
            border: 0;
            padding: 0 5px;
            // there is a special case where this is needed: chinese UI + firefox + mailto link registration bar open
            max-width: 100%;
            margin: 0;
        }

        .tt-hint {
            // don't cut of hints in firefox
            width: 100% !important;
            color: #757575;
        }

        .tt-dropdown-menu {
            width: @tokenfield-menu-width;
            min-width: @tokenfield-menu-width;
        }
        //add some more space if departments shown
        html.showDepartment & .tt-dropdown-menu {
            width: @tokenfield-menu-width + 100px;
            min-width: @tokenfield-menu-width + 100px;
        }
    }
}

// Fix for IE see bug 58917
.internet-explorer {
    .tokenfield .twitter-typeahead {
        & > .token-input.tt-input { width: inherit !important; }
    }
}

.smartphone {
    .tokenfield .twitter-typeahead {
        & > .token-input.tt-hint,
        & > .token-input.tt-input { min-width: inherit !important; }
        .tt-dropdown-menu {
            border-radius: 0;
            border: 1px solid #fff;
            border-top-color: #ccc;
        }
    }
}
