/* ==========================================================================
   AI Customer Service Chat Styles - AI客服聊天样式
   ========================================================================== */

/* Chat Container */
#ai-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Noto Sans JP', sans-serif;
}

/* Chat Button */
.ai-chat-btn {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #CC211B 0%, #ff4444 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(204, 33, 27, 0.3);
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.ai-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(204, 33, 27, 0.4);
}

.ai-chat-btn i {
    color: white;
    font-size: 24px;
}

.chat-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ffbf52;
    color: #351e15;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    line-height: 1.2;
    min-width: 18px;
    text-align: center;
}

/* Chat Window */
.ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-window.show {
    display: flex;
    animation: chatWindowSlideUp 0.3s ease-out;
}

@keyframes chatWindowSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #CC211B 0%, #ff4444 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar i {
    font-size: 18px;
    color: white;
}

.chat-title {
    display: flex;
    flex-direction: column;
}

.chat-name {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.2;
}

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

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-close-btn i {
    color: white;
    font-size: 14px;
}

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

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Message Styles */
.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 85%;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.bot-message .message-avatar {
    background: linear-gradient(135deg, #CC211B 0%, #ff4444 100%);
    color: white;
}

.user-message .message-avatar {
    background: #667EEA;
    color: white;
}

.message-avatar i {
    font-size: 14px;
}

.message-content {
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.bot-message .message-content {
    border-bottom-left-radius: 6px;
}

.user-message .message-content {
    background: #667EEA;
    color: white;
    border-bottom-right-radius: 6px;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

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

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #eee;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 8px 16px;
}

#chat-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    padding: 4px 0;
}

#chat-input::placeholder {
    color: #999;
}

.chat-send-btn {
    width: 32px;
    height: 32px;
    background: #CC211B;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: #aa1a15;
}

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

.chat-send-btn i {
    color: white;
    font-size: 14px;
}

/* Loading State */
.chat-send-btn.loading {
    background: #ccc;
    cursor: not-allowed;
}

.chat-send-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    #ai-chat-container {
        bottom: 15px;
        right: 15px;
    }
    
    .ai-chat-btn {
        width: 55px;
        height: 55px;
    }
    
    .ai-chat-btn i {
        font-size: 22px;
    }
    
    .ai-chat-window {
        width: 320px;
        height: 450px;
        bottom: 75px;
    }
    
    .chat-header {
        padding: 14px 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input-container {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100vw - 40px);
        height: 400px;
        right: -10px;
    }
    
    .message {
        max-width: 90%;
    }
}