/**
 * 火桥（huoqiao）· AI 问答助手面板样式
 * 亮色为默认，[data-theme="dark"] 覆盖为暗色。
 */

.hq-ai-assistant-panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e7e9f0;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(20, 24, 48, 0.18);
    overflow: hidden;
    z-index: 99998;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
}

.hq-ai-assistant-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.hq-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #6b7be8, #8a6be8);
    color: #fff;
    flex-shrink: 0;
}

.hq-ai-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
}

.hq-ai-title i {
    font-size: 17px;
}

.hq-ai-close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-radius: 8px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.hq-ai-close:hover {
    background: rgba(255, 255, 255, 0.32);
}

.hq-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f6f7fb;
}

.hq-ai-message {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}

.hq-ai-message.ai {
    align-self: flex-start;
    background: #ffffff;
    color: #1f2330;
    border: 1px solid #e7e9f0;
    border-bottom-left-radius: 4px;
}

.hq-ai-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6b7be8, #8a6be8);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.hq-ai-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e7e9f0;
}

.hq-ai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9aa0b5;
    animation: hq-ai-bounce 1.2s infinite ease-in-out;
}

.hq-ai-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.hq-ai-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes hq-ai-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.hq-ai-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e7e9f0;
    background: #ffffff;
    flex-shrink: 0;
}

.hq-ai-input {
    flex: 1;
    resize: none;
    border: 1px solid #dfe2ec;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 14px;
    line-height: 1.5;
    font-family: inherit;
    color: #1f2330;
    background: #f6f7fb;
    outline: none;
    max-height: 120px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.hq-ai-input:focus {
    border-color: #6b7be8;
    background: #ffffff;
}

.hq-ai-send {
    flex-shrink: 0;
    border: none;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #6b7be8, #8a6be8);
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.hq-ai-send:disabled {
    opacity: 0.55;
    cursor: default;
}

/* 移动端：底部抽屉式 */
@media (max-width: 600px) {
    .hq-ai-assistant-panel {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 70vh;
        max-height: 70vh;
        border-radius: 18px 18px 0 0;
        transform: translateY(100%);
    }

    .hq-ai-assistant-panel.is-open {
        transform: translateY(0);
    }
}

/* 暗色模式 */
[data-theme="dark"] .hq-ai-assistant-panel {
    background: #1c1f2b;
    border-color: #2c3142;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .hq-ai-messages {
    background: #161922;
}

[data-theme="dark"] .hq-ai-message.ai {
    background: #232838;
    color: #e6e8f0;
    border-color: #2c3142;
}

[data-theme="dark"] .hq-ai-typing {
    background: #232838;
    border-color: #2c3142;
}

[data-theme="dark"] .hq-ai-typing span {
    background: #5b6178;
}

[data-theme="dark"] .hq-ai-input-area {
    background: #1c1f2b;
    border-top-color: #2c3142;
}

[data-theme="dark"] .hq-ai-input {
    background: #232838;
    color: #e6e8f0;
    border-color: #2c3142;
}

[data-theme="dark"] .hq-ai-input:focus {
    background: #1c1f2b;
}
