.ufaq-chatbot-open,
.ufaq-chatbot-open body {
  overflow: hidden;
}

.ufaq-chatbot-modal {
  position: fixed;
  z-index: 1050;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
  background: rgba(0, 0, 0, 0.25);
  overflow: auto;
  overscroll-behavior: contain;
}

.ufaq-chatbot-modal[hidden] {
  display: none;
}

.ufaq-chatbot-panel {
  display: flex;
  width: min(380px, calc(100vw - 48px));
  min-width: 0;
  flex: 0 1 380px;
  height: 600px;
  min-height: 0;
  max-height: calc(100vh - 48px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e4e6eb;
  border-radius: 18px;
  background: #fff;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.15),
    0 2px 4px rgba(0, 0, 0, 0.1);
  color: #050505;
  animation: ufaqMessengerPop 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes ufaqMessengerPop {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ufaq-chatbot-header {
  display: flex;
  height: 62px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #e4e6eb;
  background: #fff;
}

.ufaq-chatbot-header-legacy {
  height: auto;
  min-height: 62px;
}

.ufaq-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ufaq-header-logo {
  width: auto;
  height: 38px;
  max-width: 190px;
  object-fit: contain;
}

.ufaq-status-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #65676b;
  font-size: 0.75rem;
}

.ufaq-status-dot,
.ufaq-trigger-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #31a24c;
}

.ufaq-chatbot-actions {
  display: flex;
  gap: 4px;
}

.ufaq-icon-btn {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #0084ff;
  cursor: pointer;
}

.ufaq-icon-btn:hover,
.ufaq-icon-btn:focus-visible {
  background: #f2f2f2;
}

.ufaq-chatbot-messages {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 16px 14px;
  background: #fff;
  scroll-behavior: smooth;
}

.ufaq-message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.ufaq-message-row.user {
  justify-content: flex-end;
}

.ufaq-bot-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-bottom: 2px;
  border: 1px solid #e4e6eb;
  border-radius: 50%;
  padding: 2px;
  background: #fff;
  object-fit: contain;
}

.ufaq-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.ufaq-message-row.assistant .ufaq-bubble {
  border-bottom-left-radius: 4px;
  background: #f0f2f5;
  color: #050505;
}

.ufaq-message-row.user .ufaq-bubble {
  border-bottom-right-radius: 4px;
  background: linear-gradient(135deg, #0084ff 0%, #00c6ff 100%);
  color: #fff;
}

.ufaq-message-row.error .ufaq-bubble {
  border: 1px solid #fad2cf;
  background: #ffebe8;
  color: #d93025;
}

.ufaq-typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border-radius: 18px 18px 18px 4px;
  background: #f0f2f5;
}

.ufaq-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #90949c;
  animation: ufaqMessengerBounce 1.3s infinite ease-in-out;
}

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

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

@keyframes ufaqMessengerBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }

  30% {
    transform: translateY(-4px);
  }
}

.ufaq-quick-replies {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 14px;
  background: #fff;
  scrollbar-width: none;
}

.ufaq-quick-replies::-webkit-scrollbar {
  display: none;
}

.ufaq-quick-reply {
  flex: 0 0 auto;
  border: 1px solid #0084ff;
  border-radius: 16px;
  padding: 6px 14px;
  background: #fff;
  color: #0084ff;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.ufaq-quick-reply:hover,
.ufaq-quick-reply:focus-visible {
  background: rgba(0, 132, 255, 0.08);
}

.ufaq-chatbot-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #e4e6eb;
  background: #fff;
}

.ufaq-input-pill {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  border-radius: 20px;
  padding: 6px 12px;
  background: #f0f2f5;
}

.ufaq-chatbot-input {
  width: 100%;
  max-height: 80px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #050505;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.3;
}

.ufaq-chatbot-input:focus-visible {
  outline: 2px solid rgba(16, 123, 223, 0.776);
  outline-offset: 2px;
  border-radius: 8px;
}

.ufaq-send-btn {
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: none;
  color: #0084ff;
  cursor: pointer;
}

.ufaq-send-btn:hover,
.ufaq-send-btn:focus-visible {
  transform: scale(1.15);
}

.ufaq-send-btn:disabled {
  color: #bcc0c4;
  cursor: not-allowed;
  transform: none;
}

.ufaq-chatbot-trigger {
  position: fixed;
  z-index: 1040;
  right: 24px;
  bottom: 24px;
  display: flex;
  width: 55px;
  height: 55px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  padding: 6px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s;
}

.ufaq-chatbot-trigger:hover,
.ufaq-chatbot-trigger:focus-visible {
  transform: scale(1.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.ufaq-chatbot-trigger img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ufaq-trigger-status {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
}

.ufaq-chatbot-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 500px) {
  .ufaq-chatbot-modal {
    padding: 0;
  }

  .ufaq-chatbot-panel {
    width: 100%;
    flex-basis: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .ufaq-bubble {
    max-width: 78%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ufaq-chatbot-panel,
  .ufaq-typing-dot,
  .ufaq-chatbot-trigger {
    animation: none;
    transition: none;
  }

  .ufaq-chatbot-messages {
    scroll-behavior: auto;
  }
}
