/* ===============================================================
   首页 AI 智能客服浮窗（仅 index.html 引入）
   配色沿用站点蓝：#1f5fae / #174a8a
   机器人图标设计 + 可拖动 + 动画效果
   =============================================================== */

/* 悬浮启动按钮 —— 机器人风格 */
#aichat-launcher {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(145deg, #3a8de8, #1a4a8a);
    color: #fff;
    border: none;
    cursor: grab;
    z-index: 99990;
    box-shadow: 0 6px 24px rgba(26, 74, 138, 0.45),
                inset 0 2px 4px rgba(255,255,255,0.25),
                inset 0 -2px 4px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow .25s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
#aichat-launcher:active { cursor: grabbing; }
#aichat-launcher:hover {
    box-shadow: 0 8px 32px rgba(26, 74, 138, 0.55),
                inset 0 2px 4px rgba(255,255,255,0.3),
                inset 0 -2px 4px rgba(0,0,0,0.2);
}
#aichat-launcher svg {
    width: 40px;
    height: 40px;
    transition: transform .3s ease;
}
#aichat-launcher:hover svg {
    transform: scale(1.08) rotate(-3deg);
}

/* 呼吸光圈 */
#aichat-launcher::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(58,141,232,0.4) 0%, transparent 70%);
    animation: aichat-glow 2.5s ease-in-out infinite;
    pointer-events: none;
}
@keyframes aichat-glow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* 猫咪眼睛动画 —— 眨眼 + 眼珠转动 */
@keyframes cat-blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}
@keyframes cat-look {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(2px, -1px); }
    50% { transform: translate(-2px, 1px); }
    75% { transform: translate(1px, 2px); }
}
.cat-eye {
    animation: cat-blink 4s infinite, cat-look 8s infinite;
    transform-origin: center;
    transform-box: fill-box;
}
.cat-eye-left { animation-delay: 0s, 0s; }
.cat-eye-right { animation-delay: 0.1s, 0.5s; }

/* 对话提示气泡 —— 简洁聊天感 */
#aichat-tip {
    position: fixed;
    right: 96px;
    bottom: 34px;
    background: #fff;
    padding: 0;
    border-radius: 16px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.14), 0 0 0 1px rgba(0,0,0,0.04);
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    z-index: 99989;
    opacity: 0;
    transform: translateX(10px) scale(0.9);
    transition: opacity .3s ease, transform .3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    max-width: 260px;
    overflow: hidden;
}
#aichat-tip.show {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
}
#aichat-tip::after {
    content: "";
    position: absolute;
    right: -8px;
    bottom: 16px;
    width: 0;
    height: 0;
    border-left: 10px solid #fff;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}
#aichat-tip .tip-close {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    background: #ff5a5a;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    pointer-events: auto;
    z-index: 2;
}

/* 气泡内容 */
#aichat-tip .tip-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
}
#aichat-tip .tip-icon {
    font-size: 28px;
    flex-shrink: 0;
    line-height: 1;
}
#aichat-tip .tip-text {
    font-size: 13px;
    color: #444;
    line-height: 1.7;
    flex: 1;
    min-width: 0;
}

/* 底部引导 */
#aichat-tip .tip-footer {
    text-align: center;
    font-size: 12px;
    color: #1f5fae;
    font-weight: 600;
    padding: 10px 16px;
    border-top: 1px dashed #e8e8e8;
    animation: tip-action-pulse 2s infinite;
    cursor: pointer;
}
@keyframes tip-action-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* 呼吸提示点 */
#aichat-launcher::after {
    content: "";
    position: absolute;
    top: 8px; right: 8px;
    width: 12px; height: 12px;
    background: #ff5a5a;
    border: 2px solid #fff;
    border-radius: 50%;
    animation: aichat-pulse 1.8s infinite;
    box-shadow: 0 0 8px rgba(255,90,90,0.6);
}
@keyframes aichat-pulse {
    0%   { transform: scale(1);   opacity: 1; }
    70%  { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1);   opacity: 0; }
}

/* 拖动时的视觉反馈 */
#aichat-launcher.dragging {
    box-shadow: 0 12px 40px rgba(26, 74, 138, 0.6),
                inset 0 2px 4px rgba(255,255,255,0.3),
                inset 0 -2px 4px rgba(0,0,0,0.2);
    transition: none;
}
#aichat-launcher.dragging::before {
    animation: none;
    opacity: 0.8;
}

/* 聊天面板 */
#aichat-panel {
    position: fixed;
    right: 22px;
    bottom: 100px;
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: 70vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25),
                0 0 0 1px rgba(0,0,0,0.05);
    display: none;
    flex-direction: column;
    z-index: 99991;
    overflow: hidden;
    animation: aichat-panel-in .35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes aichat-panel-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
#aichat-panel.open { display: flex; }

#aichat-panel .ac-header {
    background: linear-gradient(135deg, #2f7fd6, #174a8a);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
#aichat-panel .ac-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: ac-avatar-breathe 3s ease-in-out infinite;
}
@keyframes ac-avatar-breathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
#aichat-panel .ac-avatar svg { width: 26px; height: 26px; }
#aichat-panel .ac-title { font-size: 15px; font-weight: 600; line-height: 1.2; }
#aichat-panel .ac-sub   { font-size: 11px; opacity: 0.85; margin-top: 3px; }
#aichat-panel .ac-close {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
}
#aichat-panel .ac-close:hover { background: rgba(255,255,255,0.30); }

#aichat-panel .ac-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f7f9fc;
    display: flex;
    flex-direction: column;
}
#aichat-panel .ac-msg { display: flex; margin-bottom: 14px; align-items: flex-end; gap: 8px; animation: ac-msg-in .3s ease; }
@keyframes ac-msg-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
#aichat-panel .ac-msg .ac-bubble {
    max-width: 78%;
    padding: 11px 15px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}
#aichat-panel .ac-msg.bot .ac-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
/* AI 回复里的「查看完整详情」可点击链接 */
#aichat-panel .ac-detail-link {
    display: block;
    margin-top: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #2f7fd6, #174a8a);
    color: #fff !important;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: all .25s ease;
}
#aichat-panel .ac-detail-link:hover {
    background: linear-gradient(135deg, #174a8a, #0f3564);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(31, 95, 174, 0.35);
    text-decoration: none;
}
#aichat-panel .ac-msg.user { flex-direction: row-reverse; }
#aichat-panel .ac-msg.user .ac-bubble {
    background: linear-gradient(135deg, #2f7fd6, #174a8a);
    color: #fff;
    border-bottom-right-radius: 4px;
}
#aichat-panel .ac-msg .ac-mini-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #2f7fd6, #174a8a);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#aichat-panel .ac-typing .ac-bubble { padding: 14px 18px; }
#aichat-panel .ac-typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #bbb;
    border-radius: 50%;
    margin-right: 4px;
    animation: ac-typing 1.2s infinite;
}
#aichat-panel .ac-typing span:nth-child(2) { animation-delay: .2s; }
#aichat-panel .ac-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes ac-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* 快捷问题 */
#aichat-panel .ac-quick {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #eef0f4;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}
#aichat-panel .ac-chip {
    padding: 8px 14px;
    background: #f0f4f9;
    border: 1px solid #dde3ec;
    border-radius: 20px;
    font-size: 13px;
    color: #444;
    cursor: pointer;
    transition: all .2s;
}
#aichat-panel .ac-chip:hover {
    background: #e3edf7;
    border-color: #b8c9e0;
    color: #1f5fae;
}

/* 输入区 */
#aichat-panel .ac-input {
    padding: 14px 16px;
    background: #fff;
    border-top: 1px solid #eef0f4;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
#aichat-panel .ac-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #dde3ec;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
#aichat-panel .ac-input input:focus {
    border-color: #2f7fd6;
    box-shadow: 0 0 0 3px rgba(47,127,214,0.12);
}
#aichat-panel .ac-send {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2f7fd6, #174a8a);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, box-shadow .2s;
    flex-shrink: 0;
}
#aichat-panel .ac-send:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(47,127,214,0.4);
}
#aichat-panel .ac-send svg { width: 18px; height: 18px; }

/* 响应式：手机端全屏 */
@media (max-width: 480px) {
    #aichat-panel {
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
    }
    #aichat-launcher {
        right: 16px;
        bottom: 16px;
        width: 56px;
        height: 56px;
    }
    #aichat-launcher svg { width: 34px; height: 34px; }
}

/* 手机端：提示气泡不自动弹出，避免遮挡首屏内容；仅保留右下角悬浮头像入口 */
@media (max-width: 768px) {
    #aichat-tip { display: none !important; }
}
