.message {
  display: flex;
  margin-bottom: 1rem;
}

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

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

.message-content {
  max-width: 70%;
  display: flex;
  flex-direction: column;
}

.message-text {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  word-wrap: break-word;
  line-height: 1.4;
}

.message-user .message-text {
  background-color: #1e40af;
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.message-assistant .message-text {
  background-color: #e9ecef;
  color: #495057;
  border-bottom-left-radius: 0.25rem;
}

.message-timestamp {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.25rem;
  padding: 0 0.5rem;
}

.message-user .message-timestamp {
  text-align: right;
}

.message-assistant .message-timestamp {
  text-align: left;
}

/* Markdown styles */
.markdown-link {
  color: #1e40af;
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.2s ease;
}

.markdown-link:hover {
  color: #1e3a8a;
  text-decoration: none;
}

.inline-code {
  background-color: #f8f9fa;
  color: #e83e8c;
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875em;
}

.code-block {
  background-color: #f8f9fa;
  color: #495057;
  padding: 0.5rem;
  border-radius: 0.25rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875em;
  display: block;
  margin: 0.5rem 0;
  border-left: 3px solid #1e40af;
}

.markdown-blockquote {
  border-left: 4px solid #1e40af;
  padding-left: 1rem;
  margin: 0.5rem 0;
  color: #6c757d;
  font-style: italic;
}

/* Style for markdown headings in messages */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
  margin: 0.5rem 0;
  color: #495057;
}

.message-text h1 { font-size: 1.25rem; }
.message-text h2 { font-size: 1.125rem; }
.message-text h3 { font-size: 1rem; }
.message-text h4 { font-size: 0.875rem; }

/* Style for markdown lists */
.message-text ul,
.message-text ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

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

/* Style for markdown paragraphs */
.message-text p {
  margin: 0.5rem 0;
}

.message-text p:first-child {
  margin-top: 0;
}

.message-text p:last-child {
  margin-bottom: 0;
}

/* Style for strong/bold text */
.message-text strong {
  font-weight: 600;
  color: #343a40;
}

/* Style for emphasis/italic text */
.message-text em {
  font-style: italic;
  color: #495057;
}

/* Authorization request styles */
.auth-request {
  padding: 1rem;
  border: 2px solid #007bff;
  border-radius: 0.5rem;
  background-color: #f8f9ff;
  margin: 0.5rem 0;
}

.auth-header {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #007bff;
}

.auth-button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
  min-width: 150px;
  justify-content: center;
}

.auth-button:hover:not(:disabled) {
  background-color: #0056b3;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.auth-button:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-button-loading {
  background-color: #6c757d;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.auth-details {
  background-color: #e9ecef;
  padding: 0.5rem;
  border-radius: 0.25rem;
  margin: 0.5rem 0;
  color: #495057;
}

.auth-details small {
  line-height: 1.4;
}
.loading-indicator {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1rem;
}

.loading-content {
  max-width: 70%;
  display: flex;
  flex-direction: column;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background-color: #e9ecef;
  border-radius: 1rem;
  border-bottom-left-radius: 0.25rem;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #6c757d;
  animation: typing 1.4s infinite ease-in-out;
}

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

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

.loading-text {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.25rem;
  padding: 0 0.5rem;
  text-align: left;
}

@keyframes typing {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
.message-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.welcome-message {
  text-align: center;
  color: #6c757d;
  padding: 2rem;
  margin: auto;
}

.welcome-message h3 {
  margin: 0 0 1rem 0;
  color: #495057;
}

.welcome-message p {
  margin: 0;
  line-height: 1.5;
}
.message-input-form {
  width: 100%;
}

.input-container {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.5rem;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 1.5rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.input-container:focus-within {
  border-color: #1e40af;
  box-shadow: 0 0 0 0.2rem rgba(30, 64, 175, 0.25);
}

.message-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  padding: 0.5rem;
  min-height: 20px;
  max-height: 120px;
  overflow-y: auto;
  background: transparent;
}

.message-textarea::placeholder {
  color: #6c757d;
}

.message-textarea:disabled {
  color: #6c757d;
  background-color: transparent;
}

.send-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background-color: #1e40af;
  color: white;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;
  flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
  background-color: #1e3a8a;
  transform: scale(1.05);
}

.send-button:active:not(:disabled) {
  transform: scale(0.95);
}

.send-button:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
  transform: none;
}

.send-button svg {
  width: 16px;
  height: 16px;
}
.authorization-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.authorization-modal {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.authorization-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e9ecef;
}

.authorization-modal-header h2 {
  margin: 0;
  color: #495057;
  font-size: 1.25rem;
}

.close-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--th-text, #212529);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.15s ease-in-out;
}

.close-button:hover:not(:disabled) {
  background-color: #f8f9fa;
  color: #495057;
}

.close-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.authorization-modal-content {
  padding: 1.5rem;
}

.authorization-modal-content p {
  margin: 0 0 1rem 0;
  line-height: 1.5;
  color: #495057;
}

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  border: 1px solid #f5c6cb;
}

.authorization-modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.authorize-button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.15s ease-in-out;
  flex: 1;
}

.authorize-button:hover:not(:disabled) {
  background-color: #0056b3;
}

.authorize-button:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

.cancel-button {
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.15s ease-in-out;
  flex: 1;
}

.cancel-button:hover:not(:disabled) {
  background-color: #545b62;
}

.cancel-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.loading-info {
  background-color: #d1ecf1;
  color: #0c5460;
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid #bee5eb;
}

.loading-info p {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
}

.loading-info p:last-child {
  margin-bottom: 0;
}
.chat-interface {
  display: flex;
  flex-direction: column;
  height: 600px;
  width: 100%;
  max-width: 800px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.chat-header {
  padding: 1rem;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #dc3545;
}

.status-indicator.connected {
  background-color: #28a745;
}

.status-text {
  font-size: 0.875rem;
  color: #6c757d;
}

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

.chat-input {
  border-top: 1px solid #e9ecef;
  padding: 1rem;
  background-color: #f8f9fa;
}.error-
text {
  color: #dc3545;
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.reconnect-button {
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: 0.5rem;
  transition: background-color 0.15s ease-in-out;
}

.reconnect-button:hover {
  background-color: #0056b3;
}

.reconnect-button:disabled {
  background-color: #6c757d;
  cursor: not-allowed;
}

.status-indicator.connecting {
  background-color: #ffc107;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}
/* Chat Widget Styles */
.chat-widget {
  position: fixed;
  z-index: 10000;
  width: 400px;
  height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 1px solid #e1e5e9;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Positioning */
.chat-widget--bottom-right {
  bottom: 20px;
  right: 20px;
}

.chat-widget--bottom-left {
  bottom: 20px;
  left: 20px;
}

.chat-widget--top-right {
  top: 20px;
  right: 20px;
}

.chat-widget--top-left {
  top: 20px;
  left: 20px;
}

/* Themes */
.chat-widget--dark {
  background: #2d3748;
  border-color: #4a5568;
  color: white;
}

.chat-widget--dark .chat-widget__header {
  background: #1a202c;
  border-color: #4a5568;
}

/* Minimized state */
.chat-widget--minimized {
  height: 50px;
}

.chat-widget--minimized .chat-widget__content {
  display: none;
}

/* Header */
.chat-widget__header {
  background: #f7fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
}

.chat-widget__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #2d3748;
}

.chat-widget__icon {
  font-size: 16px;
}

.chat-widget__controls {
  display: flex;
  gap: 4px;
}

.chat-widget__control-btn {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  color: #718096;
  transition: all 0.2s ease;
}

.chat-widget__control-btn:hover {
  background: #e2e8f0;
  color: #2d3748;
}

.chat-widget__close:hover {
  background: #fed7d7;
  color: #c53030;
}

/* Content */
.chat-widget__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Override chat interface styles for widget */
.chat-widget .chat-interface {
  height: 100%;
  border: none;
  border-radius: 0;
}

.chat-widget .chat-header {
  display: none; /* Hide the original header */
}

.chat-widget .chat-messages {
  flex: 1;
  padding: 16px;
}

.chat-widget .chat-input {
  border-top: 1px solid #e2e8f0;
  padding: 12px 16px;
}

/* Responsive */
@media (max-width: 480px) {
  .chat-widget {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    bottom: 20px;
    right: 20px;
    left: 20px;
    top: 20px;
  }
  
  .chat-widget--bottom-right,
  .chat-widget--bottom-left,
  .chat-widget--top-right,
  .chat-widget--top-left {
    bottom: 20px;
    right: 20px;
    left: 20px;
    top: 20px;
  }
}

/* Animation for opening/closing */
@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.chat-widget {
  animation: slideInUp 0.3s ease-out;
}
/* Floating Action Button Styles */
.chat-fab {
  position: fixed;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  color: white;
  overflow: hidden;
}

/* Positioning */
.chat-fab--bottom-right {
  bottom: 24px;
  right: 24px;
}

.chat-fab--bottom-left {
  bottom: 24px;
  left: 24px;
}

.chat-fab--top-right {
  top: 24px;
  right: 24px;
}

.chat-fab--top-left {
  top: 24px;
  left: 24px;
}

/* Themes */
.chat-fab--light {
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}

.chat-fab--dark {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e2563 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.chat-fab--success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

/* Hover effects */
.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(30, 64, 175, 0.3);
  background: linear-gradient(135deg, #1e3a8a 0%, #1e2563 100%);
}

.chat-fab:active {
  transform: scale(0.95);
}

/* Open state */
.chat-fab--open {
  transform: rotate(45deg);
}

.chat-fab--open:hover {
  transform: rotate(45deg) scale(1.1);
}

/* Icon */
.chat-fab__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

/* Badge for unread messages */
.chat-fab__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e53e3e;
  color: white;
  border-radius: 10px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  border: 2px solid white;
}

/* Ripple effect */
.chat-fab__ripple {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.chat-fab:active .chat-fab__ripple {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  to {
    transform: scale(2);
    opacity: 0;
  }
}

/* Pulse animation for notifications */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(30, 64, 175, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(30, 64, 175, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(30, 64, 175, 0);
  }
}

.chat-fab--pulse {
  animation: pulse 2s infinite;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .chat-fab {
    width: 48px;
    height: 48px;
  }
  
  .chat-fab--bottom-right {
    bottom: 16px;
    right: 16px;
  }
  
  .chat-fab--bottom-left {
    bottom: 16px;
    left: 16px;
  }
}
