/* 全局样式重置和变量定义 */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --surface-gradient: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.2);
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --shadow-light: 0 4px 20px rgba(0, 0, 0, 0.05);
  --shadow-medium: 0 8px 30px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.15);
  --border-radius: 16px;
  --border-radius-lg: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --backdrop-blur: blur(20px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: #f8fafc;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* 背景动画层 */
.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  opacity: 0.03;
}

.floating-shapes {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.shape {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  backdrop-filter: var(--backdrop-blur);
  animation: float 20s ease-in-out infinite;
}

.shape-1 {
  width: 300px;
  height: 300px;
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 200px;
  height: 200px;
  top: 60%;
  right: 10%;
  animation-delay: -5s;
}

.shape-3 {
  width: 150px;
  height: 150px;
  bottom: 20%;
  left: 20%;
  animation-delay: -10s;
}

.shape-4 {
  width: 100px;
  height: 100px;
  top: 30%;
  right: 30%;
  animation-delay: -15s;
}

.shape-5 {
  width: 250px;
  height: 250px;
  bottom: 10%;
  right: 20%;
  animation-delay: -7s;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33% { transform: translateY(-30px) rotate(120deg); }
  66% { transform: translateY(20px) rotate(240deg); }
}

/* 顶部导航栏 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.nav-brand i {
  color: #667eea;
  font-size: 1.5rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.language-switcher {
  display: flex;
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 4px;
  overflow: hidden;
}

.language-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition);
}

.language-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.language-btn.active {
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--shadow-light);
}

.github-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.github-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
}

/* 主容器 */
.main-container {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
  padding: 6rem 2rem 2rem;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - 80px);
}

/* 左侧控制面板 */
.control-panel {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-medium);
  position: sticky;
  top: 100px;
}

.control-section {
  margin-bottom: 1.8rem;
}

.control-section:last-child {
  margin-bottom: 0;
}

.control-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1;
}

.control-section i {
  color: #667eea;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 预设渐变网格 - 2行4列布局 */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.6rem;
}

.preset-item {
  background: white;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0.4rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-light);
  position: relative;
  overflow: visible;
  aspect-ratio: 1;
  z-index: 1;
}

.preset-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  border-color: rgba(102, 126, 234, 0.3);
  z-index: 10;
}

.preset-item.active {
  border-color: #667eea;
  box-shadow: var(--shadow-medium);
}

.preset-bg {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.preset-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%, rgba(255, 255, 255, 0.1) 100%);
  pointer-events: none;
}

.preset-name {
  position: absolute;
  top: -45px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 20;
  pointer-events: none;
}

.preset-item:hover .preset-name {
  opacity: 1;
  top: -40px;
}

/* 颜色选择器组 */
.color-picker-group {
  display: flex;
  gap: 0.8rem;
}

.color-picker {
  flex: 1;
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: white;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  padding: 0.5rem;
  transition: var(--transition);
}

.color-input-wrapper:focus-within {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.color-input-wrapper input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: none;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-wrapper input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
}

.color-value {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* 滑块组件 */
.setting-item {
  margin-bottom: 1rem;
}

.slider-wrapper {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.modern-slider {
  flex: 1;
  height: 5px;
  background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e0 100%);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.modern-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary-gradient);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-light);
  transition: var(--transition);
}

.modern-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-medium);
}

.slider-value {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 45px;
  text-align: right;
}

/* 设置行 */
.setting-row {
  display: flex;
  gap: 0.8rem;
}

.setting-row .setting-item {
  flex: 1;
  margin-bottom: 0.5rem;
}

.setting-row .setting-item:last-child {
  margin-bottom: 0;
}

.number-input {
  width: 100%;
  padding: 0.6rem;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  background: white;
  transition: var(--transition);
  text-align: center;
}

.number-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 格式选择器 */
.format-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  padding: 4px;
  gap: 3px;
}

.format-option {
  flex: 1;
  position: relative;
  cursor: pointer;
}

.format-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.format-option span {
  display: block;
  padding: 0.6rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: var(--transition);
}

.format-option input[type="radio"]:checked + span {
  background: white;
  color: var(--text-primary);
  box-shadow: var(--shadow-light);
}

/* 控制区域内容 */
.control-content {
  flex: 1;
  overflow-y: auto;
}

/* 下载按钮 */
.download-section {
  margin-top: auto;
  padding-top: 1.8rem;
}

.download-btn {
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: var(--transition);
  box-shadow: var(--shadow-medium);
  position: relative;
  overflow: hidden;
}

.download-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.download-btn:hover::before {
  left: 100%;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-heavy);
}

.download-btn:active {
  transform: translateY(0);
}

/* 右侧预览区域 */
.preview-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.preview-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.preview-header i {
  color: #667eea;
}

.preview-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.css-code {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.05);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  padding: 0.5rem 1rem;
  background: white;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.copy-btn:hover {
  border-color: #667eea;
  color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

/* 预览容器 */
.preview-container {
  position: relative;
  height: calc(100vh - 220px);
  min-height: 400px;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-heavy);
  background: white;
}

.preview-canvas {
  width: 100%;
  height: 100%;
  background: var(--primary-gradient);
  transition: var(--transition);
  position: relative;
}

.preview-overlay {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.preview-controls {
  display: flex;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow-medium);
}

.preview-btn {
  padding: 0.75rem 1.5rem;
  background: white;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  white-space: nowrap;
}

.preview-btn:hover {
  border-color: #667eea;
  color: #667eea;
  background: rgba(102, 126, 234, 0.05);
  transform: translateY(-2px);
}

/* 滚动条样式 */
.control-content::-webkit-scrollbar {
  width: 6px;
}

.control-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}

.control-content::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 3px;
}

.control-content::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.5);
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .main-container {
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
    padding: 6rem 1.5rem 2rem;
  }
  
  .control-panel {
    padding: 1.25rem;
  }
}

@media (max-width: 900px) {
  .main-container {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 6rem 1rem 2rem;
  }
  
  .control-panel {
    position: static;
    height: auto;
    display: block;
    order: 2;
    padding: 1.5rem;
  }
  
  .control-content {
    flex: none;
    overflow-y: visible;
  }
  
  .download-section {
    margin-top: 1.5rem;
    padding-top: 0;
  }
  
  .preview-section {
    order: 1;
  }
  
  .preset-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }
  
  .navbar {
    padding: 1rem;
  }
  
  .nav-brand {
    font-size: 1.125rem;
  }
  
  .nav-actions {
    gap: 0.75rem;
  }
}

@media (max-width: 640px) {
  .preset-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .color-picker-group {
    flex-direction: column;
  }
  
  .setting-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .preview-info {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .css-code {
    max-width: 100%;
  }
  
  .preview-controls {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .preview-btn {
    justify-content: center;
  }
  
  .nav-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* 动画和特效 */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.control-section {
  animation: slideInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.control-section:nth-child(1) { animation-delay: 0.1s; }
.control-section:nth-child(2) { animation-delay: 0.2s; }
.control-section:nth-child(3) { animation-delay: 0.3s; }
.control-section:nth-child(4) { animation-delay: 0.4s; }
.control-section:nth-child(5) { animation-delay: 0.5s; }

.preview-section {
  animation: fadeIn 0.8s ease-out;
}

/* 深色模式适配（可选） */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e0;
    --text-muted: #a0aec0;
  }
  
  body {
    background: #1a202c;
  }
  
  .navbar {
    background: rgba(26, 32, 44, 0.9);
  }
  
  .control-panel {
    background: rgba(26, 32, 44, 0.9);
  }
  
  .color-input-wrapper,
  .number-input,
  .format-option span,
  .copy-btn,
  .preview-btn {
    background: #2d3748;
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
  }
  
  .preset-item {
    background: #2d3748;
  }
}

/* 图片设置区块特殊间距调整 */
.control-section .setting-row {
  margin-bottom: 0.5rem;
}

/* 减少图片设置和格式选择之间的间距 */
.control-section:nth-child(4) {
  margin-bottom: 1.2rem;
} 