/**
 * DeepSeek 智能客服聊天组件
 * 文件位置：/www/wwwroot/ntqianlin.com/assets/css/chat-widget.css
 */

/* ===== 聊天按钮样式 ===== */
.chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 140px;
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.4);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chat-bubble:hover {
    transform: translateX(-5px);
    box-shadow: 0 6px 30px rgba(255, 68, 68, 0.6);
}

.chat-bubble-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.chat-bubble-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-bubble-text {
    font-size: 16px;
    font-weight: 600;
    color: white;
    letter-spacing: 4px;
    text-align: center;
    line-height: 1.4;
    padding: 0 5px;
}

.chat-bubble-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid #ff4444;
    border-radius: 50%;
    color: #ff4444;
    font-size: 12px;
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    animation: badge-bounce 0.3s ease;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(255, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(255, 68, 68, 0.8);
    }
}

@keyframes badge-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ===== 聊天窗口样式 ===== */
.chat-window {
    position: fixed;
    bottom: 180px;
    right: 100px;  /* 留出右侧导航栏空间（导航栏宽76px + 间距） */
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chat-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 聊天头部 ===== */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-text p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-close-btn:hover {
    opacity: 1;
}

/* ===== 对话消息区域 ===== */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f7fa;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.message {
    margin-bottom: 15px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-user {
    text-align: right;
}

.message-user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: inline-block;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 70%;
    word-wrap: break-word;
    text-align: left;
}

.message-bot {
    text-align: left;
}

.message-bot .message-content {
    background: white;
    color: #333;
    display: inline-block;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* 输入中动画 */
.message-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.message-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: typing 1.4s infinite;
}

.message-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.message-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ===== 快捷问题按钮 ===== */
.quick-questions {
    padding: 10px 20px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-question-btn {
    background: #f0f2ff;
    color: #667eea;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-question-btn:hover {
    background: #667eea;
    color: white;
}

/* ===== 输入区域 ===== */
.chat-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #667eea;
}

.chat-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    .chat-bubble {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 120px;
        border-radius: 25px;
    }

    .chat-bubble-avatar {
        width: 38px;
        height: 38px;
        font-size: 24px;
    }

    .chat-bubble-text {
        font-size: 14px;
        letter-spacing: 2px;
    }

    .chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-messages {
        padding: 15px;
    }

    .message-user .message-content,
    .message-bot .message-content {
        max-width: 80%;
    }
}

/* ===== 欢迎消息样式 ===== */
.welcome-message {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.welcome-message h4 {
    margin: 0 0 10px;
    color: #667eea;
    font-size: 15px;
}

.welcome-message p {
    margin: 0;
    color: #666;
    font-size: 13px;
    line-height: 1.6;
}

/* ===== 加载动画 ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}