/* AI 助手悬浮按钮 + 向上展开的对话窗口 */

.ai-assistant-wrap {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
}

/* 圆形悬浮按钮 */
.ai-assistant-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--light-blue, #3E92CC) 0%, var(--deep-space-blue, #0A2463) 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(62, 146, 204, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-assistant-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(62, 146, 204, 0.5);
}

.ai-assistant-btn img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    display: block;
}

/* 对话窗口（向上展开） */
.ai-assistant-panel {
    position: absolute;
    bottom: 64px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 48px);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.35s ease-out, opacity 0.25s ease-out, visibility 0.25s;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(10, 36, 99, 0.2);
    background: #fff;
    border: 1px solid rgba(62, 146, 204, 0.15);
}

.ai-assistant-panel.is-open {
    max-height: 480px;
    opacity: 1;
    visibility: visible;
    transition: max-height 0.35s ease-out, opacity 0.25s ease-out, visibility 0.25s;
}

.ai-assistant-panel .ai-panel-inner {
    display: flex;
    flex-direction: column;
    height: 480px;
    max-height: 70vh;
}

/* 窗口头部 */
.ai-assistant-panel .ai-panel-header {
    flex-shrink: 0;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--deep-space-blue, #0A2463) 0%, var(--light-blue, #3E92CC) 100%);
    color: #fff;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ai-assistant-panel .ai-panel-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-assistant-panel .ai-panel-title svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.ai-assistant-panel .ai-panel-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-assistant-panel .ai-panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ai-assistant-panel .ai-panel-close svg {
    width: 18px;
    height: 18px;
}

/* 消息区域 */
.ai-assistant-panel .ai-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.ai-assistant-panel .ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.ai-assistant-panel .ai-msg.bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid rgba(62, 146, 204, 0.15);
    color: #1a1a1a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ai-assistant-panel .ai-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--light-blue, #3E92CC) 0%, var(--deep-space-blue, #0A2463) 100%);
    color: #fff;
}

.ai-assistant-panel .ai-msg-welcome {
    align-self: flex-start;
    color: #666;
    font-size: 13px;
}

/* 输入区域 */
.ai-assistant-panel .ai-panel-input-wrap {
    flex-shrink: 0;
    padding: 12px 16px;
    border-top: 1px solid rgba(62, 146, 204, 0.12);
    background: #fff;
    border-radius: 0 0 16px 16px;
}

.ai-assistant-panel .ai-panel-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-assistant-panel .ai-panel-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(62, 146, 204, 0.25);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-assistant-panel .ai-panel-input:focus {
    border-color: var(--light-blue, #3E92CC);
}

.ai-assistant-panel .ai-panel-send {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--light-blue, #3E92CC) 0%, var(--deep-space-blue, #0A2463) 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.ai-assistant-panel .ai-panel-send:hover {
    opacity: 0.9;
}

.ai-assistant-panel .ai-panel-send svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 480px) {
    .ai-assistant-wrap {
        bottom: 16px;
        right: 16px;
    }
    .ai-assistant-panel {
        width: calc(100vw - 32px);
        right: 0;
    }
}
