/* Smart AI Chatbot - widget styles. Uses logical properties so RTL/LTR both work. */
.sac-root, .sac-inline { --sac-bg: #fff; --sac-text: #0f172a; --sac-muted: #64748b; --sac-line: #e2e8f0; --sac-bot: #f1f5f9; font-family: inherit; line-height: 1.8; }
.sac-root *, .sac-inline * { box-sizing: border-box; letter-spacing: 0; }

.sac-root { position: fixed; inset-block-end: 20px; z-index: 99999; }
.sac-root.sac-pos-end { inset-inline-end: 20px; }
.sac-root.sac-pos-start { inset-inline-start: 20px; }

.sac-launcher { display: flex; align-items: center; justify-content: center; width: 58px; height: 58px; border: 0; border-radius: 50%; cursor: pointer; background: var(--sac-color, #2563eb); color: var(--sac-on, #fff); box-shadow: 0 6px 20px rgba(15, 23, 42, .28); transition: transform .15s ease; }
.sac-launcher:hover { transform: scale(1.06); }
.sac-launcher:focus-visible, .sac-ibtn:focus-visible, .sac-send:focus-visible, .sac-chip:focus-visible, .sac-fbtn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

.sac-panel { display: flex; flex-direction: column; background: var(--sac-bg); color: var(--sac-text); border: 1px solid var(--sac-line); border-radius: 16px; overflow: hidden; }
.sac-panel[hidden] { display: none; }
.sac-floating { position: absolute; inset-block-end: 72px; inline-size: min(380px, calc(100vw - 24px)); block-size: min(600px, calc(100vh - 110px)); box-shadow: 0 16px 48px rgba(15, 23, 42, .28); animation: sac-pop .18s ease-out; }
.sac-pos-end .sac-floating { inset-inline-end: 0; }
.sac-pos-start .sac-floating { inset-inline-start: 0; }
.sac-embedded { block-size: 560px; max-block-size: 80vh; inline-size: 100%; max-inline-size: 760px; margin-inline: auto; }

.sac-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; background: var(--sac-color, #2563eb); color: var(--sac-on, #fff); }
.sac-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.sac-dot { inline-size: 9px; block-size: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74, 222, 128, .3); }
.sac-actions { display: flex; gap: 4px; }
.sac-ibtn { display: inline-flex; align-items: center; justify-content: center; inline-size: 32px; block-size: 32px; border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; opacity: .9; }
.sac-ibtn:hover { background: rgba(255, 255, 255, .18); opacity: 1; }

.sac-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #fff; overscroll-behavior: contain; }
.sac-row { display: flex; flex-direction: column; max-inline-size: 88%; }
.sac-row.sac-bot { align-self: flex-start; align-items: flex-start; }
.sac-row.sac-user { align-self: flex-end; align-items: flex-end; }
.sac-bubble { padding: 9px 13px; border-radius: 14px; font-size: 14.5px; word-wrap: break-word; overflow-wrap: anywhere; }
.sac-bot .sac-bubble { background: var(--sac-bot); color: var(--sac-text); border-start-start-radius: 4px; }
.sac-user .sac-bubble { background: var(--sac-color, #2563eb); color: var(--sac-on, #fff); border-start-end-radius: 4px; white-space: pre-wrap; }
.sac-error .sac-bubble { background: #fef2f2; color: #991b1b; }
.sac-bubble p { margin: 0 0 .5em; }
.sac-bubble p:last-child, .sac-bubble ul:last-child, .sac-bubble ol:last-child { margin-block-end: 0; }
.sac-bubble ul, .sac-bubble ol { margin: 0 0 .5em; padding-inline-start: 1.4em; }
.sac-bubble a { color: inherit; text-decoration: underline; }
.sac-bubble code { direction: ltr; unicode-bidi: embed; background: rgba(15, 23, 42, .08); padding: 0 .3em; border-radius: 4px; font-size: .92em; }

.sac-extras { margin-block-start: 4px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--sac-muted); }
.sac-sources { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.sac-src { color: var(--sac-color, #2563eb); text-decoration: underline; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sac-fb { display: flex; align-items: center; gap: 4px; }
.sac-fbtn { border: 1px solid var(--sac-line); background: #fff; border-radius: 8px; padding: 0 8px; line-height: 1.6; cursor: pointer; font-size: 14px; }
.sac-fbtn:disabled { opacity: .5; cursor: default; }

.sac-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; background: #fff; }
.sac-chips:empty { display: none; }
.sac-chip { border: 1px solid var(--sac-color, #2563eb); color: var(--sac-color, #2563eb); background: #fff; border-radius: 999px; padding: 3px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
.sac-chip:hover { background: var(--sac-color, #2563eb); color: var(--sac-on, #fff); }

.sac-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-block-start: 1px solid var(--sac-line); background: #fff; }
.sac-input { flex: 1; resize: none; border: 1px solid var(--sac-line); border-radius: 12px; padding: 8px 12px; font: inherit; font-size: 14.5px; line-height: 1.7; max-block-size: 110px; color: var(--sac-text); background: #fff; }
.sac-input:focus { outline: 2px solid var(--sac-color, #2563eb); outline-offset: -1px; border-color: transparent; }
.sac-send { display: inline-flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px; flex: none; border: 0; border-radius: 12px; background: var(--sac-color, #2563eb); color: var(--sac-on, #fff); cursor: pointer; }
.sac-send:disabled { opacity: .5; cursor: default; }
[dir="rtl"] .sac-flip { transform: scaleX(-1); }
.sac-note { padding: 0 14px 8px; font-size: 11.5px; color: var(--sac-muted); text-align: center; background: #fff; }

.sac-typing { display: inline-flex; gap: 4px; align-items: center; padding: 6px 2px; }
.sac-typing i { inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--sac-muted); animation: sac-blink 1.2s infinite ease-in-out; }
.sac-typing i:nth-child(2) { animation-delay: .18s; }
.sac-typing i:nth-child(3) { animation-delay: .36s; }

@keyframes sac-blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes sac-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

@media (max-width: 480px) {
	.sac-root { inset-block-end: 12px; }
	.sac-root.sac-pos-end { inset-inline-end: 12px; }
	.sac-root.sac-pos-start { inset-inline-start: 12px; }
	.sac-floating { position: fixed; inset: 0; inline-size: 100%; block-size: 100%; border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.sac-floating, .sac-typing i { animation: none; }
	.sac-launcher { transition: none; }
}
