/* ============================================
   SHERCO ID - Estilos Principales
   Paleta: Naranja #F97316, Azul #0EA5E9
   ============================================ */

:root {
  --color-primary: #F97316;
  --color-primary-dark: #EA580C;
  --color-secondary: #0EA5E9;
  --color-secondary-dark: #0284C7;
  --color-success: #10B981;
  --color-dark: #1F2937;
  --color-gray: #6B7280;
  --color-light: #F3F4F6;
  --color-white: #FFFFFF;
  --color-black: #000000;
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--color-white);
  color: var(--color-dark);
  line-height: 1.5;
  overflow-x: hidden;
}

/* ============================================
   SPLASH SCREEN
   ============================================ */

.splash-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--color-white) 0%, #FFF7ED 50%, #FFEDD5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.splash-content {
  text-align: center;
  padding: 2rem;
}

.logo-wrapper {
  position: relative;
  display: inline-block;
  margin-bottom: 2rem;
}

.camera-icon {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 25px 50px -12px rgba(249, 115, 22, 0.5),
    0 0 0 4px rgba(249, 115, 22, 0.1);
  animation: float 3s ease-in-out infinite;
}

.camera-icon svg {
  width: 60px;
  height: 60px;
  color: var(--color-white);
}

.sparkles {
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 32px;
  animation: sparkle 2s ease-in-out infinite;
}

.brand-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.text-dark { color: var(--color-dark); }
.text-orange { 
  color: var(--color-primary);
  position: relative;
}

.brand-line {
  width: 120px;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 2px;
  margin: 0 auto 2rem;
}

.loading-wrapper {
  max-width: 280px;
  margin: 0 auto;
}

.progress-container {
  width: 100%;
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary), var(--color-primary));
  background-size: 200% 100%;
  border-radius: 3px;
  transition: width 0.1s linear;
}

.loading-text {
  color: var(--color-gray);
  font-weight: 500;
}

.dots::after {
  content: '...';
  animation: loading-dots 1.5s steps(4) infinite;
}

/* ============================================
   WELCOME SCREEN
   ============================================ */

.app-container {
  min-height: 100vh;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.app-container.visible {
  opacity: 1;
}

.welcome-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(180deg, var(--color-white) 0%, #FFF7ED 100%);
}

.hero-content {
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.logo-hero {
  margin-bottom: 2rem;
}

.icon-box {
  width: 140px;
  height: 140px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #FB923C 100%);
  border-radius: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  position: relative;
  box-shadow: 
    0 25px 50px -12px rgba(249, 115, 22, 0.4),
    0 0 0 4px rgba(249, 115, 22, 0.1);
  animation: float 6s ease-in-out infinite;
}

.icon-box svg {
  width: 70px;
  height: 70px;
  color: var(--color-white);
}

.sparkle {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 36px;
  animation: sparkle-rotate 3s ease-in-out infinite;
}

.logo-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
}

.highlight {
  color: var(--color-primary);
}

.gradient-line {
  width: 100px;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 2px;
  margin: 0.5rem auto 0;
}

.headline {
  font-size: 2rem;
  font-weight: 300;
  color: var(--color-dark);
  margin-bottom: 0.5rem;
}

.subheadline {
  color: var(--color-gray);
  font-size: 1.125rem;
  margin-bottom: 3rem;
}

.features-grid {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 3rem;
  perspective: 1000px;
}

.feature-item {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(20px);
  animation: slide-up 0.6s ease-out forwards;
  animation-delay: var(--delay);
  transition: all 0.3s ease;
}

.feature-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.feature-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--color-light) 0%, #E5E7EB 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.feature-item span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-dark);
}

.btn-start {
  width: 100%;
  padding: 1.25rem 2rem;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-lg);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.btn-start::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left 0.5s;
}

.btn-start:hover::before {
  left: 100%;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(249, 115, 22, 0.5);
}

.btn-start:active {
  transform: translateY(0);
}

.btn-start svg {
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
}

.btn-start:hover svg {
  transform: translateX(4px);
}

.footer-text {
  color: var(--color-gray);
  font-size: 0.875rem;
}

/* ============================================
   CAMERA SCREEN
   ============================================ */

.camera-screen {
  position: fixed;
  inset: 0;
  background: var(--color-black);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.camera-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}

.btn-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border: none;
  color: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.btn-back:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.1);
}

.btn-back svg {
  width: 24px;
  height: 24px;
}

.camera-header h2 {
  color: var(--color-white);
  font-size: 1.25rem;
  font-weight: 600;
}

.spacer {
  width: 40px;
}

.camera-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guide-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.passport-frame {
  width: 300px;
  height: 400px;
  position: relative;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-md);
}

.corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: var(--color-primary);
  border-style: solid;
  border-width: 0;
  transition: all 0.3s ease;
}

.corner.tl {
  top: -2px;
  left: -2px;
  border-top-width: 4px;
  border-left-width: 4px;
  border-top-left-radius: var(--radius-lg);
  animation: pulse-corner 2s ease-in-out infinite;
}

.corner.tr {
  top: -2px;
  right: -2px;
  border-top-width: 4px;
  border-right-width: 4px;
  border-top-right-radius: var(--radius-lg);
  animation: pulse-corner 2s ease-in-out infinite 0.5s;
}

.corner.bl {
  bottom: -2px;
  left: -2px;
  border-bottom-width: 4px;
  border-left-width: 4px;
  border-bottom-left-radius: var(--radius-lg);
  animation: pulse-corner 2s ease-in-out infinite 1s;
}

.corner.br {
  bottom: -2px;
  right: -2px;
  border-bottom-width: 4px;
  border-right-width: 4px;
  border-bottom-right-radius: var(--radius-lg);
  animation: pulse-corner 2s ease-in-out infinite 1.5s;
}

.face-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  width: 220px;
  height: 280px;
}

.oval-mask {
  width: 100%;
  height: 200px;
  border: 2px dashed rgba(255,255,255,0.5);
  border-radius: 50% 50% 45% 45%;
  position: relative;
}

.oval-mask::before {
  content: '';
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 50% 50% 45% 45%;
  animation: breathe 3s ease-in-out infinite;
}

.shoulder-guide {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 80px;
  border: 2px dashed rgba(255,255,255,0.4);
  border-radius: 50% 50% 0 0;
  border-bottom: none;
}

.center-mark {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(249, 115, 22, 0.6);
  border-radius: 50%;
}

.center-mark::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: var(--color-primary);
  border-radius: 50%;
}

.guide-text {
  color: var(--color-white);
  font-size: 1.1rem;
  margin-top: 2rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  animation: fade-pulse 2s ease-in-out infinite;
}

.btn-switch-camera {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--color-white);
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: auto;
}

.btn-switch-camera:hover {
  background: rgba(0,0,0,0.8);
  transform: translateX(-50%) scale(1.05);
}

.btn-switch-camera svg {
  width: 20px;
  height: 20px;
}

.camera-controls {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.btn-capture {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.capture-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--color-white);
  padding: 6px;
  transition: transform 0.2s ease;
}

.capture-button {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--color-primary);
  transition: all 0.3s ease;
}

.btn-capture:hover .capture-ring {
  transform: scale(1.1);
}

.btn-capture:active .capture-ring {
  transform: scale(0.95);
}

.btn-capture:active .capture-button {
  background: var(--color-primary-dark);
}

.format-hint {
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
}

.flash-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-white);
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
}

.flash-overlay.active {
  animation: flash 0.3s ease-out;
}

/* ============================================
   PROCESSING SCREEN
   ============================================ */

.processing-screen {
  position: fixed;
  inset: 0;
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.processing-content {
  text-align: center;
  padding: 2rem;
  max-width: 400px;
}

.spinner-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 2rem;
}

.gradient-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--color-primary), var(--color-secondary), var(--color-primary));
  animation: spin 1.5s linear infinite;
  mask: radial-gradient(circle at center, transparent 55%, black 56%);
  -webkit-mask: radial-gradient(circle at center, transparent 55%, black 56%);
}

.spinner-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.spinner-icon svg {
  width: 48px;
  height: 48px;
  animation: pulse 2s ease-in-out infinite;
}

.processing-title {
  font-size: 1.75rem;
  color: var(--color-dark);
  margin-bottom: 0.5rem;
}

.processing-desc {
  color: var(--color-gray);
  margin-bottom: 2rem;
}

.progress-wrapper {
  position: relative;
  margin-bottom: 2rem;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--color-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 4px;
  transition: width 0.1s linear;
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 1.5s infinite;
}

.progress-percent {
  position: absolute;
  right: -50px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  color: var(--color-primary);
  font-size: 0.875rem;
  min-width: 40px;
}

.steps-indicator {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.4;
  transition: all 0.3s ease;
}

.step.active {
  opacity: 1;
  transform: scale(1.1);
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.step.active .step-dot {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: var(--color-white);
  box-shadow: var(--shadow-md);
}

.step span {
  font-size: 0.75rem;
  font-weight: 500;
}

.success-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.success-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.success-icon {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--color-success), #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-white);
  font-size: 48px;
  margin-bottom: 1rem;
  animation: scale-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 25px -5px rgba(16, 185, 129, 0.4);
}

.success-overlay h2 {
  font-size: 2rem;
  color: var(--color-success);
  animation: slide-up 0.5s ease-out 0.2s both;
}

/* ============================================
   EDITOR SCREEN
   ============================================ */

.editor-screen {
  min-height: 100vh;
  background: #F9FAFB;
  display: flex;
  flex-direction: column;
}

.editor-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #E5E7EB;
  z-index: 10;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--color-light);
  color: var(--color-gray);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: #E5E7EB;
  color: var(--color-dark);
  transform: scale(1.05);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

.editor-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-dark);
}

.editor-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.preview-section {
  margin-bottom: 1.5rem;
}

.photo-wrapper {
  position: relative;
  background: var(--color-white);
  padding: 12px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  transform: perspective(1000px) rotateY(-3deg);
  transition: transform 0.5s ease;
  display: inline-block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  display: block;
}

.photo-wrapper:hover {
  transform: perspective(1000px) rotateY(0deg);
}

.photo-wrapper img {
  width: 100%;
  height: auto;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius-md);
  display: block;
}

.format-tag {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-dark));
  color: var(--color-white);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.btn-ai {
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--color-white);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  color: var(--color-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-ai::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(249, 115, 22, 0.1), transparent);
  transition: left 0.5s;
}

.btn-ai:hover::before {
  left: 100%;
}

.btn-ai:hover {
  background: #FFF7ED;
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.2);
}

.btn-ai.processing {
  background: var(--color-primary);
  color: var(--color-white);
  pointer-events: none;
}

.ai-sparkle {
  font-size: 1.25rem;
  animation: sparkle 2s ease-in-out infinite;
}

.btn-ai .info {
  width: 20px;
  height: 20px;
  margin-left: auto;
  opacity: 0.5;
}

.tools-section {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.tools-toggle {
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.tools-toggle:hover {
  background: #F9FAFB;
}

.tools-toggle h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-dark);
}

.tools-toggle .chevron {
  width: 20px;
  height: 20px;
  color: var(--color-gray);
  transition: transform 0.3s ease;
}

.tools-toggle.expanded .chevron {
  transform: rotate(180deg);
}

.tools-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.tools-panel.expanded {
  max-height: 600px;
}

.tool-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
  border-bottom: 1px solid #E5E7EB;
}

.tab {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: var(--color-light);
  border-radius: var(--radius-md);
  color: var(--color-gray);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: var(--color-white);
  box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.3);
}

.adjustments {
  padding: 1.5rem;
}

.slider-group {
  margin-bottom: 1.5rem;
}

.slider-group:last-child {
  margin-bottom: 0;
}

.slider-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.slider-label .icon {
  font-size: 1.25rem;
}

.slider-label label {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #374151;
}

.slider-label .value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-primary);
  min-width: 45px;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #E5E7EB;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.4);
  transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.4);
}

.editor-footer {
  position: sticky;
  bottom: 0;
  background: var(--color-white);
  padding: 1rem 1.5rem;
  display: flex;
  gap: 1rem;
  border-top: 1px solid #E5E7EB;
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.btn-share {
  flex: 1;
  padding: 1rem;
  background: #EFF6FF;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-secondary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.btn-share:hover {
  background: #DBEAFE;
  transform: translateY(-2px);
}

.btn-share svg {
  width: 20px;
  height: 20px;
}

.btn-save {
  flex: 1;
  padding: 1rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-white);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.4);
  transition: all 0.3s ease;
}

.btn-save:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(249, 115, 22, 0.5);
}

.btn-save svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   RESULTS SCREEN
   ============================================ */

.results-screen {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--color-white) 0%, #F0F9FF 100%);
  padding: 2rem 1.5rem;
}

.results-content {
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.results-content h2 {
  font-size: 1.75rem;
  color: var(--color-dark);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--color-gray);
  margin-bottom: 2rem;
}

.final-photo {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.photo-frame-final {
  position: relative;
  background: var(--color-white);
  padding: 16px;
  border-radius: var(--radius-xl);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  transform: perspective(1000px) rotateY(-3deg);
  transition: transform 0.5s ease;
}

.photo-frame-final:hover {
  transform: perspective(1000px) rotateY(0deg);
}

.photo-frame-final img {
  width: 240px;
  height: 320px;
  object-fit: cover;
  border-radius: var(--radius-md);
  display: block;
}

.btn-expand {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--color-white);
  border: none;
  color: var(--color-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.photo-frame-final:hover .btn-expand {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.btn-expand svg {
  width: 24px;
  height: 24px;
}

.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.action-card {
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-card.primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: var(--color-white);
  box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.3);
}

.action-card.secondary {
  background: var(--color-white);
  color: #374151;
  border: 2px solid #E5E7EB;
}

.action-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-xl);
}

.action-icon {
  font-size: 2rem;
}

.action-card span {
  font-size: 0.875rem;
  font-weight: 600;
}

.bottom-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding-top: 1rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--color-gray);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  transition: all 0.2s ease;
}

.link-btn:hover {
  color: var(--color-primary);
}

.link-btn svg {
  width: 18px;
  height: 18px;
}

/* ============================================
   FAREWELL SCREEN
   ============================================ */

.farewell-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--color-dark) 0%, #111827 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.farewell-screen.show {
  opacity: 1;
  pointer-events: all;
}

.farewell-content {
  text-align: center;
  color: var(--color-white);
  position: relative;
  padding: 2rem;
}

.farewell-logo {
  position: relative;
  display: inline-block;
  margin-bottom: 2rem;
}

.icon-large {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  animation: float 3s ease-in-out infinite;
  box-shadow: 0 25px 50px -12px rgba(249, 115, 22, 0.4);
}

.sparkles-animation {
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 40px;
  animation: sparkle 2s ease-in-out infinite;
}

.thanks-text {
  font-size: 1.5rem;
  font-weight: 300;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.brand-name-farewell {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.tagline {
  font-size: 1.25rem;
  color: #9CA3AF;
  font-weight: 300;
  letter-spacing: 0.1em;
}

.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 20px;
  height: 20px;
  background: rgba(249, 115, 22, 0.3);
  border-radius: 50%;
  animation: float-shape 8s ease-in-out infinite;
}

/* ============================================
   CORRECCIÓN DE PROPORCIÓN 3:4 (VERTICAL)
   ============================================ */

/* Forzar contenedor vertical */
.photo-wrapper,
.photo-frame-final,
.preview-section > div:first-child {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

/* Aspect ratio 3:4 vertical usando padding trick */
.photo-wrapper::before,
.photo-frame-final::before {
  content: '';
  display: block;
  padding-top: 133.33%; /* 4/3 = 1.333... (altura/ancho) */
}

/* Imagen posicionada absolutamente dentro del contenedor */
.photo-wrapper img,
.photo-frame-final img,
#editorImage,
#finalImage {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center top !important; /* Centrar en la cara */
}

/* Badge de formato posicionado correctamente */
.format-tag,
.format-badge {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

/* Asegurar que el canvas de cámara no se vea */
#cameraCanvas {
  display: none !important;
}

/* Spinner en botón de IA */
.btn-ai .spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Correcciones de proporción y spinner */
.btn-ai .spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slide-up {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

/* ============================================
   FIX: Contenedor de imagen sin espacio extra
   ============================================ */

.photo-wrapper-fixed {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.photo-container-fixed {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4; /* Proporción 3:4 vertical */
  background: #1a1a2e;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fallback para navegadores antiguos */
@supports not (aspect-ratio: 3/4) {
  .photo-container-fixed {
    padding-top: 133.33%;
  }
  
  .photo-container-fixed img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}

.photo-container-fixed img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Si la imagen es landscape, usar contain */
.photo-container-fixed.img-landscape img {
  object-fit: contain;
  padding: 8px;
}

/* Tag de formato */
.format-tag {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

/* Botón expandir */
.btn-expand {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.btn-expand:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.05);
}

.btn-expand svg {
  width: 20px;
  height: 20px;
  color: white;
}

/* Responsive */
@media (max-width: 480px) {
  .photo-wrapper-fixed {
    max-width: 280px;
  }
}

@media (min-width: 768px) {
  .photo-wrapper-fixed {
    max-width: 400px;
  }
}

.particle:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { top: 20%; right: 10%; background: rgba(14, 165, 233, 0.3); animation-delay: 1s; }
.particle:nth-child(3) { bottom: 20%; left: 20%; background: rgba(16, 185, 129, 0.3); animation-delay: 2s; }
.particle:nth-child(4) { bottom: 10%; right: 20%; animation-delay: 3s; }
.particle:nth-child(5) { top: 50%; left: 5%; background: rgba(14, 165, 233, 0.3); animation-delay: 4s; }
.particle:nth-child(6) { top: 50%; right: 5%; animation-delay: 5s; }