* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* 	font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; */
    /* 	background: linear-gradient(135deg, #2ebbee 0%, #0e75b4 100%); */
    /* 	min-height: 100vh; */
    /* 	padding: 20px; */
}

/* 聊天按鈕 */
.chat-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2ebbee 0%, #0e75b4 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.chat-button svg {
    width: 30px;
    height: 30px;
    fill: white;
}

.chat-button.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

#canvas {
    z-index: 999999;
    position: fixed;
    bottom: 32px;
    right: 32px;
    cursor: pointer;
    /*box-shadow: inset 0 0 0 2px;*/
}

/* 聊天視窗 */
.chat-window {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1001;
    overflow: hidden;
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chat-window.expanded {
    width: 410px;
    /* 	height: calc(100vh - 60px); */
    height: 100vh;
    right: 0;
    bottom: 0;
    border-radius: unset;
}

/* 聊天標題列 */
.chat-header {
    background: linear-gradient(135deg, #2ebbee 0%, #0e75b4 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* 	border-radius: 20px 20px 0 0; */
}

.chat-header h3 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: 600;
}

.header-left {
    display: flex;
    gap: 10px;
}

.expand-button,
.close-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.expand-button:hover,
.close-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.expand-button svg,
.close-button svg {
    width: 16px;
    height: 16px;
    fill: white;
}

/* 對話區域 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* 訊息氣泡 */
.message {
    display: flex;
    animation: messageSlide 0.3s ease;
    gap: 10px;
    align-items: flex-end;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

/* AI 頭像 */
.ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2ebbee 0%, #0e75b4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.ai-avatar svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #2ebbee 0%, #0e75b4 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 輸入區域 */
.chat-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.chat-input:focus {
    border-color: #667eea;
}

.send-button {
    background: linear-gradient(135deg, #2ebbee 0%, #0e75b4 100%);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* 手機適配 */
@media (max-width: 480px) {
    .chat-window {
        /* 		width: calc(100vw - 40px); */
        /* 		height: calc(100vh - 100px); */
        width: 100vw;
        height: 100vh;
        right: 0;
        bottom: 0;
        border-radius: unset;
    }

    .chat-button {
        bottom: 20px;
        right: 20px;
    }

    .message-bubble {
        max-width: 85%;
        font-size: 13px;
    }
}

/* 輸入中動畫 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}
