/* AI 助手浮动按钮 + 对话面板 */
.ai-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary, #0D7C66);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(13,124,102,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: transform 0.2s, box-shadow 0.2s;
}
.ai-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(13,124,102,0.5);
}
.ai-fab svg { width: 26px; height: 26px; }
.ai-fab .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #2ECC71;
    border: 2px solid #fff;
}

.ai-panel {
    position: fixed;
    right: 24px;
    bottom: 88px;
    width: 400px;
    height: 540px;
    border-radius: 12px;
    background: var(--card-bg, #111D2E);
    border: 1px solid var(--border, #1E3048);
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
}
.ai-panel.open {
    display: flex;
    animation: aiSlideUp 0.25s ease-out;
}
@keyframes aiSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border, #1E3048);
    background: var(--primary, #0D7C66);
    color: #fff;
}
.ai-panel-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}
.ai-panel-header .subtitle {
    font-size: 11px;
    opacity: 0.8;
    margin-top: 2px;
}
.ai-panel-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.15s;
}
.ai-panel-close:hover { background: rgba(255,255,255,0.25); }

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ai-messages::-webkit-scrollbar { width: 4px; }
.ai-messages::-webkit-scrollbar-thumb { background: var(--border, #1E3048); border-radius: 2px; }

.ai-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}
.ai-msg.user {
    align-self: flex-end;
    background: var(--primary, #0D7C66);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.ai-msg.assistant {
    align-self: flex-start;
    background: var(--surface, #1a2738);
    color: var(--text, #E8ECF1);
    border-bottom-left-radius: 4px;
}
.ai-msg.assistant .sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border, #1E3048);
    font-size: 11px;
    color: var(--text-muted, #8B9BB4);
}
.ai-msg.assistant .sources span {
    display: inline-block;
    background: rgba(13,124,102,0.15);
    color: var(--primary, #0D7C66);
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px 4px 2px 0;
}

.ai-msg .typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted, #8B9BB4);
    margin: 0 2px;
    animation: dotBounce 1.2s infinite;
}
.ai-msg .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-msg .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

.ai-welcome {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted, #8B9BB4);
}
.ai-welcome .icon { font-size: 36px; margin-bottom: 12px; }
.ai-welcome h4 { color: var(--text, #E8ECF1); margin: 0 0 8px; font-size: 15px; }
.ai-welcome p { font-size: 12px; margin: 0 0 16px; }
.ai-welcome .quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}
.ai-welcome .quick-questions button {
    background: rgba(13,124,102,0.12);
    border: 1px solid rgba(13,124,102,0.25);
    color: var(--primary, #0D7C66);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.ai-welcome .quick-questions button:hover {
    background: rgba(13,124,102,0.2);
}

.ai-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border, #1E3048);
    background: var(--surface, #1a2738);
}
.ai-input-area input {
    flex: 1;
    background: var(--input-bg, #0B1426);
    border: 1px solid var(--border, #1E3048);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text, #E8ECF1);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}
.ai-input-area input:focus {
    border-color: var(--primary, #0D7C66);
}
.ai-input-area input::placeholder {
    color: var(--text-muted, #8B9BB4);
}
.ai-input-area button {
    background: var(--primary, #0D7C66);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.ai-input-area button:hover { opacity: 0.85; }
.ai-input-area button:disabled { opacity: 0.4; cursor: not-allowed; }
.ai-input-area button svg { width: 18px; height: 18px; }
