/* General styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  color: #0f0f0f;
}

/* Chart customizations */
canvas#drt-plot {
  background: linear-gradient(to bottom, rgba(255,255,255,0) 1%, rgba(255,255,255,0) 99%);
  border-radius: 4px;
}

/* Dataset styles for Chart.js */
.chart-area-fill {
  opacity: 0.3;
}

/* Canvas rendering improvement - 优化图表渲染性能 */
canvas {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  /* 启用硬件加速 */
  transform: translateZ(0);
  will-change: transform;
}

/* Prevent zooming */
@media (max-width: 768px) {
  body {
    touch-action: pan-x pan-y;
  }
}

/* Modal animations - 优化模态窗口性能 */
#about-modal {
  transition: opacity 0.3s ease, visibility 0.3s ease;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  /* 启用硬件加速 */
  transform: translateZ(0);
  will-change: opacity, visibility;
}

#about-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Citations 模态窗口复用相同动画与样式 */
#citations-modal {
  transition: opacity 0.3s ease, visibility 0.3s ease;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateZ(0);
  will-change: opacity, visibility;
}

#citations-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#about-modal .bg-white {
  transform: translateY(20px);
  transition: transform 0.3s ease;
  /* 启用硬件加速 */
  will-change: transform;
}

#about-modal.active .bg-white {
  transform: translateY(0);
}

#citations-modal .bg-white {
  transform: translateY(20px);
  transition: transform 0.3s ease;
  will-change: transform;
}

#citations-modal.active .bg-white {
  transform: translateY(0);
}

/* Modal scrollbar styling */
#about-modal .bg-white::-webkit-scrollbar {
  width: 8px;
}

#about-modal .bg-white::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

#about-modal .bg-white::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

#about-modal .bg-white::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* 加载动画样式 - 修复动画问题 */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1.5s linear infinite;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* 错误消息样式 - 优化过渡 */
#error-message {
  transition: opacity 0.3s ease;
  /* 启用硬件加速 */
  transform: translateZ(0);
  will-change: opacity;
}

/* 加载动画容器优化 */
#loading-animation {
  /* 启用硬件加速 */
  transform: translateZ(0);
  will-change: opacity;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .aspect-square {
    aspect-ratio: 4/3;
  }
  
  .aspect-\[2\/1\] {
    aspect-ratio: 3/2;
  }
}

/* 切换按钮样式 - 优化过渡性能 */
#plot-toggle-buttons button {
  transition: all 0.2s ease;
  font-weight: 500;
  /* 启用硬件加速 */
  transform: translateZ(0);
  will-change: background-color, color;
}

#plot-toggle-buttons button.active-toggle {
  background-color: #6b7280 !important;
  color: white !important;
}

#plot-toggle-buttons button:not(.active-toggle) {
  background-color: #d1d5db;
  color: #374151;
}

#plot-toggle-buttons button:not(.active-toggle):hover {
  background-color: #9ca3af;
}

/* 表单优化 - 减少重绘 */
form {
  /* 启用硬件加速 */
  transform: translateZ(0);
}
