/* zobot container */
.zobot-container {
  overflow-x: hidden;
}

/* Popup teaser */
.zobot-popup-teaser {
  position: fixed;
  bottom: 7rem;
  left: 1.5rem;
  z-index: 40;
  background: linear-gradient(to right, #7647CE, #F75053);
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  width: 90vw;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(1rem);
  pointer-events: none;
  transition: all 0.5s ease;
  animation: bounce 1s infinite;

  &:hover {
    animation: none;
  }
}

.zobot-popup-teaser.popup-hidden {
  opacity: 0;
  pointer-events: none;
  animation: none;
}

.zobot-popup-text {
  font-size: 14px;
  color: #ffffff;
  position: relative;
}

.zobot-popup-close {
  position: absolute;
  top: -0.75rem;
  right: -0.25rem;
  cursor: pointer;
  border-radius: 9999px;
  background: #bfdbfe;
  padding: 10px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;

  &:hover {
    background-color: #df2020ee;
  }
}

.zobot-close-icon {
  width: 1.5rem;
  height: 1.5rem;
}


/* Floating chatbot button */
.zobot-open-btn {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 50;
  cursor: pointer;
  /* border-radius: 9999px; */
  width: 9rem;
  height: 9rem;
  transition: all 0.3s ease;
  transform: scale(1.25);

  &:hover {
    transform: scale(1.5) rotate(360deg);
  }

  &:active {
    transform: scale(0.95);
  }
}

/* Chat widget */
.zobot-chat-widget {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 999;
  width: 85vw;
  max-width: 400px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transition: all 0.3s ease;
  transform: scale(0.95);
  opacity: 0;
}

.zobot-chat-widget.show {
  opacity: 1;
  transform: scale(1);
}


/* Header */
.zobot-header {
  padding: 1rem;
  background: linear-gradient(to right, #7647CE, #F75053);
  font-weight: 600;
  font-size: 1.125rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zobot-title {
  font-weight: bold;
  font-size: 20px;
}

.zobot-subtitle {
  font-size: 14px;
  color: #d8b4fe;
}

.zobot-header-close {
  background: #ef4444;
  border-radius: 9999px;
  width: 1.25rem;
  border-radius: 50%;
  padding: 5px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;

  &:hover {
    background: #dc2626;
  }
}


/* Messages */
.zobot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  font-size: 0.875rem;
  word-break: break-word;
  white-space: pre-wrap;
}


/* Input area */
.zobot-input-area {
  position: relative;
  border-top: 1px solid #d1d5db;
  padding: 1rem;
}

.zobot-input {
  width: 100%;
  resize: none;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  padding: 0.5rem;
  font-size: 14px;
  outline: none;
  /* background-color: transparent !important; */
  color: gray !important;

  &:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f6;
    color: #7647CE !important;
    text-shadow: 0 1px 1px rgba(255, 84, 120, 0.35);
  }
}

.zobot-input .zobot-input::placeholder {
  color: gray;
}

.zobot-send-btn {
  position: absolute;
  right: 1.5rem;
  top: 40%;
  transform: translateY(-50%);
  cursor: pointer;
  border-radius: 0.375rem;
  background: linear-gradient(to right, #7647CE, #F75053);
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease-in-out;

  &:disabled {
    cursor: not-allowed;
  }

  &:hover {
    filter: brightness(1.1);
    box-shadow: 0 35px 35px rgba(255, 84, 120, 0.35);
  }

  &:active {
    transform: translateY(-50%) scale(0.95);
  }
}

.zobot-send-icon {
  width: 1rem;
  height: 1rem;
}

.zobot-input-hint {
  font-size: 11px;
  color: #6b7280;
  margin-top: 0.25rem;
}


/* --- JS toggle classes --- */

/* Popup hidden/visible states */
.popup-hidden {
  opacity: 0 !important;
  transform: translateY(1rem) !important;
  pointer-events: none !important;
}

.popup-visible {
  opacity: 1 !important;
  pointer-events: auto !important;
}


/* Chat widget show/hide */
.is-hidden {
  opacity: 0 !important;
  transform: scale(0.95) !important;
  pointer-events: none !important;
}

.widget-show {
  opacity: 1 !important;
  transform: scale(1) !important;
  pointer-events: auto !important;
}


/* Message styling from JS-created classes */
.message-wrapper {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
}

.message-user {
  align-items: flex-end;
  font-size: 14px;
}

.message-bot {
  align-items: flex-start;
  font-size: 14px;
}

.message-bubble {
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  max-width: 75%;
  word-break: break-word;
}

.bubble-user {
  background: linear-gradient(to right, #7647CE, #F75053);
  color: white;
}

.bubble-bot {
  background: #e5e7eb;
  color: #111827;
}

.bubble-error {
  background: #fecaca;
  color: #991b1b;
}

.message-time {
  font-size: 0.9rem;
  color: #6b7280;
  margin-top: 0.25rem;
}


/* Typing indicator */
.typing-indicator {
  padding: 0.5rem 0.75rem;
  background: #e5e7eb;
  color: #111827;
  border-radius: 0.375rem;
  width: fit-content;
  font-size: 14px;
}


@keyframes bounce {

  0%,
  100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }

  50% {
    transform: none;
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}