/* Chatbot widget styles */
#chatbot {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 360px;
  max-width: calc(100% - 48px);
  height: 420px;
  display: none; /* shown via JS */
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  z-index: 10050;
  background: rgba(227,98,231,0.12);
  border: 1px solid rgba(227,98,231,0.18);
  box-shadow: 0 18px 60px rgba(16,24,40,0.35);
  color: var(--text-on-primary);
  backdrop-filter: blur(8px);
}

#chatbot.active { display: flex; }

#chatbot .chat-header {
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(118,75,162,0.95), rgba(102,126,234,0.95));
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info { display: flex; flex-direction: column; gap: 2px; }
.chat-title { font-size: 1rem; line-height: 1.2; }
.chat-mode { font-size: 0.75rem; opacity: 0.8; font-weight: 500; }
.chat-mode.mode-ai { color: #34d399; opacity: 1; }
.chat-header-actions { display: flex; align-items: center; gap: 8px; }
.chat-settings { width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.18s ease, transform 0.18s ease; }
.chat-settings:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }
.chat-settings i { pointer-events: none; }
.chat-settings:focus-visible { outline: 2px solid rgba(255,255,255,0.35); outline-offset: 2px; }

#chatbot .chat-body {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
}

#chatbot .chat-body p,
#chatbot .chat-body .bot { margin: 0; padding: 8px 12px; border-radius: 12px; background: rgba(0,0,0,0.05); color: var(--text-on-primary); }
#chatbot .chat-body .bot { align-self: flex-start; }
#chatbot .chat-body p.bot,
#chatbot .chat-body .bot { background: rgba(118,75,162,0.12); }
#chatbot .chat-body .bot.rich { background: rgba(118,75,162,0.16); }
#chatbot .chat-body .bot.error { background: rgba(220,38,38,0.18); color: #fee2e2; }
#chatbot .chat-body .bot.pending { opacity: 0.85; }
#chatbot .chat-body .bot code { display: inline-block; margin-top: 6px; padding: 2px 4px; border-radius: 4px; background: rgba(0,0,0,0.25); font-family: "Courier New", Courier, monospace; }
#chatbot .chat-body p.user { align-self: flex-end; background: linear-gradient(90deg, rgba(102,126,234,0.18), rgba(118,75,162,0.18)); }

#chatbot .chat-input {
  padding: 10px;
  display: flex;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.04);
  background: rgba(0,0,0,0.02);
}
#chatbot .chat-input input[type="text"] { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.04); background: rgba(255,255,255,0.02); color: var(--text-on-primary); }
#chatbot .chat-input button { padding: 8px 12px; border-radius: 10px; border: none; background: linear-gradient(90deg, #667eea, #764ba2); color: white; cursor: pointer; }

/* Floating button */
#button-floating {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(90deg, #667eea, #764ba2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10060;
  box-shadow: 0 10px 30px rgba(118,75,162,0.25);
  cursor: pointer;
}
#button-floating.hidden { display: none; }
#button-floating:focus { outline: 2px solid rgba(255,255,255,0.12); }

.quick-replies { display: flex; gap: 8px; padding: 10px 12px; background: rgba(0,0,0,0.02); border-top: 1px solid rgba(255,255,255,0.02); }
.quick-reply { padding: 8px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.04); background: rgba(118,75,162,0.08); color: var(--text-on-primary); cursor: pointer; font-weight: 600; }
.quick-reply:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(118,75,162,0.08); }
.chat-highlight { color: var(--accent-color); font-weight: 600; }
.chat-action-buttons { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.chat-action-buttons button { padding: 6px 10px; border-radius: 8px; border: none; background: linear-gradient(90deg,#667eea,#764ba2); color: #fff; cursor: pointer; font-weight: 600; transition: transform 0.18s ease; }
.chat-action-buttons button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(118,75,162,0.1); }
.chat-action-buttons button:focus-visible { outline: 2px solid rgba(255,255,255,0.35); outline-offset: 2px; }

@media (max-width: 768px) {
  #chatbot { left: 12px; right: 12px; width: auto; bottom: 80px; }
  #button-floating { left: auto; right: 20px; bottom: 20px; }
}
