body {
  background: #fff;
  color: #111;
  font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
  font-size: 14px; /* Base font size for better readability */
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Logo styling for crisp rendering and better visibility */
img[src="/static/logo.svg"], img[src*="logo.svg"] {
  /* Ensure crisp rendering for SVG */
  image-rendering: optimizeQuality;
  
  /* Make the logo appear bolder using CSS filters */
  filter: contrast(1.4) brightness(0.8) drop-shadow(0 1px 2px rgba(0,0,0,0.2));
  
  /* Ensure sharp edges */
  shape-rendering: crispEdges;
  
  /* Prevent blur on scaling */
  transform-origin: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Specific enhancement for small logos */
img[src="/static/logo.svg"][style*="32px"], 
img[src="/static/logo.svg"][style*="40px"],
img[src="/static/logo.svg"][style*="44px"],
img[src="/static/logo.svg"][style*="48px"] {
  /* Increase stroke width appearance for small sizes */
  filter: contrast(1.6) brightness(0.75) drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

/* For medium logos */
img[src="/static/logo.svg"][style*="56px"], 
img[src="/static/logo.svg"][style*="64px"] {
  filter: contrast(1.4) brightness(0.8) drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}

/* For larger logos, use less aggressive filtering */
img[src="/static/logo.svg"][style*="80px"], 
img[src="/static/logo.svg"][style*="100px"],
img[src="/static/logo.svg"][style*="120px"] {
  filter: contrast(1.3) brightness(0.85) drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}

/* Alternative approach using CSS transform for better scaling */
.logo-crisp {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  filter: contrast(1.4) brightness(0.8) drop-shadow(0 1px 3px rgba(0,0,0,0.25));
  transform: scale(1.01); /* Slight scale to improve crispness */
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  img[src="/static/logo.svg"], img[src*="logo.svg"] {
    /* For high DPI displays, reduce the aggressive filtering */
    filter: contrast(1.15) brightness(0.9);
    image-rendering: auto;
  }
  
  .logo-crisp {
    filter: contrast(1.2) brightness(0.9);
    transform: none;
  }
}

/* Logo container styling for better positioning and rendering */
.logo-section img, .embed-header img {
  /* Ensure the logo maintains aspect ratio */
  object-fit: contain;
  /* Prevent any distortion */
  width: auto;
  height: auto;
  max-width: 100%;
  /* Smooth any minor scaling artifacts */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Utility class for extra-bold logo appearance */
.logo-bold {
  filter: contrast(1.5) brightness(0.75) drop-shadow(0 0 0.5px rgba(0,0,0,0.4));
  transform: scale(1.02);
}

/* For very small logos (less than 40px), apply stronger enhancement */
img[src="/static/logo.svg"][style*="32px"] {
  filter: contrast(1.6) brightness(0.7) drop-shadow(0 0 0.5px rgba(0,0,0,0.5));
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

footer {
  border-bottom: 1px solid #222;
  padding: 1rem 0;
  margin-bottom: 2rem;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: bold;
  margin: 1.5rem 0 1rem 0;
}

a {
  color: #111;
  text-decoration: underline;
}

a:hover {
  color: #555;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: 0.9rem; /* Smaller font size for form elements */
  border: 1px solid #222;
  background: #fff;
  color: #111;
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  border-radius: 3px;
}

button {
  cursor: pointer;
  background: #111;
  color: #fff;
  border: none;
  transition: background 0.2s;
}

button:hover {
  background: #333;
}

.card {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 5px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.user-msg {
  text-align: right;
  font-weight: bold;
  margin: 0.5em 0;
}

.bot-msg {
  text-align: left;
  font-style: italic;
  margin: 0.5em 0;
}

/* Modern Chat UI Styles with Mobile Performance Optimizations */
.chat-container {
  max-width: 800px;
  margin: 2rem auto;
  background: #fafafa;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 500px;
  /* Performance optimizations */
  contain: layout style paint;
  will-change: auto;
}

.chat-header {
  padding: 1.2rem 1.5rem 0.5rem 1.5rem;
  border-bottom: 1px solid #eee;
}

.chat-desc {
  color: #555;
  font-size: 1em;
  margin-bottom: 0.5em;
}

.chat-history {
  flex: 1;
  padding: 1.2rem 1.5rem;
  overflow-y: auto;
  min-height: 300px;
  max-height: 400px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  /* Mobile scroll optimizations */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* Hardware acceleration */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  /* Reduce layout calculations */
  contain: layout style paint;
}

.user-msg, .bot-msg {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  max-width: 80%;
  word-wrap: break-word;
  /* Performance optimizations */
  contain: layout style;
  will-change: auto;
}

.user-msg {
  background: #111;
  color: #fff;
  align-self: flex-end;
  margin-left: auto;
}

.bot-msg {
  background: #f0f0f0;
  color: #111;
  align-self: flex-start;
  margin-right: auto;
}

.chat-form {
  padding: 1rem 1.5rem;
  border-top: 1px solid #eee;
  background: #fff;
}

.chat-input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  resize: none;
  font-family: inherit;
  /* Mobile optimizations */
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* iOS specific fix to prevent zoom */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
  .chat-input {
    font-size: 16px !important;
  }
}

.chat-send {
  background: #111;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all 0.2s;
  /* Mobile touch optimization */
  touch-action: manipulation;
  min-height: 44px;
  min-width: 44px;
}

.chat-send:hover {
  background: #333;
  transform: translateY(-1px);
}

.chat-send:active {
  transform: translateY(0);
}

.chat-status {
  text-align: center;
  padding: 0.5rem;
  color: #666;
  font-size: 0.9rem;
}

/* Chat message styling improvements */
.message {
  font-size: 0.9rem; /* Smaller base font size for messages */
  line-height: 1.4;
}

.message-bubble {
  font-size: inherit;
  max-width: 85%; /* Prevent messages from being too wide */
}

.message-bubble h1 {
  font-size: 1.1rem !important;
  margin: 0.5rem 0;
}

.message-bubble h2 {
  font-size: 1rem !important;
  margin: 0.4rem 0;
}

.message-bubble h3 {
  font-size: 0.95rem !important;
  margin: 0.3rem 0;
}

.message-bubble p {
  font-size: 0.9rem;
  margin: 0.75rem 0;
  line-height: 1.5;
  color: #000000;
  word-wrap: break-word;
}

.message-bubble ul, .message-bubble ol {
  font-size: 0.9rem;
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.message-bubble code {
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
  background: #f5f5f5;
  border-radius: 3px;
}

.message-bubble pre {
  font-size: 0.8rem;
  padding: 1rem;
  background: #f8f8f8;
  border-radius: 5px;
  overflow-x: auto;
}

.message-sources {
  font-size: 0.8rem;
}

.query-rewrite-info {
  font-size: 0.75rem !important;
}

/* Form and input improvements */
#chatInput {
  font-size: 0.9rem;
  line-height: 1.3;
}

/* Mobile improvements */
@media (max-width: 768px) {
  .message {
    font-size: 0.85rem;
  }
  
  .message-bubble {
    max-width: 95%;
  }
  
  .message-bubble h1 {
    font-size: 1rem !important;
  }
  
  .message-bubble h2 {
    font-size: 0.95rem !important;
  }
  
  .message-bubble h3 {
    font-size: 0.9rem !important;
  }
  
  .message-bubble p {
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0.6rem 0;
  }
  
  #chatInput {
    font-size: 0.85rem;
  }
}

.landing-page {
  max-width: 100%;
  margin: 0 auto;
}

.hero-section {
  text-align: center;
  padding: 4rem 0;
}

.btn-primary {
  background: #111;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-secondary {
  background: transparent;
  color: #111;
  border: 1px solid #111;
  border-radius: 3px;
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  background: #111;
  color: #fff;
}

.feature-card {
  transition: all 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.step-item {
  transition: all 0.2s ease;
}

.step-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

#header-auth-container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 100%;
}

#header-auth-container .btn {
  transition: all 0.2s ease;
}

/* Enhanced mobile responsive styles with performance optimizations */
@media (max-width: 768px) {
  body {
    /* Optimize mobile scrolling */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  
  /* Mobile scroll optimization */
  .chat-history {
    /* Hardware acceleration for smooth scrolling */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Reduce layout thrashing */
    contain: layout style paint;
  }
  
  /* Reduce animations on mobile for performance */
  * {
    transition-duration: 0.1s !important;
    animation-duration: 0.1s !important;
  }
  
  .hero-section {
    padding: 2rem 0;
  }
  
  .hero-section h1 {
    font-size: 1.5rem; /* Reduced from 2rem */
  }
  
  .hero-section p {
    font-size: 0.9rem; /* Reduced from 1rem */
  }
  
  .hero-cta {
    flex-direction: column;
    align-items: center;
  }
  
  .hero-cta .btn-primary,
  .hero-cta .btn-secondary {
    width: 100%;
    max-width: 300px;
    margin-bottom: 0.5rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .features-section,
  .how-it-works-section {
    padding: 2rem 0;
  }
  
  .section-header h2 {
    font-size: 1.4rem; /* Reduced from 1.8rem */
  }
  
  .step-item {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
  
  .step-number {
    align-self: center;
  }
  
  .container {
    padding: 1rem 0.5rem;
  }
  
  #header-auth-container {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  #auth-buttons {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  /* Mobile chat optimizations */
  .chat-container {
    margin: 1rem;
    min-height: calc(100vh - 2rem);
  }
  
  .chat-input {
    /* Prevent zoom on iOS */
    font-size: 16px !important;
    /* Improve touch responsiveness */
    touch-action: manipulation;
  }
  
  .chat-send {
    /* Larger touch target */
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
  }
  
  /* Reduce complex selectors that cause reflow */
  .message-bubble {
    will-change: auto;
    contain: layout style;
  }
}

/* Additional CSS to fix mobile UI lag and scrolling issues */

/* Prevent layout shifts and improve performance */
.chat-container {
  position: relative;
  /* Prevent content jumps */
  contain: layout style paint;
}

/* Fix mobile scrolling performance */
@media (max-width: 768px) {
  .chat-history {
    /* Force hardware acceleration */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Better scroll performance */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto !important; /* Disable smooth scroll on mobile for performance */
    /* Prevent overscroll bounce */
    overscroll-behavior: contain;
    /* Optimize for mobile */
    will-change: scroll-position;
  }
  
  /* Optimize message rendering */
  .message {
    /* Prevent reflows */
    contain: layout style;
    /* Optimize for scrolling */
    transform: translateZ(0);
  }
  
  /* Reduce complexity during scrolling */
  .chat-history.scrolling .message {
    will-change: transform;
  }
  
  .chat-history.scrolling .source-chunk-content {
    display: none !important;
  }
  
  .chat-history.scrolling .query-enhance-info {
    display: none !important;
  }
}

/* Fix send button reliability on mobile */
.chat-send {
  /* Prevent double-tap issues */
  touch-action: manipulation;
  /* Better touch handling */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* Prevent text selection issues on mobile */
@media (max-width: 768px) {
  .message-bubble {
    -webkit-user-select: text;
    user-select: text;
    /* Prevent accidental selection during scroll */
    -webkit-touch-callout: default;
  }
  
  /* But prevent selection on UI elements */
  .chat-send,
  .source-item,
  .upload-tab,
  button {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}

/* Optimize typing indicator */
.typing-indicator {
  /* Hardware acceleration */
  transform: translateZ(0);
  /* Reduce layout calculations */
  contain: layout style paint;
}

/* Fix input focus issues on mobile */
@media (max-width: 768px) {
  .chat-input:focus {
    /* Prevent layout shifts when keyboard appears */
    transform: translateZ(0);
    /* Better input handling */
    outline: none;
    border-color: #007bff;
  }
}

/* Performance optimizations for sources */
.sources-content {
  /* Enable GPU acceleration */
  transform: translateZ(0);
  /* Better scroll performance */
  -webkit-overflow-scrolling: touch;
}

/* Embed widget source chunks styles */
.pragbase-widget-sources {
  margin-top: 0.75rem;
  font-size: 0.7rem;
  color: #666;
}

.pragbase-widget-sources-toggle {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0.2rem 0;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
  font-weight: 400;
  border-radius: 3px;
}

.pragbase-widget-sources-toggle:hover {
  color: #666;
  background: #f5f5f5;
}

.pragbase-widget-toggle-icon {
  transition: transform 0.2s ease;
  font-size: 0.6rem;
  opacity: 0.7;
}

.pragbase-widget-toggle-icon.rotated {
  transform: rotate(180deg);
}

.pragbase-widget-sources-content {
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  margin-top: 0.5rem;
  opacity: 0;
}

.pragbase-widget-sources-content.expanded {
  max-height: 500px;
  overflow-y: auto;
  opacity: 1;
  margin-top: 0.5rem;
}

.pragbase-widget-sources-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pragbase-widget-source-item {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 0.75rem;
  border-left: 3px solid #e0e0e0;
  transition: all 0.2s ease;
}

.pragbase-widget-source-item:hover {
  background: #f0f0f0;
  border-left-color: #ccc;
}

.pragbase-widget-source-filename {
  font-size: 0.65rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pragbase-widget-source-text {
  font-size: 0.7rem;
  line-height: 1.5;
  color: #444;
  max-height: 80px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #eee;
}

/* Mobile optimizations for embed widget sources */
@media (max-width: 768px) {
  .pragbase-widget-sources {
    font-size: 0.65rem;
    margin-top: 0.6rem;
  }
  
  .pragbase-widget-sources-toggle {
    font-size: 0.65rem;
    padding: 0.15rem 0;
  }
  
  .pragbase-widget-sources-list {
    gap: 0.5rem;
  }
  
  .pragbase-widget-source-item {
    padding: 0.6rem;
  }
  
  .pragbase-widget-source-filename {
    font-size: 0.6rem;
    margin-bottom: 0.3rem;
  }
  
  .pragbase-widget-source-text {
    font-size: 0.65rem;
    padding: 0.4rem;
    max-height: 70px;
  }
  
  .pragbase-widget-sources-content.expanded {
    max-height: 350px;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High refresh rate display optimizations */
@media screen and (min-resolution: 2dppx) {
  .chat-history {
    /* Better scrolling on high DPI displays */
    scroll-snap-type: none;
  }
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
  .chat-container {
    /* Fix height issues on iOS */
    min-height: -webkit-fill-available;
  }
  
  .chat-history {
    /* Fix scroll bounce on iOS */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

/* Rate Limit Status Display */
.rate-limit-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  margin-top: 0.5rem;
  border: 1px solid transparent;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.rate-limit-good {
  background: linear-gradient(135deg, #e6f7e6, #d4f4d4);
  color: #16a34a;
  border-color: #bbf7d0;
}

.rate-limit-warning {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #d97706;
  border-color: #fcd34d;
}

.rate-limit-critical {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #dc2626;
  border-color: #f87171;
}

.rate-limit-disabled {
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  color: #6b7280;
  border-color: #d1d5db;
}

.rate-limit-icon {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
}

.rate-limit-text {
  font-weight: 500;
  white-space: nowrap;
  flex: 1;
}

/* Rate limit progress bar */
.rate-limit-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
  transition: width 0.3s ease;
}

.rate-limit-good .rate-limit-progress {
  background: #22c55e;
}

.rate-limit-warning .rate-limit-progress {
  background: #f59e0b;
}

.rate-limit-critical .rate-limit-progress {
  background: #ef4444;
}

/* Rate limit tooltip */
.rate-limit-status[title]:hover {
  cursor: help;
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Rate limit container */
.rate-limit-container {
  margin: 0.5rem 0;
  padding: 0 1rem;
}

/* Rate limit refresh button */
.rate-limit-refresh {
  background: none;
  border: none;
  color: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  border-radius: 3px;
  transition: background-color 0.2s;
  margin-left: 0.3rem;
}

.rate-limit-refresh:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile rate limit adjustments */
@media (max-width: 768px) {
  .rate-limit-status {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    gap: 0.3rem;
    margin-top: 0.3rem;
  }
  
  .rate-limit-text {
    font-size: 0.65rem;
  }
  
  .rate-limit-icon {
    font-size: 0.7rem;
  }
  
  .rate-limit-container {
    padding: 0 0.5rem;
    margin: 0.3rem 0;
  }
  
  .rate-limit-refresh {
    font-size: 0.6rem;
    margin-left: 0.2rem;
  }
}

/* Rate limit animation for updates */
@keyframes rateLimitUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.rate-limit-status.updating {
  animation: rateLimitUpdate 0.3s ease;
}

/* Unlimited rate limit for dev user */
.rate-limit-status.rate-limit-unlimited {
  background: linear-gradient(135deg, #4caf50, #66bb6a);
  color: white;
  border-color: #4caf50;
}

.rate-limit-status.rate-limit-unlimited:hover {
  background: linear-gradient(135deg, #45a049, #5cb85c);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

/* Chat input disabled state when rate limited */
.chat-input:disabled {
  background-color: #f5f5f5;
  cursor: not-allowed;
  opacity: 0.6;
}

.chat-send:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  opacity: 0.6;
}

.chat-send:disabled:hover {
  background-color: #cccccc;
  transform: none;
}

/* Rate Limit Display Styles */
.rate-limit-display {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #495057;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.rate-limit-display.warning {
  background: linear-gradient(135deg, #fff3cd, #ffeaa7);
  border-color: #ffeaa7;
  color: #856404;
}

.rate-limit-display.danger {
  background: linear-gradient(135deg, #f8d7da, #fdcae1);
  border-color: #f5c6cb;
  color: #721c24;
}

.rate-limit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.rate-limit-count {
  font-size: 1rem;
  font-weight: 700;
}

.rate-limit-progress-container {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.rate-limit-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #28a745, #20c997);
  border-radius: 4px;
  transition: all 0.3s ease;
  position: relative;
}

.rate-limit-progress-bar.warning {
  background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.rate-limit-progress-bar.danger {
  background: linear-gradient(90deg, #dc3545, #e74c3c);
}

.rate-limit-progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.rate-limit-reset {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

.rate-limit-icon {
  margin-right: 0.5rem;
  font-size: 1.1em;
}

/* Loading state */
.rate-limit-display.loading {
  opacity: 0.7;
  pointer-events: none;
}

.rate-limit-display.loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .rate-limit-display {
    padding: 0.6rem 0.8rem;
    font-size: 0.8rem;
  }
  
  .rate-limit-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .rate-limit-count {
    font-size: 0.9rem;
  }
  
  .rate-limit-progress-container {
    height: 5px;
  }
}

/* Accessibility improvements */
.rate-limit-display:focus-within {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

.rate-limit-display[aria-expanded="true"] {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Animation for updates */
.rate-limit-display.updated {
  animation: pulse-update 0.6s ease;
}

@keyframes pulse-update {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
  100% { transform: scale(1); }
}

/* Hidden state */
.rate-limit-display.hidden {
  display: none;
}

/* Compact view for smaller screens */
.rate-limit-display.compact {
  padding: 0.5rem;
  font-size: 0.75rem;
}

.rate-limit-display.compact .rate-limit-header {
  margin-bottom: 0.25rem;
}

.rate-limit-display.compact .rate-limit-progress-container {
  height: 4px;
  margin-bottom: 0.25rem;
}

/* Integration with existing chat styles */
.chat-input-area .rate-limit-display {
  margin-bottom: 0.75rem;
  border-radius: 6px;
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
  .rate-limit-display {
    background: linear-gradient(135deg, #2d3748, #4a5568);
    border-color: #4a5568;
    color: #e2e8f0;
  }
  
  .rate-limit-progress-container {
    background: rgba(255, 255, 255, 0.1);
  }
}