/**
 * AI Chat Widget Styles
 * All styles are prefixed with .epkb-ai-chat to avoid conflicts
 */
.epkb-ai-chat-widget-root {
  all: initial;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}
.epkb-ai-chat-widget-root * {
  box-sizing: border-box !important;
  line-height: normal !important;
}

.epkb-ai-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.epkb-ai-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #0066CC;
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
  font-size: 24px;
}
.epkb-ai-chat-toggle:hover {
  transform: scale(1.05);
}
.epkb-ai-chat-toggle.epkb-ai-chat-toggle--open {
  transform: scale(0.9);
}

.epkb-ai-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  height: 500px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: epkb-slideUp 0.3s ease-out;
}

.epkb-ai-chat-header {
  background-color: #0066CC;
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.epkb-ai-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.epkb-ai-chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.epkb-ai-chat-close:hover {
  opacity: 0.8;
}

.epkb-ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background-color: #F9F9F9;
}

.epkb-ai-chat-message {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  animation: epkb-fadeIn 0.3s ease-out;
}
.epkb-ai-chat-message--user {
  justify-content: flex-end;
}

.epkb-ai-chat-message-content {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
}
.epkb-ai-chat-message--user .epkb-ai-chat-message-content {
  background-color: #0066CC;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.epkb-ai-chat-message--bot .epkb-ai-chat-message-content {
  background-color: white;
  color: #333333;
  border: 1px solid #E0E0E0;
  border-bottom-left-radius: 4px;
}

.epkb-ai-chat-input-container {
  padding: 16px;
  border-top: 1px solid #E0E0E0;
  background-color: white;
}

.epkb-ai-chat-input-wrapper {
  display: flex;
  gap: 8px;
}

.epkb-ai-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #E0E0E0;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.epkb-ai-chat-input:focus {
  border-color: #0066CC;
}

.epkb-ai-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background-color: #0066CC;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  font-size: 16px;
}
.epkb-ai-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.epkb-ai-chat-send--loading {
  animation: epkb-rotate 1s linear infinite;
}

.epkb-ai-chat-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background-color: white;
  border: 1px solid #E0E0E0;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.epkb-ai-chat-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #999999;
  animation: epkb-pulse 1.4s infinite ease-in-out;
}
.epkb-ai-chat-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.epkb-ai-chat-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

.epkb-ai-chat-error {
  background-color: #FFEEEE;
  color: #CC3333;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 8px 0;
  font-size: 13px;
  animation: epkb-fadeIn 0.3s ease-out;
}

@keyframes epkb-slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes epkb-fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes epkb-pulse {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}
@keyframes epkb-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 450px) {
  .epkb-ai-chat-window {
    width: calc(100vw - 20px);
    right: 10px;
    left: 10px;
    height: calc(100vh - 100px);
    bottom: 70px;
  }
  .epkb-ai-chat-toggle {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
}
