/**
 * ThinkingIndicator - 聊天氣泡思考指示器樣式
 * iMessage / LINE 風格的三點彈跳氣泡
 * 🆕 超時階段：5s+ 顯示鼓勵文字
 */

/* ===== 容器 ===== */
.thinking-indicator-message {
    animation: thinkingFadeIn 0.25s ease-out;
}

/* 頭像佔位：保持與一般訊息對齊，不顯示任何內容 */
.thinking-indicator-message .thinking-avatar-placeholder {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    /* 空白佔位，讓氣泡對齊一般訊息 */
}

/* ===== 聊天氣泡 ===== */
.thinking-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    background: var(--neutral-100, #f1f5f9);
    border-radius: 18px 18px 18px 4px;
    min-width: 56px;
    min-height: 36px;
    animation: thinkingBubbleBreath 2.4s ease-in-out infinite;
    transition: background 0.3s ease;
}

@keyframes thinkingBubbleBreath {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(148, 163, 184, 0);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
    }
}

@media (prefers-reduced-motion: reduce) {
    .thinking-bubble { animation: none; }
}

/* ===== 三點彈跳 ===== */
.thinking-dot {
    display: block;
    width: 7px;
    height: 7px;
    background: var(--neutral-400, #94a3b8);
    border-radius: 50%;
    animation: thinkingBounce 1.4s infinite both;
}

.thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ===== 🆕 超時鼓勵文字 ===== */
.thinking-text {
    display: none;
    font-size: 13px;
    color: var(--neutral-500, #64748b);
    margin-left: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thinking-text.visible {
    display: inline;
    animation: thinkingTextFadeIn 0.4s ease-out forwards;
}

/* 切換進度文字時的淡出狀態（setText 內部使用，150ms 後切回 visible） */
.thinking-text.text-fading {
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    animation: none;
}

@keyframes thinkingTextFadeIn {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== 入場動畫 ===== */
@keyframes thinkingFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 深色模式（停用：AI 聊天頁面不支援深色模式，統一使用淺色樣式）===== */

/* ===== 響應式 ===== */
@media (max-width: 768px) {
    .thinking-bubble {
        padding: 8px 14px;
        min-height: 32px;
    }

    .thinking-dot {
        width: 6px;
        height: 6px;
    }

    .thinking-text {
        font-size: 12px;
    }
}
