/* Chat Widget Styles */
:root {
    --chat-primary: #4f46e5;
    --chat-bg: #ffffff;
    --chat-text: #1f2937;
    --chat-gray: #f3f4f6;
}

.chat-widget-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--chat-primary);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-widget-launcher:hover {
    transform: scale(1.1);
}

.chat-launcher-icon {
    color: white;
    font-size: 24px;
    transition: opacity 0.3s;
}

.chat-widget-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--chat-bg);
    border-radius: 16px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chat-widget-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-agent-avatar {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--chat-primary);
    font-size: 20px;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-header-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.chat-close-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
}

.chat-close-btn:hover {
    opacity: 1;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.message.bot {
    align-self: flex-start;
    background: white;
    color: var(--chat-text);
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.message.user {
    align-self: flex-end;
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    border-bottom-left-radius: 2px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #cbd5e1;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Quick Questions */
.quick-replies {
    display: flex;
    gap: 8px;
    padding: 10px 20px 15px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
    
    /* 优化滚动条样式 - 开始 */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(0,0,0,0.1) transparent;
}

.quick-replies::-webkit-scrollbar {
    height: 4px; /* Chrome/Safari */
    display: block; /* 确保滚动条显示 */
}

.quick-replies::-webkit-scrollbar-track {
    background: transparent;
}

.quick-replies::-webkit-scrollbar-thumb {
    background-color: rgba(0,0,0,0.1);
    border-radius: 4px;
}
/* 优化滚动条样式 - 结束 */

.quick-chip {
    flex: 0 0 auto; /* 防止被压缩 */
    white-space: nowrap;
    padding: 6px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    font-size: 12px;
    color: var(--chat-primary);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.quick-chip:hover {
    background: #eef2ff;
    border-color: var(--chat-primary);
}

/* Input Area */
.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    resize: none;
    height: 42px;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--chat-primary);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chat-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}

.chat-send-btn:hover {
    background: #4338ca;
}

.chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .chat-widget-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}
