/* Chat Widget Styles */

* {
  box-sizing: border-box;
}

#chat-widget-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999999;
}

/* Toggle Button (Floating Icon) */
.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
  border: none;
  padding: 0;
}

.chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.chat-toggle:active {
  transform: scale(0.95);
}

/* Chat Widget Box */
.chat-widget {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 400px;
  height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
  display: none;
  flex-direction: column;
  animation: slideIn 0.3s ease-out;
  opacity: 0;
}

.chat-widget.active {
  display: flex;
  opacity: 1;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Chat Header */
.chat-widget-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 12px 12px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chat-widget-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.chat-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.chat-close-btn:hover {
  transform: rotate(90deg);
}

/* Chat Messages Container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fb;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Chat Message Styles */
.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: messageAppear 0.3s ease-out;
}

@keyframes messageAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.user-message {
  justify-content: flex-end;
}

.chat-message.bot-message {
  justify-content: flex-start;
}

.message-content {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 12px;
  word-wrap: break-word;
  line-height: 1.4;
  font-size: 14px;
}

.user-message .message-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px 4px 12px 12px;
}

.bot-message .message-content {
  background: #e2e8f0;
  color: #2d3748;
  border-radius: 4px 12px 12px 12px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #e2e8f0;
  border-radius: 12px;
  width: fit-content;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a0aec0;
  animation: typingAnimation 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0%,
  60%,
  100% {
    opacity: 0.5;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px);
  }
}

/* Chat Input Area */
.chat-input-area {
  padding: 16px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: white;
  border-radius: 0 0 12px 12px;
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  border: 1px solid #cbd5e0;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease;
  outline: none;
}

.chat-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input::placeholder {
  color: #a0aec0;
}

.chat-input:disabled {
  background-color: #f7fafc;
  cursor: not-allowed;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 18px;
  font-weight: bold;
  padding: 0;
}

.chat-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.chat-send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.chat-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Error Display */
.chat-error {
  color: #c53030;
  background-color: #fed7d7;
  border: 1px solid #fc8181;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 8px;
  animation: slideIn 0.2s ease-out;
}

/* Responsive Design */
@media (max-width: 600px) {
  .chat-widget {
    width: calc(100vw - 24px);
    height: 70vh;
    max-height: 600px;
  }

  .message-content {
    max-width: 85%;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .chat-widget,
  .chat-message,
  .chat-toggle {
    animation: none;
    transition: none;
  }
}

/* Print Styles */
@media print {
  #chat-widget-container {
    display: none;
  }
}
