/* =========================================================
   Chatbot AI Frontend Styles
   Modern professional chat UI
========================================================= */

:root {
    --cb-primary: #0a84ff;
    --cb-primary-soft: #e8f3ff;
    --cb-primary-strong: #0066d6;
    --cb-bg: #f7f8fa;
    --cb-surface: #ffffff;
    --cb-dark: #0f172a;
    --cb-light: #f1f5f9;
    --cb-border: #e2e8f0;
    --cb-text: #0f172a;
    --cb-muted: #64748b;
    --cb-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
    --cb-radius: 22px;
}

#chatbot-ai,
#chatbot-ai *:not(svg):not(svg *):not(i):not(.fas):not(.fa):not(.fab) {
    box-sizing: border-box;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

#chatbot-ai .fas,
#chatbot-ai .fa {
    display: inline-block !important;
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
    font-variant: normal;
    text-rendering: auto;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
}

#chatbot-ai .chatbot-ai-open .fas { font-size: 24px; color: #fff; }
#chatbot-ai .chatbot-ai-icon .fas,
#chatbot-ai .chatbot-ai-send .fas,
#chatbot-ai .chatbot-ai-close .fas { font-size: 15px; color: inherit; }
#chatbot-ai .chatbot-ai-call .fas { color: #fff !important; font-size: 14px; }

#chatbot-ai svg {
    display: block !important;
    overflow: visible !important;
    flex-shrink: 0;
    max-width: none !important;
    max-height: none !important;
}

#chatbot-ai .chatbot-ai-avatar svg {
    width: 22px !important;
    height: 22px !important;
    color: #fff;
    stroke: #fff;
}

.chatbot-ai-open {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, var(--cb-primary) 0%, var(--cb-primary-strong) 100%);
    color: #fff;
    cursor: pointer;
    z-index: 999999;
    box-shadow: 0 14px 32px rgba(10, 132, 255, 0.38);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.chatbot-ai-open:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 18px 36px rgba(10, 132, 255, 0.45);
}

.chatbot-ai-window {
    position: fixed;
    top: 20px;
    left: 75px;
    right: 75px;
    bottom: 35px;
    width: auto;
    height: auto;
    border-radius: var(--cb-radius);
    overflow: hidden;
    background: var(--cb-surface);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: var(--cb-shadow);
    display: none;
    flex-direction: column;
    z-index: 999999;
}

.chatbot-ai-window.active {
    display: flex;
    animation: chatbotWindowIn 0.28s ease;
}

@keyframes chatbotWindowIn {
    from { opacity: 0; transform: translateY(12px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
    .chatbot-ai-window {
        top: 0; left: 0; right: 0; bottom: 0;
        width: 100%; height: 100%; height: 100dvh;
        border-radius: 0; border: none;
    }
}

.chatbot-ai-header {
    flex-shrink: 0;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chatbot-ai-title { display: flex; align-items: center; gap: 12px; }

.chatbot-ai-avatar {
    width: 42px; height: 42px;
    background: linear-gradient(145deg, var(--cb-primary), var(--cb-primary-strong));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; overflow: hidden; padding: 0;
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

.chatbot-ai-title-text strong {
    display: block; font-size: 15px; font-weight: 650; letter-spacing: 0.01em;
}

.chatbot-ai-status {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 3px; font-size: 12px; color: #94a3b8;
}

.chatbot-ai-status-dot {
    width: 7px; height: 7px; border-radius: 50%; background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
    animation: chatbotPulseDot 1.8s ease infinite;
}

@keyframes chatbotPulseDot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35); }
    50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
}

.chatbot-ai-header-actions { display: flex; align-items: center; gap: 8px; }

.chatbot-ai-close {
    width: 34px; height: 34px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.2s ease;
}

.chatbot-ai-close:hover { background: rgba(255, 255, 255, 0.16); }

.chatbot-ai-messages {
    flex: 1; min-height: 0; padding: 20px 28px 12px; overflow-y: auto;
    background:
        radial-gradient(ellipse at top, rgba(10, 132, 255, 0.05), transparent 55%),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 48%, #f8fafc 100%);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.chatbot-ai-messages::-webkit-scrollbar { width: 6px; }
.chatbot-ai-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

.chatbot-ai-message {
    margin-bottom: 12px; max-width: 80%; line-height: 1.45; font-size: 14px; word-wrap: break-word;
}

.chatbot-ai-message-text {
    padding: 11px 15px; border-radius: 16px; line-height: 1.45; font-size: 14px; word-wrap: break-word;
}

.chatbot-ai-message.bot { align-self: flex-start; max-width: 100%; width: fit-content; }

.chatbot-ai-message.bot .chatbot-ai-message-text {
    background: #fff; color: var(--cb-text); border: 1px solid var(--cb-border);
    border-radius: 4px 18px 18px 18px; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.chatbot-ai-message.bot.has-products {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 16px; width: 100%; max-width: 100%; background: transparent; padding: 0;
}

.chatbot-ai-message.bot.has-products .chatbot-ai-message-text,
.chatbot-ai-message.bot .product-summary {
    background: #fff; border: 1px solid var(--cb-border);
    border-radius: 4px 18px 18px 18px; padding: 14px 16px; margin-bottom: 0;
    color: var(--cb-text); line-height: 1.5; font-size: 14px; max-width: 60%; width: fit-content;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.chatbot-ai-message.user { margin-left: auto; max-width: 70%; width: fit-content; }

.chatbot-ai-message.user .chatbot-ai-message-text {
    background: linear-gradient(145deg, #1e293b, #0f172a); color: #fff;
    border-radius: 18px 18px 4px 18px; font-size: 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.chatbot-ai-suggestions {
    margin: 0 0 12px 0; padding: 4px 0 8px; border-radius: 12px;
    color: var(--cb-text); align-self: flex-start; width: fit-content;
}

.chatbot-ai-suggestions-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--cb-muted); }
.chatbot-ai-suggestions-list { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.chatbot-ai-suggestion {
    border: 1px solid var(--cb-border); background: #fff; color: #1f2937;
    padding: 10px 14px; border-radius: 999px; cursor: pointer; font-size: 13px;
    line-height: 1.4; text-align: left; transition: 0.2s ease;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.chatbot-ai-suggestion:hover {
    background: var(--cb-primary-soft); border-color: #93c5fd; color: var(--cb-primary-strong);
}

.chatbot-ai-related-products { margin: 0 0 12px 0; padding: 4px 0 8px; border-radius: 12px; max-width: 100%; }
.chatbot-ai-related-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--cb-muted); }

.chatbot-ai-related-products .products-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; width: 100%; margin-top: 0;
}

.chatbot-ai-related-products .product-card-grid { width: 100%; max-width: none; min-height: 360px; }

@media (max-width: 1024px) {
    .chatbot-ai-related-products .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .chatbot-ai-related-products .product-card-grid { min-height: 0; }
    .chatbot-ai-related-products .product-card-image { height: auto; aspect-ratio: 1 / 1; }
}

@media (max-width: 640px) {
    .chatbot-ai-related-products .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.chatbot-ai-footer {
    flex-shrink: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    margin: 0; padding: 14px 20px 16px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, #ffffff 28%);
    border: none; border-top: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 0; box-shadow: none; position: relative; z-index: 2; width: 100%;
}

.chatbot-ai-composer-shell {
    display: flex; align-items: flex-end; gap: 8px; width: 100%; padding: 8px;
    background: #fff; border: 1px solid var(--cb-border); border-radius: 20px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px rgba(15, 23, 42, 0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: visible;
}

.chatbot-ai-composer-shell:focus-within {
    border-color: rgba(10, 132, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.1), 0 10px 28px rgba(15, 23, 42, 0.08);
}

.chatbot-ai-composer {
    flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px;
    padding: 8px 4px 8px 2px; background: transparent; border: none; border-radius: 0;
}

.chatbot-ai-actions {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0; padding-bottom: 2px;
}

.chatbot-ai-footer-hint {
    margin: 0; padding: 0 6px; font-size: 11px; color: var(--cb-muted); letter-spacing: 0.01em;
}

#chatbot-ai-input {
    width: 100%; resize: none; border: none; border-radius: 0; padding: 6px 4px;
    font-size: 14px; line-height: 1.45; color: var(--cb-text); outline: none;
    max-height: 120px; min-height: 24px; background: transparent; box-shadow: none;
}

#chatbot-ai-input::placeholder { color: #94a3b8; }

.chatbot-ai-icon {
    position: relative; flex-shrink: 0; width: 40px; height: 40px; min-width: 40px; min-height: 40px;
    padding: 0; border-radius: 12px; border: none; background: var(--cb-light) !important;
    color: #334155 !important; cursor: pointer; font-size: 16px; line-height: 1;
    display: inline-flex !important; align-items: center; justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease; box-shadow: none;
}

.chatbot-ai-icon:hover { background: #e2e8f0 !important; color: var(--cb-dark) !important; }
.chatbot-ai-icon:active { transform: scale(0.96); }

#chatbot-ai-upload { border-radius: 12px; background: transparent !important; color: #64748b !important; }
#chatbot-ai-upload:hover { background: var(--cb-light) !important; color: var(--cb-primary) !important; }
#chatbot-ai-voice { border-radius: 12px; }

.chatbot-ai-icon[data-tip]::after,
.chatbot-ai-send[data-tip]::after {
    content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(4px); width: max-content; max-width: 200px;
    padding: 7px 10px; border-radius: 8px; background: #0f172a; color: #fff;
    font-size: 11px; font-weight: 500; line-height: 1.35; white-space: normal; text-align: center;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 20; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}

.chatbot-ai-icon[data-tip]:hover::after,
.chatbot-ai-icon[data-tip]:focus::after,
.chatbot-ai-send[data-tip]:hover::after,
.chatbot-ai-send[data-tip]:focus::after {
    opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}

.chatbot-ai-send {
    position: relative; flex-shrink: 0;
    background: linear-gradient(145deg, var(--cb-primary), var(--cb-primary-strong)) !important;
    color: #fff !important; border: none; width: 42px; height: 42px; min-width: 42px; min-height: 42px;
    padding: 0; border-radius: 14px; cursor: pointer; font-size: 16px;
    display: inline-flex !important; align-items: center; justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 8px 18px rgba(10, 132, 255, 0.28);
}

.chatbot-ai-send:hover {
    background: linear-gradient(145deg, var(--cb-primary), var(--cb-primary-strong)) !important;
    filter: brightness(1.05); transform: translateY(-1px);
}

.chatbot-ai-send .fas { color: #fff !important; }

.chatbot-ai-preview {
    display: none; gap: 10px; flex-wrap: wrap; padding: 2px 4px 2px 0; background: transparent;
}
.chatbot-ai-preview.has-images { display: flex; }

.chatbot-ai-preview-item {
    position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: visible;
    background: #f3f4f6; border: 1px solid var(--cb-border); flex-shrink: 0;
}

.chatbot-ai-preview-item img {
    width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 10px;
}

.chatbot-ai-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    background: #111827;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: background 0.15s ease, transform 0.15s ease;
}

.chatbot-ai-preview-remove:hover {
    background: #000;
    transform: scale(1.06);
}

.chatbot-ai-preview-remove svg {
    display: block;
    width: 8px;
    height: 8px;
}

/* =========================================================
   Animations
========================================================= */

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

/* Background overlay */

html.chatbot-ai-scroll-lock,
body.chatbot-ai-scroll-lock {
    overflow: hidden !important;
    height: 100%;
    overscroll-behavior: none;
    touch-action: none;
}

body.chatbot-ai-scroll-lock {
    position: fixed;
    width: 100%;
}

.chatbot-ai-overlay {
    position: fixed;
    inset: 0;

    background: rgba(15, 23, 42, 0.42);

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    opacity: 0;
    visibility: hidden;

    transition: all .3s ease;

    z-index: 999998;
}

.chatbot-ai-overlay.active {
    opacity: 1;
    visibility: visible;
}

.products-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.product-card {
    border: 1px solid var(--cb-border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #f8fafc;
}

.product-card-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.product-card-meta {
    font-size: 13px;
    color: var(--cb-text);
    opacity: 0.9;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 285px));
    justify-content: left;
    gap: 16px;
    margin-top: 12px;
}

.product-card-grid {
    width: 100%;
    max-width: 285px;
    min-height: 385px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--cb-border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.product-card-grid:hover {
    transform: translateY(-2px);
}

.product-card-image {
    width: 100%;
    height: 285px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatbot-ai-messages .product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
#chatbot-ai-messages .product-card-grid,
#chatbot-ai-messages .product-card-grid:hover,
#chatbot-ai-messages .product-card-grid:focus,
#chatbot-ai-messages .product-card-grid:visited
{
    text-decoration: none ;
}

.product-card-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    background: #ffffff;
    border-top: 1px solid #eeeeee;
}

.product-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--cb-text);
}

.product-card-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--cb-primary);
}

.product-card-sku {
    font-size: 13px;
    color: var(--cb-text);
    opacity: 0.75;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 285px));
    justify-content: left;
    gap: 16px;
    margin-top: 0;
    width: 100%;
}

.product-card-grid {
    width: 100%;
    max-width: 285px;
    min-height: 385px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--cb-border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.product-card-grid + .product-card-grid {
    margin-top: 0;
}

/* ======================================
   AI Chat History - My Account
====================================== */


.chatbot-ai-history-wrapper {
    padding: 20px 0;
}


.chatbot-ai-history-wrapper h2 {
    margin-bottom: 10px;
}


.chatbot-ai-history-wrapper h3 {
    margin-bottom: 25px;
}




/* Empty State */

.chatbot-ai-history-empty {

    background: #f8f8f8;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;

}


.chatbot-ai-empty-icon {

    display: block;
    font-size: 40px;
    margin-bottom: 15px;

}


.chatbot-ai-history-empty p {

    margin: 0;
    color: #666;

}





/* History Cards */

.chatbot-ai-history-list {

    display: flex;
    flex-direction: column;
    gap: 20px;

}



.chatbot-ai-history-card {

    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    padding: 20px;

}



.chatbot-ai-history-date {

    font-size: 14px;
    margin-bottom: 8px;
    color: #555;

}



.chatbot-ai-history-count {

    font-size: 14px;
    margin-bottom: 15px;

}



.chatbot-ai-history-summary {

    background: #f7f7f7;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;

}



.chatbot-ai-history-summary p {

    margin: 8px 0 0;

    color: #555;

}





/* View Button */

.chatbot-ai-view-chat {

    background: #2563eb;
    color: #fff;

    border: none;

    border-radius: 8px;

    padding: 10px 18px;

    cursor: pointer;

    font-size: 14px;

}


.chatbot-ai-view-chat:hover {

    opacity: .9;

}





/* ======================================
   Chat Modal
====================================== */


.chatbot-ai-history-modal {

    display: none;

    position: fixed;

    z-index: 99999;

    top: 0;
    left: 0;

    width: 100%;
    height: 100%;

    background: rgba(0,0,0,.45);

}




.chatbot-ai-history-modal-content {

    background: #fff;

    width: 90%;

    max-width: 650px;

    max-height: 80vh;

    overflow-y: auto;

    margin: 5% auto;

    border-radius: 16px;

    padding: 25px;

    position: relative;

}




.chatbot-ai-history-close {

    position: absolute;

    right: 20px;

    top: 15px;

    border: none;

    background: none;

    font-size: 28px;

    cursor: pointer;

}





/* Messages */


#chatbot-ai-history-messages {

    padding-top: 30px;

}



.chatbot-ai-history-message {

    display: flex;

    margin-bottom: 15px;

}



.chatbot-ai-history-message.user {

    justify-content: flex-end;

}



.chatbot-ai-history-message.bot {

    justify-content: flex-start;

}




.chatbot-ai-history-bubble {

    max-width: 75%;

    padding: 12px 16px;

    border-radius: 14px;

    line-height: 1.5;

    font-size: 14px;

}




.chatbot-ai-history-message.user 
.chatbot-ai-history-bubble {


    background: #111827;

    color: #fff;

    border-bottom-right-radius: 4px;


}



.chatbot-ai-history-message.bot 
.chatbot-ai-history-bubble {


    background: #f1f1f1;

    color: #333;

    border-bottom-left-radius: 4px;


}





.chatbot-ai-history-loading {

    text-align: center;

    padding: 30px;

    color: #666;

}





.chatbot-ai-history-message.has-products {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
}

.chatbot-ai-history-message.has-products .chatbot-ai-history-bubble {
    max-width: 75%;
    margin-bottom: 10px;
}

.chatbot-ai-history-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    width: 100%;
}

.chatbot-ai-history-product-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chatbot-ai-history-product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f8fafc;
    overflow: hidden;
}

.chatbot-ai-history-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chatbot-ai-history-product-content {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chatbot-ai-history-product-name {
    font-size: 13px;
    font-weight: 700;
    color: #1f2937;
}

.chatbot-ai-history-product-price {
    font-size: 14px;
    font-weight: 700;
    color: #0a84ff;
}

.chatbot-ai-history-product-sku {
    font-size: 11px;
    color: #6b7280;
}

@media (max-width: 768px) {

    .chatbot-ai-open {
        bottom: max(16px, env(safe-area-inset-bottom));
        right: max(16px, env(safe-area-inset-right));
        width: 54px;
        height: 54px;
    }

    .chatbot-ai-messages {
        padding: 12px 14px 8px;
    }

    .chatbot-ai-message.user {
        max-width: 88%;
    }

    .chatbot-ai-message.bot.has-products .chatbot-ai-message-text,
    .chatbot-ai-message.bot .product-summary {
        max-width: 100%;
        padding: 12px 14px;
    }

    .chatbot-ai-suggestions-title,
    .chatbot-ai-related-title {
        font-size: 16px;
    }

    .chatbot-ai-footer {
        width: 100%;
        margin: 0;
        padding: 10px 12px max(12px, env(safe-area-inset-bottom));
        gap: 6px;
        border-radius: 0;
    }

    .chatbot-ai-composer-shell {
        padding: 6px;
        border-radius: 16px;
        gap: 6px;
    }

    .chatbot-ai-composer {
        padding: 6px 2px;
        gap: 6px;
    }

    .chatbot-ai-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .chatbot-ai-send {
        width: 38px;
        height: 38px;
        min-width: 38px;
        min-height: 38px;
    }

    .chatbot-ai-icon[data-tip]::after,
    .chatbot-ai-send[data-tip]::after {
        display: none;
    }

    #chatbot-ai-input {
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .chatbot-ai-preview-item {
        width: 48px;
        height: 48px;
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .product-card-grid {
        max-width: none;
        min-height: 0;
        border-radius: 12px;
    }

    .product-card-image {
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .product-card-content {
        padding: 10px;
    }

    .product-card-name {
        font-size: 12px;
    }

    .product-card-price {
        font-size: 13px;
    }

    .product-card-sku {
        font-size: 11px;
    }

    .chatbot-ai-related-products {
        padding: 8px 0;
    }

    .chatbot-ai-related-products .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .chatbot-ai-related-products .product-card-grid {
        min-height: 0;
    }

    .chatbot-ai-history-modal-content {
        width: 95%;
        margin: 8% auto;
        max-height: 85vh;
        padding: 18px 14px;
    }

    .chatbot-ai-history-bubble {
        max-width: 90%;
    }

    .chatbot-ai-history-products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .products-grid,
    .chatbot-ai-related-products .products-grid,
    .chatbot-ai-history-products {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .chatbot-ai-footer {
        width: 100%;
        gap: 4px;
        padding: 8px 10px max(10px, env(safe-area-inset-bottom));
    }

    .chatbot-ai-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
    }

    .chatbot-ai-send {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        border-radius: 12px;
    }

    .chatbot-ai-footer-hint {
        font-size: 10px;
    }
}

.chatbot-clear-chat {
    margin: 0;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-clear-chat:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.35);
}

.chatbot-ai-typing-indicator {
    background: #fff;
    border: 1px solid var(--cb-border);
    padding: 12px 16px;
    border-radius: 4px 18px 18px 18px;
    display: flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}


.chatbot-ai-typing-indicator span {
    width: 7px;
    height: 7px;
    background: #6b7280;
    border-radius: 50%;
    animation: chatbotTyping 1.4s infinite ease-in-out;
}


.chatbot-ai-typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}


.chatbot-ai-typing-indicator span:nth-child(2) {
    animation-delay: .2s;
}


.chatbot-ai-typing-indicator span:nth-child(3) {
    animation-delay: .4s;
}


@keyframes chatbotTyping {

    0%, 60%, 100% {
        transform: translateY(0);
        opacity: .4;
    }

    30% {
        transform: translateY(-5px);
        opacity: 1;
    }

}