/* ===== Chatbot ===== */

.chatbot-bubble {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--glow);
}
.chatbot-bubble svg { width: 24px; height: 24px; }
.chatbot-bubble:hover { transform: translateY(-1px); }

.chatbot-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 60;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: min(560px, calc(100vh - 120px));
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chatbot-panel[hidden] { display: none; }

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--color-primary);
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
}
.chatbot-header-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chatbot-header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.chatbot-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
}
.chatbot-close svg { width: 18px; height: 18px; }

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chatbot-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.chatbot-msg-bot {
  align-self: flex-start;
  background: var(--bg-alt);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chatbot-msg-user {
  align-self: flex-end;
  background: var(--color-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.chatbot-suggestion {
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
  text-align: left;
}
.chatbot-suggestion:hover { border-color: var(--color-accent); color: var(--color-accent-dark); }

.chatbot-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
}
.chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: chatbot-typing-bounce 1.2s infinite ease-in-out;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatbot-typing-bounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .chatbot-typing span { animation: none; opacity: 0.6; }
}

.chatbot-cta {
  margin: 0 16px 12px;
  text-align: center;
  padding: 10px 16px;
  font-size: 0.9rem;
}
.chatbot-cta[hidden] { display: none; }

.chatbot-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.chatbot-input-row input {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
}
.chatbot-input-row input:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.chatbot-send {
  border: none;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius-sm);
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.chatbot-send svg { width: 18px; height: 18px; }
.chatbot-send:disabled { opacity: 0.5; cursor: default; }

.chatbot-footer-note {
  margin: 0;
  padding: 8px 16px 12px;
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
}

@media (max-width: 480px) {
  .chatbot-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .chatbot-bubble { right: 16px; bottom: 16px; }
}
