/* SugarCube Realism Enhancer Page Styles
   Composes css/design-system.css primitives (.sc-card, .sc-button, .sc-input) and --sc-* tokens. */

.hero-section {
  background: var(--sc-color-canvas, #f8faf9);
  padding-top: var(--sc-space-12, 3rem);
  padding-bottom: var(--sc-space-8, 2rem);
  text-align: center;
}

.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  color: var(--sc-color-ink, #102019);
  line-height: var(--sc-leading-tight, 1.08);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  color: var(--sc-color-muted, #5f6f67);
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.gen-card {
  padding: 1.75rem;
  max-width: 1200px;
  margin: 0 auto;
}

.workspace {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.75rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

.step-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--sc-color-brand-500, #10b981);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.step-title {
  font-weight: 700;
  color: var(--sc-color-ink, #102019);
}

.step-hint {
  font-size: 0.8rem;
  color: var(--sc-color-muted, #5f6f67);
  margin-left: auto;
}

.upload-zone {
  border: 2px dashed var(--sc-color-border-strong, #bfd4c9);
  border-radius: var(--sc-radius-lg, 1rem);
  padding: 2rem 1rem;
  text-align: center;
  background: var(--sc-color-surface-muted, #f1f5f3);
  cursor: pointer;
  transition: all var(--sc-motion-fast, 160ms) var(--sc-ease);
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-zone:hover, .upload-zone:focus-visible {
  border-color: var(--sc-color-brand-500, #10b981);
  background: var(--sc-color-brand-50, #ecfdf5);
}

.upload-plus {
  font-size: 2.5rem;
  color: var(--sc-color-brand-500, #10b981);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.upload-hint-main {
  font-weight: 600;
  color: var(--sc-color-ink, #102019);
  margin-bottom: 0.25rem;
}

.upload-hint-sub {
  font-size: 0.85rem;
  color: var(--sc-color-muted, #5f6f67);
}

.uploaded-preview-wrap {
  position: relative;
  width: 100%;
  max-height: 320px;
}

.uploaded-preview {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: var(--sc-radius-md, 0.75rem);
}

.remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(16, 32, 25, 0.75);
  color: #ffffff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.remove-btn:hover {
  background: rgba(180, 35, 53, 0.9);
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.template-card {
  padding: 0.75rem;
  text-align: left;
  cursor: pointer;
  position: relative;
  color: inherit;
  font: inherit;
  width: 100%;
  box-sizing: border-box;
}
.template-card.selected {
  border-color: var(--sc-color-brand-500, #10b981);
  background: var(--sc-color-brand-50, #ecfdf5);
  box-shadow: 0 0 0 2px var(--sc-color-brand-500, #10b981);
}

.template-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--sc-radius-sm, 0.5rem);
  margin-bottom: 0.5rem;
  background: var(--sc-color-surface-muted, #f1f5f3);
}
.template-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.template-preview-label {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(16, 32, 25, 0.7);
  color: #ffffff;
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}

.template-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--sc-color-ink, #102019);
  margin-bottom: 0.15rem;
}

.template-desc {
  font-size: 0.75rem;
  color: var(--sc-color-muted, #5f6f67);
  line-height: 1.3;
}

.template-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--sc-color-brand-500, #10b981);
  color: #ffffff;
  font-size: 0.75rem;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.template-card.selected .template-check {
  display: flex;
}

/* Status & Progress Bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--sc-radius-md, 0.75rem);
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.status-bar.idle { display: none !important; }
.status-bar.active,
.status-bar.show,
.status-bar.loading,
.status-bar.processing,
.status-bar.success,
.status-bar.error {
  display: flex !important;
}
.status-bar.processing,
.status-bar.loading {
  background: var(--sc-color-surface-muted, #f1f5f3);
  color: var(--sc-color-ink, #102019);
  border: 1px solid var(--sc-color-border, #dbe7e1);
}
.status-bar.success {
  background: var(--sc-color-brand-50, #ecfdf5);
  color: var(--sc-color-brand-700, #047857);
  border: 1px solid var(--sc-color-brand-500, #10b981);
}
.status-bar.error {
  background: #fef2f2;
  color: var(--sc-color-danger, #b42335);
  border: 1px solid #fca5a5;
}

.progress-container {
  display: none;
  margin-top: 0.75rem;
}
.progress-container.active,
.progress-container.show {
  display: block !important;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--sc-color-surface-muted, #f1f5f3);
  border-radius: var(--sc-radius-pill, 999px);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--sc-color-brand-500, #10b981);
  transition: width 0.2s ease;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--sc-color-muted, #5f6f67);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: sc-spin 0.75s linear infinite;
}

/* Tool Actions & Generate Button */
.tool-actions, .action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--sc-color-border, #dbe7e1);
  margin-top: 1rem;
}

.generate-btn, .enhance-btn {
  width: 100%;
  max-width: 480px;
  font-size: 1rem;
}

/* Result Area - Dual-support active & show */
.result-area {
  display: none;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sc-color-border, #dbe7e1);
  text-align: center;
}
.result-area.active,
.result-area.show {
  display: block !important;
}
.result-area img {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--sc-radius-lg, 1rem);
  object-fit: contain;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}



.realism-optics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}
.realism-optics-card {
  padding: 1.5rem;
}
.realism-optics-card h3 {
  color: var(--sc-color-ink, #102019);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.realism-optics-card p {
  color: var(--sc-color-muted, #5f6f67);
  font-size: 0.88rem;
  line-height: 1.6;
}

.cta-tool-link {
  background: var(--sc-color-surface-muted, #f1f5f3);
  color: var(--sc-color-brand-500, #10b981);
  text-decoration: none;
}
.cta-tool-link:hover {
  background: var(--sc-color-border, #dbe7e1);
}

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

input, textarea { font-size: 16px; }
