/* === AI机器人样式 === */

/* --- 机器人 Canvas 容器 (缩小版) --- */
.wawa-container {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 2001;
    /* 高于编辑器弹窗(1000)和登录弹窗(2000) */
    /* 缩小到 200px */
    width: 200px;
    height: 200px;
    pointer-events: none;
}

/* --- 核心 Canvas 样式 --- */
#wawa-canvas {
    width: 100%;
    height: 100%;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
    filter: drop-shadow(-4px 4px 12px rgba(0, 0, 0, 0.2));
}

/* --- 状态定义 --- */

/* 状态1：偷看 (Peeking) */
.state-peeking {
    transform: translate(45%, 0) rotate(-5deg) scale(0.9);
}

.state-peeking:hover {
    transform: translate(35%, 0) rotate(0deg) scale(0.95);
}

/* 状态2：现身 (Active) */
.state-active {
    transform: translate(-20px, 0) scale(1.1);
}

/* --- 聊天窗口 (客服风格) --- */
#chat-window {
    position: fixed;
    bottom: 210px;
    /* 在机器人上方 */
    right: 20px;
    width: 300px;
    max-height: 450px;
    z-index: 10002;
    /* 高于编辑器弹窗(9999) */
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* 移动端编辑器打开时隐藏机器人悬浮球 */
body.mobile-editor-open .wawa-container {
    display: none !important;
}

.chat-hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.chat-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* 聊天框标题栏 - 橘色+浅蓝色渐变 */
.chat-header {
    background: linear-gradient(135deg, #ff8c42 0%, #87ceeb 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 消息列表 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f7f8fa;
    max-height: 320px;
}

.chat-message {
    margin-bottom: 12px;
    display: flex;
}

.chat-message.ai {
    justify-content: flex-start;
}

.chat-message.user {
    justify-content: flex-end;
}

/* 气泡样式 */
.bubble-ai {
    background: #ffffff;
    color: #333;
    padding: 10px 14px;
    border-radius: 12px 12px 12px 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    max-width: 75%;
    font-size: 13px;
    line-height: 1.5;
}

.bubble-user {
    background: linear-gradient(135deg, #ff8c42 0%, #87ceeb 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 12px 12px 4px 12px;
    max-width: 75%;
    font-size: 13px;
    line-height: 1.5;
}

/* 输入框区域 */
.chat-input {
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: white;
    border-radius: 0 0 12px 12px;
}

.chat-input form {
    display: flex;
    gap: 8px;
}

.chat-input input,
.user-input-editable {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    min-height: 36px;
    max-height: 100px;
    overflow-y: auto;
}

.user-input-editable:empty:before {
    content: attr(data-placeholder);
    color: #999;
    cursor: text;
}

.chat-input input:focus,
.user-input-editable:focus {
    border-color: #667eea;
}

/* 文本引用标签样式 - 橘色主题 */
.text-reference-tag {
    display: inline-block;
    background: linear-gradient(135deg, #ffe4d1 0%, #e3f4ff 100%);
    color: #d97706;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 12px;
    margin: 0 2px;
    border: 1.5px solid #ff8c42;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: all 0.2s;
}

.text-reference-tag:hover {
    background: linear-gradient(135deg, #ffd1b3 0%, #c6e8ff 100%);
    border-color: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 140, 66, 0.3);
}

.chat-input button {
    background: linear-gradient(135deg, #ff8c42 0%, #87ceeb 100%);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-input button:hover {
    transform: scale(1.05);
}

/* 提示框动画 */
@keyframes point-right {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(5px);
    }
}

.animate-point {
    animation: point-right 1s infinite ease-in-out;
}

/* 提示气泡 - 浮在机器人头上 */
#tooltip {
    position: absolute;
    bottom: 150px;
    /* 相对于容器底部，机器人头部位置 */
    right: 10px;
    background: white;
    color: #4b5563;
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    pointer-events: auto;
}

/* 小三角指向机器人（向下） */
#tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    /* 气泡底部 */
    right: 20px;
    /* 三角位置 */
    transform: rotate(45deg);
    width: 8px;
    height: 8px;
    background: white;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

/* 快速操作按钮（优化/精简） */
.chat-quick-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.chat-input .chat-quick-btn {
    width: auto;
    height: auto;
    border: 1px solid rgba(180, 196, 220, 0.55);
    border-radius: 10px;
    background: linear-gradient(135deg, #f8fbff 0%, #f2f8ff 100%);
    color: #32526e;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 9px 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(62, 95, 133, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.chat-input .chat-quick-btn .material-symbols-outlined {
    font-size: 15px;
    line-height: 1;
}

.chat-input .chat-quick-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(62, 95, 133, 0.2);
}

.chat-input .chat-quick-btn-optimize {
    border-color: rgba(129, 159, 218, 0.62);
    background: linear-gradient(135deg, #edf4ff 0%, #e7f0ff 100%);
    color: #2f4f91;
}

.chat-input .chat-quick-btn-optimize:hover {
    border-color: rgba(95, 134, 210, 0.8);
}

.chat-input .chat-quick-btn-concise {
    border-color: rgba(129, 186, 192, 0.62);
    background: linear-gradient(135deg, #eefbf9 0%, #e4f5f2 100%);
    color: #2f6d77;
}

.chat-input .chat-quick-btn-concise:hover {
    border-color: rgba(86, 159, 171, 0.82);
}

/* === AI 思考中气泡动画 === */
.ai-thinking-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px !important;
    background: linear-gradient(135deg, #fff8f3 0%, #f0f7ff 100%) !important;
    border: 1px solid rgba(255, 140, 66, 0.15);
    min-width: 140px;
}

.ai-thinking-dots {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff8c42, #87ceeb);
    animation: ai-dot-bounce 1.4s ease-in-out infinite;
}

.ai-dot:nth-child(2) {
    animation-delay: 0.16s;
}

.ai-dot:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes ai-dot-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.ai-thinking-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-thinking-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #555;
    transition: opacity 0.3s;
}

.ai-thinking-timer {
    font-size: 11px;
    color: #ff8c42;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}