/* AI Bot Chat Widget - 客服聊天氣泡模組樣式 */

/* 氣泡按鈕容器 - 固定在右下角 */
.aibot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
}

/* 氣泡按鈕 */
.aibot-bubble-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s ease;
    position: relative;
    animation: pulse 2s infinite;
}

.aibot-bubble-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.aibot-bubble-btn:active {
    transform: scale(0.95);
}

/* 脈動動畫 */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

/* 未讀訊息徽章 */
.aibot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* 聊天視窗容器 - 固定在右下角 */
.aibot-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 456px;
    height: 660px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.aibot-chat-window.show {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 聊天視窗標題列 */
.aibot-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aibot-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aibot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.aibot-header-text h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.aibot-header-text p {
    margin: 0;
    font-size: 11px;
    opacity: 0.9;
}

.aibot-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.aibot-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 聊天訊息區域 */
.aibot-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.aibot-chat-body::-webkit-scrollbar {
    width: 6px;
}

.aibot-chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.aibot-chat-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.aibot-chat-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 訊息項目 */
.aibot-message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aibot-message.bot {
    justify-content: flex-start;
}

.aibot-message.user {
    justify-content: flex-end;
}

.aibot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.aibot-message.user .aibot-message-avatar {
    background: #6c757d;
    order: 2;
    margin-left: 8px;
}

.aibot-message.bot .aibot-message-avatar {
    margin-right: 8px;
}

.aibot-message-content {
    max-width: 70%;
}

.aibot-message-bubble {
    padding: 14px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.8;
    white-space: pre-wrap;
    font-size: 13px;
}

.aibot-message.bot .aibot-message-bubble {
    background: rgba(173, 216, 255, 0.25);
    backdrop-filter: blur(10px);
    color: #2c3e50;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(173, 216, 255, 0.3);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.08);
}

.aibot-message.user .aibot-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* 列表樣式 - 模擬網頁的 li 效果 */
.aibot-message-bubble .aibot-list {
    margin: 10px 0;
    padding-left: 24px;
}

.aibot-message-bubble .aibot-list li {
    margin: 6px 0;
    line-height: 1.7;
    padding-left: 6px;
}

.aibot-message-bubble ol.aibot-list {
    list-style-type: decimal;
}

.aibot-message-bubble ul.aibot-list {
    list-style-type: disc;
}

.aibot-message-bubble ol.aibot-list li::marker {
    color: #667eea;
    font-weight: bold;
}

.aibot-message-bubble ul.aibot-list li::marker {
    color: #667eea;
}

/* 列表項目懸停效果 */
.aibot-message-bubble .aibot-list li:hover {
    color: #1a202c;
}

.aibot-message-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* 正在輸入指示器 */
.aibot-typing {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(173, 216, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(173, 216, 255, 0.3);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: fit-content;
}

.aibot-typing.show {
    display: flex;
}

.aibot-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.aibot-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.aibot-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* 快速回覆按鈕 */
.aibot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.aibot-quick-reply-btn {
    padding: 6px 12px;
    border: 1px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.aibot-quick-reply-btn:hover {
    background: #667eea;
    color: white;
}

/* 輸入區域 */
.aibot-chat-footer {
    padding: 16px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.aibot-input-group {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.aibot-input-wrapper {
    flex: 1;
    position: relative;
}

.aibot-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dee2e6;
    border-radius: 24px;
    outline: none;
    resize: none;
    font-size: 13px;
    max-height: 100px;
    overflow-y: auto;
}

.aibot-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.aibot-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.aibot-send-btn:hover {
    transform: scale(1.05);
}

.aibot-send-btn:active {
    transform: scale(0.95);
}

.aibot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 響應式設計 */
@media (max-width: 480px) {
    .aibot-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 90px;
        right: 20px;
    }
    
    .aibot-widget {
        bottom: 15px;
        right: 15px;
    }
}

/* 歡迎訊息樣式 */
.aibot-welcome-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.aibot-welcome-card h6 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 13px;
    font-weight: 600;
}

.aibot-welcome-card p {
    margin: 0;
    color: #666;
    font-size: 12px;
    line-height: 1.5;
}
