/**
 * Custom Styles
 * 补充 Tailwind CSS 未覆盖的样式
 */

/* 全局样式 */
* {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

/* 代码编辑器字体 */
#codeEditor {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  tab-size: 2;
  -moz-tab-size: 2;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 隐藏滚动条但保持功能 */
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* 预览容器网格背景 */
.bg-grid {
  background-image: radial-gradient(circle, #1e293b 1px, transparent 1px);
  background-size: 20px 20px;
}

/* 渐变文字效果 */
.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 自定义动画 */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.shimmer {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* macOS 窗口控制点样式（用于未来的外壳系统） */
.macos-controls {
  display: flex;
  gap: 8px;
}

.macos-control-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.macos-control-red { background: #ff5f57; }
.macos-control-yellow { background: #febc2e; }
.macos-control-green { background: #28c840; }

/* 深色模式下的优化 */
@media (prefers-color-scheme: dark) {
  /* 优化表单控件在深色模式下的显示 */
  input[type="number"]::-webkit-inner-spin-button,
  input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  input[type="number"] {
    -moz-appearance: textfield;
  }
}

/* 进度条动画 */
#progressBar {
  transition: width 0.3s ease-out;
}

/* Toast 通知动画 */
@keyframes slideInFromBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast-enter {
  animation: slideInFromBottom 0.3s ease-out;
}

/* 模态框动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#licenseModal > div:first-child {
  animation: fadeIn 0.2s ease-out;
}

#licenseModal > div:last-child {
  animation: fadeIn 0.3s ease-out;
  transform-origin: center;
}

/* 按钮悬停效果增强 */
button:not(:disabled):hover {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* 选择框自定义样式 */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 36px;
}

/* 深色模式选择框箭头 */
.dark select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* iframe 预览区域优化 */
#previewIframe {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* 响应式优化 */
@media (max-width: 1024px) {
  #previewIframe {
    transform: scale(0.85);
  }
}

@media (max-width: 768px) {
  #previewIframe {
    transform: scale(0.75);
  }
}

/* 加载骨架屏（可选） */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.dark .skeleton {
  background: linear-gradient(90deg, #2d2d2d 25%, #3d3d3d 50%, #2d2d2d 75%);
  background-size: 200% 100%;
}

/* 聚焦环优化 */
*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* 打印样式（隐藏不必要的元素） */
@media print {
  header, footer, #exportBtn, #upgradeBtn {
    display: none;
  }
}
