/* Customer assistant widget. Scoped under .ai-widget so it cannot affect page styles. */
.ai-widget { position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 900; font-family: inherit; }
.ai-widget__toggle {
    display: flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border: 0; border-radius: 50%;
    background: #2c307a; color: #fff; cursor: pointer;
    box-shadow: 0 8px 24px rgba(44, 48, 122, .35);
    transition: transform .2s ease, box-shadow .2s ease;
}
.ai-widget__toggle:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(44, 48, 122, .45); }
.ai-widget__toggle svg { width: 26px; height: 26px; fill: currentColor; }

.ai-widget__panel {
    position: absolute; inset-inline-end: 0; bottom: 72px;
    width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 140px));
    display: none; flex-direction: column; overflow: hidden;
    background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(15, 18, 60, .25);
}
.ai-widget--open .ai-widget__panel { display: flex; }
.ai-widget--open .ai-widget__toggle { transform: scale(.9); }

.ai-widget__header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px; background: #2c307a; color: #fff;
}
.ai-widget__header h2 { margin: 0; font-size: 15px; font-weight: 600; }
.ai-widget__header button {
    background: transparent; border: 0; color: #fff; cursor: pointer;
    font-size: 12px; opacity: .85; padding: 4px 6px; border-radius: 6px;
}
.ai-widget__header button:hover { opacity: 1; background: rgba(255, 255, 255, .15); }

.ai-widget__log { flex: 1; overflow-y: auto; padding: 16px; background: #f7f8fc; }
.ai-msg { max-width: 85%; margin-bottom: 12px; padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.55; word-wrap: break-word; }
.ai-msg--user { white-space: pre-wrap; }
.ai-msg--bot { background: #fff; color: #1d2135; border: 1px solid #e6e8f2; margin-inline-end: auto; }
.ai-msg--user { background: #2c307a; color: #fff; margin-inline-start: auto; }
.ai-msg--error { background: #fdecec; color: #8c1c1c; border: 1px solid #f5c6c6; margin-inline-end: auto; }
.ai-msg--pending { opacity: .6; font-style: italic; }

.ai-confirm { background: #fff; border: 1px solid #f0c36d; border-inline-start: 4px solid #f0a12e; border-radius: 12px; padding: 13px; margin-bottom: 12px; font-size: 13.5px; }
.ai-confirm__title { font-weight: 600; margin-bottom: 6px; color: #7a4a00; }
.ai-confirm__summary { margin-bottom: 8px; color: #1d2135; line-height: 1.5; }
.ai-confirm__hint { color: #6b6f85; font-size: 12px; margin-bottom: 10px; }
.ai-confirm__actions { display: flex; gap: 8px; }
.ai-confirm__actions button { flex: 1; padding: 8px; border-radius: 8px; border: 0; cursor: pointer; font-size: 13px; font-weight: 600; }
.ai-confirm__yes { background: #2c307a; color: #fff; }
.ai-confirm__no { background: #eceef6; color: #3a3f5c; }

.ai-widget__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e6e8f2; background: #fff; }
.ai-widget__form textarea {
    flex: 1; resize: none; border: 1px solid #d9dcea; border-radius: 10px;
    padding: 9px 12px; font-size: 14px; font-family: inherit; max-height: 96px; line-height: 1.4;
}
.ai-widget__form textarea:focus { outline: 2px solid #2c307a; outline-offset: -1px; border-color: transparent; }
.ai-widget__form button { border: 0; border-radius: 10px; background: #2c307a; color: #fff; padding: 0 16px; cursor: pointer; font-size: 14px; font-weight: 600; }
.ai-widget__form button:disabled { opacity: .5; cursor: not-allowed; }

[dir="rtl"] .ai-confirm { border-inline-start: 1px solid #f0c36d; border-inline-end: 4px solid #f0a12e; }

@media (max-width: 480px) {
    .ai-widget { inset-inline-end: 12px; bottom: 12px; }
    .ai-widget__panel { bottom: 66px; height: min(70vh, calc(100vh - 110px)); }
}

.ai-msg p { margin: 0; }
.ai-msg p + p, .ai-msg p + ul, .ai-msg p + ol, .ai-msg ul + p, .ai-msg ol + p { margin-top: 0.5em; }
.ai-msg ul, .ai-msg ol { margin: 0; padding-inline-start: 1.25em; }
.ai-msg li { margin: 0.2em 0; }
