/* KHRIA Chatbot Widget Styles */
.khria-chatbot-widget {
  --primary-color: #4F46E5;
  --text-color: #FFFFFF;
  --bg-color: #FFFFFF;
  --border-color: #E5E7EB;
  --message-bg: #F3F4F6;
  --message-text: #1F2937;
  --chat-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  font-family: var(--chat-font);
  box-sizing: border-box;
  z-index: 99999;
}

.khria-chatbot-widget *,
.khria-chatbot-widget *::before,
.khria-chatbot-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.khria-chatbot-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 20px;
  right: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  border: none;
  z-index: 99999;
  transition: transform 0.3s ease;
  overflow: hidden;
}

.khria-chatbot-bubble img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: brightness(0) invert(1); /* Makes icon white */
}

/* Style for SVG icons */
.khria-chatbot-bubble svg,
.khria-chatbot-icon svg {
  width: 24px !important;
  height: 24px !important;
  fill: none !important;
  stroke: var(--text-color) !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  color: var(--text-color) !important;
}

/* Icon container for better positioning */
.khria-chatbot-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.khria-chatbot-bubble:hover {
  transform: scale(1.05);
}

.khria-chatbot-bubble.top-left {
  top: 20px;
  left: 20px;
  bottom: auto;
  right: auto;
}

.khria-chatbot-bubble.top-right {
  top: 20px;
  right: 20px;
  bottom: auto;
  left: auto;
}

.khria-chatbot-bubble.bottom-left {
  bottom: 20px;
  left: 20px;
  top: auto;
  right: auto;
}

.khria-chatbot-bubble.bottom-right {
  bottom: 20px;
  right: 20px;
  top: auto;
  left: auto;
}

.khria-chatbot-container {
  position: fixed;
  width: 350px;
  max-width: 90vw;
  height: 500px;
  max-height: 80vh;
  background-color: var(--bg-color);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.khria-chatbot-container.open {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.khria-chatbot-container.top-left {
  top: 100px;
  left: 20px;
  bottom: auto;
  right: auto;
}

.khria-chatbot-container.top-right {
  top: 100px;
  right: 20px;
  bottom: auto;
  left: auto;
}

.khria-chatbot-container.bottom-left {
  bottom: 100px;
  left: 20px;
  top: auto;
  right: auto;
}

.khria-chatbot-container.bottom-right {
  bottom: 100px;
  right: 20px;
  top: auto;
  left: auto;
}

.khria-chatbot-header {
  background-color: var(--primary-color);
  color: var(--text-color);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.khria-chatbot-title {
  font-size: 16px;
  font-weight: bold;
}

.khria-chatbot-close {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
}

.khria-chatbot-close:hover {
  opacity: 1;
}

.khria-chatbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.khria-message {
  max-width: 80%;
  padding: 12px;
  border-radius: 12px;
  animation: message-fade-in 0.3s ease;
}

@keyframes message-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.khria-message.assistant {
  background-color: var(--message-bg);
  color: var(--message-text);
  align-self: flex-start;
  border-top-left-radius: 4px;
}

.khria-message.user {
  background-color: var(--primary-color);
  color: var(--text-color);
  align-self: flex-end;
  border-top-right-radius: 4px;
}

.khria-chatbot-input {
  padding: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
}

.khria-chatbot-input-field {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: var(--chat-font);
  font-size: 14px;
  outline: none;
}

.khria-chatbot-input-field:focus {
  border-color: var(--primary-color);
}

.khria-chatbot-send {
  background-color: var(--primary-color);
  color: var(--text-color);
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.khria-chatbot-send:hover {
  background-color: color-mix(in srgb, var(--primary-color) 90%, black);
}

.khria-chatbot-send:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.khria-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
}

.khria-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--message-text);
  opacity: 0.7;
}

.khria-typing-dot:nth-child(1) {
  animation: typing-dot 1s infinite 0.1s;
}

.khria-typing-dot:nth-child(2) {
  animation: typing-dot 1s infinite 0.2s;
}

.khria-typing-dot:nth-child(3) {
  animation: typing-dot 1s infinite 0.3s;
}

@keyframes typing-dot {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@media (max-width: 480px) {
  .khria-chatbot-container {
    width: 90vw;
    height: 70vh;
  }
}