/* ================= 首页悬浮问答助手 ================= */
.ai-home {
    position: fixed;
    inset: 0;
    z-index: 10000;
    font-family: inherit;
    pointer-events: none;   /* 只让弹窗本体可交互 */
}

/* 遮罩层 */
.ai-home-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 40, .46);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}
.ai-home-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}
/* 首页专用：把联系按钮下移，让问答助手居上（原 bottom: 90px） */
.fab-contact {
    bottom: 24px;
}

/* ---------- 悬浮按钮 ---------- */
.ai-home-fab {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366F1 0%, #7C5CF0 50%, #A855F7 100%);
    box-shadow: 0 8px 24px rgba(99, 102, 241, .42);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .25s cubic-bezier(.34, 1.4, .64, 1), box-shadow .25s;
    position: relative;
}
.ai-home-fab svg { width: 27px; height: 27px; display: block; }
.ai-home-fab:hover {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 12px 30px rgba(99, 102, 241, .5);
}
.ai-home-fab:active { transform: scale(.96); }
.ai-home-fab.is-active {
    transform: rotate(90deg) scale(1.02);
    box-shadow: 0 10px 26px rgba(99, 102, 241, .5);
}
/* 呼吸光晕 */
.ai-home-fab::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(139, 92, 246, .45);
    animation: aiPulse 2.4s ease-out infinite;
    pointer-events: none;
}
@keyframes aiPulse {
    0%   { transform: scale(.9);  opacity: .7; }
    70%  { transform: scale(1.25); opacity: 0; }
    100% { transform: scale(1.25); opacity: 0; }
}
.ai-home-fab.is-active::after { animation: none; opacity: 0; }

/* ---------- 面板 ---------- */
.ai-home-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    width: min(940px, calc(100vw - 40px));
    height: min(700px, calc(100vh - 56px));
    max-height: none;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 30px 90px rgba(30, 24, 90, .38);
    overflow: hidden;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.94);
    transform-origin: center;
    transition: opacity .22s ease, transform .28s cubic-bezier(.34, 1.3, .64, 1);
    pointer-events: none;
}
.ai-home-panel.is-open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.ai-home-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 17px 18px;
    background: linear-gradient(130deg, #6366F1 0%, #7C5CF0 48%, #A855F7 100%);
    overflow: hidden;
    flex: none;
}
.ai-home-head::before,
.ai-home-head::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.ai-home-head::before {
    top: -52px; right: -22px;
    width: 138px; height: 138px;
    background: rgba(255, 255, 255, .14);
}
.ai-home-head::after {
    bottom: -56px; right: 52px;
    width: 94px; height: 94px;
    background: rgba(255, 255, 255, .08);
}
.ai-home-badge {
    position: relative;
    z-index: 1;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: rgba(255, 255, 255, .17);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ai-home-badge svg { width: 23px; height: 23px; display: block; }
.ai-home-titles { position: relative; z-index: 1; flex: 1; min-width: 0; }
.ai-home-titles h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .01em;
}
.ai-home-titles p {
    margin: 3px 0 0;
    font-size: 12.6px;
    font-weight: 500;
    color: rgba(255, 255, 255, .93);
    line-height: 1.42;
}
.ai-home-close {
    position: relative;
    z-index: 1;
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, transform .2s;
}
.ai-home-close:hover { background: rgba(255, 255, 255, .32); transform: rotate(90deg); }
.ai-home-close svg { width: 15px; height: 15px; }

/* ---------- 消息区 ---------- */
.ai-home-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    min-height: 220px;
    background: #fafaff;
    scroll-behavior: smooth;
}
.ai-home-msg { margin-bottom: 11px; }
.ai-home-bubble {
    font-size: 13.6px;
    line-height: 1.72;
    padding: 11px 14px;
    border-radius: 15px;
    white-space: pre-line;
}
.ai-home-bot .ai-home-bubble {
    background: #f1f1fd;
    color: #3a4160;
    border-bottom-left-radius: 5px;
}
.ai-home-user { text-align: right; }
.ai-home-user .ai-home-bubble {
    display: inline-block;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff;
    border-bottom-right-radius: 5px;
    text-align: left;
    max-width: 92%;
}

.ai-home-results {
    margin-top: 11px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ai-home-card {
    background: #fff;
    border: 1px solid #e9e9f6;
    border-radius: 12px;
    padding: 11px 13px;
    transition: border-color .18s, box-shadow .18s;
}
.ai-home-card:hover {
    border-color: #6366F1;
    box-shadow: 0 4px 14px rgba(99, 102, 241, .16);
}
.ai-home-card-q {
    font-size: 13.6px;
    font-weight: 700;
    color: #1B2A4A;
    line-height: 1.45;
    margin-bottom: 5px;
}
.ai-home-card-a {
    font-size: 13.2px;
    color: #55607a;
    line-height: 1.75;
    white-space: pre-line;
}
.ai-home-card-meta {
    margin-top: 7px;
    font-size: 11.5px;
    color: #6366F1;
    font-weight: 600;
}
.ai-home-rel { margin-top: 12px; font-size: 12.8px; font-weight: 700; color: #1B2A4A; }
.ai-home-rel .ai-home-rel-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ai-home-rel button {
    display: inline-block;
    width: auto;
    max-width: 100%;
    text-align: left;
    border: 0;
    background: #f2f1fe;
    color: #3a4160;
    font-size: 12.6px;
    padding: 8px 11px;
    border-radius: 9px;
    margin-top: 6px;
    cursor: pointer;
    line-height: 1.45;
    font-weight: 500;
}
.ai-home-rel button:hover { background: #e9e7fd; color: #6366F1; }

/* ---------- 快捷问题 ---------- */
.ai-home-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 11px 16px 0;
    flex: none;
}
.ai-home-qchip {
    border: 1px solid #e9e9f6;
    background: #f7f7fd;
    color: #6b7891;
    font-size: 12.2px;
    padding: 6px 11px;
    border-radius: 20px;
    cursor: pointer;
    transition: all .18s;
}
.ai-home-qchip:hover {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    border-color: transparent;
    color: #fff;
}

/* ---------- 输入区 ---------- */
.ai-home-form {
    display: flex;
    gap: 8px;
    padding: 12px 16px 8px;
    flex: none;
}
.ai-home-form input {
    flex: 1;
    min-width: 0;
    border: 1px solid #e9e9f6;
    background: #f7f7fd;
    border-radius: 11px;
    padding: 10px 13px;
    font-size: 13.5px;
    outline: none;
    color: #1B2A4A;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.ai-home-form input:focus {
    border-color: #6366F1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
    background: #fff;
}
.ai-home-form button {
    flex: none;
    border: 0;
    border-radius: 11px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    cursor: pointer;
    transition: opacity .2s;
}
.ai-home-form button:hover { opacity: .9; }

.ai-home-all {
    display: block;
    text-align: center;
    padding: 6px 16px 15px;
    font-size: 12.6px;
    font-weight: 600;
    color: #6366F1;
    text-decoration: none;
    flex: none;
}
.ai-home-all:hover { text-decoration: underline; }

/* ---------- 响应式 ---------- */
@media (max-width: 576px) {
    .fab-contact { bottom: 16px; }
    .ai-home-fab { width: 52px; height: 52px; }
    .ai-home-fab svg { width: 24px; height: 24px; }
    .ai-home-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 40px);
        border-radius: 18px;
    }
    .ai-home-body { padding: 14px 16px; }
}
