/* Chat Widget Styles */
.chat-toggle-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  z-index: 999;
  transition: all 0.3s ease;
}

.chat-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.chat-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 380px;
  height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-header {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px 12px 0 0;
  color: white;
}

.chat-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.chat-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: #f9fafb;
}

.chat-welcome {
  text-align: center;
  color: #666;
  padding: 1rem;
}

.chat-welcome p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.chat-welcome ul {
  text-align: left;
  margin: 1rem auto;
  padding-left: 1.5rem;
  max-width: 280px;
}

.chat-welcome li {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: #555;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: slideIn 0.3s ease;
}

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

.chat-user {
  align-items: flex-end;
}

.chat-assistant {
  align-items: flex-start;
}

.chat-user .message-content {
  background: #667eea;
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 12px 12px 2px 12px;
  max-width: 85%;
  word-wrap: break-word;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.chat-assistant .message-content {
  background: white;
  color: #333;
  padding: 0.75rem 1rem;
  border-radius: 12px 12px 12px 2px;
  max-width: 85%;
  word-wrap: break-word;
  font-size: 0.975rem;
  line-height: 1.6;
  border: 1px solid #e5e7eb;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.system-message {
  background: #fef3c7;
  color: #92400e;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  border-left: 3px solid #f59e0b;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* Better readability for numbered/bulleted lists in messages */
.message-content ul,
.message-content ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.message-content li {
  margin: 0.25rem 0;
}

.message-content strong {
  font-weight: 600;
}

.suggested-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  max-width: 85%;
}

.action-prompt {
  font-size: 0.85rem;
  color: #666;
  margin: 0 0 0.5rem 0;
  font-weight: 500;
}

.action-btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.action-btn:hover:not(:disabled) {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-result {
  background: white;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 1rem;
  max-width: 85%;
}

.action-result h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  color: #1e40af;
}

.appeal-text {
  background: #f0f9ff;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
  color: #1e3a8a;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #5568d3;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: 12px 12px 12px 2px;
  border: 1px solid #e5e7eb;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #9ca3af;
  border-radius: 50%;
  animation: pulse 1.4s infinite;
}

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

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

@keyframes pulse {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px);
  }
}

.chat-input-form {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
  background: white;
  border-radius: 0 0 12px 12px;
}

.chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input:disabled {
  background: #f3f4f6;
  cursor: not-allowed;
}

.chat-send-btn {
  background: #667eea;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-send-btn:hover:not(:disabled) {
  background: #5568d3;
}

.chat-send-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .chat-widget {
    width: calc(100vw - 2rem);
    height: 70vh;
    bottom: 1rem;
    right: 1rem;
  }

  .chat-toggle-btn {
    bottom: 1rem;
    right: 1rem;
  }
}
