/* AI 客服浮動元件樣式（前綴 ai-chat- 以避免與站台樣式衝突） */
#ai-chat-fab {
    position: fixed;
    right: 32px;
    bottom: 32px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #1a5276;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1080;
    transition: background 0.25s ease, transform 0.25s ease;
}
#ai-chat-fab:hover { background: #2e86c1; transform: translateY(-2px); }
#ai-chat-fab span { font-size: 2rem; color: #fff; line-height: 1; }

#ai-chat-tooltip {
    position: fixed;
    right: 108px;
    bottom: 46px;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 1080;
    max-width: 60vw;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
#ai-chat-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-left: 6px solid #333;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

#ai-chat-box {
    position: fixed;
    right: 32px;
    bottom: 110px;
    width: 460px;
    max-width: 96vw;
    max-height: 72vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 22px 20px 16px;
    display: none;
    flex-direction: column;
    z-index: 1081;
    font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
}
#ai-chat-box.active { display: flex; }
#ai-chat-box .ai-chat-header {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a5276;
    margin: 0 0 12px;
    padding-right: 28px;
}
#ai-chat-close {
    position: absolute;
    right: 12px;
    top: 10px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #888;
    cursor: pointer;
}
#ai-chat-close:hover { color: #333; }

#ai-chat-input-container { display: flex; gap: 6px; align-items: stretch; }
#ai-chat-question {
    flex: 1;
    padding: 9px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 1rem;
}
#ai-chat-question:focus { border-color: #2e86c1; outline: none; }
#ai-chat-ask {
    padding: 8px 18px;
    border-radius: 6px;
    border: none;
    background: #1a5276;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
#ai-chat-ask:hover { background: #2e86c1; }
#ai-chat-ask:disabled { background: #9bb6c7; cursor: default; }

#ai-chat-answer {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ai-answer-card {
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 16px 18px;
    word-break: break-word;
    font-size: 0.98rem;
    line-height: 1.7;
}
.ai-answer-title { font-weight: 700; color: #1a5276; margin-bottom: 6px; font-size: 1.05em; }
.ai-answer-section { margin-bottom: 6px; }
.ai-answer-link {
    display: inline-block;
    margin-top: 10px;
    color: #fff;
    background: #1a5276;
    padding: 6px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
}
.ai-answer-link:hover { background: #2e86c1; color: #fff; }
.ai-answer-card.ai-greeting {
    background: linear-gradient(135deg, #e8f5e8 0%, #f1f8e9 100%);
    border-left: 4px solid #4caf50;
    color: #2e7d32;
    font-weight: 500;
}
.ai-answer-card.ai-official {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    border-left: 4px solid #2196f3;
}

@media (max-width: 768px) {
    #ai-chat-box {
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%; height: 100%;
        max-width: 100%; max-height: 100%;
        border-radius: 0;
        padding: 56px 14px 16px;
    }
    #ai-chat-input-container { flex-direction: column; gap: 10px; }
    #ai-chat-question { width: 100%; font-size: 16px; }
    #ai-chat-ask { width: 100%; min-height: 46px; font-size: 16px; }
    #ai-chat-fab { right: 16px; bottom: 16px; width: 56px; height: 56px; }
    #ai-chat-close { right: 14px; top: 14px; font-size: 1.5rem; }
    #ai-chat-tooltip { right: 80px; bottom: 28px; max-width: 60vw; white-space: normal; }
}
