/* 在线客服浮动聊天框 */
.abchat {
    position: fixed;
    right: 10px;
    bottom: 90px;
    z-index: 1200;
}

.abchat-toggle {
    position: relative;
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(0deg, #EACD93, #F8EAC5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    padding: 0;
}

.abchat-toggle:hover {
    filter: brightness(1.04);
}

.abchat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #d9534f;
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
    font-weight: 600;
}

.abchat-panel {
    position: fixed;
    right: 10px;
    bottom: 152px;
    width: 340px;
    max-width: calc(100vw - 20px);
    height: 460px;
    max-height: calc(100vh - 170px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.abchat-panel[hidden] {
    display: none;
}

.abchat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #004C50;
    color: #fff;
}

.abchat-title {
    font-size: 15px;
    font-weight: 600;
}

.abchat-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.abchat-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f5f3ee;
}

.abchat-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 10px;
}

.abchat-row.is-me {
    align-items: flex-end;
}

.abchat-row.is-system {
    align-items: center;
}

.abchat-bubble {
    max-width: 80%;
    padding: 9px 12px;
    border-radius: 14px;
    background: #fff;
    color: #222;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.abchat-row.is-me .abchat-bubble {
    background: #004C50;
    color: #fff;
}

.abchat-row.is-system .abchat-bubble {
    background: transparent;
    color: #888;
    font-size: 12px;
    box-shadow: none;
}

.abchat-time {
    font-size: 11px;
    color: #999;
    margin-top: 3px;
}

.abchat-tip {
    padding: 0 12px;
    color: #b00020;
    font-size: 12px;
}

.abchat-tip:empty {
    display: none;
}

.abchat-tip:not(:empty) {
    padding: 6px 12px 0;
}

.abchat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eee;
    background: #fff;
}

.abchat-form textarea {
    flex: 1;
    resize: none;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
    line-height: 1.4;
    max-height: 96px;
    outline: none;
    color: #222;
}

.abchat-form textarea:focus {
    border-color: #004C50;
}

.abchat-send {
    border: 0;
    border-radius: 10px;
    background: #004C50;
    color: #fff;
    font-size: 14px;
    padding: 9px 16px;
    cursor: pointer;
    flex: 0 0 auto;
}

.abchat-send:disabled {
    opacity: 0.6;
    cursor: default;
}

/* 面板展开时隐藏旧的 hover 浮动组，避免与面板重叠 */
body.abchat-open #ftchat {
    opacity: 0;
    visibility: hidden;
}

#ftchat {
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

@media (max-width: 480px) {
    .abchat-panel {
        left: 10px;
        right: 10px;
        width: auto;
        height: min(70vh, 520px);
    }
}
