.nexora-chatbot-messages {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px 18px 22px;
    background: var(--nexora-chatBgColor, #fff);
    overscroll-behavior: contain;
    scrollbar-color: rgba(100, 116, 139, .34) transparent;
    scrollbar-width: thin;
}

.nexora-chatbot-messages[hidden] {
    display: none !important;
}

.nexora-chatbot-messages::-webkit-scrollbar,
.nexora-chatbot-window .nexora-chatbot-profile::-webkit-scrollbar {
    width: 7px;
}

.nexora-chatbot-messages::-webkit-scrollbar-thumb,
.nexora-chatbot-window .nexora-chatbot-profile::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(100, 116, 139, .30);
    background-clip: padding-box;
}

.nexora-message {
    position: relative;
    display: flex;
    width: fit-content;
    max-width: min(88%, 370px);
    min-width: 0;
    flex-direction: column;
    align-self: flex-start;
    gap: 7px;
}

.nexora-message--user {
    align-self: flex-end;
    align-items: flex-end;
}

.nexora-message-author {
    display: flex;
    min-height: 32px;
    align-items: center;
    gap: 9px;
    color: var(--nexora-assistantLabelTextColor, #687385);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.nexora-message-avatar {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--nexora-assistantIconBgColor, #2563eb);
    color: var(--nexora-assistantIconColor, #fff);
    font-size: 12px;
    font-weight: 700;
}

.nexora-message-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: contain;
}

.nexora-bubble {
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    padding: 12px 15px;
    border-radius: 19px;
    color: var(--nexora-botBubbleTextColor, #172033);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.nexora-message--bot .nexora-bubble {
    border-bottom-left-radius: 6px;
    background: var(--nexora-botBubbleBgColor, #f0f4f9);
}

.nexora-message--user .nexora-bubble {
    border-bottom-right-radius: 6px;
    background: var(--nexora-userBubbleBgColor, #2563eb);
    color: var(--nexora-userBubbleTextColor, #fff);
}

.nexora-message.bubble-shape-rounded .nexora-bubble { border-radius: 19px; }
.nexora-message.bubble-shape-rounded.nexora-message--bot .nexora-bubble { border-bottom-left-radius: 6px; }
.nexora-message.bubble-shape-rounded.nexora-message--user .nexora-bubble { border-bottom-right-radius: 6px; }
.nexora-message.bubble-shape-soft .nexora-bubble { border-radius: 13px; }
.nexora-message.bubble-shape-pill .nexora-bubble { border-radius: 24px; }
.nexora-message.bubble-shape-sharp .nexora-bubble { border-radius: 5px; }
.layout-bubble .nexora-bubble { border-radius: 22px; }
.layout-sharp .nexora-bubble { border-radius: 5px; }

.nexora-bubble p { margin: 0; }
.nexora-bubble p + p { margin-top: 9px; }
.nexora-bubble strong { font-weight: 700; }
.nexora-bubble em { font-style: italic; }
.nexora-bubble del { text-decoration: line-through; }
.nexora-bubble h1,
.nexora-bubble h2,
.nexora-bubble h3,
.nexora-bubble h4,
.nexora-bubble h5,
.nexora-bubble h6 { margin: 0 0 8px; font-size: 1em; line-height: 1.3; }
.nexora-bubble ul,
.nexora-bubble ol { margin: 8px 0; padding-left: 20px; }
.nexora-bubble li + li { margin-top: 4px; }
.nexora-bubble blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid currentColor; opacity: .85; }
.nexora-bubble code { padding: 2px 5px; border-radius: 5px; background: rgba(15, 23, 42, .09); font: inherit; font-size: .92em; }
.nexora-bubble pre { margin: 8px 0; padding: 10px; overflow: auto; border-radius: 9px; background: rgba(15, 23, 42, .08); white-space: pre-wrap; }
.nexora-bubble pre code { padding: 0; background: transparent; }

.nexora-message-image {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 340px;
    border-radius: 15px;
    background: rgba(100, 116, 139, .08);
    object-fit: contain;
}

.nexora-bubble:has(.nexora-message-image) { padding: 6px; }
.nexora-message-image-error { color: #687385; font-size: 12px; }
.nexora-message-link { color: inherit; text-decoration: underline; overflow-wrap: anywhere; word-break: break-word; }
.nexora-message-time { color: #8a94a4; font-size: 11px; }

.nexora-message-reactions {
    display: flex;
    min-height: 0;
    flex-wrap: wrap;
    gap: 5px;
}

.nexora-message-reaction {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: 1px solid rgba(100, 116, 139, .2);
    border-radius: 12px;
    background: var(--nexora-chatBgColor, #fff);
    color: #475569;
    font-size: 12px;
}

.nexora-message-reaction span { font-size: 11px; }
.nexora-message--typing .nexora-bubble { width: 68px; min-height: 42px; padding: 12px 14px; }

.nexora-typing {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nexora-typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: nexora-typing-bounce 1s ease-in-out infinite;
}

.nexora-typing i:nth-child(2) { animation-delay: 120ms; }
.nexora-typing i:nth-child(3) { animation-delay: 240ms; }

@keyframes nexora-typing-bounce {
    0%, 60%, 100% { opacity: .45; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

@media (max-width: 560px) {
    .nexora-chatbot-messages { gap: 10px; padding: 13px 12px 14px; }
    .nexora-message { max-width: min(90%, 370px); }
    .nexora-bubble { padding: 11px 14px; font-size: 14px; }
    .nexora-message-image { max-height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
    .nexora-typing i { animation: none; opacity: .65; }
}

/* Product cards are presentation-only; commerce actions can be connected later. */
.nexora-message:has(.nexora-product-display) {
    width: 100%;
    max-width: 100%;
}

.nexora-message:has(.nexora-product-display) .nexora-bubble {
    width: 100%;
    padding: 0;
    background: transparent;
    color: inherit;
}

.nexora-product-display {
    width: 100%;
    min-width: 0;
}

.nexora-product-intro {
    width: fit-content;
    max-width: 100%;
    margin: 0 0 8px;
    padding: 9px 12px;
    border-radius: 17px;
    background: var(--nexora-botBubbleBgColor, #f0f4f9);
    color: var(--nexora-botBubbleTextColor, #172033);
    font-size: 14px;
    line-height: 1.5;
}

.nexora-product-intro p { margin: 0; }
.nexora-product-intro p + p { margin-top: 8px; }

.nexora-product-display__heading {
    margin: 0 0 7px;
    color: var(--nexora-headerTextColor, #172033);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.nexora-product-track {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    gap: 8px;
}

.nexora-product-carousel {
    position: relative;
    width: 100%;
    min-width: 0;
}

.nexora-product-track--carousel {
    overflow-x: auto;
    padding: 1px 0 5px;
    scroll-padding-inline: 0;
    scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nexora-product-track--carousel::-webkit-scrollbar { display: none; }

.nexora-product-carousel__arrow {
    position: absolute;
    z-index: 2;
    top: 50%;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid rgba(100, 116, 139, .2);
    border-radius: 50%;
    background: var(--nexora-chatBgColor, #fff);
    color: var(--nexora-controlTextColor, #64748b);
    box-shadow: 0 3px 12px rgba(15, 23, 42, .15);
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.nexora-product-carousel__arrow[hidden] { display: none !important; }
.nexora-product-carousel__arrow--prev { left: -7px; }
.nexora-product-carousel__arrow--next { right: -7px; }
.nexora-product-carousel__arrow svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nexora-product-carousel__arrow:focus-visible { outline: 2px solid var(--nexora-controlTextColor, #64748b); outline-offset: 2px; }
.nexora-product-carousel__arrow:hover { background: var(--nexora-chatBgColor, #fff); color: var(--nexora-headerTextColor, #172033); box-shadow: 0 5px 15px rgba(15, 23, 42, .2); }
.nexora-product-carousel__arrow:active { transform: translateY(-50%) scale(.95); }

.nexora-product-track--single { justify-content: center; }

.nexora-product-card {
    position: relative;
    display: flex;
    width: min(210px, 68vw);
    min-width: min(194px, 68vw);
    flex: 0 0 min(210px, 68vw);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(100, 116, 139, .18);
    border-radius: 19px;
    background: var(--nexora-chatBgColor, #fff);
    color: var(--nexora-headerTextColor, #172033);
    scroll-snap-align: start;
}

.nexora-product-card--featured {
    width: min(100%, 340px);
    min-width: 0;
    flex: 0 1 340px;
    margin-inline: auto;
}

.nexora-product-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 1.45 / 1;
    overflow: hidden;
    background: rgba(100, 116, 139, .08);
}

.nexora-product-card--featured .nexora-product-card__media {
    aspect-ratio: 1.95 / 1;
    background: #f1f5fb;
}

.nexora-product-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nexora-product-card__placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: var(--nexora-headerSubtitleTextColor, #687385);
    font-size: 12px;
}

.nexora-product-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    max-width: calc(100% - 20px);
    overflow: hidden;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--nexora-assistantIconBgColor, #172033);
    color: var(--nexora-assistantIconColor, #fff);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nexora-product-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 10px 7px;
}

.nexora-product-card__title {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: var(--nexora-headerTextColor, #172033);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.nexora-product-card__trainer {
    margin: -2px 0 0;
    color: var(--nexora-headerSubtitleTextColor, #687385);
    font-size: 13px;
    line-height: 1.4;
}

.nexora-product-card__trainer strong {
    color: var(--nexora-headerTextColor, #172033);
    font-weight: 650;
}

.nexora-product-card__rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--nexora-headerTextColor, #172033);
    font-size: 12px;
    line-height: 1.2;
}

.nexora-product-card__rating > span:first-child { color: #f59e0b; font-size: 14px; }
.nexora-product-card__rating-count { color: var(--nexora-headerSubtitleTextColor, #687385); }

.nexora-product-card__prices {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    color: var(--nexora-headerTextColor, #172033);
}

.nexora-product-card__prices strong { font-size: 17px; font-weight: 750; }
.nexora-product-card__prices del { color: var(--nexora-headerSubtitleTextColor, #687385); font-size: 12px; }

.nexora-product-card__description {
    margin: 0;
    color: var(--nexora-headerSubtitleTextColor, #687385);
    font-size: 13px;
    line-height: 1.5;
}

.nexora-product-card__variants {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
}

.nexora-product-card__variants li {
    padding: 6px 9px;
    border: 1px solid rgba(100, 116, 139, .22);
    border-radius: 999px;
    color: var(--nexora-headerTextColor, #172033);
    font-size: 11px;
    line-height: 1;
}

.nexora-product-card__features {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    width: 100%;
    margin: 2px 0 0;
    padding: 0;
    color: var(--nexora-headerSubtitleTextColor, #687385);
    font-size: 12px;
    line-height: 1.4;
    list-style: none;
}

.nexora-product-card__features li::before {
    margin-right: 4px;
    color: #16a34a;
    content: '✓';
    font-weight: 700;
}

.nexora-product-card__features li {
    max-width: 100%;
    padding: 2px 5px;
    border-radius: 8px;
    background: rgba(100, 116, 139, .07);
    font-size: 10px;
}

@media (max-width: 560px) {
    .nexora-product-track { gap: 8px; }
    .nexora-product-card { width: min(200px, 68vw); min-width: min(184px, 68vw); flex-basis: min(200px, 68vw); }
    .nexora-product-card--featured { width: min(100%, 320px); min-width: 0; flex-basis: 320px; }
    .nexora-product-card--featured .nexora-product-card__media { aspect-ratio: 1.95 / 1; }
    .nexora-product-carousel__arrow { width: 32px; height: 32px; }
}
