/* Chatbot CSS - Emerald Glassmorphism Style */
.chatbot-container {
    position: fixed;
    bottom: 40px; /* Nâng cao để né reCAPTCHA */
    right: 40px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-end; /* Thẳng hàng bên phải */
    font-family: 'Be Vietnam Pro', sans-serif;
}

#chatbot-toggle {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid #047857;
}

#chatbot-toggle:hover {
    transform: scale(1.05);
    background: #f8fafc;
    box-shadow: 0 15px 35px rgba(4, 120, 87, 0.2);
}

#chatbot-toggle img {
    width: 55px;
    height: 55px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s ease;
}

.chatbot-window.active {
    display: flex;
    animation: slideIn 0.3s ease-out forwards;
}

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

.chatbot-header {
    padding: 1.5rem;
    background: #047857;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header .avatar {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header .info h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.chatbot-header .info p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.8;
}

.chatbot-messages {
    flex: 1;
    padding: 1rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    min-height: 151px;
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 1.2rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.message.bot {
    align-self: flex-start;
    background: #F1F5F9;
    color: #334155;
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background: #047857;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-options {
    padding: 0.5rem 1rem 0.5rem;
    display: none; /* Hidden by default - only show when bot asks or user triggers */
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    background: rgba(248, 250, 252, 0.5);
    border-top: 1px solid #F1F5F9;
}

.option-btn {
    background: white;
    border: 1px solid #E2E8F0;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.option-btn:hover {
    border-color: #10b981;
    color: #10b981;
    background: #F0FDF4;
}

.chatbot-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #F1F5F9;
    display: flex;
    gap: 8px;
}

.chatbot-footer input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    background: transparent;
}

@media (max-width: 768px) {
    .chatbot-container {
        bottom: 100px; /* Nâng cao để không đè lên Sticky CTA (Mua ngay 88k) */
        right: 15px; /* Sát lề phải */
        gap: 10px;
    }
    #chatbot-toggle {
        width: 60px;
        height: 60px;
        border: 2px solid #047857;
    }
    #chatbot-toggle img {
        width: 42px;
        height: 42px;
    }
    /* Đảm bảo icon Zalo cũng thu nhỏ trên mobile */
    .chatbot-container a img {
        width: 42px !important;
        height: 42px !important;
    }
    .chatbot-window {
        width: calc(100vw - 30px);
        height: 65vh;
        right: 0;
        bottom: 70px;
    }
}

/* Zalo QR Modal Styles */
#zalo-qr-modal.active {
    opacity: 1;
    pointer-events: auto;
}

#zalo-qr-modal.active .bg-white {
    transform: scale(1);
}

#zalo-qr-img {
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#zalo-qr-modal .bg-white:hover #zalo-qr-img {
    transform: scale(1.05);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

