/* ================================================
   Style Preview Widget — aicompoz.it
   Drag-drop upload → style picker → AI results
   ================================================ */

.preview-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 5rem 2rem;
  text-align: center;
}

.preview-section .section-heading {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.preview-section .section-sub {
  font-size: 0.95rem;
  color: var(--text-mid);
  font-weight: 300;
  max-width: 480px;
  margin: 0 auto 3rem;
}

.preview-widget {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2.5rem;
  max-width: 720px;
  margin: 0 auto;
  box-shadow: 0 8px 40px rgba(42, 74, 62, 0.06);
}

/* Step indicator */
.preview-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.step-dot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 400;
}

.step-dot.active {
  color: var(--green);
  font-weight: 600;
}

.step-dot.completed {
  color: var(--terracotta);
}

.step-num-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-dot.active .step-num-badge {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.step-dot.completed .step-num-badge {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: white;
}

.step-line {
  width: 40px;
  height: 1px;
  background: var(--border);
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 3rem 2rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
  margin-bottom: 1.5rem;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--terracotta);
  background: var(--terracotta-light);
}

.upload-zone.has-image {
  border-style: solid;
  border-color: var(--green);
  padding: 1rem;
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
}

.upload-text {
  font-size: 0.95rem;
  color: var(--text-mid);
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.upload-hint {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 300;
}

.upload-preview {
  display: none;
  position: relative;
}

.upload-zone.has-image .upload-preview {
  display: block;
}

.upload-zone.has-image .upload-placeholder {
  display: none;
}

.preview-img {
  max-width: 100%;
  max-height: 280px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  margin: 0 auto;
}

.remove-upload {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Style picker */
.style-picker {
  display: none;
  margin-bottom: 1.5rem;
  text-align: left;
}

.style-picker.visible {
  display: block;
}

.style-picker-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.style-picker-label span {
  color: var(--text-light);
  font-weight: 300;
}

.style-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.style-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: white;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-dark);
  font-weight: 400;
  transition: all 0.18s ease;
  user-select: none;
}

.style-chip:hover {
  border-color: var(--green);
  background: var(--green-muted);
}

.style-chip.selected {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.style-chip .check-icon {
  display: none;
  width: 12px;
}

.style-chip.selected .check-icon {
  display: block;
}

/* CTA Button */
.preview-cta {
  display: none;
  width: 100%;
  padding: 1rem;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: opacity 0.2s ease, transform 0.15s ease;
  margin-bottom: 1rem;
}

.preview-cta.visible {
  display: block;
}

.preview-cta:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.preview-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preview-cta.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Results */
.preview-results {
  display: none;
  margin-top: 1rem;
}

.preview-results.visible {
  display: block;
}

.results-heading {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 1.25rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-card {
  border-radius: 14px;
  overflow: hidden;
  background: white;
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.result-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(42, 74, 62, 0.1);
}

.result-img-wrap {
  aspect-ratio: 4/3;
  background: var(--cream);
  overflow: hidden;
}

.result-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  text-align: center;
}

.result-style-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-muted);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 0.4rem;
}

.result-placeholder-text {
  font-size: 0.72rem;
  color: var(--text-light);
  font-weight: 300;
}

.result-failed-badge {
  background: var(--terracotta-light);
  color: var(--terracotta);
}

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

.result-btn {
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: 'DM Sans', sans-serif;
}

.result-btn--primary {
  background: var(--green);
  color: white;
  border: none;
}

.result-btn--primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.result-btn--secondary {
  background: white;
  color: var(--text-dark);
  border: 1.5px solid var(--border);
}

.result-btn--secondary:hover {
  border-color: var(--green);
  color: var(--green);
}

/* Mobile */
@media (max-width: 600px) {
  .preview-widget {
    padding: 1.5rem;
    border-radius: 18px;
  }

  .results-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .style-options {
    gap: 0.5rem;
  }

  .style-chip {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
  }
}