/* Chatbot Customizer Styles */

/* Custom CSS for toggle switches */
.toggle-checkbox:checked {
  right: 0;
  border-color: #6366f1;
}

.toggle-checkbox:checked + .toggle-label {
  background-color: #6366f1;
}

/* Chat window transition */
#chat-window {
  transform: translateY(0);
  opacity: 1;
}

#chat-window.hidden {
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}

#chat-toggle:not(.hidden) {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* Color preview boxes */
.color-preview {
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
}

/* Logo preview */
.logo-preview-container {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.logo-preview-container input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Range sliders */
.range-slider {
  width: 100%;
  margin: 10px 0;
}

.range-value {
  display: inline-block;
  width: 40px;
  text-align: center;
  font-weight: 500;
}

/* Preview container */
.preview-container {
  position: relative;
  min-height: 500px;
  background-color: #f9fafb;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
}

/* Chat preview elements */
.chat-preview {
  position: fixed !important;
  bottom: 1.5rem !important;
  right: 1.5rem !important;
  z-index: 1000 !important;
}

.quick-reply-btn {
  transition: all 0.2s ease-in-out;
}

.quick-reply-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Flex utilities for quick reply buttons */
.flex {
  display: flex;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-2 {
  gap: 0.5rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.flex-grow {
  flex-grow: 1;
}

.chat-window {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 20rem;
  margin-bottom: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.hidden {
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  color: white;
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-logo {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-title {
  font-weight: 600;
}

.chat-header-actions {
  display: flex;
  gap: 0.5rem;
}

.chat-header-button {
  border-radius: 0.25rem;
  padding: 0.25rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.chat-header-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.chat-messages {
  background-color: white;
  padding: 1rem;
  height: 20rem;
  overflow-y: auto;
}

.message {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.message-avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #6366f1;
}

.message-content {
  border-radius: 1.5rem;
  padding: 0.5rem 1rem;
  max-width: 80%;
}

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

.message-user .message-content {
  border-top-right-radius: 0;
}

.message-bot .message-content {
  border-top-left-radius: 0;
}

.chat-input-container {
  background-color: white;
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
  border-bottom-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

.chat-input-form {
  display: flex;
  gap: 0.5rem;
}

.chat-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  font-size: 0.875rem;
  outline: none;
}

.chat-input:focus {
  border-color: #6366f1;
}

.send-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.chat-toggle {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  margin: 0 auto;
}

.chat-toggle:not(.hidden) {
  animation: pulse 2s infinite;
}

/* Form controls */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #374151;
  background-color: #fff;
  background-clip: padding-box;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  border-color: #6366f1;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.color-picker-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Preview styles that will be dynamically updated */
.preview-header {
  background-color: #6366f1;
}

.preview-send-button {
  background-color: #6366f1;
}

.preview-user-message {
  background-color: #6366f1;
  color: white;
}

.preview-bot-message {
  background-color: #f3f4f6;
  color: #374151;
}

.preview-logo {
  background-color: white;
  color: #6366f1;
}

.preview-bot-avatar {
  background-color: #e0e7ff;
  color: #6366f1;
}

/* Typing indicator with 5 dots animation */
.typing-indicator {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  background: #6366f1;
  border-radius: 50%;
  display: inline-block;
  margin: 0 2px;
  animation: typing 1.2s infinite;
}

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

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

.typing-indicator span:nth-child(4) {
  animation-delay: 0.6s;
}

.typing-indicator span:nth-child(5) {
  animation-delay: 0.8s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

/* Hide chat background when buttons are visible */
.chat-messages.buttons-visible {
  background: transparent;
}