/* Website assistant (button + chat panel). Colours follow --ai-accent, set by ai_widget() for each website. */
.ai-fab { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 900; display: inline-flex; align-items: center; gap: .5rem; border: 0; border-radius: 999px; padding: .55rem 1rem .55rem .55rem; background: var(--ai-accent, #1f3b57); color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); font: 600 15px/1.2 inherit; font-family: inherit; cursor: pointer; transition: transform .2s; }
.ai-fab:hover { transform: translateY(-2px); }
.ai-fab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--ai-accent, #1f3b57); }
.ai-dot { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; }
.ai-dot svg { width: 18px; height: 18px; fill: currentColor; }
.ai-panel { position: fixed; inset-inline-start: 20px; bottom: 86px; z-index: 950; display: flex; flex-direction: column; width: min(400px, calc(100vw - 32px)); height: min(580px, calc(100vh - 120px)); border-radius: 22px; background: #fff; color: #1d2430; border: 1px solid rgba(0, 0, 0, .08); box-shadow: 0 24px 60px rgba(0, 0, 0, .25); overflow: hidden; opacity: 0; visibility: hidden; transform: translateY(12px) scale(.98); transform-origin: bottom left; transition: opacity .22s, transform .22s, visibility .22s; font-family: inherit; text-align: start; }
[dir="rtl"] .ai-panel { transform-origin: bottom right; }
.ai-panel.open { opacity: 1; visibility: visible; transform: none; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; background: var(--ai-accent, #1f3b57); color: #fff; }
.ai-badge-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .14); flex: none; }
.ai-badge-ico svg, .ai-icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ai-head-txt { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.ai-head-txt strong { color: #fff; font-size: 16px; }
.ai-head-txt small { color: rgba(255, 255, 255, .75); font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ai-icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; flex: none; }
.ai-icon-btn:hover { background: rgba(255, 255, 255, .24); }
.ai-log { flex: 1; overflow-y: auto; padding: 16px; display: grid; align-content: start; gap: 10px; background: #f5f6f8; }
.ai-msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.7; animation: aiIn .25s ease both; }
@keyframes aiIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ai-msg p { margin: 0; white-space: pre-line; }
.ai-bot { justify-self: start; background: #fff; border: 1px solid rgba(0, 0, 0, .08); border-end-start-radius: 4px; }
.ai-me { justify-self: end; background: var(--ai-accent, #1f3b57); color: #fff; border-end-end-radius: 4px; }
.ai-err { color: #a11212; }
.ai-wait { display: flex; align-items: center; gap: 8px; color: #6b7280; }
.ai-dots { display: inline-flex; gap: 3px; } .ai-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: aiDot 1s infinite ease-in-out; } .ai-dots i:nth-child(2) { animation-delay: .15s; } .ai-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.ai-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ai-chip { padding: 6px 12px; border: 1px solid rgba(0, 0, 0, .12); border-radius: 999px; background: #f5f6f8; color: #374151; font: inherit; font-size: 12.5px; cursor: pointer; text-align: start; }
.ai-chip:hover { border-color: var(--ai-accent, #1f3b57); color: var(--ai-accent, #1f3b57); }
.ai-sources { display: grid; gap: 4px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed rgba(0, 0, 0, .12); }
.ai-sources small { color: #6b7280; font-size: 11px; font-weight: 700; }
.ai-sources a { color: var(--ai-accent, #1f3b57); font-size: 13px; font-weight: 600; text-decoration: none; }
.ai-sources a:hover { text-decoration: underline; }
.ai-ask { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid rgba(0, 0, 0, .08); background: #fff; margin: 0; }
.ai-ask textarea { flex: 1; height: 44px; min-height: 44px; max-height: 132px; overflow-y: hidden; padding: 10px 14px; border: 1px solid rgba(0, 0, 0, .15); border-radius: 14px; background: #fff; color: #1d2430; font: inherit; font-size: 14.5px; resize: none; line-height: 1.5; box-sizing: border-box; }
.ai-ask textarea:focus { outline: none; border-color: var(--ai-accent, #1f3b57); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
.ai-send { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--ai-accent, #1f3b57); color: #fff; cursor: pointer; flex: none; }
.ai-send svg { width: 20px; height: 20px; fill: currentColor; }
[dir="rtl"] .ai-send svg { transform: scaleX(-1); }
.ai-send:disabled { opacity: .5; }
html.ai-open, html.ai-open body { overflow: hidden; }
@media (max-width: 520px) {
  .ai-fab { padding: 7px; gap: 0; bottom: 16px; inset-inline-start: 16px; }
  .ai-fab .txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ai-fab .ai-dot { width: 40px; height: 40px; }
  .ai-panel { inset-inline: 8px; top: 8px; bottom: 8px; width: auto; height: auto; max-height: calc(100dvh - 16px); }
}
@media print { .ai-fab, .ai-panel { display: none !important; } }
