﻿/* ---- Toggle Button ---- */
#chatbot-widget {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 99;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#chatbot-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6C63FF 0%, #FF6584 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(108, 99, 255, 0.5);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
    position: relative;
    margin-right: auto;
    background-size: cover;
    background-position: center;
    background: url(/images/chat-bot.jpg) center center / cover no-repeat;
}

    #chatbot-toggle:hover {
        transform: scale(1.1) rotate(5deg);
        box-shadow: 0 12px 40px rgba(108, 99, 255, 0.65);
    }

    #chatbot-toggle:active {
        transform: scale(0.95);
    }

.toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

    .toggle-icon svg {
        width: 26px;
        height: 26px;
        color: #fff;
    }

@keyframes pulse-dot {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* ---- Chat Window ---- */
#chatbot-window {
    position: absolute;
    bottom: 55px;
    left: 0;
    width: 380px;
    height: 580px;
    background: #13152A;
    border: 1px solid rgba(108, 99, 255, 0.25);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(108,99,255,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom left;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
    backdrop-filter: blur(20px);
}

    #chatbot-window.open {
        transform: scale(1) translateY(0);
        opacity: 1;
        pointer-events: all;
    }

/* ---- Header ---- */
.faq-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(108,99,255,0.2) 0%, rgba(255,101,132,0.1) 100%);
    border-bottom: 1px solid rgba(108, 99, 255, 0.2);
    flex-shrink: 0;
}

.faq-header-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #6C63FF, #FF6584);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.faq-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #00E676;
    border-radius: 50%;
    border: 2px solid #13152A;
    animation: pulse-green 2.5s infinite;
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0,230,118,0.4);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(0,230,118,0);
    }
}

.faq-header-info {
    flex: 1;
}

    .faq-header-info h2 {
        font-size: 0.9rem;
        font-weight: 600;
        color: #E8EAF6;
        margin: 0;
    }

    .faq-header-info p {
        font-size: 0.75rem;
        color: #00E676;
        margin: 2px 0 0;
    }

.faq-header-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #8B8FA8;
    display: flex;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

    .faq-header-close:hover {
        background: rgba(255,255,255,0.08);
        color: #E8EAF6;
    }

    .faq-header-close svg {
        width: 18px;
        height: 18px;
    }

/* ---- Messages Area ---- */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(108,99,255,0.3) transparent;
}

    .chat-messages::-webkit-scrollbar {
        width: 4px;
    }

    .chat-messages::-webkit-scrollbar-thumb {
        background: rgba(108,99,255,0.3);
        border-radius: 2px;
    }

/* ---- Message Bubbles ---- */
.msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: msgIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}

    .msg.bot {
        align-self: flex-start;
    }

    .msg.user {
        align-self: flex-end;
    }

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.msg-sender {
    font-size: 0.7rem;
    color: #8B8FA8;
    margin-bottom: 4px;
    padding: 0 4px;
    font-weight: 500;
}

.msg.user .msg-sender {
    text-align: right;
}

.msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.55;
    word-break: break-word;
}

.msg.bot .msg-bubble {
    background: #1A1D35;
    color: #E8EAF6;
    border-radius: 4px 16px 16px 16px;
    border: 1px solid rgba(108,99,255,0.15);
}

.msg.user .msg-bubble {
    background: linear-gradient(135deg, #6C63FF, #8B85FF);
    color: #fff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 16px rgba(108,99,255,0.35);
}

.msg-bubble strong {
    color: #A8A4FF;
}

.msg-bubble .answer-text {
    margin-top: 4px;
}

.msg-bubble .answer-image {
    margin-top: 10px;
}

    .msg-bubble .answer-image img {
        width: -webkit-fill-available;
        border-radius: 10px;
    }

/* ---- Quick Reply Buttons ---- */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    max-width: 340px;
}

.quick-replies-btn {
    background: rgba(108,99,255,0.12);
    border: 1px solid rgba(108,99,255,0.35);
    color: #A8A4FF;
    border-radius: 50px;
    padding: 7px 14px;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, color 0.2s;
    white-space: nowrap;
}

    .quick-replies-btn:hover {
        background: rgba(108,99,255,0.28);
        border-color: rgba(108,99,255,0.7);
        color: #fff;
        transform: translateY(-1px);
    }

    .quick-replies-btn:active {
        transform: translateY(0);
    }

    .quick-replies-btn.selected {
        background: linear-gradient(135deg, #6C63FF, #FF6584);
        border-color: transparent;
        color: #fff;
    }

    .quick-replies-btn.lang-btn {
        font-size: 0.82rem;
    }

    .quick-replies-btn.faq-btn {
        border-radius: 10px;
        text-align: left;
        white-space: normal;
        line-height: 1.4;
        padding: 9px 14px;
    }


/* Action buttons (Hỏi thêm / Đổi ngôn ngữ) */
.faq-action-btns {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.faq-action-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #C0C4D8;
    border-radius: 50px;
    padding: 7px 16px;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

    .action-btn:hover {
        background: rgba(108,99,255,0.2);
        border-color: rgba(108,99,255,0.5);
        color: #fff;
        transform: translateY(-1px);
    }

/* ---- Typing Indicator ---- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: #1A1D35;
    border-radius: 4px 16px 16px 16px;
    border: 1px solid rgba(108,99,255,0.15);
    width: fit-content;
    animation: msgIn 0.3s ease both;
}

.typing-dot {
    width: 7px;
    height: 7px;
    background: #8B8FA8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

    .typing-dot:nth-child(1) {
        animation-delay: 0s;
    }

    .typing-dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .typing-dot:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ---- Footer ---- */
.chat-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(108,99,255,0.12);
    flex-shrink: 0;
}

.chat-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #8B8FA8;
    font-size: 0.75rem;
}

    .chat-hint svg {
        opacity: 0.6;
        flex-shrink: 0;
    }

/* ---- Scrollbar Colors ---- */
.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: rgba(108,99,255,0.25) transparent;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
    #chatbot-widget {
        bottom: 16px;
        left: 16px;
        right: auto;
    }

    #chatbot-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        left: 0;
        bottom: 55px;
    }
}

.modal-faq-img {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
}

    .modal-faq-img.show {
        opacity: 1;
        visibility: visible;
    }

    .modal-faq-img .faq-header-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        z-index: 2;
    }

/* KHUNG chứa ảnh */
.faq-img-containner {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 16px;
    transform: scale(0.96);
    transition: transform 0.25s ease;
}

.modal-faq-img.show .faq-img-containner {
    transform: scale(1);
}

.faq-img {
    display: block;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
}

.quick-rep-img {
    width: -webkit-fill-available;
}