.ai-chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
}

.ai-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #eb881e 0%, #ef7c00 100%);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.ai-chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ai-chat-container {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-header {
  background: linear-gradient(135deg, #093969 0%, #002f5d 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.ai-chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  font-size: 16px;
}

.ai-chat-message {
  margin-bottom: 16px;
  display: flex;
}

.ai-chat-message-content {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
}

.ai-chat-message-content * {
  font-size: inherit;
}

.ai-chat-message-content ol,
.ai-chat-message-content ul {
  padding: 0 0 0 16px;
  margin: 0;
}

.ai-chat-message-content ol li,
.ai-chat-message-content ul li {
  list-style-position: outside;
}

.ai-chat-user .ai-chat-message-content {
  background: linear-gradient(135deg, #093969 0%, #002f5d 100%);
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.ai-chat-bot .ai-chat-message-content {
  background: white;
  color: #333;
  border: 1px solid #e0e0e0;
  border-bottom-left-radius: 4px;
}

.ai-chat-bot.error .ai-chat-message-content {
  background: #fee;
  border-color: #fcc;
  color: #c33;
}

.ai-chat-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.ai-chat-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: typing 1.4s infinite;
}

.ai-chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-chat-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;
  }
}

.ai-chat-sources {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.ai-chat-sources strong {
  display: block;
  margin-bottom: 8px;
  color: #002f5d;
}

.ai-chat-sources ul {
  margin: 0;
  padding-left: 20px;
}

.ai-chat-sources li {
  margin-bottom: 4px;
}

.ai-chat-sources a {
  color: #002f5d;
  text-decoration: none;
}

.ai-chat-sources a:hover {
  color: #ef7c00;
  text-decoration: underline;
}

.ai-chat-input-container {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: white;
  border-top: 1px solid #e0e0e0;
}

.ai-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
}

.ai-chat-input:focus {
  border-color: #002f5d;
}

.ai-chat-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #eb881e 0%, #ef7c00 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.2s,
    transform 0.2s;
  flex-shrink: 0;
}

.ai-chat-send:hover:not(:disabled) {
  opacity: 0.9;
  transform: scale(1.05);
}

.ai-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .ai-chat-container {
    width: calc(100vw - 40px);
    height: calc(100vh - 120px);
  }
}
