/* ===== 聊天窗口整体 ===== */
#sac-chat-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 99999;
    font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 右下角圆形按钮 */
#sac-chat-button {
    width: 60px; height: 60px; border-radius: 50%;
    background: #1a2b4a; color: #fff; font-size: 28px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#sac-chat-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* 聊天框主体 */
#sac-chat-box {
    width: 360px; height: 520px; background: #fff;
    border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex; flex-direction: column; overflow: hidden;
    position: absolute; bottom: 76px; right: 0;
    animation: sacFadeIn 0.25s ease;
}
@keyframes sacFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 顶部标题栏 */
#sac-chat-header {
    background: #1a2b4a; color: #fff;
    padding: 16px 18px; font-weight: 600; font-size: 16px;
    display: flex; align-items: center; justify-content: space-between;
}
#sac-chat-header .sac-status {
    display: inline-flex; align-items: center; font-size: 12px; font-weight: 400; opacity: 0.85;
}
#sac-chat-header .sac-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #4ade80; margin-right: 6px;
}
#sac-chat-close {
    cursor: pointer; font-size: 22px; line-height: 1; opacity: 0.8;
    background: none; border: none; color: #fff; padding: 0;
}
#sac-chat-close:hover { opacity: 1; }

/* 消息区 */
#sac-chat-messages {
    flex: 1; padding: 16px; overflow-y: auto; background: #f4f6f9;
    display: flex; flex-direction: column; gap: 10px;
}
#sac-chat-messages p {
    margin: 0; padding: 10px 14px; border-radius: 14px;
    max-width: 78%; line-height: 1.5; font-size: 14px;
    word-wrap: break-word; white-space: pre-wrap;
}
/* 用户消息:右侧、深蓝 */
.sac-user-msg {
    background: #1a2b4a; color: #fff;
    align-self: flex-end; border-bottom-right-radius: 4px;
}
/* AI 消息:左侧、白底 */
.sac-ai-msg {
    background: #fff; color: #2d3748;
    border: 1px solid #e2e8f0; border-bottom-left-radius: 4px;
    margin: 0; padding: 10px 14px; border-radius: 14px;
    line-height: 1.5; font-size: 14px; word-wrap: break-word; white-space: pre-wrap;
}
/* AI 消息里的链接 */
.sac-ai-msg a { color: #2563eb; text-decoration: underline; word-break: break-all; }

/* 输入区 */
#sac-chat-input-area {
    display: flex; border-top: 1px solid #eceff3; padding: 12px; background: #fff;
}
#sac-chat-input {
    flex: 1; border: 1px solid #d5dbe3; border-radius: 22px;
    padding: 10px 16px; font-size: 14px; outline: none;
}
#sac-chat-input:focus { border-color: #1a2b4a; }
#sac-chat-send {
    margin-left: 8px; background: #1a2b4a; color: #fff; border: none;
    border-radius: 22px; padding: 0 18px; font-size: 14px; cursor: pointer;
    transition: background 0.2s;
}
#sac-chat-send:hover { background: #26406e; }

/* "正在输入"的小动画 */
.sac-typing { display: inline-flex; gap: 4px; align-items: center; }
.sac-typing span {
    width: 7px; height: 7px; border-radius: 50%; background: #9aa5b5;
    animation: sacBlink 1.2s infinite both;
}
.sac-typing span:nth-child(2) { animation-delay: 0.2s; }
.sac-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes sacBlink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
/* AI 消息行:头像 + 气泡 水平排列 */
.sac-ai-row {
    display: flex;
    align-items: flex-start;   /* 头像和气泡底部对齐 */
    gap: 8px;
    max-width: 85%;
    align-self: flex-start;  /* 整行靠左 */
}

/* 头像小圆圈 */
.sac-avatar {
    width: 30px; height: 30px; flex-shrink: 0;
    border-radius: 50%;
    background: #1a2b4a;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}