﻿/* ========================================
   AI 客服懸浮按鈕與對話框樣式
   ======================================== */

/* 主容器 */
.ai-customer-service-widget {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ========================================
   懸浮按鈕（圓角矩形 + 文字）
   ======================================== */
.ai-cs-float-button {
    position: fixed;
    bottom: 24px;
    right: 90px;
    min-width: 80px;
    height: 48px;
    padding: 0 16px;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    border: none;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    overflow: visible;
}

    .ai-cs-float-button:hover {
        transform: translateY(-2px) scale(1.05);
        box-shadow: 0 6px 16px rgba(74, 144, 226, 0.5), 0 4px 8px rgba(0, 0, 0, 0.15);
    }

    .ai-cs-float-button:active {
        transform: translateY(0) scale(0.98);
    }

.ai-cs-float-button-active {
    background: linear-gradient(135deg, #357ABD 0%, #2868A8 100%);
}

/* 按鈕圖示 */
.ai-cs-icon {
    width: 22px;
    height: 22px;
    color: #ffffff;
    stroke-width: 2;
    flex-shrink: 0;
}

/* 按鈕文字 */
.ai-cs-button-text {
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* 通知徽章 */
.ai-cs-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #FF4757;
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(255, 71, 87, 0.4);
    border: 2px solid #ffffff;
}

/* ========================================
   提醒泡泡
   ======================================== */
.ai-cs-reminder-bubble {
    position: fixed;
    bottom: 82px;
    right: 90px;
    background: #ffffff;
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: aiCsReminderBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    cursor: pointer;
    max-width: 200px;
}

    .ai-cs-reminder-bubble::after {
        content: '';
        position: absolute;
        bottom: -8px;
        right: 30px;
        width: 0;
        height: 0;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-top: 8px solid #ffffff;
    }

    .ai-cs-reminder-bubble p {
        margin: 0;
        font-size: 14px;
        font-weight: 600;
        color: #1F2937;
    }

.ai-cs-reminder-sub {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: #6B7280 !important;
    margin-top: 4px !important;
}

.ai-cs-reminder-close {
    position: absolute;
    top: 4px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    font-size: 16px;
    color: #9CA3AF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

    .ai-cs-reminder-close:hover {
        color: #4B5563;
    }

@keyframes aiCsReminderBounce {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   對話框
   ======================================== */
.ai-cs-dialog {
    position: fixed;
    /* 尺寸/位置(bottom/right/width/height)統一改由 AICustomerServiceEmbeddedChat.css 的 .ai-cs-dialog 定義
       (外框統一 #2:機器人與 AI 共用同一外框,可拖寬、手機 RWD 一致),此處不再寫死 400×600 */
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10001;
    animation: aiCsDialogSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes aiCsDialogSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   對話框標題列
   ======================================== */
.ai-cs-dialog-header {
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-cs-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-cs-header-icon {
    width: 24px;
    height: 24px;
    color: #ffffff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.ai-cs-header-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.ai-cs-close-button {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

    .ai-cs-close-button:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .ai-cs-close-button svg {
        width: 18px;
        height: 18px;
        color: #ffffff;
    }

/* ========================================
   對話框內容區域
   ======================================== */
.ai-cs-dialog-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    background: #F8F9FA;
}

    .ai-cs-dialog-body::-webkit-scrollbar {
        width: 6px;
    }

    .ai-cs-dialog-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .ai-cs-dialog-body::-webkit-scrollbar-thumb {
        background: #D1D5DB;
        border-radius: 3px;
    }

        .ai-cs-dialog-body::-webkit-scrollbar-thumb:hover {
            background: #9CA3AF;
        }

/* GoToUrl 連結 icon */
.ai-cs-goto-link {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 4px;
    color: #4f46e5;
    border-radius: 4px;
    transition: all 0.2s ease;
    vertical-align: middle;
}

    .ai-cs-goto-link:hover {
        color: #4338ca;
        background-color: #eef2ff;
    }

    .ai-cs-goto-link svg {
        width: 16px;
        height: 16px;
    }
/* ========================================
   歡迎區域
   ======================================== */
.ai-cs-welcome-section {
    text-align: center;
    margin-bottom: 24px;
}

.ai-cs-welcome-avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

    .ai-cs-welcome-avatar svg {
        width: 32px;
        height: 32px;
        color: #ffffff;
    }

.ai-cs-welcome-title {
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
    margin: 0 0 8px 0;
}

.ai-cs-welcome-subtitle {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
}

/* ========================================
   快速回覆按鈕
   ======================================== */
.ai-cs-quick-replies {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-cs-quick-reply-btn {
    width: 100%;
    padding: 16px 20px;
    background: #ffffff;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
}

    .ai-cs-quick-reply-btn::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
        transform: translateX(-4px);
        transition: transform 0.2s ease;
    }

    .ai-cs-quick-reply-btn:hover {
        background: #F9FAFB;
        border-color: #4A90E2;
        color: #1F2937;
        transform: translateX(4px);
        box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
    }

        .ai-cs-quick-reply-btn:hover::before {
            transform: translateX(0);
        }

    .ai-cs-quick-reply-btn:active {
        transform: translateX(2px);
    }

/* ========================================
   回覆內容區域
   ======================================== */
.ai-cs-reply-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ai-cs-reply-header {
    margin-bottom: 16px;
}

.ai-cs-back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #4A90E2;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .ai-cs-back-button:hover {
        background: #F9FAFB;
        border-color: #4A90E2;
    }

    .ai-cs-back-button svg {
        width: 16px;
        height: 16px;
    }

.ai-cs-reply-body {
    flex: 1;
    overflow-y: auto;
}

/* ========================================
   訊息樣式
   ======================================== */
.ai-cs-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-cs-message-bot {
    flex-direction: row;
}

.ai-cs-message-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .ai-cs-message-avatar svg {
        width: 20px;
        height: 20px;
        color: #ffffff;
    }

.ai-cs-message-content {
    flex: 1;
    min-width: 0;
}

.ai-cs-message-header {
    margin-bottom: 6px;
}

.ai-cs-message-sender {
    font-size: 13px;
    font-weight: 600;
    color: #4A90E2;
}

.ai-cs-message-text {
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    /* 字級拉軸(#2 外框統一):機器人答案也吃字級 var(預設 14px),標題列 A⁺ 拉軸對機器人生效 */
    font-size: var(--ai-cs-font-size, 14px);
    line-height: 1.6;
    color: #374151;
    word-wrap: break-word;
    white-space: pre-line;
}

/* ========================================
   對話框底部
   ======================================== */
.ai-cs-dialog-footer {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.ai-cs-ai-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

    .ai-cs-ai-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
        text-decoration: none;
        color: #ffffff;
    }

    .ai-cs-ai-button:active {
        transform: translateY(0);
    }

    .ai-cs-ai-button svg {
        width: 20px;
        height: 20px;
    }

/* ========================================
   響應式設計
   ======================================== */
@media (max-width: 480px) {
    .ai-cs-float-button {
        bottom: 16px;
        right: 16px;
        min-width: 70px;
        height: 44px;
        padding: 0 14px;
        gap: 6px;
    }

    .ai-cs-icon {
        width: 20px;
        height: 20px;
    }

    .ai-cs-button-text {
        font-size: 13px;
    }

    /* .ai-cs-dialog 尺寸已由 AICustomerServiceEmbeddedChat.css @media768 統一(外框統一 #2),此處不再覆蓋 */

    .ai-cs-reminder-bubble {
        bottom: 70px;
        right: 16px;
        max-width: 180px;
    }

        .ai-cs-reminder-bubble::after {
            right: 24px;
        }
}

@media (max-width: 360px) {
    .ai-cs-float-button {
        bottom: 12px;
        right: 12px;
        min-width: 60px;
        height: 40px;
        padding: 0 12px;
    }

    .ai-cs-icon {
        width: 18px;
        height: 18px;
    }

    .ai-cs-button-text {
        font-size: 12px;
    }

    /* .ai-cs-dialog 尺寸已由 AICustomerServiceEmbeddedChat.css @media768 統一(外框統一 #2),此處不再覆蓋 */

    .ai-cs-reminder-bubble {
        bottom: 62px;
        right: 12px;
        max-width: 160px;
        padding: 12px 14px;
    }
}
