.chatbot-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  font-family: "Segoe UI", "Nunito Sans", system-ui, sans-serif;
}

.chatbot-fab {
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue), #0f5be0);
  color: #fff;
  box-shadow: 0 16px 34px rgba(15, 45, 102, 0.28);
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px rgba(15, 45, 102, 0.35);
}

.chatbot-fab svg {
  width: 28px;
  height: 28px;
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(390px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 120px));
  background: #fff;
  border: 1px solid var(--gray-100);
  border-radius: 18px;
  box-shadow: 0 24px 50px rgba(10, 35, 89, 0.22);
  overflow: hidden;
  display: none;
  flex-direction: column;
  height: min(560px, calc(100vh - 120px));
}

.chatbot-panel.open {
  display: flex;
}

.chatbot-header {
  background: linear-gradient(120deg, var(--blue), #0f5be0);
  color: #fff;
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chatbot-header strong {
  display: block;
  font-size: 0.98rem;
}

.chatbot-header small {
  opacity: 0.9;
  font-size: 0.8rem;
}

.chatbot-close {
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.chatbot-messages {
  padding: 14px;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
}

.chat-msg {
  max-width: 88%;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.92rem;
  line-height: 1.35;
}

.chat-msg.bot {
  background: #edf3ff;
  color: var(--blue-dark);
  align-self: flex-start;
}

.chat-msg.user {
  background: var(--blue);
  color: #fff;
  align-self: flex-end;
}

.chat-typing {
  align-self: flex-start;
  background: #edf3ff;
  color: #234886;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.85rem;
}

.chat-action {
  align-self: flex-start;
}

.chat-action-btn {
  border: none;
  border-radius: 12px;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--blue), #0f5be0);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(15, 45, 102, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.chat-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(15, 45, 102, 0.24);
}

.chat-action-btn:active {
  transform: translateY(0);
  opacity: 0.95;
}

.chatbot-quick {
  border-top: 1px solid var(--gray-100);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #fff;
  max-height: 128px;
  overflow-y: auto;
  align-content: flex-start;
}

.chatbot-quick button {
  border: 1px solid #d6e4ff;
  background: #f5f8ff;
  color: #22447b;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 0.82rem;
  cursor: pointer;
}

.chatbot-input-wrap {
  border-top: 1px solid var(--gray-100);
  padding: 10px;
  display: flex;
  gap: 8px;
  background: #fff;
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  padding: 10px 11px;
  font-size: 0.9rem;
}

.chatbot-send {
  border: none;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

[data-theme="dark"] .chatbot-panel,
[data-theme="dark"] .chatbot-quick,
[data-theme="dark"] .chatbot-input-wrap {
  background: var(--white);
}

[data-theme="dark"] .chatbot-messages {
  background: linear-gradient(180deg, #111b2f, #101828);
}

[data-theme="dark"] .chat-msg.bot,
[data-theme="dark"] .chat-typing {
  background: #1a2d52;
  color: #dbe6ff;
}

[data-theme="dark"] .chatbot-quick button {
  background: #192949;
  border-color: #294173;
  color: #dbe6ff;
}

@media (max-width: 640px) {
  .chatbot-root {
    right: 12px;
    bottom: 12px;
  }

  .chatbot-panel {
    right: 0;
    bottom: 72px;
    width: min(100vw - 12px, 390px);
    height: calc(100vh - 96px);
    max-height: calc(100vh - 96px);
  }
}
