/* =========================================================
   艾智能官网 · AI 问答浮窗
   仅在 PC 端显示（≤768px 自动隐藏），依赖 ai/ 下的后端服务
   ========================================================= */

.ait-chat {
    position: fixed;
    right: 26px;
    bottom: 150px;
    z-index: 9999;
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    color: #2b2f36;
}

/* ---------- 触发按钮（初始状态） ---------- */
.ait-chat__fab {
    position: fixed;
    right: 26px;
    bottom: 150px;
    width: 76px;
    height: 76px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 8px 24px rgba(37, 99, 235, .28);
    cursor: pointer;
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease;
}

.ait-chat__fab:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 12px 30px rgba(37, 99, 235, .38);
}

.ait-chat__fab img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ait-chat__fab::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, .35);
    animation: ait-chat-pulse 2.4s ease-out infinite;
}

@keyframes ait-chat-pulse {
    0% { transform: scale(1); opacity: .9; }
    70% { transform: scale(1.25); opacity: 0; }
    100% { transform: scale(1.25); opacity: 0; }
}

/* ---------- 聊天面板 ---------- */
.ait-chat__panel {
    display: none;
    flex-direction: column;
    width: 440px;
    max-width: calc(100vw - 52px);
    height: 600px;
    max-height: calc(100vh - 200px);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 14px 42px rgba(15, 23, 42, .22);
    border: 1px solid #e6e9f0;
    overflow: hidden;
}

.ait-chat__panel.is-open {
    display: flex;
    flex-direction: column;
}

/* ---------- 头部 ---------- */
.ait-chat__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #fff;
}

.ait-chat__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    flex: 0 0 auto;
}

.ait-chat__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ait-chat__title {
    flex: 1;
    min-width: 0;
}

.ait-chat__title strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.ait-chat__title span {
    display: block;
    font-size: 12px;
    opacity: .85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ait-chat__close {
    border: none;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

.ait-chat__close:hover {
    background: rgba(255, 255, 255, .3);
}

/* ---------- 消息区 ---------- */
.ait-chat__body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f6f8fc;
}

.ait-chat__msg {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.ait-chat__msg--user {
    align-items: flex-end;
}

.ait-chat__bubble {
    max-width: 88%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 14px;
    background: #fff;
    border: 1px solid #e6e9f0;
    word-break: break-word;
    white-space: pre-wrap;
}

.ait-chat__msg--user .ait-chat__bubble {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.ait-chat__bubble p {
    margin: 0 0 6px;
}

.ait-chat__bubble p:last-child {
    margin-bottom: 0;
}

.ait-chat__bubble a {
    color: #2563eb;
    text-decoration: none;
}

.ait-chat__msg--user .ait-chat__bubble a {
    color: #fff;
    text-decoration: underline;
}

.ait-chat__time {
    font-size: 11px;
    color: #9aa3b2;
    margin: 3px 4px 0;
}

.ait-chat__note {
    font-size: 12px;
    color: #8a94a6;
    margin: 6px 4px 0;
}

.ait-chat__disclaimer {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    color: #b45309;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    padding: 1px 6px;
}

.ait-chat__sources {
    margin-top: 6px;
    font-size: 12px;
}

.ait-chat__sources a {
    display: inline-block;
    margin: 2px 6px 0 0;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    text-decoration: none;
}

.ait-chat__device {
    display: block;
    margin-top: 8px;
    padding: 9px 12px;
    border: 1px solid #d7dce5;
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    color: #2b2f36;
}

.ait-chat__device:hover {
    border-color: #2563eb;
    background: #f5f7ff;
}

.ait-chat__device strong {
    display: block;
    font-size: 13.5px;
    color: #2563eb;
}

.ait-chat__device span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #6b7280;
}

.ait-chat__device em {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    font-style: normal;
    color: #9aa3b2;
}

.ait-chat__nav {
    display: block;
    margin-top: 8px;
    padding: 9px 12px;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    background: #eef2ff;
    color: #3730a3;
    text-decoration: none;
}

.ait-chat__nav:hover {
    background: #e0e7ff;
}

.ait-chat__nav strong {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
}

.ait-chat__nav span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    opacity: .8;
}

/* ---------- 快捷问题 ---------- */
.ait-chat__quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px 0;
    background: #f6f8fc;
}

.ait-chat__quick button {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    cursor: pointer;
}

.ait-chat__quick button:hover {
    background: #e0e7ff;
}

/* ---------- 输入区 ---------- */
.ait-chat__foot {
    padding: 8px 10px 10px;
    border-top: 1px solid #e6e9f0;
    background: #fff;
}

.ait-chat__hint {
    font-size: 11px;
    color: #8a94a6;
    margin-bottom: 6px;
}

.ait-chat__hint a {
    color: #2563eb;
    text-decoration: none;
}

.ait-chat__input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.ait-chat__input {
    flex: 1;
    resize: none;
    height: 64px;
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    color: #2b2f36;
    border: 1px solid #d7dce5;
    border-radius: 10px;
    outline: none;
}

.ait-chat__input:focus {
    border-color: #2563eb;
}

.ait-chat__send {
    height: 38px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    font-size: 13.5px;
    cursor: pointer;
}

.ait-chat__send:disabled {
    background: #9db4e8;
    cursor: not-allowed;
}

/* ---------- 打字动画 ---------- */
.ait-chat__typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin: 0 2px;
    border-radius: 50%;
    background: #9aa3b2;
    animation: ait-chat-dot 1.2s infinite ease-in-out;
}

.ait-chat__typing span:nth-child(2) { animation-delay: .18s; }
.ait-chat__typing span:nth-child(3) { animation-delay: .36s; }

@keyframes ait-chat-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- 移动端隐藏 ---------- */
@media (max-width: 768px) {
    .ait-chat { display: none !important; }
}
