@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

.chatbot-widget,
.chatbot-toggle {
  --chatbot-font: 'Inter', sans-serif;
  --chatbot-shell-bg: #ffffff;
  --chatbot-shell-border: rgba(132, 73, 255, 0.16);
  --chatbot-shell-shadow: 0 26px 70px rgba(115, 84, 178, 0.2);
  --chatbot-header-bg: #ffffff;
  --chatbot-header-border: rgba(17, 24, 39, 0.08);
  --chatbot-header-text: #111827;
  --chatbot-header-action: #b6b6c5;
  --chatbot-status-dot: #22c55e;
  --chatbot-surface: #ffffff;
  --chatbot-text: #111827;
  --chatbot-muted: #a0a0ae;
  --chatbot-bot-bg: #ececef;
  --chatbot-bot-text: #161616;
  --chatbot-user-bg-start: #7d19df;
  --chatbot-user-bg-end: #520fa1;
  --chatbot-user-text: #ffffff;
  --chatbot-input-bg: #ffffff;
  --chatbot-input-border: #d6d6df;
  --chatbot-input-text: #111827;
  --chatbot-input-placeholder: #8a8a98;
  --chatbot-send-bg: #111111;
  --chatbot-send-text: #ffffff;
  --chatbot-brand: #6615ce;
  --chatbot-toggle-bg-start: #7d19df;
  --chatbot-toggle-bg-end: #520fa1;
  --chatbot-toggle-text: #ffffff;
  --chatbot-toggle-icon-bg: #8d47ed;
}

.chatbot-widget *,
.chatbot-toggle * {
  box-sizing: border-box;
}

.chatbot-hidden {
  display: none !important;
}

.chatbot-toggle-hidden {
  display: none !important;
}

.chatbot-widget {
  position: fixed;
  bottom: 20px;
  width: 350px;
  height: 430px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--chatbot-shell-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 248, 255, 0.98)),
    var(--chatbot-shell-bg);
  box-shadow: var(--chatbot-shell-shadow);
  z-index: 9999;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--chatbot-header-bg);
  border-bottom: 1px solid var(--chatbot-header-border);
}

.chatbot-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chatbot-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #7d19df, #520fa1);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(103, 21, 206, 0.24);
  overflow: hidden;
}

.chatbot-avatar-has-image {
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: none;
}

.chatbot-avatar-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatbot-avatar-has-image .chatbot-avatar-image {
  object-fit: contain;
}

.chatbot-avatar-fallback {
  font-size: 22px;
  font-weight: 800;
}

.chatbot-header-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#chatbot-title {
  display: block;
  color: var(--chatbot-header-text);
  font-family: var(--chatbot-font);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.chatbot-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--chatbot-muted);
  font-family: var(--chatbot-font);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
}

.chatbot-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--chatbot-status-dot);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatbot-header-button {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--chatbot-header-action);
  font-family: var(--chatbot-font);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.18s ease, transform 0.18s ease;
}

.chatbot-header-button:hover,
.chatbot-header-button:focus {
  color: #6d6d78;
  outline: none;
  transform: translateY(-1px);
}

.chatbot-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 0 10px;
  background: var(--chatbot-surface);
}

#chatbot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 168, 182, 0.45) transparent;
}

#chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

#chatbot-messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(168, 168, 182, 0.45);
}

.chatbot-empty-state {
  display: none;
}

.chatbot-message-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 100%;
}

.chatbot-message-row-user {
  align-items: flex-end;
}

.chatbot-message-row-bot {
  align-items: flex-start;
}

.chatbot-message {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 18px;
  font-family: var(--chatbot-font);
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.chatbot-message p,
.chatbot-message ul,
.chatbot-message ol {
  margin: 0;
}

.chatbot-message p + p,
.chatbot-message ul + p,
.chatbot-message ol + p,
.chatbot-message p + ul,
.chatbot-message p + ol {
  margin-top: 8px;
}

.chatbot-message ul,
.chatbot-message ol {
  padding-left: 18px;
}

.chatbot-message a {
  color: inherit;
  font-weight: 700;
}

.chatbot-message code {
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.08);
  font-size: 12px;
}

.chatbot-bot {
  background: var(--chatbot-bot-bg);
  color: var(--chatbot-bot-text);
  border-top-left-radius: 10px;
}

.chatbot-user {
  background: linear-gradient(135deg, var(--chatbot-user-bg-start), var(--chatbot-user-bg-end));
  color: var(--chatbot-user-text);
  border-top-right-radius: 10px;
}

.chatbot-message-time {
  padding: 0 4px;
  color: var(--chatbot-muted);
  font-family: var(--chatbot-font);
  font-size: 11px;
  line-height: 1.2;
}

.chatbot-message-row-typing .chatbot-message {
  min-width: 64px;
}

.chatbot-message-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chatbot-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #8c8ca0;
  animation: chatbotTyping 1s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chatbotTyping {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.chatbot-input-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 14px;
  padding: 7px 8px 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--chatbot-input-border);
  background: var(--chatbot-input-bg);
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
}

#chatbot-input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: var(--chatbot-input-text);
  font-family: var(--chatbot-font);
  font-size: 14px;
  line-height: 1.4;
}

#chatbot-input::placeholder {
  color: var(--chatbot-input-placeholder);
}

#chatbot-input:focus {
  outline: none;
}

#chatbot-send {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  border-radius: 999px;
  background: var(--chatbot-send-bg);
  color: var(--chatbot-send-text);
  font-family: var(--chatbot-font);
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

#chatbot-send:hover,
#chatbot-send:focus {
  transform: translateY(-1px) scale(1.02);
  outline: none;
}

#chatbot-send:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.chatbot-brand {
  display: block;
  padding: 14px 18px 2px;
  text-align: center;
  color: var(--chatbot-brand);
  font-family: var(--chatbot-font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.chatbot-brand:hover,
.chatbot-brand:focus {
  text-decoration: underline;
  outline: none;
}

.chatbot-toggle {
  position: fixed;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 8px 14px 8px 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--chatbot-toggle-bg-start), var(--chatbot-toggle-bg-end));
  color: var(--chatbot-toggle-text);
  box-shadow: var(--chatbot-shell-shadow);
  cursor: pointer;
  z-index: 10000;
}

.chatbot-toggle-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--chatbot-toggle-icon-bg);
  overflow: hidden;
}

.chatbot-toggle-image {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 999px;
}

.chatbot-toggle.chatbot-toggle-has-custom-icon .chatbot-toggle-icon {
  background: #ffffff;
}

.chatbot-toggle.chatbot-toggle-has-custom-icon .chatbot-toggle-image {
  width: 100%;
  height: 100%;
}

.chatbot-toggle-fallback {
  font-family: var(--chatbot-font);
  font-size: 15px;
  font-weight: 800;
}

.chatbot-toggle-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.chatbot-toggle-title {
  font-family: var(--chatbot-font);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.chatbot-toggle-subtitle {
  font-family: var(--chatbot-font);
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.78;
}

@media (max-width: 640px) {
  .chatbot-widget {
    left: 12px !important;
    right: 12px !important;
    bottom: 12px;
    width: auto !important;
    height: min(80vh, 520px) !important;
    max-width: none;
  }

  .chatbot-message {
    max-width: 90%;
  }

  .chatbot-toggle {
    right: 12px !important;
    left: auto !important;
    bottom: 12px;
  }
}

@media (max-width: 460px) {
  .chatbot-toggle-copy {
    display: none;
  }

  .chatbot-toggle {
    padding-right: 8px;
  }
}
