/* AI consultant chat widget */
.ai-fab { position:fixed; right:20px; bottom:20px; z-index:50; display:flex; align-items:center; gap:10px; padding:10px 18px 10px 10px; border:0; border-radius:999px; cursor:pointer;
  font:600 15px "Segoe UI", system-ui, sans-serif; color:#1a0d02; background:linear-gradient(90deg,#ffd36b,#ff8a3d);
  box-shadow:0 10px 30px -8px rgba(255,140,60,.7), 0 0 0 1px rgba(255,255,255,.15) inset; transition:transform .2s; }
.ai-fab:hover { transform:translateY(-2px); }
.ai-fab .orb { width:36px; height:36px; border-radius:50%; flex:none; position:relative;
  background:conic-gradient(from 0deg,#4fd86b,#ff5a2a,#ffd36b,#e8eef8,#3d8bff,#4fd86b); animation:aiSpin 6s linear infinite; }
.ai-fab .orb::after { content:"М"; position:absolute; inset:4px; border-radius:50%; background:#0b0d1a; color:#ffe7b0; display:grid; place-items:center; font:italic 17px Georgia, serif; }
.ai-fab .dot { position:absolute; top:6px; right:8px; width:10px; height:10px; border-radius:50%; background:#3be36b; box-shadow:0 0 0 2px #fff3; animation:aiPing 2s ease-out infinite; }
@keyframes aiSpin { to { transform:rotate(360deg); } }
@keyframes aiPing { 0% { box-shadow:0 0 0 0 rgba(59,227,107,.7); } 100% { box-shadow:0 0 0 10px rgba(59,227,107,0); } }
.ai-fab[hidden] { display:none; }

.ai-panel { position:fixed; right:20px; bottom:20px; z-index:60; width:380px; max-width:calc(100vw - 24px); height:min(620px, calc(100svh - 40px));
  display:flex; flex-direction:column; border-radius:22px; overflow:hidden; color:#eef1f8;
  background:rgba(10,12,26,.96); border:1px solid rgba(255,211,107,.35); box-shadow:0 30px 80px -20px rgba(0,0,0,.8), 0 0 60px -20px rgba(255,170,80,.5);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); font:15px/1.5 "Segoe UI", system-ui, sans-serif;
  transform-origin:bottom right; animation:aiOpen .25s ease-out; }
.ai-panel[hidden] { display:none; }
@keyframes aiOpen { from { opacity:0; transform:scale(.92) translateY(10px); } }
.ai-head { display:flex; align-items:center; gap:12px; padding:14px 16px; border-bottom:1px solid rgba(255,255,255,.08);
  background:linear-gradient(90deg, rgba(255,211,107,.12), transparent); }
.ai-head .orb { width:34px; height:34px; border-radius:50%; flex:none; background:conic-gradient(from 0deg,#4fd86b,#ff5a2a,#ffd36b,#e8eef8,#3d8bff,#4fd86b); position:relative; }
.ai-head .orb::after { content:"М"; position:absolute; inset:4px; border-radius:50%; background:#0b0d1a; color:#ffe7b0; display:grid; place-items:center; font:italic 16px Georgia, serif; }
.ai-head b { display:block; font-size:15px; }
.ai-head small { color:#9aa3b8; font-size:12px; }
.ai-head small::before { content:""; display:inline-block; width:7px; height:7px; border-radius:50%; background:#3be36b; margin-right:6px; vertical-align:1px; }
.ai-close { margin-left:auto; width:34px; height:34px; border-radius:50%; border:1px solid rgba(255,255,255,.15); background:transparent; color:#eef1f8; font-size:20px; line-height:1; cursor:pointer; }
.ai-close:hover { background:rgba(255,255,255,.08); }

.ai-log { flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:10px; overscroll-behavior:contain; }
.ai-msg { max-width:86%; padding:10px 14px; border-radius:16px; white-space:pre-wrap; overflow-wrap:anywhere; }
.ai-msg.bot { align-self:flex-start; background:#171a2e; border:1px solid rgba(255,255,255,.07); border-bottom-left-radius:4px; }
.ai-msg.me { align-self:flex-end; background:linear-gradient(90deg,#ffd36b,#ffae5c); color:#1a0d02; border-bottom-right-radius:4px; }
.ai-typing { align-self:flex-start; display:flex; gap:5px; padding:14px; background:#171a2e; border-radius:16px; border-bottom-left-radius:4px; }
.ai-typing i { width:7px; height:7px; border-radius:50%; background:#ffd36b; animation:aiDot 1.2s infinite; }
.ai-typing i:nth-child(2) { animation-delay:.15s; } .ai-typing i:nth-child(3) { animation-delay:.3s; }
@keyframes aiDot { 0%, 60%, 100% { opacity:.25; transform:translateY(0); } 30% { opacity:1; transform:translateY(-4px); } }

.ai-chips { display:flex; flex-wrap:wrap; gap:8px; padding:0 16px 10px; }
.ai-chips button { border:1px solid rgba(255,211,107,.45); background:rgba(255,211,107,.08); color:#ffe7b0; border-radius:999px; padding:7px 12px; font:inherit; font-size:13px; cursor:pointer; }
.ai-chips button:hover { background:rgba(255,211,107,.18); }

.ai-cta { display:flex; gap:8px; padding:0 16px 10px; }
.ai-cta a { flex:1; text-align:center; text-decoration:none; padding:9px; border-radius:12px; font-size:13px; font-weight:600; }
.ai-cta .rec { background:linear-gradient(90deg,#ffd36b,#ff8a3d); color:#1a0d02; }

.ai-form { display:flex; gap:8px; padding:12px 12px 8px; border-top:1px solid rgba(255,255,255,.08); }
.ai-form textarea { flex:1; resize:none; overflow:hidden; height:44px; max-height:110px; padding:11px 12px; border-radius:14px; border:1px solid #2a2f44; background:#070912; color:#eef1f8; font:inherit; }
.ai-form textarea:focus { outline:none; border-color:#ffd36b; }
.ai-form button { width:44px; height:44px; flex:none; border:0; border-radius:14px; cursor:pointer; background:linear-gradient(135deg,#ffd36b,#ff8a3d); color:#1a0d02; font-size:18px; }
.ai-form button:disabled { opacity:.5; cursor:default; }
.ai-note { padding:0 14px 10px; font-size:11px; color:#7d8599; text-align:center; }

@media (max-width:520px) {
  .ai-fab { right:12px; bottom:12px; }
  .ai-panel { right:0; left:0; bottom:0; width:100%; max-width:100%; height:86svh; border-radius:22px 22px 0 0; }
}
@media (prefers-reduced-motion:reduce) { .ai-fab .orb, .ai-fab .dot, .ai-typing i, .ai-panel { animation:none; } }
