/* ===== 浮動按鈕 ===== */
.chat-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 50px;
    height: 50px;
    /* background: #3b82f6; */
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    z-index: 999;
}

/* ===== 聊天視窗 ===== */
.chat-window {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 460PX;
    height: 72vh;
    max-height: 720px;
    background: #fff;
    border-radius: 15px !important;
    z-index: 998;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
}

@media (max-width:575px) {
    .chat-fab {
        position: fixed;
        right: 24px;
        bottom: 24px;
        width: 50px;
        height: 50px;
        /* background: #3b82f6; */
        color: #fff;
        /* border-radius: 50%; */
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
        z-index: 999;
    }

    .chat-window {
        position: fixed;
        right: 3%;
        bottom: 10%;
        width: 94%;
        height: 70vh;
        max-height: 480px;
        background: #fff;
        border-radius: 15px !important;
        z-index: 998;
        box-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
        display: flex;
        flex-direction: column;
    }
}

.chat-window .chat-header {
    height: 50px;
    background: linear-gradient(135deg, #fff, #ffff);
    color: #fff;
    padding: 0 16px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== 動畫 ===== */
.chat-slide-enter-active,
.chat-slide-leave-active {
    transition: all 0.25s ease;
}

.chat-slide-enter-from,
.chat-slide-leave-to {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
}
:root {
    --chat-bg: #f8fafc;
    /* 主背景（跟後台一致） */
    --chat-panel: #ffffff;
    /* 卡片白 */
    --chat-border: #e5e7eb;

    --chat-accent: #3b82f6;
    /* 後台藍 */
    --chat-accent-soft: #eff6ff;

    --chat-user-bubble: #3b82f6;
    --chat-ai-bubble: #ffffff;

    --chat-text-main: #1f2937;
    --chat-text-muted: #6b7280;
}

.chat-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chat-wrapper .chat-container {
    height: 100%;
    display: flex;
    /* border-radius: 12px; */
    border-bottom-right-radius: 12px;
    border-bottom-left-radius: 12px;
    overflow: hidden;
    background: var(--chat-bg);
    /* border: 1px solid var(--chat-border); */
}

/* .chat-window .chat-message.user .bubble::before {
    content: "";
    position: absolute;
    right: 5px;
    border-right: none;
    border-left: 10px solid transparent;
    border-top: 10px solid #2d6eef;
    bottom: -6px;
}

.chat-window .chat-message.ai .bubble::before {
    content: "";
    position: absolute;
    left: 5px;
    border-left: none;
    border-right: 10px solid transparent;
    border-top: 10px solid #efefef;
    bottom: -10px;
} */
.chat-wrapper .el-input-group--prepend>.el-input__wrapper,
.chat-wrapper .el-input-group__append {
    border-bottom-left-radius: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 20px !important;
    border: 0;
}

.chat-wrapper .el-input-group__append,
.chat-wrapper .el-input-group__prepend .el-input-group__append,
.chat-wrapper .el-input-group__prepend {
    box-shadow: 0 0px 0 0 var(--el-input-border-color) inset, 0 0 0 0 var(--el-input-border-color) inset, 0px 0 0 0 var(--el-input-border-color) inset;
    border: 0;
}

.chat-wrapper .el-footer {
    padding: 0 !important;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}

.chat-wrapper .el-input__wrapper,
.chat-wrapper .el-input__wrapper:hover {
    box-shadow: 0 0 0 0px var(--el-input-border-color, var(--el-border-color)) inset;
}

.chat-wrapper .chat-sidebar {
    background: linear-gradient(180deg,
            #0b1220 0%,
            #020617 100%);
    padding: 12px;
    color: var(--chat-text-main);
}

.chat-wrapper .chat-session-menu {
    background: transparent;
    border: none;
}

.chat-wrapper .chat-session-menu .el-menu-item {
    color: var(--chat-text-muted);
    /* border-radius: 8px; */
    margin-bottom: 4px;
}

.chat-wrapper .chat-session-menu .el-menu-item.is-active {
    background: var(--chat-accent-soft);
    color: #fff;
}

.chat-wrapper .chat-main {
    background: #f8fafc;
    flex: 1;
    min-height: 0;
    /* 🔥 Element Plus scrollbar 必加 */
}

.chat-wrapper .chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
}

.chat-wrapper .chat-message.user {
    flex-direction: row-reverse;
}

.chat-wrapper .chat-message .bubble {
    max-width: 80%;
    padding: 4px 12px;
    border-radius: 8px;
    line-height: 1.4;
}

.chat-wrapper .chat-message.ai .bubble {
    background: #ffffff;
    color: var(--chat-text-main);
    border: 1px solid var(--chat-border);
    background: #c7c7c73d !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .04);
}

.chat-wrapper .chat-message.user .bubble {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

.chat-wrapper .chat-message p {
    margin-bottom: 0 !important;
}

.chat-wrapper .chat-input {
    background: #ffffff;
    border-top: 1px solid var(--chat-border);
    height: 50px;
}

.chat-wrapper .chat-input .el-input__wrapper {
    height: 50px;
    padding-left: 1rem;
    padding-right: 1rem;
    border-bottom-left-radius: 15px;
}

.chat-wrapper .el-avatar.ai {
    background: #e5e7eb;
    color: #374151;
}

.chat-wrapper .el-avatar.user {
    background: var(--chat-accent);
    color: #fff;
}

.chat-wrapper .markdown-body {
    color: var(--chat-text-main);
}

.chat-wrapper .markdown-body pre {
    background: #020617;
    border: 1px solid var(--chat-border);
}

.chat-wrapper .markdown-body code {
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
}

.chat-wrapper .el-input-group__append button.el-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}

.chat-wrapper .el-input-group__append,
.chat-wrapper .el-input-group__prepend {
    padding: 0 30px;
    box-shadow: 0 0px 0 0 var(--el-input-border-color) inset, 0 0 0 0 var(--el-input-border-color) inset, 0px 0 0 0 var(--el-input-border-color) inset;
}