/* Модуль «ИИ-чат» — виджет на сайте. Цвет задаётся в админке (--aic-c). */
.aic, .aic * { box-sizing: border-box; }
.aic { --aic-c: #448c74; font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif; color: #1f2937; position: fixed; right: 20px; bottom: 20px; z-index: 2147483000; }
.aic-btn { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--aic-c); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(0,0,0,.22); transition: transform .15s; position: relative; }
.aic-btn:hover { transform: scale(1.06); }
.aic-btn svg { width: 28px; height: 28px; }
.aic-badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; display: none; }
.aic-panel { position: absolute; right: 0; bottom: 0; width: 370px; height: min(600px, calc(100vh - 40px)); background: #fff; border-radius: 18px; box-shadow: 0 18px 50px rgba(0,0,0,.25); display: none; flex-direction: column; overflow: hidden; }
.aic.open .aic-panel { display: flex; animation: aicIn .18s ease-out; }
.aic.open .aic-btn { display: none; }
@keyframes aicIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.aic-head { background: var(--aic-c); color: #fff; padding: 14px 14px 14px 16px; display: flex; align-items: center; gap: 12px; }
.aic-ava { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; position: relative; flex: 0 0 auto; }
.aic-ava::after { content: ""; position: absolute; right: 0; bottom: 1px; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--aic-c); }
.aic-who { flex: 1; min-width: 0; }
.aic-who b { display: block; font-size: 15px; }
.aic-who span { font-size: 12px; opacity: .85; }
.aic-x { background: rgba(255,255,255,.18); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 32px; }
.aic-list { flex: 1; overflow-y: auto; padding: 14px; background: #f6f7f9; display: flex; flex-direction: column; gap: 8px; }
.aic-m { max-width: 85%; padding: 9px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: 14px; }
.aic-m a { color: inherit; text-decoration: underline; }
.aic-m small { display: block; font-size: 11px; opacity: .55; margin-top: 3px; text-align: right; }
.aic-in { align-self: flex-start; background: #fff; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; }
.aic-out { align-self: flex-end; background: var(--aic-c); color: #fff; border-bottom-right-radius: 4px; }
.aic-op { align-self: flex-start; background: #fff7e6; border: 1px solid #f5d38a; border-bottom-left-radius: 4px; }
.aic-op i { display: block; font-style: normal; font-size: 11px; font-weight: 600; opacity: .7; margin-bottom: 2px; }
.aic-typing { align-self: flex-start; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 10px 14px; display: none; }
.aic-typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: #9ca3af; animation: aicDot 1s infinite; }
.aic-typing span:nth-child(2) { animation-delay: .15s; } .aic-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes aicDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.aic-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e5e7eb; background: #fff; align-items: flex-end; }
.aic-form textarea { flex: 1; resize: none; border: 1px solid #d1d5db; border-radius: 20px; padding: 9px 14px; font: inherit; font-size: 14px; max-height: 120px; min-height: 40px; outline: 0; }
.aic-form textarea:focus { border-color: var(--aic-c); }
.aic-send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--aic-c); color: #fff; cursor: pointer; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.aic-send:disabled { opacity: .5; cursor: default; }
.aic-send svg { width: 18px; height: 18px; }
.aic-note { font-size: 11px; color: #9ca3af; text-align: center; padding: 0 10px 8px; background: #fff; }
.aic-test { position: absolute; left: 0; top: -26px; font-size: 11px; background: #fef3c7; color: #92400e; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
@media (max-width: 640px) {
    .aic { right: 14px; bottom: 14px; }
    .aic.open { inset: 0; right: 0; bottom: 0; }
    .aic.open .aic-panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; }
}
