/* Flowix Chat Widget Styles */

#flowix-widget-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --flowix-primary-color: #4F46E5;
}

/* Widget Button */
.flowix-widget-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #4F46E5;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  border: none;
  animation: slideInButton 0.4s ease-out;
}

@keyframes slideInButton {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.flowix-widget-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.flowix-widget-button svg {
  width: 28px;
  height: 28px;
}

/* Chat Window */
.flowix-widget-chat {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInChat 0.3s ease-out;
  transform-origin: bottom right;
}

@keyframes slideInChat {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.flowix-widget-chat.closing {
  animation: slideOutChat 0.2s ease-in forwards;
}

@keyframes slideOutChat {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
}

/* Header */
.flowix-widget-header {
  background-color: #4F46E5;
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flowix-widget-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.flowix-widget-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}

.flowix-widget-minimize-btn,
.flowix-widget-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.flowix-widget-minimize-btn:hover,
.flowix-widget-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Messages Container */
.flowix-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background-color: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Scrollbar styling */
.flowix-widget-messages::-webkit-scrollbar {
  width: 6px;
}

.flowix-widget-messages::-webkit-scrollbar-track {
  background: transparent;
}

.flowix-widget-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.flowix-widget-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Messages */
.flowix-widget-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flowix-widget-message-bot {
  background-color: white;
  color: #1f2937;
  align-self: flex-start;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.flowix-widget-message-user {
  background-color: var(--flowix-primary-color);
  color: white;
  align-self: flex-end;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Typing Indicator */
.flowix-widget-typing {
  display: flex;
  gap: 4px;
  padding: 16px;
}

.flowix-widget-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #9ca3af;
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Input Container */
.flowix-widget-input-container {
  display: flex;
  padding: 16px;
  background: white;
  border-top: 1px solid #e5e7eb;
  gap: 8px;
}

.flowix-widget-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.flowix-widget-input:focus {
  border-color: var(--flowix-primary-color);
}

.flowix-widget-send-btn {
  width: 44px;
  height: 44px;
  background-color: #4F46E5;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.flowix-widget-send-btn:hover {
  background-color: #4338ca;
  transform: scale(1.05);
}

.flowix-widget-send-btn:active {
  transform: scale(0.95);
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .flowix-widget-chat {
    width: calc(100vw - 40px);
    height: calc(100vh - 100px);
    max-height: calc(100vh - 100px);
    left: 0;
    right: 0;
    margin: 0 auto;
  }

  #flowix-widget-container {
    right: 20px;
    bottom: 20px;
  }
}
