/* =============================================
   FabricAI — Result Section Styles
   styles/result.css
   ============================================= */

/* ─── Result Section Wrapper ────────────────── */
#result-section {
  display: none;
  animation: slideUp var(--duration-slow) var(--ease-out) both;
  padding-bottom: var(--space-16);
}

#result-section.visible {
  display: block;
}

/* ─── Result Header ─────────────────────────── */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.result-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.result-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
}

.result-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* ─── Three Image Cards Grid ────────────────── */
.result-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.result-img-card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg);
  transition: var(--transition-slow);
}

.result-img-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--color-border-strong);
}

/* Generated image card — featured/larger */
.result-img-card.featured {
  border-color: var(--color-brand-600);
  box-shadow: var(--shadow-lg), var(--shadow-brand);
}

.result-img-card.featured:hover {
  box-shadow: var(--shadow-xl), var(--shadow-brand-strong);
}

.result-card-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--glass-border);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.result-card-label svg {
  width: 14px;
  height: 14px;
}

.result-card-label.label--original {
  color: var(--color-text-secondary);
}

.result-card-label.label--cloth {
  color: var(--color-text-secondary);
}

.result-card-label.label--ai {
  color: var(--color-text-brand);
}

.result-card-label .label-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.label--original .label-dot { background: var(--color-text-tertiary); }
.label--cloth .label-dot    { background: var(--color-info); }
.label--ai .label-dot       {
  background: var(--gradient-brand);
  animation: pulse 2s ease-in-out infinite;
}

.result-card-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
}

.result-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

.result-img-card:hover .result-card-img {
  transform: scale(1.03);
}

/* Fullscreen trigger overlay */
.result-card-overlay {
  position: absolute;
  inset: 0;
  background: hsla(240,14%,6%,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
  backdrop-filter: blur(2px);
}

.result-img-card:hover .result-card-overlay {
  opacity: 1;
}

.result-card-fullscreen-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: hsla(240,12%,9%,0.9);
  border: var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: var(--transition-base);
  backdrop-filter: blur(8px);
}

.result-card-fullscreen-btn:hover {
  background: var(--color-bg-overlay);
  color: var(--color-text-primary);
  transform: scale(1.05);
}

.result-card-fullscreen-btn svg {
  width: 14px;
  height: 14px;
}

/* ─── Before/After Comparison Slider ────────── */
.comparison-section {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.comparison-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.comparison-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

.comparison-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-left: auto;
}

/* ─── Slider Container ──────────────────────── */
.slider-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  max-height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
}

/* "Before" image (full width, clipped by slider) */
.slider-before {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.slider-before img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* "After" image (clipped to the right of slider) */
.slider-after {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  clip-path: inset(0 0 0 50%);
  transition: clip-path 0ms; /* No transition — updated in JS */
}

.slider-after img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* ─── Slider Handle ─────────────────────────── */
.slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  background: white;
  box-shadow: 0 0 10px hsla(0,0%,0%,0.5);
  z-index: 10;
  transition: left 0ms;
}

.slider-handle-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: white;
  box-shadow: 0 4px 15px hsla(0,0%,0%,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-bg-base);
}

.slider-handle-circle svg {
  width: 20px;
  height: 20px;
}

/* Slider labels */
.slider-label {
  position: absolute;
  top: var(--space-3);
  padding: var(--space-1) var(--space-3);
  background: hsla(240,14%,6%,0.8);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: white;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  pointer-events: none;
}

.slider-label--before { left: var(--space-3); }
.slider-label--after  { right: var(--space-3); }

/* ─── Result Action Buttons ─────────────────── */
.result-actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  justify-content: center;
}

/* Primary download button */
.result-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: var(--transition-base);
  border: none;
  position: relative;
  overflow: hidden;
}

.result-btn svg {
  width: 18px;
  height: 18px;
}

.result-btn--primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow: var(--shadow-brand);
}

.result-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-brand-strong);
}

.result-btn--outline {
  background: hsla(240, 10%, 14%, 0.8);
  border: 1.5px solid var(--color-border-default);
  color: var(--color-text-secondary);
  backdrop-filter: blur(8px);
}

.result-btn--outline:hover {
  border-color: var(--color-brand-500);
  color: var(--color-text-brand);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px hsla(263,70%,58%,0.15);
}

/* Download success brief state */
.result-btn--primary.downloading {
  background: linear-gradient(135deg, hsl(155, 65%, 40%) 0%, hsl(155, 65%, 35%) 100%);
  box-shadow: var(--shadow-success);
}

/* ─── Fullscreen Modal ──────────────────────── */
#fullscreen-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out);
}

#fullscreen-modal.open {
  opacity: 1;
  pointer-events: all;
}

.fullscreen-backdrop {
  position: absolute;
  inset: 0;
  background: hsla(240, 14%, 4%, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.fullscreen-content {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 800px);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  transform: scale(0.9);
  transition: transform var(--duration-slow) var(--ease-bounce);
}

#fullscreen-modal.open .fullscreen-content {
  transform: scale(1);
}

.fullscreen-img {
  max-width: 100%;
  max-height: calc(90dvh - 80px);
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.fullscreen-close {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: hsla(240, 10%, 20%, 0.9);
  border: var(--glass-border);
  backdrop-filter: blur(8px);
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-base);
  z-index: 2;
}

.fullscreen-close:hover {
  background: var(--color-bg-overlay);
  color: var(--color-text-primary);
  transform: scale(1.1);
}

.fullscreen-close svg {
  width: 20px;
  height: 20px;
}

/* ─── Success Confetti / Sparkle ────────────── */
.result-success-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-success-soft);
  border: 1px solid var(--color-success-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-success);
  animation: slideDown var(--duration-slow) var(--ease-bounce) both;
}

.result-success-badge svg {
  width: 16px;
  height: 16px;
}
