/* --- META AI STYLE CSS --- */

/* 1. NÚT CHAT & HEADER: Hiệu ứng Gradient động */
@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#decox-gemini-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* NÚT CHAT "THỞ" (EXPAND/COLLAPSE) */
#decox-chat-toggle {
    background: linear-gradient(-45deg, #0072ff, #00c6ff, #8E2DE2, #4A00E0);
    background-size: 300% 300%;
    animation: gradientMove 5s ease infinite;
    
    color: #fff;
    border: none;
    border-radius: 30px; /* Bo tròn kiểu Pill */
    height: 60px;
    padding: 0;
    
    transition: width 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    
    width: 60px; /* Mặc định tròn */
    display: flex;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 114, 255, 0.4);
    cursor: pointer;
    white-space: nowrap;
}

#decox-chat-toggle:hover {
    transform: scale(1.05);
}

#decox-chat-toggle.expanded {
    width: 180px; /* Mở rộng khi active */
}

.toggle-icon {
    margin-right: 8px;
    width: 60px;
    height: 60px;
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-text {
    opacity: 0;
    font-weight: 600;
    font-size: 15px;
    padding-right: 20px;
    transform: translateX(20px);
    transition: all 0.3s ease;
}

#decox-chat-toggle.expanded .toggle-text {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.2s;
}

/* Cửa sổ Chat */
#decox-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0,0,0,0.05);
}

#decox-chat-window:not(.hidden) {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header Gradient */
.chat-header {
    background: #000000;
    color: #fff;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 17px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

#decox-chat-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    padding-bottom: 5px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#decox-chat-close:hover { background: rgba(255,255,255,0.4); }

/* Vùng tin nhắn */
#decox-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* CÂU HỎI GỢI Ý */
#decox-suggestions-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: messageSlideIn 0.5s ease-out;
}

#decox-suggestions-container.hidden { display: none; }

.suggestions-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 5px;
    margin-left: 5px;
}

.suggestion-btn {
    background: #333; 
    color: #fff;
    border: none;
    padding: 12px 16px;
    border-radius: 12px;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
}

.suggestion-btn::before {
    content: "💬"; 
    margin-right: 10px;
    font-size: 16px;
}

.suggestion-btn:hover {
    background: #444;
    transform: translateX(5px);
}

@media (min-width: 769px) {
    .suggestion-btn {
        background: #f0f2f5;
        color: #333;
    }
    .suggestion-btn:hover {
        background: #e4e6eb;
    }
}

/* TIN NHẮN ANIMATION */
@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    animation: messageSlideIn 0.4s ease-out forwards;
    word-wrap: break-word;
}

.message.bot {
    background: #f0f2f5;
    color: #050505;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.message.user {
    background: linear-gradient(135deg, #0072ff, #00c6ff);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
    box-shadow: 0 2px 8px rgba(0, 114, 255, 0.25);
}

/* LOADING */
.typing-indicator {
    background: #f0f2f5;
    padding: 15px 20px;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    animation: messageSlideIn 0.3s ease-out;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #90949c;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.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); }
    40% { transform: scale(1); }
}

/* Input Area */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    background: #fff;
    display: flex;
    gap: 10px;
    align-items: center;
}

#decox-chat-input {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid #e4e6eb;
    border-radius: 30px;
    outline: none;
    font-size: 15px;
    background: #f0f2f5;
    transition: all 0.2s;
}

#decox-chat-input:focus {
    background: #fff;
    box-shadow: 0 0 0 2px rgba(0, 114, 255, 0.2);
    border-color: #0072ff;
}

#decox-chat-send {
    background: transparent;
    color: #0072ff;
    border: none;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#decox-chat-send:hover { transform: scale(1.1); color: #00c6ff; }
#decox-chat-send:disabled { color: #ccc; cursor: default; }

/* Table & Image */
.decox-table-wrapper { border-radius: 12px; overflow: hidden; border: 1px solid #eee; margin: 10px 0; }
.decox-chat-table th { background-color: #f7f8fa; }
.decox-chat-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.decox-chat-table th, .decox-chat-table td { border-bottom: 1px solid #eee; padding: 10px 12px; text-align: left; color: #333; }
.decox-chat-img { border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); transition: transform 0.3s; display: block; max-width: 100%; max-height: 180px; width: auto; height: auto; object-fit: contain; margin: 8px 0; border: 1px solid #eee; cursor: zoom-in; }
.decox-chat-img:hover { transform: scale(1.02); }

/* Responsive Mobile */
@media (max-width: 768px) {
    #decox-chat-window:not(.hidden) {
        position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        width: 100%; height: 100%; max-height: 100%;
        border-radius: 0;
    }
}

/* Lightbox */
#decox-lightbox {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.95); z-index: 10000000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease; backdrop-filter: blur(5px);
}
#decox-lightbox.visible { opacity: 1; visibility: visible; }
#decox-lightbox-img { max-width: 95%; max-height: 95%; border-radius: 4px; box-shadow: 0 0 30px rgba(0,0,0,0.5); object-fit: contain; }
#decox-lightbox-close { position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; background: rgba(255,255,255,0.2); border-radius: 50%; color: #fff; font-size: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s; }
#decox-lightbox-close:hover { background: rgba(255,255,255,0.4); }