/**
 * AI客服挂件样式 - 腾讯云风格
 */

/* ===== 悬浮按钮 ===== */
#aichat-fab {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0052D9, #366EF4);
    box-shadow: 0 4px 16px rgba(0, 82, 217, 0.35);
    cursor: pointer;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: none;
    padding: 0;
}
#aichat-fab:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 82, 217, 0.45);
}
#aichat-fab svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}
#aichat-fab .aichat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #F53F3F;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    display: none;
}
#aichat-fab .aichat-badge.show {
    display: block;
}

/* ===== 聊天面板 ===== */
#aichat-panel {
    position: fixed;
    right: 28px;
    bottom: 100px;
    width: 380px;
    height: 540px;
    max-height: calc(100vh - 140px);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
    z-index: 99999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
}
#aichat-panel.open {
    display: flex;
    animation: aichatPop 0.25s ease;
}
@keyframes aichatPop {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* ===== 头部 ===== */
#aichat-header {
    background: linear-gradient(135deg, #0052D9, #366EF4);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
#aichat-header .aichat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
#aichat-header .aichat-avatar svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}
#aichat-header .aichat-title {
    flex: 1;
    color: #fff;
}
#aichat-header .aichat-title strong {
    font-size: 15px;
    font-weight: 600;
    display: block;
    line-height: 1.3;
}
#aichat-header .aichat-title span {
    font-size: 12px;
    opacity: 0.8;
    display: block;
}
#aichat-header .aichat-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2BA471;
    display: inline-block;
    margin-right: 4px;
}
#aichat-header .aichat-close {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
#aichat-header .aichat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== 消息区域 ===== */
#aichat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    background: #F7F8FA;
    scroll-behavior: smooth;
}
#aichat-messages::-webkit-scrollbar {
    width: 5px;
}
#aichat-messages::-webkit-scrollbar-thumb {
    background: #C9CDD4;
    border-radius: 3px;
}

/* 欢迎横幅 */
.aichat-welcome-banner {
    background: linear-gradient(135deg, #ECF2FE, #DBE7FF);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    border: 1px solid #D6E4FF;
}
.aichat-welcome-banner h4 {
    margin: 0 0 6px;
    font-size: 14px;
    color: #0052D9;
    font-weight: 600;
}
.aichat-welcome-banner p {
    margin: 0;
    font-size: 12px;
    color: #4E5969;
    line-height: 1.6;
}

/* 快捷问题 */
.aichat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.aichat-quick button {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #B7C7E6;
    background: #fff;
    color: #0052D9;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.aichat-quick button:hover {
    background: #0052D9;
    color: #fff;
    border-color: #0052D9;
}

/* 消息气泡 */
.aichat-msg {
    display: flex;
    margin-bottom: 14px;
    gap: 8px;
    align-items: flex-start;
}
.aichat-msg .aichat-msg-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}
.aichat-msg.aichat-bot .aichat-msg-icon {
    background: linear-gradient(135deg, #0052D9, #366EF4);
    color: #fff;
}
.aichat-msg.aichat-user {
    flex-direction: row-reverse;
}
.aichat-msg.aichat-user .aichat-msg-icon {
    background: #E5E6EB;
    color: #4E5969;
}
.aichat-msg .aichat-bubble {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
}
.aichat-msg.aichat-bot .aichat-bubble {
    background: #fff;
    color: #1D2129;
    border: 1px solid #E5E6EB;
    border-top-left-radius: 4px;
}
.aichat-msg.aichat-user .aichat-bubble {
    background: #0052D9;
    color: #fff;
    border-top-right-radius: 4px;
}

/* 加载动画 */
.aichat-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.aichat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #A0A8B5;
    animation: aichatBlink 1.2s infinite;
}
.aichat-typing span:nth-child(2) { animation-delay: 0.2s; }
.aichat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aichatBlink {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30%           { opacity: 1;   transform: scale(1); }
}

/* ===== 输入区域 ===== */
#aichat-input-area {
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #E5E6EB;
    flex-shrink: 0;
}
#aichat-input-wrap {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
#aichat-input {
    flex: 1;
    border: 1px solid #E5E6EB;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    resize: none;
    outline: none;
    max-height: 80px;
    line-height: 1.5;
    font-family: inherit;
    transition: border-color 0.2s;
}
#aichat-input:focus {
    border-color: #0052D9;
}
#aichat-input::placeholder {
    color: #C9CDD4;
}
#aichat-send {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: #0052D9;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, opacity 0.2s;
}
#aichat-send:hover {
    background: #003CAB;
}
#aichat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
#aichat-send svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}
#aichat-input-hint {
    font-size: 11px;
    color: #C9CDD4;
    text-align: center;
    margin-top: 6px;
}

/* ===== 未配置提示 ===== */
.aichat-notice {
    text-align: center;
    padding: 30px 20px;
    color: #86909C;
    font-size: 13px;
    line-height: 1.8;
}
.aichat-notice svg {
    width: 40px;
    height: 40px;
    fill: #C9CDD4;
    margin-bottom: 10px;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    #aichat-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    #aichat-fab {
        right: 16px;
        bottom: 16px;
        width: 48px;
        height: 48px;
    }
}