﻿
/* 主聊天室區塊 */
.chat-panel {
    min-width: 320px;
    min-height: 320px;
    background: #191B2A;
    display: flex;
    width: 100%;
    height: 100%;
}

/* 左側用戶列表區塊 + 隔線 */
.chat-user-list-wrap {
    min-width: 120px;
    max-width: 140px;
    background: #181c2f;
    border-right: 2.5px solid #232547; /* 明顯隔線 */
    transition: width .2s, min-width .2s, max-width .2s;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

    .chat-user-list-wrap.collapsed {
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        opacity: 0;
        border-right: none;
        padding: 0;
    }

#chat-user-list {
    padding: 0;
    margin: 0;
    list-style: none;
    flex: 1 1 auto;
    background: #181c2f;
    height: 100%;
}

    #chat-user-list li {
        cursor: pointer;
        padding: 10px 16px;
        background: none;
        color: #fff;
        border-bottom: 1px solid #24253e;
        transition: background .12s, color .14s;
        font-size: 1rem;
        position: relative;
    }

        #chat-user-list li.active, #chat-user-list li:hover {
            background: #232547;
            color: #ffc800;
        }

        #chat-user-list li .unread-dot {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: #ff5151;
        }

/* 右側對話內容 */
.chat-conversation-pane {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #191B2A;
    
    position: relative;
}

.chat-target-alert {
    padding: 9px 16px 6px 16px;
    color: #fff;
    background: #222540;
    font-size: 1.07rem;
    border-bottom: 1px solid #24253e;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .chat-target-alert i {
        color: #ffc800;
        font-size: 1.3rem;
        margin-right: 4px;
    }

#chat-target-remind {
    font-weight: 700;
    color: #ffc800;
    font-size: 1.12rem;
    margin-left: 2px;
}

/* 客服聊天浮動區（桌機左下，手機中央） */
#chat-customer-popup {
    display: none;
    position: fixed;
    left: 32px;
    bottom: 32px;
    z-index: 3000;
    width: 380px;
    max-width: 96vw;
    min-width: 0;
    border-radius: 18px;
    box-shadow: 0 8px 40px 4px rgba(0,0,0,0.35);
    background: none;
    transition: all 0.22s cubic-bezier(.55,.06,.68,.19);
    box-sizing: border-box;
}

    #chat-customer-popup.active {
        display: block;
    }

    #chat-customer-popup .chat-customer-main {
        border-radius: 18px;
        overflow: hidden;
        background: #191B2A;
        border: 1.5px solid #2e3055;
        padding: 0;
    }

    /* 右上關閉 */
    #chat-customer-popup .btn-close {
        filter: invert(80%) sepia(70%) saturate(950%) hue-rotate(-20deg);
        opacity: .78;
    }

        #chat-customer-popup .btn-close:hover {
            opacity: 1;
        }

    /* 對話訊息區 */
.chat-body {
    height: 340px; /* 或用 max-height 也可，根據你想要的效果 */
    overflow-y: auto;
    background: #191B2A;
    color: #fff;
    font-size: 1rem;
    padding: 16px 12px;
    flex: 1 1 auto;
    /* 建議加上 box-sizing: border-box; */
    box-sizing: border-box;
}


    #chat-customer-popup .chat-footer {
        background: #fff;
        border-top: 1.5px solid #f0eae3;
        padding: 14px 12px;
    }

    #chat-customer-popup textarea.form-control {
        border-radius: 8px;
        font-size: 1rem;
        background: #f7f8fa;
        color: #232547;
        border: 1px solid #e1e1e1;
        min-height: 36px;
        resize: none;
    }

    #chat-customer-popup .btn-primary {
        background: #1876fa;
        border: none;
        color: #fff;
        font-weight: bold;
        letter-spacing: 1px;
        border-radius: 6px;
        transition: background 0.18s;
    }

        #chat-customer-popup .btn-primary:hover {
            background: #0556ba;
        }

    #chat-customer-popup .chat-main {
        padding: 0;
        margin: 0;
        list-style: none;
    }

        #chat-customer-popup .chat-main li {
            margin-bottom: 8px;
            font-size: 1rem;
        }

/* 客服按鈕（左下角浮動icon） */
#chat-customer-btn {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 3020;
    cursor: pointer;
    background: none;
    border-radius: 50%;
    box-shadow: 0 4px 18px 0 rgba(0,0,0,0.22);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: box-shadow .18s;
    border: none;
}

    #chat-customer-btn:hover {
        box-shadow: 0 8px 30px 0 rgba(0,0,0,0.33);
        background: none;
    }

    #chat-customer-btn .icon-round {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: #ffc800;
        box-shadow: 0 2px 8px 0 rgba(255,200,0,0.08);
        overflow: hidden;
    }

    #chat-customer-btn img {
        width: 34px;
        height: 34px;
        display: block;
        background: transparent;
        border-radius: 50%;
        padding: 0;
    }

/* RWD - 手機優化 */
@media (max-width: 991px) {
    #chat-customer-popup {
        left: 2vw;
        right: 2vw;
        bottom: 12px;
        width: 92vw;
        max-width: 92vw;
        min-width: 0;
        margin: 0 auto;
        transform: none !important;
        border-radius: 12px;
        box-sizing: border-box;
    }

        #chat-customer-popup .chat-customer-main {
            border-radius: 12px;
            padding: 0;
        }

    .chat-user-list-wrap {
        min-width: 72px;
        max-width: 96px;
    }

    #chat-customer-btn {
        left: 6px;
        bottom: 6px;
        width: 48px;
        height: 48px;
    }

        #chat-customer-btn .icon-round {
            width: 40px;
            height: 40px;
        }

        #chat-customer-btn img {
            width: 28px;
            height: 28px;
        }

    .chat-target-alert {
        font-size: .98rem;
        padding: 8px 10px 6px 10px;
    }
}

.chat-header {
    background: #232547;
    color: #fff;
    border-radius: 18px 18px 0 0;
}

    .chat-header strong {
        color: #fff !important;
        font-weight: 700;
        font-size: 1.14rem;
        letter-spacing: .5px;
    }

.user-list-title {
    background: #222540;
    border-bottom: 2px solid #fff;
}

#chat-user-list {
    background: #181c2f;
    padding: 0;
    margin: 0;
    list-style: none;
}

.user-list-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1.5px solid #fff;
    background: none;
    transition: background .16s, color .15s;
}

    .user-list-item .avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: #fff;
        margin-right: 5px;
    }

    .user-list-item .user-name {
        color: #e4e5eb;
        font-weight: 700;
        font-size: 1rem;
        letter-spacing: .5px;
    }

    .user-list-item.active, .user-list-item:hover {
        background: #ffc800;
    }

        .user-list-item.active .user-name,
        .user-list-item:hover .user-name {
            color: #e4e5eb !important;
        }

    .user-list-item:not(.active):not(:hover) .user-name {
        color: #fff;
    }

/* 輸入區always置底，檔案icon靠左，送出靠右 */
.chat-footer {
    background: #fff;
    border-top: 1.5px solid #f0eae3;
    padding: 12px 10px 10px 10px;
    position: relative;
}

#chat-send-form {
    display: flex;
    align-items: end;
    gap: 8px;
    width: 100%;
}

    #chat-send-form textarea.form-control {
        border-radius: 8px;
        font-size: 1rem;
        background: #f7f8fa;
        color: #232547;
        border: 1px solid #e1e1e1;
        min-height: 36px;
        resize: none;
    }

    #chat-send-form .btn-link {
        color: #232547;
        background: none;
        border: none;
        font-size: 1.16rem;
    }

        #chat-send-form .btn-link:hover {
            color: #ffc800;
            background: none;
        }

/* 對話對象提醒區 */
.chat-target-alert {
    padding: 9px 16px 6px 16px;
    color: #fff;
    background: #222540;
    font-size: 1.07rem;
    border-bottom: 1px solid #24253e;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .chat-target-alert i {
        color: #ffc800;
        font-size: 1.3rem;
        margin-right: 4px;
    }

#chat-target-remind {
    font-weight: 700;
    color: #ffc800;
    font-size: 1.12rem;
    margin-left: 2px;
}


/* ========================= */
/* 分邊訊息 (自己靠右、對方靠左) */
/* ========================= */

#chat-messages .me {
    text-align: right;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    margin-bottom: 8px;
}

#chat-messages .you {
    text-align: left;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    margin-bottom: 8px;
}

    /* 內文區塊樣式 */
    #chat-messages .me span,
    #chat-messages .you span {
        display: inline-block;
        padding: 8px 16px;
        border-radius: 16px;
        max-width: 75%;
        font-size: 1rem;
        line-height: 1.5;
        word-break: break-all;
    }

#chat-messages .me span {
    background: #ffe25d;
    color: #232547;
    margin-left: 16px;
    border-bottom-right-radius: 4px;
}

#chat-messages .you span {
    background: #262d46;
    color: #fff;
    margin-right: 16px;
    border-bottom-left-radius: 4px;
}

/* 訊息時間靠近訊息泡泡 */
#chat-messages .me .chat-time,
#chat-messages .you .chat-time {
    display: block;
    font-size: 0.92em;
    opacity: 0.72;
    margin-top: 3px;
    min-width: 60px;
}

#chat-messages .me .chat-time {
    text-align: right;
    color: #888533;
    margin-left: 16px;
}

#chat-messages .you .chat-time {
    text-align: left;
    color: #fff;
    margin-right: 16px;
}

.unread-dot {
    position: absolute;
    right: 18px;
    top: 14px;
    background: #ff5151;
    color: #fff;
    border-radius: 50%;
    font-size: .92rem;
    min-width: 20px;
    min-height: 20px;
    line-height: 20px;
    text-align: center;
    padding: 0 6px;
    font-weight: bold;
    display: inline-block;
    z-index: 2;
}

.user-list-item {
    position: relative;
}


#chat-unread-badge {
    position: absolute;
    right: 0;
    top: 0;
    min-width: 18px;
    height: 18px;
    background: #ff5151;
    color: #fff;
    border-radius: 50%;
    padding: 0 5px;
    font-size: 0.98rem;
    display: none;
    z-index: 2;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}
