:root {
  --chatbot-accent: #2E7D32;
  --chatbot-accent-soft: rgba(46, 125, 50, 0.12);
  --chatbot-bg: #ffffff;
  --chatbot-text: #1A1F22;
  --chatbot-muted: #7b8794;
  --chatbot-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.chatbot-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
}

.chatbot-toggle {
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chatbot-accent), #43A047);
  box-shadow: var(--chatbot-shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-toggle:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.chatbot-face {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  position: relative;
}

.chatbot-face::before,
.chatbot-face::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  top: 12px;
}

.chatbot-face::before {
  left: 10px;
}

.chatbot-face::after {
  right: 10px;
}

.chatbot-mouth {
  width: 16px;
  height: 8px;
  border-radius: 0 0 14px 14px;
  border: 2px solid #fff;
  border-top: 0;
  margin-top: 10px;
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 84px;
  width: 340px;
  max-height: 520px;
  background: var(--chatbot-bg);
  border-radius: 18px;
  box-shadow: var(--chatbot-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}

.chatbot-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.chatbot-header {
  padding: 16px 18px;
  padding-right: 48px;
  background: linear-gradient(135deg, var(--chatbot-accent), #43A047);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.chatbot-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.chatbot-header span {
  font-size: 0.75rem;
  opacity: 0.85;
}

.chatbot-minimize {
  background: transparent;
  border: none;
  border-radius: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.95);
  opacity: 0.95;
  transition: background 0.15s ease, opacity 0.15s ease;
  position: absolute;
  top: 10px;
  right: 10px;
}

.chatbot-minimize svg {
  width: 14px;
  height: 14px;
}

.chatbot-minimize:hover {
  background: rgba(255, 255, 255, 0.14);
  opacity: 1;
}

.chatbot-minimize:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.chatbot-messages {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9fafb;
}

.chatbot-message {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.4;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  white-space: pre-wrap;
}

.chatbot-message.user {
  margin-left: auto;
  background: var(--chatbot-accent);
  color: white;
}

.chatbot-message.bot {
  margin-right: auto;
  background: white;
  color: var(--chatbot-text);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.chatbot-panel.is-loading .chatbot-input input,
.chatbot-panel.is-loading .chatbot-input button {
  opacity: 0.75;
}

.chatbot-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: white;
}

.chatbot-input input {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.9rem;
  outline: none;
}

.chatbot-input input:focus {
  border-color: var(--chatbot-accent);
  box-shadow: 0 0 0 3px var(--chatbot-accent-soft);
}

.chatbot-input button {
  border: none;
  background: var(--chatbot-accent);
  color: white;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.chatbot-input button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chatbot-input button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 12px;
  font-size: 0.82rem;
  color: var(--chatbot-muted);
}

.chatbot-typing[hidden] {
  display: none;
}

.chatbot-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.chatbot-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--chatbot-accent);
  opacity: 0.35;
  animation: chatbotTypingPulse 1.15s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.18s;
}

.chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.36s;
}

.chatbot-typing-label {
  letter-spacing: 0.01em;
}

@keyframes chatbotTypingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0) scale(0.9);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-2px) scale(1);
    opacity: 1;
  }
}

body.dark-mode .chatbot-panel {
  background: #0f172a;
}

body.dark-mode .chatbot-messages {
  background: #0b1220;
}

body.dark-mode .chatbot-message.bot {
  background: #111c33;
  color: #e6edf3;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .chatbot-typing-bubble {
  background: #111c33;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .chatbot-typing {
  color: #9fb0c3;
}

body.dark-mode .chatbot-input {
  background: #0f172a;
  border-top-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .chatbot-input input {
  background: #0b1220;
  color: #e6edf3;
  border-color: rgba(255, 255, 255, 0.12);
}
