﻿/* ===== CHATBOT SIÊU CHUYÊN NGHIỆP - CORN N-TP RESTAURANT ===== */
:root {
    --primary-color: #e67e22;
    --primary-dark: #d35400;
    --secondary-color: #2ecc71;
    --dark-color: #34495e;
    --light-color: #ecf0f1;
    --gray-color: #95a5a6;
    --gradient-primary: linear-gradient(135deg, #e67e22, #d35400);
    --gradient-secondary: linear-gradient(135deg, #e67e22, #d35400);
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 35px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s ease;
}

/* Reset CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Chatbot Widget */
#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Nút toggle - ĐÃ FIX */
#chatbot-toggle {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    animation: pulse 2s infinite;
    border: none;
    outline: none;
    position: relative;
    z-index: 10001;
}

    #chatbot-toggle:hover {
        transform: scale(1.1);
        box-shadow: var(--shadow-xl);
    }

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: var(--shadow-lg);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(230, 126, 34, 0.1), var(--shadow-lg);
    }
}

/* Chatbot Container - ĐÃ FIX */
#chatbot-container {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10002;
}

    /* QUAN TRỌNG: Class active phải có display: flex */
    #chatbot-container.active {
        display: flex !important;
        opacity: 1;
        transform: translateY(0) scale(1);
    }

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chatbot Header */
#chatbot-header {
    background: var(--gradient-secondary);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

    #chatbot-header h5 {
        margin: 0;
        font-weight: 600;
        font-size: 16px;
        color: white;
        display: flex;
        align-items: center;
        gap: 8px;
    }

#chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    #chatbot-close:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: rotate(90deg);
    }

/* Chatbot Messages */
#chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Messages */
.message {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease-out;
    line-height: 1.4;
    position: relative;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    background: var(--gradient-primary);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.3);
}

.message.bot {
    background: white;
    color: var(--dark-color);
    border: 1px solid #e9ecef;
    margin-right: auto;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.message.typing {
    background: white;
    color: var(--gray-color);
    font-style: italic;
    border: 1px solid #e9ecef;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

/* Quick Replies */
.quick-replies-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-reply-btn {
    background: var(--light-color);
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--dark-color);
    white-space: nowrap;
    font-family: inherit;
    border: none;
}

    .quick-reply-btn:hover {
        background: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(230, 126, 34, 0.3);
    }

/* Chatbot Input */
#chatbot-input {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    background: white;
    flex-shrink: 0;
}

#chatbot-text {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 25px;
    padding: 12px 18px;
    outline: none;
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
    background: #f8f9fa;
}

    #chatbot-text:focus {
        border-color: var(--primary-color);
        background: white;
        box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
    }

#chatbot-send {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.3);
}

    #chatbot-send:hover {
        background: var(--primary-dark);
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(230, 126, 34, 0.4);
    }

    #chatbot-send:active {
        transform: scale(0.95);
    }

/* Welcome Message Special Styling */
.welcome-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
}

    .welcome-message strong {
        color: white !important;
    }

/* Scrollbar Styling */
#chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

#chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

    #chatbot-messages::-webkit-scrollbar-thumb:hover {
        background: var(--primary-dark);
    }

/* Responsive Design */
@media (max-width: 480px) {
    #chatbot-widget {
        bottom: 15px;
        right: 15px;
    }

    #chatbot-container {
        width: calc(100vw - 30px);
        height: 70vh;
        right: 0;
        bottom: 65px;
    }

    #chatbot-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .message {
        max-width: 90%;
    }
}

/* Typing Dots */
.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--gray-color);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

    .typing-dot:nth-child(1) {
        animation-delay: -0.32s;
    }

    .typing-dot:nth-child(2) {
        animation-delay: -0.16s;
    }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Đảm bảo không bị các style khác ghi đè */
#chatbot-widget * {
    box-sizing: border-box !important;
}

#chatbot-container * {
    box-sizing: border-box !important;
}
