/* Ewan AI chat: full page, floating panel and launcher. Logical properties keep RTL right. */
.ewan-ai {
    --ea-brand: var(--primary, #BF5B28);
    --ea-soft: var(--soft-primary, rgba(191, 91, 40, .12));
    --ea-line: #e7e3df;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--ea-line);
    border-radius: 16px;
    overflow: hidden;
    min-height: 560px;
    height: calc(100vh - 220px);
    max-height: 860px;
}
.ewan-ai__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--ea-line);
    background: linear-gradient(135deg, var(--ea-soft), #fff 70%);
}
.ewan-ai__avatar {
    flex: 0 0 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ea-brand);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.ewan-ai__titles { flex: 1; min-width: 0; }
.ewan-ai__name { font-weight: 700; font-size: 16px; color: #1b1b28; }
.ewan-ai__tagline { font-size: 12px; color: #6b6b7b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ewan-ai__new {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
    color: var(--ea-brand); background: var(--ea-soft); text-decoration: none !important; white-space: nowrap;
}
.ewan-ai__new:hover { background: var(--ea-brand); color: #fff; }
.ewan-ai--compact .ewan-ai__new span { display: none; }
.ewan-ai--compact .ewan-ai__new { width: 30px; height: 30px; padding: 0; justify-content: center; font-size: 16px; }
.ewan-ai__expand, .ewan-ai__close {
    border: 0; background: transparent; color: #6b6b7b; font-size: 20px; padding: 4px; line-height: 1;
}
.ewan-ai__expand:hover, .ewan-ai__close:hover { color: var(--ea-brand); }

.ewan-ai__log { flex: 1; overflow-y: auto; padding: 18px; scroll-behavior: smooth; background: #fbfaf9; }
.ewan-ai__msg { margin-bottom: 14px; display: flex; flex-direction: column; align-items: flex-start; }
.ewan-ai__msg--user { align-items: flex-end; }
.ewan-ai__bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    background: #fff;
    border: 1px solid var(--ea-line);
    color: #1b1b28;
    overflow-wrap: anywhere;
}
.ewan-ai__msg--bot .ewan-ai__bubble { border-start-start-radius: 4px; }
.ewan-ai__msg--user .ewan-ai__bubble { background: var(--ea-brand); border-color: var(--ea-brand); color: #fff; border-start-end-radius: 4px; }
.ewan-ai__bubble p { margin: 0 0 6px; }
.ewan-ai__bubble p:last-child, .ewan-ai__bubble ul:last-child, .ewan-ai__bubble ol:last-child { margin-bottom: 0; }
.ewan-ai__bubble ul, .ewan-ai__bubble ol { margin: 4px 0 6px; padding-inline-start: 20px; }
.ewan-ai__bubble a { color: var(--ea-brand); font-weight: 600; }
.ewan-ai__msg--error .ewan-ai__bubble { border-color: #f1c4c4; background: #fff6f6; color: #8a2a2a; }
.ewan-ai__msg--thinking .ewan-ai__bubble { color: #6b6b7b; font-style: italic; }
.ewan-ai__msg--thinking .ewan-ai__bubble::after {
    content: ''; display: inline-block; width: 1.2em; text-align: start;
    animation: ewan-ai-dots 1.2s steps(4, end) infinite;
}
@keyframes ewan-ai-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.ewan-ai-rfq {
    display: inline-block; margin-top: 4px; padding: 4px 12px; border-radius: 999px;
    background: var(--ea-soft); color: var(--ea-brand) !important; text-decoration: none !important;
}

.ewan-ai-cards { width: 100%; margin-top: 10px; }
.ewan-ai-cards__label { font-size: 12px; font-weight: 700; color: #6b6b7b; margin-bottom: 6px; }
.ewan-ai-cards .aiz-card-box { background: #fff; border-radius: 12px; height: 100%; }

/* Product carousel: scroll-snap track, arrows only when there is more to see. */
.ewan-ai-carousel { position: relative; }
.ewan-ai-carousel__track {
    display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
    scroll-behavior: smooth; scrollbar-width: none; padding: 2px 2px 6px;
}
.ewan-ai-carousel__track::-webkit-scrollbar { display: none; }
.ewan-ai-carousel__item { flex: 0 0 calc((100% - 20px) / 3.15); scroll-snap-align: start; min-width: 0; }
.ewan-ai--compact .ewan-ai-carousel__item { flex-basis: calc((100% - 10px) / 2.2); }
.ewan-ai-carousel__nav {
    position: absolute; top: 40%; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--ea-line);
    background: #fff; color: #1b1b28; font-size: 18px; display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .14); transform: translateY(-50%); cursor: pointer;
}
.ewan-ai-carousel__nav:hover { color: var(--ea-brand); border-color: var(--ea-brand); }
.ewan-ai-carousel__nav[hidden] { display: none; }
.ewan-ai-carousel__nav--prev { inset-inline-start: -8px; }
.ewan-ai-carousel__nav--next { inset-inline-end: -8px; }
[dir="rtl"] .ewan-ai-carousel__nav i { transform: scaleX(-1); }
.ewan-ai-carousel__count { font-size: 11px; color: #8a8a99; margin-top: 2px; }
@media (max-width: 575.98px) {
    .ewan-ai-carousel__item, .ewan-ai--compact .ewan-ai-carousel__item { flex-basis: calc((100% - 10px) / 2.2); }
    .ewan-ai-carousel__nav { width: 30px; height: 30px; font-size: 16px; }
}
.ewan-ai-cards .h-md-200px { height: 150px !important; }
.ewan-ai-cards .aiz-card-box h3, .ewan-ai-cards .aiz-card-box .fs-16 { font-size: 14px !important; }
.ewan-ai--compact .ewan-ai-cards .h-md-200px, .ewan-ai--compact .ewan-ai-cards .h-100px { height: 110px !important; }

.ewan-ai__starters { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 10px; background: #fbfaf9; }
.ewan-ai__starter {
    border: 1px solid var(--ea-line); background: #fff; border-radius: 999px; padding: 6px 12px;
    font-size: 13px; color: #1b1b28; cursor: pointer;
}
.ewan-ai__starter:hover { border-color: var(--ea-brand); color: var(--ea-brand); }

.ewan-ai__form { border-top: 1px solid var(--ea-line); padding: 12px 14px 10px; background: #fff; }
.ewan-ai__turnstile { margin-bottom: 8px; }
.ewan-ai__composer { display: flex; align-items: flex-end; gap: 8px; }
.ewan-ai__composer textarea {
    flex: 1; resize: none; border: 1px solid var(--ea-line); border-radius: 12px; padding: 10px 12px;
    font-size: 14px; line-height: 1.5; max-height: 140px; outline: none;
}
.ewan-ai__composer textarea:focus { border-color: var(--ea-brand); box-shadow: 0 0 0 3px var(--ea-soft); }
.ewan-ai__send {
    flex: 0 0 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ea-brand); color: #fff; font-size: 20px;
}
.ewan-ai__send:disabled { opacity: .55; }
[dir="rtl"] .ewan-ai__send i { transform: scaleX(-1); }
.ewan-ai__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-top: 6px; font-size: 11px; color: #8a8a99; }
.ewan-ai__remaining { font-weight: 600; }
.ewan-ai__login { border-top: 1px solid var(--ea-line); padding: 16px; text-align: center; font-size: 14px; }

/* Page */
.ewan-ai-history { background: #fff; border: 1px solid #e7e3df; border-radius: 16px; padding: 14px; max-height: calc(100vh - 220px); overflow-y: auto; }
.ewan-ai-history__label { font-size: 12px; font-weight: 700; color: #6b6b7b; text-transform: uppercase; margin-bottom: 8px; }
.ewan-ai-history__item { display: flex; align-items: center; border-radius: 10px; }
.ewan-ai-history__item.is-active, .ewan-ai-history__item:hover { background: var(--soft-primary, rgba(191, 91, 40, .12)); }
.ewan-ai-history__link { flex: 1; min-width: 0; padding: 8px 10px; color: #1b1b28; text-decoration: none !important; }
.ewan-ai-history__title { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ewan-ai-history__date { display: block; font-size: 11px; color: #8a8a99; }
.ewan-ai-history__delete { border: 0; background: transparent; color: #a0a0ad; padding: 6px 8px; }
.ewan-ai-history__delete:hover { color: #c0392b; }

/* Floating panel */
.ewan-ai--compact { min-height: 0; height: 100%; max-height: none; border: 0; border-radius: 0; }
.ewan-ai--compact .ewan-ai__log { padding: 14px; }
.ewan-ai--compact .ewan-ai__starters { padding: 0 14px 8px; }

/* Launcher: bottom-left in both directions (WhatsApp sits bottom-right). */
.ewan-ai-launcher { position: fixed; left: 20px; bottom: 20px; z-index: 1040; }
.ewan-ai-launcher__button {
    position: relative; display: inline-flex; align-items: center; gap: 10px; height: 58px; padding: 0 22px 0 8px;
    border: 0; border-radius: 999px; color: #fff; cursor: pointer; text-align: start;
    background: linear-gradient(135deg, var(--primary, #BF5B28) 0%, #8f3f17 100%);
    box-shadow: 0 10px 28px rgba(143, 63, 23, .35), 0 2px 6px rgba(0, 0, 0, .12);
    transition: transform .2s ease, box-shadow .2s ease;
}
.ewan-ai-launcher__button:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(143, 63, 23, .42), 0 3px 8px rgba(0, 0, 0, .14); }
.ewan-ai-launcher__button:focus-visible { outline: 3px solid rgba(191, 91, 40, .45); outline-offset: 3px; }
.ewan-ai-launcher__button::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    box-shadow: 0 0 0 0 rgba(191, 91, 40, .55); animation: ewan-ai-pulse 2.4s ease-out 1.2s 3;
}
@keyframes ewan-ai-pulse { 0% { box-shadow: 0 0 0 0 rgba(191, 91, 40, .55); } 70%, 100% { box-shadow: 0 0 0 16px rgba(191, 91, 40, 0); } }
.ewan-ai-launcher.is-open .ewan-ai-launcher__button::after { animation: none; }
.ewan-ai-launcher__icon {
    flex: 0 0 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .35);
}
.ewan-ai-launcher__icon i { font-size: 24px; }
.ewan-ai-launcher__text { display: flex; flex-direction: column; line-height: 1.15; }
.ewan-ai-launcher__label { font-weight: 700; font-size: 15px; }
.ewan-ai-launcher__hint { font-size: 11px; opacity: .85; }

/* "Beta" tag: on the button's corner, and inline in the chat header. */
.ewan-ai-beta {
    display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .04em;
    text-transform: uppercase; line-height: 1.6; background: #fff; color: var(--primary, #BF5B28); border: 1px solid currentColor;
}
.ewan-ai-launcher__button .ewan-ai-beta { position: absolute; top: -8px; right: -6px; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.ewan-ai-beta--inline { vertical-align: middle; margin-inline-start: 6px; font-size: 9px; background: var(--ea-soft, rgba(191, 91, 40, .12)); border-color: transparent; }

.ewan-ai-launcher__teaser {
    position: absolute; left: 0; bottom: 72px; width: 250px; padding: 12px 30px 12px 14px; border-radius: 14px;
    background: #fff; color: #1b1b28; font-size: 13px; line-height: 1.45; cursor: pointer;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16); animation: ewan-ai-rise .35s ease-out;
}
.ewan-ai-launcher__teaser::after {
    content: ''; position: absolute; left: 28px; bottom: -7px; width: 14px; height: 14px; background: #fff;
    transform: rotate(45deg); box-shadow: 4px 4px 8px rgba(0, 0, 0, .06);
}
.ewan-ai-launcher__teaser-close {
    position: absolute; top: 4px; right: 6px; border: 0; background: transparent; color: #8a8a99; font-size: 18px; line-height: 1; padding: 2px 4px;
}
[dir="rtl"] .ewan-ai-launcher__teaser { padding: 12px 14px 12px 30px; }
[dir="rtl"] .ewan-ai-launcher__teaser-close { right: auto; left: 6px; }
.ewan-ai-launcher.is-open .ewan-ai-launcher__teaser { display: none; }
.ewan-ai-launcher.is-open { z-index: 10000; }   /* above the text-size buttons (9990), below the terms gate (10050) */
@keyframes ewan-ai-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.ewan-ai-launcher__panel {
    display: none; position: absolute; left: 0; bottom: 70px; width: 380px; height: min(620px, calc(100vh - 120px));
    background: #fff; border-radius: 16px; box-shadow: 0 16px 48px rgba(0, 0, 0, .22); overflow: hidden;
}
.ewan-ai-launcher.is-open .ewan-ai-launcher__panel { display: block; animation: ewan-ai-rise .25s ease-out; }
.ewan-ai-launcher__loading { display: flex; height: 100%; align-items: center; justify-content: center; color: #8a8a99; font-size: 14px; }
@media (max-width: 1199.98px) {
    /* Above the mobile bottom navigation bar. */
    .ewan-ai-launcher { bottom: 78px; left: 12px; }
    .ewan-ai-launcher__button { height: 52px; padding: 0 18px 0 6px; }
    .ewan-ai-launcher__icon { flex-basis: 40px; height: 40px; }
}
@media (max-width: 575.98px) {
    .ewan-ai-launcher__text { display: none; }
    .ewan-ai-launcher__button { width: 54px; height: 54px; padding: 0; justify-content: center; }
    .ewan-ai-launcher__icon { background: transparent; border: 0; }
    .ewan-ai-launcher__button .ewan-ai-beta { top: -6px; right: -10px; font-size: 9px; padding: 0 5px; }
    .ewan-ai-launcher__teaser { width: min(250px, calc(100vw - 40px)); bottom: 66px; }
    .ewan-ai-launcher.is-open { left: 0; right: 0; bottom: 0; top: 0; }
    .ewan-ai-launcher.is-open .ewan-ai-launcher__button { display: none; }
    .ewan-ai-launcher__panel { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; }
    .ewan-ai:not(.ewan-ai--compact) { height: calc(100vh - 160px); }
    .ewan-ai__bubble { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
    .ewan-ai-launcher__button::after, .ewan-ai-launcher__teaser, .ewan-ai-launcher.is-open .ewan-ai-launcher__panel { animation: none; }
    .ewan-ai-launcher__button { transition: none; }
}
@media print { .ewan-ai-launcher { display: none; } }
