/* =========================================================
   AI Chatbot (lower-left)
   ========================================================= */

#chatFab{
  position:fixed;left:22px;bottom:22px;width:60px;height:60px;border-radius:50%;
  background:var(--grad-primary);color:#fff;display:grid;place-items:center;font-size:24px;
  box-shadow:0 14px 30px rgba(15,76,129,.45);z-index:300;cursor:pointer;
  transition:transform .3s var(--ease), box-shadow .3s var(--ease);
}
#chatFab:hover{transform:translateY(-4px) scale(1.06)}
#chatFab::after{
  content:"";position:absolute;inset:0;border-radius:50%;border:2px solid var(--primary-2);
  animation:pingRing 2.2s ease-out infinite;
}
#chatFab .fab-badge{
  position:absolute;top:-4px;right:-4px;background:var(--accent);color:#fff;font-size:10px;
  font-weight:700;padding:2px 6px;border-radius:10px;border:2px solid var(--bg);
}
#chatFab.open .icon-open{display:none}
#chatFab .icon-close{display:none}
#chatFab.open .icon-close{display:block}

.chat-window{
  position:fixed;left:22px;bottom:96px;width:380px;max-width:calc(100vw - 30px);height:560px;max-height:78vh;
  background:var(--surface);border:1px solid var(--border);border-radius:22px;
  box-shadow:var(--shadow-lg);z-index:299;display:flex;flex-direction:column;overflow:hidden;
  opacity:0;visibility:hidden;transform:translateY(20px) scale(.96);
  transition:.3s var(--ease);
}
.chat-window.open{opacity:1;visibility:visible;transform:translateY(0) scale(1)}

.chat-header{
  background:var(--grad-primary);color:#fff;padding:18px 20px;
  display:flex;gap:12px;align-items:center;position:relative;
}
.chat-header::after{content:"";position:absolute;inset:0;background:radial-gradient(circle at 90% 20%,rgba(255,255,255,.2),transparent 60%);pointer-events:none}
.chat-avatar{
  width:44px;height:44px;border-radius:14px;background:rgba(255,255,255,.2);
  display:grid;place-items:center;font-size:20px;position:relative;flex-shrink:0;
  border:2px solid rgba(255,255,255,.3);
}
.chat-avatar::after{
  content:"";position:absolute;bottom:0;right:0;width:12px;height:12px;background:#0AE55C;
  border:2px solid var(--primary);border-radius:50%;
}
.chat-header h4{color:#fff;font-size:15px}
.chat-header small{opacity:.9;font-size:12px;display:flex;align-items:center;gap:4px}
.chat-header small::before{content:"●";color:#0AE55C;font-size:10px}
.chat-close{
  margin-left:auto;width:34px;height:34px;border-radius:10px;background:rgba(255,255,255,.15);
  color:#fff;display:grid;place-items:center;cursor:pointer;transition:.2s;
}
.chat-close:hover{background:rgba(255,255,255,.28)}

.chat-body{
  flex:1;overflow-y:auto;padding:18px;display:flex;flex-direction:column;gap:12px;
  background:var(--bg);scroll-behavior:smooth;
}
.chat-body::-webkit-scrollbar{width:6px}
.chat-body::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}

.msg{
  max-width:82%;padding:11px 14px;border-radius:14px;font-size:13.5px;line-height:1.5;
  animation:fadeInUp .3s var(--ease);word-wrap:break-word;
}
.msg.bot{
  background:var(--surface);color:var(--text);border:1px solid var(--border);
  border-bottom-left-radius:4px;align-self:flex-start;
  box-shadow:var(--shadow-sm);
}
.msg.user{
  background:var(--grad-primary);color:#fff;border-bottom-right-radius:4px;align-self:flex-end;
  box-shadow:0 6px 16px rgba(15,76,129,.25);
}
.msg-time{
  font-size:10.5px;opacity:.6;margin-top:4px;display:block;
}

.msg.bot .bot-name{
  font-size:11px;color:var(--primary);font-weight:600;margin-bottom:4px;
  display:flex;align-items:center;gap:6px;
}
.msg.bot .bot-name::before{
  content:"";width:6px;height:6px;background:var(--accent);border-radius:50%;
}

/* Typing indicator */
.typing{
  align-self:flex-start;background:var(--surface);border:1px solid var(--border);
  border-radius:14px;border-bottom-left-radius:4px;padding:12px 16px;display:flex;gap:4px;
}
.typing span{
  width:7px;height:7px;background:var(--primary-2);border-radius:50%;
  animation:dotPulse 1.4s ease-in-out infinite;
}
.typing span:nth-child(2){animation-delay:.2s}
.typing span:nth-child(3){animation-delay:.4s}

/* Quick replies */
.quick-replies{
  display:flex;gap:6px;flex-wrap:wrap;margin-top:6px;padding:0 4px;
}
.quick-reply{
  padding:8px 12px;background:var(--surface);border:1.5px solid var(--primary-2);
  color:var(--primary);border-radius:16px;font-size:12px;font-weight:600;cursor:pointer;
  transition:.2s;
}
.quick-reply:hover{background:var(--grad-primary);color:#fff;border-color:transparent;transform:translateY(-2px)}

/* Chat suggestion cards */
.chat-card{
  background:var(--surface);border:1px solid var(--border);border-radius:14px;
  padding:12px;display:flex;gap:10px;align-items:center;cursor:pointer;transition:.2s;
  max-width:82%;align-self:flex-start;
}
.chat-card:hover{border-color:var(--primary-2);transform:translateX(4px);box-shadow:var(--shadow-sm)}
.chat-card .cc-icon{
  width:38px;height:38px;border-radius:10px;background:var(--grad-primary);color:#fff;
  display:grid;place-items:center;flex-shrink:0;
}
.chat-card b{font-size:13px;display:block}
.chat-card small{font-size:11.5px;color:var(--text-muted)}

.chat-input{
  padding:12px;border-top:1px solid var(--border);background:var(--surface);
  display:flex;gap:8px;align-items:center;
}
.chat-input input{
  flex:1;padding:11px 14px;border-radius:12px;border:1.5px solid var(--border);
  background:var(--bg);font-size:13.5px;outline:none;transition:.2s;
}
.chat-input input:focus{border-color:var(--primary-2);background:var(--surface)}
.chat-send{
  width:42px;height:42px;border-radius:12px;background:var(--grad-primary);color:#fff;
  display:grid;place-items:center;cursor:pointer;transition:.2s;flex-shrink:0;
}
.chat-send:hover{transform:scale(1.05);filter:brightness(1.1)}
.chat-send:disabled{opacity:.5;cursor:not-allowed;transform:none}

.chat-footer-note{
  padding:6px 12px;background:var(--surface);border-top:1px solid var(--border);
  font-size:10.5px;color:var(--text-muted);text-align:center;
}
.chat-footer-note i{color:var(--primary-2)}
