/* Styling for ADS366 Mau Giao Dien Widget */
.ads366-mau-giao-dien-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: stretch;
    width: 100%;
}

/* Force each card to take up its full column space and reset any Elementor flex basis */
.ads366-mau-giao-dien-wrapper > .sc-maugiaodien-card {
    width: 100% !important;
    max-width: 100% !important;
    flex-basis: auto !important;
}

@media (max-width: 1024px) {
    .ads366-mau-giao-dien-wrapper {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .ads366-mau-giao-dien-wrapper {
        grid-template-columns: 1fr;
    }
}

.ads-item-hidden {
    display: none !important;
}

.ads366-loadmore-wrap {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Toast popup styles */
.ads366-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 15px;
    font-family: "Inter", sans-serif;
    font-weight: 500;
    z-index: 999999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    opacity: 0;
    transition: all 0.4s ease;
}

.ads366-toast.show {
    opacity: 1;
    bottom: 40px;
}

/* ============================================================
   AI CHATBOX — Premium Dark Theme
   ============================================================ */

/* Card phải có position relative để chatbox overlay được */
.ads366-mau-giao-dien-wrapper .sc-maugiaodien-card {
    position: relative;
    overflow: hidden;
}

/* Nút trigger "🤖 Tư vấn AI" — thay vị trí giá 490.000đ */
.sc-maugiaodien-ai-wrap {
    display: flex;
    align-items: center;
    flex: 1;
}

.sc-ai-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.sc-ai-trigger::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.18), transparent 60%);
    opacity: 0;
    transition: opacity 0.25s;
    border-radius: inherit;
}

.sc-ai-trigger:active {
    transform: translateY(0px);
    box-shadow: 0 3px 10px rgba(14, 165, 233, 0.35);
}

/* ===========================================
   CHATBOX PANEL — overlay toàn bộ card
   =========================================== */
.sc-ai-chatbox {
    position: absolute;
    inset: 0;
    background: #ffffff;
    border-radius: inherit;
    display: flex;
    flex-direction: column;
    z-index: 50;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    /* Ẩn: thu nhỏ + trong suốt */
    opacity: 0;
    transform: scale(0.96) translateY(6px);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.sc-ai-chatbox.sc-ai-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Header chatbox */
.sc-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.sc-ai-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sc-ai-avatar {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.sc-ai-header strong {
    display: block;
    color: #ffffff;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
}

.sc-ai-status {
    display: block;
    color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.sc-ai-status::before {
    content: '● ';
    color: #4ade80;
    animation: sc-ai-pulse 1.6s ease-in-out infinite;
}

@keyframes sc-ai-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.25; }
}

.sc-ai-close {
    background: rgba(255, 255, 255, 0.22);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
    line-height: 1;
}

.sc-ai-close:hover {
    background: rgba(255, 255, 255, 0.38);
}

/* Vùng tin nhắn */
.sc-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

.sc-ai-messages::-webkit-scrollbar {
    width: 4px;
}
.sc-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}
.sc-ai-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Bong bóng tin nhắn — animation xuất hiện */
.sc-ai-bubble {
    max-width: 88%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 12.5px;
    line-height: 1.6;
    font-family: 'Inter', -apple-system, sans-serif;
    word-break: break-word;
    animation: sc-ai-pop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes sc-ai-pop {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Tin nhắn user — bên phải, màu xanh lam */
.sc-ai-bubble-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Tin nhắn AI — bên trái, nền sáng */
.sc-ai-bubble-bot {
    align-self: flex-start;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

/* Tin nhắn lỗi */
.sc-ai-bubble-error {
    background: #3f0808 !important;
    color: #fca5a5 !important;
    border-color: #7f1d1d !important;
}

/* Kiểu dáng cho thẻ sản phẩm trực quan AI đề xuất */
.sc-ai-bubble .ai-card-suggest {
    display: block;
    text-decoration: none !important;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin: 12px 0 6px 0;
    transition: all 0.25s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.06);
}

.sc-ai-bubble .ai-card-suggest:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -3px rgba(14,165,233,0.15);
    border-color: #0ea5e9;
}

.sc-ai-bubble .ai-card-suggest img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
    object-position: top center;
    border-bottom: 1px solid #e2e8f0;
    margin: 0 !important;
    padding: 0 !important;
}

.sc-ai-bubble .ai-card-content {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.sc-ai-bubble .ai-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
    text-align: left;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sc-ai-bubble .ai-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    background: #f1f5f9;
    color: #0ea5e9;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s;
    margin-top: 2px;
}

.sc-ai-bubble .ai-card-suggest:hover .ai-card-btn {
    background: #0ea5e9;
    color: #ffffff;
}

/* Các link thông thường nếu lỡ có */
.sc-ai-bubble a:not(.ai-card-suggest) {
    color: #0ea5e9;
    text-decoration: underline;
}

/* Typing indicator ●●● */
.sc-ai-typing {
    display: flex !important;
    align-items: center;
    gap: 5px;
    padding: 12px 16px !important;
    min-height: 42px;
}

.sc-ai-typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #0ea5e9;
    border-radius: 50%;
    animation: sc-ai-bounce 1.15s ease-in-out infinite;
}

.sc-ai-typing span:nth-child(2) { animation-delay: 0.18s; }
.sc-ai-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes sc-ai-bounce {
    0%, 60%, 100% { transform: translateY(0);    opacity: 0.45; }
    30%            { transform: translateY(-8px); opacity: 1;    }
}

/* Footer: input + nút gửi */
.sc-ai-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.sc-ai-input {
    flex: 1;
    min-width: 0;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 50px;
    color: #1e293b;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    padding: 8px 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sc-ai-input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.sc-ai-input::placeholder {
    color: #94a3b8;
    font-size: 11.5px;
}

.sc-ai-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.sc-ai-send-btn {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sc-ai-send-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.45);
}

.sc-ai-send-btn:active {
    transform: scale(0.96);
}

.sc-ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}