/* ==========================================
   AI客服助手 - 全站通用样式
   ========================================== */

/* 浮动AI按钮 */
.ai-assistant-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 9998;
    color: white;
}

.ai-assistant-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.ai-assistant-btn svg {
    width: 28px;
    height: 28px;
}

.ai-assistant-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.4);
}

/* AI对话面板 */
.ai-assistant-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.ai-assistant-panel.active {
    right: 0;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .ai-assistant-panel {
        background: rgba(30, 30, 30, 0.95);
        color: #e0e0e0;
    }
}

/* 面板头部 */
.ai-assistant-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ai-assistant-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
}

.ai-assistant-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-assistant-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* 对话内容区 */
.ai-assistant-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 自定义滚动条 */
.ai-assistant-content::-webkit-scrollbar {
    width: 6px;
}

.ai-assistant-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.ai-assistant-content::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.ai-assistant-content::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* 欢迎消息 */
.ai-welcome {
    text-align: center;
    padding: 20px;
}

.ai-avatar {
    font-size: 48px;
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.ai-welcome-text {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* 消息气泡 */
.ai-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.ai-message-content {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 14px;
}

/* 用户消息 */
.ai-message.user {
    flex-direction: row-reverse;
}

.ai-message.user .ai-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

/* AI消息 */
.ai-message.assistant .ai-message-content {
    background: rgba(102, 126, 234, 0.1);
    color: #333;
    border-bottom-left-radius: 4px;
}

@media (prefers-color-scheme: dark) {
    .ai-message.assistant .ai-message-content {
        background: rgba(102, 126, 234, 0.2);
        color: #e0e0e0;
    }
}

/* 错误消息 */
.ai-message.error .ai-message-content {
    background: rgba(255, 87, 87, 0.1);
    color: #ff5757;
    border: 1px solid rgba(255, 87, 87, 0.3);
}

/* 打字动画 */
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.ai-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* 输入区域 */
.ai-assistant-input-area {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 10px;
}

@media (prefers-color-scheme: dark) {
    .ai-assistant-input-area {
        background: rgba(255, 255, 255, 0.05);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

.ai-assistant-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background: white;
}

.ai-assistant-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

@media (prefers-color-scheme: dark) {
    .ai-assistant-input {
        background: rgba(255, 255, 255, 0.1);
        color: #e0e0e0;
        border-color: rgba(102, 126, 234, 0.3);
    }
}

.ai-assistant-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ai-assistant-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.ai-assistant-send-btn:active {
    transform: scale(0.95);
}

/* 消息内容格式化 */
.ai-message-content strong {
    font-weight: 600;
    color: #667eea;
}

.ai-message-content em {
    font-style: italic;
    color: #764ba2;
}

.ai-message-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

@media (prefers-color-scheme: dark) {
    .ai-message-content code {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .ai-assistant-panel {
        width: 100%;
        right: -100%;
    }

    .ai-assistant-btn {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .ai-assistant-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* 平板适配 */
@media (max-width: 1024px) and (min-width: 769px) {
    .ai-assistant-panel {
        width: 360px;
    }
}