html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}
/* Markdown styles */
.markdown p {
    margin-bottom: 0.5rem;
}
.markdown p:last-child {
    margin-bottom: 0;
}
.markdown ul, .markdown ol {
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}
.markdown ul {
    list-style-type: disc;
}
.markdown ol {
    list-style-type: decimal;
}
.markdown a {
    color: #3182ce;
    text-decoration: underline;
}
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
    font-weight: bold;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}
.markdown h1 {
    font-size: 1.5rem;
}
.markdown h2 {
    font-size: 1.25rem;
}
.markdown h3 {
    font-size: 1.125rem;
}
.markdown pre, .markdown code {
    background-color: #f7fafc;
    border-radius: 0.25rem;
    padding: 0.125rem 0.25rem;
    font-family: monospace;
}
.markdown pre {
    padding: 0.5rem;
    overflow-x: auto;
}
.markdown blockquote {
    border-left: 4px solid #e2e8f0;
    padding-left: 0.5rem;
    font-style: italic;
}
/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
}
.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    margin: 0 1px;
    opacity: 0.6;
    animation: typing 1.4s infinite ease-in-out both;
}
.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 typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* ===== Chat UI Enhancements ===== */

/* Connection Indicator */
.connection-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Toast Notifications */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Message Animations */
.chat-body > div {
  animation: messageSlide 0.3s ease;
}

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

/* Enhanced Chat Input */
#chat-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Accessibility Improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Message Status Indicators */
.message-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.message-status.sent::before {
  content: "✓";
  color: #10b981;
}

.message-status.delivered::before {
  content: "✓✓";
  color: #10b981;
}

.message-status.read::before {
  content: "✓✓";
  color: #3b82f6;
}

.message-status.failed::before {
  content: "⚠";
  color: #ef4444;
}

/* Responsive Improvements */
@media (max-width: 640px) {
  .connection-indicator {
    top: 5px;
    right: 5px;
    padding: 6px 12px;
    font-size: 12px;
  }
  
  .toast {
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .connection-indicator {
    background-color: rgba(0, 0, 0, 0.8);
  }
  
  .typing-indicator span {
    background-color: #999;
  }
}