﻿/* ==========================================
   CHAT AI - WIG SHOP
   Màu: #a8193b (chính) | #ff6f61 (phụ)
   ========================================== */

/* Chat Container */
.chat-container {
    position: fixed;
    top: 50%;
    margin-top: -260px;
    right: 20px;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(168, 25, 59, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    z-index: 9999;
    animation: slideUp 0.3s ease;
    border: 1px solid rgba(168, 25, 59, 0.1);
}

/* Chat Toggle Button */
.chat-toggle-btn {
    position: fixed;
    top: 50%;
    margin-top: -30px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #a8193b;
    color: #ffffff;
    border: none;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(168, 25, 59, 0.45);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

    .chat-toggle-btn:hover {
        transform: scale(1.1) rotate(-5deg);
        background: #ff6f61;
        box-shadow: 0 6px 28px rgba(255, 111, 97, 0.5);
    }

    .chat-toggle-btn:active {
        transform: scale(0.95);
    }

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #a8193b 0%, #ff6f61 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .chat-title .icon {
        font-size: 24px;
    }

    .chat-title h3 {
        margin: 0;
        font-size: 15px;
        font-weight: 600;
    }

.online-status {
    font-size: 11px;
    opacity: 0.9;
}

.close-chat {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    padding: 0 6px;
    opacity: 0.8;
    transition: all 0.2s;
}

    .close-chat:hover {
        opacity: 1;
        transform: rotate(90deg);
    }

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8f6f7;
}

/* Message Item */
.message {
    margin-bottom: 12px;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

.user-message {
    margin-left: auto;
}

.ai-message {
    margin-right: auto;
}

.message-content {
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 14px;
    white-space: pre-wrap;
}

/* 🔥 MÀU TIN NHẮN USER */
.user-message .message-content {
    background: linear-gradient(135deg, #a8193b 0%, #c92a5a 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(168, 25, 59, 0.25);
}

/* 🔥 MÀU TIN NHẮN AI */
.ai-message .message-content {
    background: #ffffff;
    color: #333333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(168, 25, 59, 0.08);
}

.message-time {
    font-size: 10px;
    color: #999999;
    margin-top: 4px;
    padding: 0 4px;
}

.ai-message .message-time {
    text-align: left;
}

.user-message .message-time {
    text-align: right;
}

/* Chat Input Area */
.chat-input-container {
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #eeeeee;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

#chatInput {
    flex: 1;
    border: 2px solid #e8e0e2;
    border-radius: 20px;
    padding: 10px 16px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    min-height: 40px;
    max-height: 100px;
    outline: none;
    transition: border-color 0.3s;
}

    #chatInput:focus {
        border-color: #a8193b;
        box-shadow: 0 0 0 3px rgba(168, 25, 59, 0.1);
    }

/* 🔥 MÀU NÚT GỬI */
.send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #a8193b 0%, #ff6f61 100%);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(168, 25, 59, 0.3);
}

    .send-btn:hover {
        transform: scale(1.08);
        box-shadow: 0 4px 16px rgba(255, 111, 97, 0.45);
    }

    .send-btn:active {
        transform: scale(0.92);
    }

    .send-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
    }

/* Typing Indicator */
.typing {
    padding: 4px 0;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(168, 25, 59, 0.08);
    width: fit-content;
}

    .typing-dots span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        animation: typing 1.4s infinite;
    }

        .typing-dots span:nth-child(1) {
            background: #a8193b;
            animation-delay: 0s;
        }

        .typing-dots span:nth-child(2) {
            background: #ff6f61;
            animation-delay: 0.2s;
        }

        .typing-dots span:nth-child(3) {
            background: #a8193b;
            animation-delay: 0.4s;
        }

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1edef;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #a8193b;
    border-radius: 4px;
}

    .chat-messages::-webkit-scrollbar-thumb:hover {
        background: #ff6f61;
    }

/* Responsive - Mobile */
@media (max-width: 480px) {
    .chat-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-toggle-btn {
        top: 50%;
        margin-top: -28px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
}
