/* Safe Chatbot Widget Styles - Based on Vanilla Implementation */
/* Scoped to prevent conflicts with main page styles */

#chatbot-container {
  position: fixed;
  bottom: 90px;
  right: 80px;
  z-index: 1000;
  font-family: 'Inter', sans-serif;
}

#chatbot-container * {
  box-sizing: border-box;
}

/* Toggle Button */
#chatbot-container .chatbot-toggle {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.4);
  transition: all 0.3s ease;
  border: none;
  padding: 0;
}

#chatbot-container .chatbot-toggle:hover {
  background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(30, 58, 138, 0.5);
}

#chatbot-container .chatbot-toggle svg {
  width: 24px;
  height: 24px;
  fill: white;
}

/* Chat Window */
#chatbot-container .chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 350px;
  height: 500px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#chatbot-container .chatbot-window.open {
  display: flex;
}

/* Header */
#chatbot-container .chatbot-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

#chatbot-container .chatbot-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: white;
}

#chatbot-container .chatbot-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chatbot-container .chatbot-close:hover {
  opacity: 0.8;
}

/* Messages Area */
#chatbot-container .chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #1f2937;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#chatbot-container .message {
  display: flex;
  max-width: 100%;
}

#chatbot-container .message.user {
  justify-content: flex-end;
}

#chatbot-container .message.bot {
  justify-content: flex-start;
}

#chatbot-container .message-content {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}

#chatbot-container .message.user .message-content {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  color: white;
}

#chatbot-container .message.bot .message-content {
  background: #374151;
  color: #f3f4f6;
  border: 1px solid #4b5563;
}

/* Typing Indicator */
#chatbot-container .typing-indicator {
  display: flex;
  justify-content: flex-start;
}

#chatbot-container .typing-indicator .message-content {
  background: white;
  color: #666;
  border: 1px solid #e1e5e9;
  display: flex;
  align-items: center;
  gap: 4px;
}

#chatbot-container .typing-dot {
  width: 8px;
  height: 8px;
  background: #666;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

#chatbot-container .typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

#chatbot-container .typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Input Area */
#chatbot-container .chatbot-input-area {
  padding: 16px 20px;
  background: #374151;
  border-top: 1px solid #4b5563;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

#chatbot-container .chatbot-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #4b5563;
  border-radius: 24px;
  background: #1f2937;
  color: #f3f4f6;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

#chatbot-container .chatbot-input:focus {
  border-color: #1e3a8a;
  box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.2);
}

#chatbot-container .chatbot-input:disabled {
  background: #374151;
  cursor: not-allowed;
}

#chatbot-container .chatbot-input::placeholder {
  color: #9ca3af;
}

#chatbot-container .chatbot-send {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.2);
}

#chatbot-container .chatbot-send:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

#chatbot-container .chatbot-send:disabled:hover {
  transform: none;
  box-shadow: 0 2px 8px rgba(30, 58, 138, 0.2);
}

#chatbot-container .chatbot-send:disabled {
  background: linear-gradient(135deg, #1e3a8a 0%, #3730a3 100%);
  opacity: 0.8;
  cursor: not-allowed;
}

#chatbot-container .chatbot-send svg {
  width: 20px;
  height: 20px;
  fill: white;
}

#chatbot-container .chatbot-send .loading-spinner {
  width: 18px;
  height: 18px;
  stroke: white !important;
  fill: none !important;
}

#chatbot-container .chatbot-send:disabled .loading-spinner {
  stroke: white !important;
  opacity: 1 !important;
}

/* Error Message */
#chatbot-container .error-message {
  padding: 16px 20px;
  background: #fee;
  color: #c53030;
  text-align: center;
  font-size: 14px;
  border-top: 1px solid #fed7d7;
}

/* Responsive Design */
@media (max-width: 480px) {
  #chatbot-container .chatbot-window {
    width: 300px;
    height: 450px;
  }
  
  #chatbot-container {
    bottom: 80px;
    right: 70px;
  }
  
  #chatbot-container .chatbot-toggle {
    width: 56px;
    height: 56px;
  }
  
  #chatbot-container .chatbot-send {
    width: 44px;
    height: 44px;
    padding: 12px;
  }
  
  #chatbot-container .chatbot-toggle svg {
    width: 20px;
    height: 20px;
  }
}

/* Scrollbar Styling */
#chatbot-container .chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

#chatbot-container .chatbot-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

#chatbot-container .chatbot-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
}

#chatbot-container .chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
