/* 电商图匠 - 样式 */

/* 基础变量 */
:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --success: #10B981;
  --bg: #0F172A;
  --bg-secondary: #1E293B;
  --bg-card: #334155;
  --text: #F8FAFC;
  --text-secondary: #94A3B8;
  --border: #475569;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶部导航 */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
}

.logo-icon {
  font-size: 28px;
}

.nav {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.limit-info {
  text-align: center;
  color: #94A3B8;
  font-size: 14px;
  margin-bottom: 20px;
  padding: 8px 16px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 20px;
  display: inline-block;
}

.limit-info span {
  color: #4F46E5;
  font-weight: bold;
}

.nav-item {
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
  background: var(--bg-card);
  color: var(--text);
}

.github-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 14px;
}

.github-link:hover {
  color: var(--text);
}

/* 主内容区 */
.main {
  flex: 1;
  padding: 40px 32px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* 上传区 */
.upload-section {
  max-width: 600px;
  margin: 0 auto;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 40px;
  text-align: center;
  transition: all 0.3s;
  background: var(--bg-secondary);
  cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.upload-area h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.upload-area p {
  color: var(--text-secondary);
  margin: 8px 0;
}

.upload-hint {
  font-size: 12px;
  margin-top: 16px;
}

/* 按钮 */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
}

/* 结果区 */
.result-section {
  max-width: 1000px;
  margin: 0 auto;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.result-header h3 {
  font-size: 20px;
}

/* 对比容器 */
.compare-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.compare-box {
  background: transparent;
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
}

.compare-label {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
}

.compare-box img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 600px;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.compare-actions {
  margin-top: 16px;
  text-align: center;
}

/* 加载状态 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-overlay p {
  margin-top: 16px;
  font-size: 18px;
}

.loading-hint {
  font-size: 14px;
  color: var(--text-secondary);
}

/* 底部 */
.footer {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  border-top: 1px solid var(--border);
}

/* 响应式 */
@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }
  
  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  
  .main {
    padding: 24px 16px;
  }
  
  .compare-container {
    grid-template-columns: 1fr;
  }
}

/* 尺寸选择器 */
.size-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.size-selector label {
  color: var(--text-secondary);
  font-size: 14px;
}

.size-selector select {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.size-selector select:focus {
  outline: none;
  border-color: var(--primary);
}

.custom-size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-size input {
  width: 80px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}

.custom-size input:focus {
  outline: none;
  border-color: var(--primary);
}

.custom-size span {
  color: var(--text-secondary);
}

/* 批量处理样式 */
.batch-section {
  max-width: 800px;
  margin: 0 auto;
}

.batch-list {
  margin-top: 20px;
}

.batch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  color: var(--text-secondary);
}

.batch-items {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.batch-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
}

.batch-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.batch-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.batch-options {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  color: var(--text-secondary);
}

.batch-options select {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}

.batch-progress {
  margin: 20px 0;
}

.progress-bar {
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}

.progress-text {
  text-align: center;
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 14px;
}

.batch-results {
  margin-top: 20px;
}

.batch-results h4 {
  margin-bottom: 15px;
  color: var(--text);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 15px;
}

.result-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
}

.result-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-item .download-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  padding: 4px 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
