@import "../../ui/css/functions/func.scss";

.ui-popup-mask {
    .wrapper-edit-method {
        width: 100%;

        .ui-check-wrapper {
            padding: 0 28px;
        }
    }

    .status-grid,
    .contacts-record,
    .contacts-wo {
        position: relative;

        >.ui-grid {
            overflow-x: visible;
            max-height: 200px;
        }
    }
}

.comm {
    display: flex;
    flex-direction: column;
    width: 320px;
    background-color: var(--dark-fore-color);
    border: 1px solid var(--title-ctrlbg-color);
    margin-left: 12px;

    & {
        --dark-fore-color: #fff;
        --dark-fore-opacity-color: rgba(255, 255, 255, .6);
        --strong-color: #333;
        --light-color: #ccc;
    }

    .roundbtn {
        width: 30px;
        height: 30px;
        display: inline-block;
        box-sizing: border-box;
        cursor: pointer;
        padding: 7px;
        margin-left: 10px;
        fill: var(--dark-fore-color);
        border-radius: 15px;
        border: none;
        transition: background-color .2s;
        user-select: none;

        @include outline();

        &:hover {
            background-color: var(--dark-fore-opacity-color);

            > svg {
                opacity: .6;
            }
        }

        &.disabled,
        &:disabled {
            fill: lightgray;
            background-color: transparent !important;

            &:hover > svg {
                opacity: unset;
            }
        }

        > svg {
            width: 13px;
            height: 14px;
            display: block;
            transition: opacity .2s;
        }
    }

    .title-bar {
        flex: 0 0 auto;
        padding: 5px 0 5px 10px;
        color: var(--title-color);
        background-color: var(--title-ctrlbg-color);
        line-height: 24px;
        display: flex;
        align-items: center;
        font-size: var(--font-larger-size);

        > div {
            flex: 1 1 auto;

            > .title-company {
                line-height: 1rem;
                padding: 2px 10px;
                // background-color: rgba(0, 0, 0, .15);

                > .title-company-name {
                    font-weight: bold;
                }

                > .title-company-selector {
                    cursor: pointer;
                    vertical-align: middle;

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

                    > svg {
                        width: 14px;
                        height: 14px;
                        fill: rgb(123, 28, 33);
                        margin: 0 5px 3px;
                        vertical-align: middle;
                    }
                }
            }
        }

        > .title-functions {
            flex: 0 0 auto;
            display: flex;
            padding: 0 4px;

            > label {
                margin: 0 4px;
                box-sizing: border-box;
                cursor: pointer;
                width: 30px;
                height: 30px;
                background-color: var(--dark-fore-color);
                border-radius: 15px;
                display: flex;
                align-items: center;
                justify-content: center;
                transition: background-color .2s;

                > svg {
                    fill: var(--strong-color);
                    width: 14px;
                    height: 14px;
                    transition: opacity .2s;
                }

                &:hover {
                    background-color: var(--dark-fore-opacity-color);

                    > svg {
                        opacity: .6;
                    }
                }

                &.disabled {
                    cursor: default;
                    opacity: .6;

                    &:hover {
                        background-color: var(--dark-fore-color);

                        > svg {
                            opacity: unset;
                        }
                    }
                }
            }
        }
    }

    .contact-bar {
        flex: 0 0 auto;
        padding: 4px 0;
        display: flex;
        border-bottom: 1px solid var(--title-ctrlbg-color);
        position: relative;

        > .bar-icon {
            flex: 0 0 auto;

            > svg {
                width: 30px;
                height: 30px;
                margin: 0 8px;
            }
        }

        > .bar-list {
            flex: 1 1 auto;
            width: calc(100% - 46px);

            .bar-list-container {
                min-height: 26px;
                max-height: 120px;
                overflow-x: hidden;
                overflow-y: auto;
                position: relative;
            }

            .contact-item {
                display: flex;
                align-items: center;
                line-height: 22px;

                > svg {
                    flex: 0 0 auto;
                    width: 16px;
                    height: 16px;
                    margin-right: 6px;
                    fill: var(--strong-color);
                }

                > span {
                    // flex: 1 1 auto;
                    color: var(--strong-color);
                    font-size: var(--font-size);
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    padding-right: 10px;
                }
            }
        }

        > .bar-info {
            display: none;
            flex: 1 1 auto;
            text-align: right;
            margin-right: 50px;
        }

        > .bar-collapser {
            position: absolute;
            top: 3px;
            right: 18px;
            width: 26px;
            height: 26px;
            box-sizing: border-box;
            padding: 10px;
            cursor: pointer;
            border-radius: 13px;
            transition: background-color .12s ease;

            &:hover {
                background-color: var(--light-color);
            }

            > span {
                width: 6px;
                height: 6px;
                position: absolute;
                border-top: 1px solid var(--strong-color);
                border-right: 1px solid var(--strong-color);
                top: 8px;
                transform: rotate(135deg);
            }

            &.collapsed > span {
                top: 9px;
                left: 8px;
                transform: rotate(45deg);
            }
        }

        .roundbtn {
            float: right;
            margin: 4px 10px 10px;

            > svg {
                width: 16px;
            }
        }
    }

    &.collapsed {
        .contact-bar {
            border-bottom-color: transparent;

            > .bar-icon,
            > .bar-list {
                display: none;
            }

            > .bar-info {
                display: block;
            }
        }

        .follower-bar {
            display: none !important;
        }
    }

    .message-bar {
        flex: 0 0 auto;
        border-bottom: 1px solid var(--title-ctrlbg-color);
        display: flex;
        flex-direction: column;

        > textarea {
            padding: 10px 10px 0;
            border: 1px solid var(--title-ctrlbg-color);
            border-radius: 5px;
            height: 70px;
            resize: none;
            font-size: var(--font-smaller-size);
            font-family: var(--font-family);
            margin: 3px 5px;
            background: #f0f0f0;

            @include outline();
        }

        > .customer-reply {
            background-color: #d3d3d3;
            padding: 5px 10px 0 10px;
            border-radius: 5px;
            margin: 0 6px 3px 6px;
            display: flex;
            white-space: nowrap;
            line-height: 22px;

            > .reply-msg {
                flex: 1 1 auto;
                display: inline;
                margin-left: 4px;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            > layer {
                > .ui-icon {
                    width: 16px;
                    height: 16px;
                    cursor: pointer;
                    fill: var(--secondary-link-color);
                }
            }
        }

        > div {
            padding: 0 10px 10px;

            > .customer-left {
                float: left;
                text-align: left;

                > .customer-name {
                    > span {
                        font-size: var(--font-smaller-size);
                    }

                    > .ui-input {
                        margin-left: 4px;
                        width: 150px;
                        border-top: none;
                        border-left: none;
                        border-right: none;
                    }
                }

                > .file-selector {
                    display: inline-flex;
                    align-items: center;
                    height: 30px;

                    > .selector-link {
                        cursor: pointer;
                        display: flex;

                        > svg {
                            width: 16px;
                            height: 16px;
                            fill: var(--secondary-link-color);
                        }

                        > input {
                            display: none;
                        }
                    }

                    > .selector-name {
                        max-width: 130px;
                        padding: 0 20px 0 4px;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        white-space: nowrap;

                        + layer {
                            display: none;
                            margin-left: -20px;
                            cursor: pointer;

                            > svg {
                                width: 16px;
                                height: 16px;
                                fill: var(--red-color);
                            }

                            &:hover {
                                display: flex;
                            }
                        }

                        &:hover + layer {
                            display: flex;
                        }

                        > .ui-tooltip-wrapper img {
                            max-width: 120px;
                            max-height: 80px;
                        }
                    }
                }
            }

            > .prompt-count {
                display: inline-block;
                color: var(--light-color);
                font-size: var(--font-smaller-size);
            }
        }
    }

    .list-bar {
        flex: 1 1 auto;
        overflow: auto;
        margin-top: 8px;
        min-height: 100px;

        .item-div {
            margin-top: 5px;
            border-bottom: solid 1px lightgray;
            padding: 3px 10px 5px;
            line-height: 1.5rem;
            white-space: normal;
            word-break: break-word;
            overflow: hidden;
            font-size: var(--font-size);
            color: #333;
            display: flex;
            flex-direction: column;

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

            .item-poster {
                font-weight: bold;
                font-size: var(--font-size);
                align-self: flex-start;

                .ui-tooltip-wrapper > .ui-tooltip-content {
                    font-weight: normal;
                }
            }

            .item-content {
                line-height: 1.2rem;
                padding: 8px 20px;
                border-radius: 5px;
                white-space: pre-wrap;
                word-break: break-word;
                max-width: 240px;
                /*background-color: rgb(244, 244, 244);*/
                background-color: #f5f5f5;

                audio[controls] {
                    width: 220px;
                }

                a > svg {
                    width: 13px;
                    height: 13px;
                    fill: #2140fb;

                    &:hover {
                        border-bottom: 1px solid;
                    }
                }

                > span::after {
                    content: '';
                    display: block;
                }

                .item-status {
                    text-align: right;
                    margin-top: 3px;
                    font-weight: bold;
                    margin-right: -12px;
                    font-size: .625rem;
                    float: right;

                    .ui-tooltip-content .tip-function-button {
                        text-align: right;

                        > svg {
                            width: 20px;
                            height: 20px;
                            cursor: pointer;
                            border: 1px solid;
                            border-radius: 10px;
                            padding: 2px;
                            box-sizing: border-box;
                            transition: opacity .12s;

                            &:hover {
                                opacity: .5;
                            }
                        }
                    }
                }

                .reply {
                    background-color: white;
                    padding: 5px;
                    border: solid 2px #f2f2f2;
                    border-left: solid 2px lightgray;
                    border-radius: 5px;
                    margin-bottom: 2px;
                    max-height: 36px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 2;
                }
            }

            .item-time {
                align-self: flex-end;
                color: #aaa;
                font-size: .6875rem;
            }

            &.item-other {
                .item-content {
                    margin-left: 10px;
                    align-self: flex-start;
                }
            }

            &.item-self {

                .item-poster,
                .item-content {
                    align-self: flex-end;
                }

                .item-content {
                    margin-right: 10px;
                    background-color: #9eea6a;
                }
            }

            &.item-sent .item-content {
                background-color: rgb(164, 226, 251);
            }
        }
    }

    .ui-popup-mask {
        .ui-grid {
            height: 100%;
            min-height: 120px;

            > .ui-grid-wrapper > .ui-grid-table > tbody > .ui-grid-row > td {
                vertical-align: top;

                .col-icon {
                    padding: 10px 4px 10px 8px;
                }

                .icon-contact-type {
                    cursor: unset;

                    > svg {
                        fill: #333;
                    }

                    &:hover > svg {
                        opacity: unset;
                    }
                }

                .contact-wrapper {
                    width: 100px;
                    padding: var(--spacing-cell);

                    .contact-name {
                        overflow: hidden;
                        text-overflow: ellipsis;
                        line-height: 30px;
                    }

                    .contact-note {
                        color: #999;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        margin: 3px 0 3px;
                    }
                }
            }
        }

        .follower-wrapper {
            display: flex;
            flex-direction: column;
            width: 600px;

            > .follower-search {
                margin-bottom: 6px;
            }

            > .follower-grid {
                height: 380px;
            }
        }

        .selcontact-wrapper {
            display: flex;
            flex-direction: column;
            width: 780px;

            > .selcontact-grid {
                height: 200px;
            }
        }
    }
}

/*@media (prefers-color-scheme: dark) {
    .comm {
        --dark-fore-color: #000;
        --dark-fore-opacity-color: rgba(0, 0, 0, .4);
        --strong-color: #ccc;
        --light-color: #333;
    }
}*/