/* ============================================================
   在线智能客服悬浮窗（前台全站）
   主色跟随站点主题变量 var(--primary)，未定义时回退远创蓝
   ============================================================ */

.aic-fab {
    position: fixed; right: 26px; bottom: 86px; z-index: 99;
    width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
    background: linear-gradient(135deg, var(--primary, #185FA5), var(--accent, #1D6FA8));
    color: #fff; display: grid; place-items: center;
    box-shadow: 0 10px 26px rgba(24, 95, 165, .38);
    transition: transform .25s ease, box-shadow .25s ease;
}
.aic-fab:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(24, 95, 165, .46); }
.aic-fab.aic-active { transform: scale(.92); }

.aic-panel {
    position: fixed; right: 26px; bottom: 152px; z-index: 99;
    width: 340px; max-width: calc(100vw - 24px);
    height: 500px; max-height: calc(100dvh - 180px);
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, .06);
    box-shadow: 0 18px 50px rgba(10, 40, 80, .22);
    opacity: 0; visibility: hidden; transform: translateY(16px) scale(.98);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}
.aic-panel.aic-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* ---------- 头部 ---------- */
.aic-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 14px; color: #fff; flex: 0 0 auto;
    background: linear-gradient(135deg, var(--primary, #185FA5), var(--accent, #1D6FA8));
}
.aic-head-t { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.aic-head-dot {
    width: 9px; height: 9px; border-radius: 50%; background: #4ADE80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, .25);
}
.aic-close {
    border: 0; background: rgba(255, 255, 255, .18); color: #fff;
    width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
    font-size: 16px; line-height: 1;
}
.aic-close:hover { background: rgba(255, 255, 255, .3); }

/* ---------- 消息区 ---------- */
.aic-msgs {
    flex: 1 1 auto; overflow-y: auto; padding: 14px 12px;
    background: #F5F8FB; display: flex; flex-direction: column; gap: 10px;
}
.aic-msg { display: flex; }
.aic-msg.aic-user { justify-content: flex-end; }
.aic-bubble {
    max-width: 82%; padding: 9px 12px; border-radius: 12px;
    font-size: 13.5px; line-height: 1.65; word-break: break-word; white-space: pre-wrap;
}
.aic-user .aic-bubble { background: var(--primary, #185FA5); color: #fff; border-bottom-right-radius: 4px; }
.aic-assistant .aic-bubble { background: #fff; color: #21303F; border: 1px solid #E3EBF2; border-bottom-left-radius: 4px; }

/* 正在输入动画 */
.aic-loading .aic-bubble { display: flex; gap: 4px; align-items: center; padding: 12px 14px; }
.aic-dot {
    width: 6px; height: 6px; border-radius: 50%; background: #9FB4C8;
    animation: aicBlink 1.2s infinite ease-in-out;
}
.aic-dot:nth-child(2) { animation-delay: .2s; }
.aic-dot:nth-child(3) { animation-delay: .4s; }
@keyframes aicBlink { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ---------- 快捷问题 ---------- */
.aic-quick {
    flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 6px;
    padding: 8px 12px; border-top: 1px solid #EDF2F7; background: #fff;
}
.aic-chip {
    border: 1px solid #D7E2EC; background: #F6FAFD; color: var(--primary, #185FA5);
    font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}
.aic-chip:hover { background: #EAF2F9; border-color: var(--primary, #185FA5); }

/* ---------- 输入区 ---------- */
.aic-foot {
    flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 12px;
    background: #fff; border-top: 1px solid #EDF2F7;
}
.aic-input {
    flex: 1 1 auto; min-width: 0; height: 38px; padding: 0 12px;
    border: 1px solid #D7E2EC; border-radius: 9px; font-size: 13.5px; outline: none;
}
.aic-input:focus { border-color: var(--primary, #185FA5); box-shadow: 0 0 0 3px rgba(24, 95, 165, .12); }
.aic-send {
    flex: 0 0 auto; height: 38px; padding: 0 16px; border: 0; border-radius: 9px;
    background: var(--primary, #185FA5); color: #fff; font-size: 13.5px; cursor: pointer;
}
.aic-send:hover { filter: brightness(1.1); }
.aic-send:disabled { opacity: .55; cursor: default; }

/* ---------- 窄屏适配 ---------- */
@media (max-width: 480px) {
    .aic-fab { right: 16px; bottom: 78px; width: 50px; height: 50px; }
    .aic-panel { right: 12px; bottom: 140px; }
}
