/* 5280 Sprinklers Chatbot Widget Styles */

.chatbot-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Chat Bubble (closed state) */
.chatbot-bubble {
  width: 60px;
  height: 60px;
  border-radius: 30px;
  background: #28a745;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

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

/* Chat Window (open state) */
.chatbot-window {
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 48px);
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.chatbot-header {
  background: #28a745;
  color: white;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 12px 12px 0 0;
}

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

.chatbot-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Messages Container */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

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

/* Messages */
.message {
  margin-bottom: 16px;
  display: flex;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

.message-content {
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 80%;
  word-wrap: break-word;
  line-height: 1.5;
  font-size: 14px;
}

.message-user .message-content {
  background: #007bff;
  color: white;
  border-radius: 18px 18px 4px 18px;
}

.message-bot .message-content {
  background: white;
  color: #333;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Links in messages */
.message-content a {
  color: #28a745;
  text-decoration: underline;
  word-break: break-all;
}

.message-content a:hover {
  color: #218838;
}

.message-user .message-content a {
  color: #b8f0c8;
}

.message-user .message-content a:hover {
  color: white;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: fit-content;
}

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

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Input Area */
.chatbot-input {
  padding: 16px;
  border-top: 1px solid #dee2e6;
  display: flex;
  gap: 8px;
  background: white;
  border-radius: 0 0 12px 12px;
}

.chatbot-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ced4da;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease;
}

.chatbot-input input:focus {
  border-color: #28a745;
}

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

.chatbot-input button {
  background: #28a745;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
}

.chatbot-input button:hover:not(:disabled) {
  background: #218838;
}

.chatbot-input button:active:not(:disabled) {
  transform: scale(0.98);
}

.chatbot-input button:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Error Message */
.chatbot-error {
  padding: 8px 16px;
  background: #f8d7da;
  color: #721c24;
  border-top: 1px solid #f5c6cb;
  font-size: 12px;
  text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .chatbot-container {
    bottom: 0;
    right: 0;
    left: 0;
  }

  .chatbot-bubble {
    position: fixed;
    bottom: 16px;
    right: 16px;
  }

  .chatbot-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    animation: slideUp 0.3s ease-out;
  }

  .chatbot-header {
    border-radius: 0;
  }

  .chatbot-input {
    border-radius: 0;
  }

  .message-content {
    max-width: 85%;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .chatbot-window {
    background: #1e1e1e;
  }

  .chatbot-messages {
    background: #2d2d2d;
  }

  .message-bot .message-content {
    background: #3a3a3a;
    color: #e0e0e0;
  }

  .chatbot-input {
    background: #1e1e1e;
    border-top-color: #3a3a3a;
  }

  .chatbot-input input {
    background: #2d2d2d;
    border-color: #3a3a3a;
    color: #e0e0e0;
  }

  .chatbot-input input:focus {
    border-color: #28a745;
  }

  .message-bot .message-content a {
    color: #5cdb7a;
  }

  .message-bot .message-content a:hover {
    color: #8aeea0;
  }
}

/* Accessibility improvements */
.chatbot-bubble:focus,
.chatbot-close:focus,
.chatbot-input button:focus,
.chatbot-input input:focus {
  outline: 2px solid #28a745;
  outline-offset: 2px;
}

/* Print styles (hide chatbot when printing) */
@media print {
  .chatbot-container {
    display: none !important;
  }
}
