/* Enhanced AI Face Swap Studio - Custom Styles */

/* Base styles and smooth interactions */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Prevent horizontal scroll on mobile */
  overflow-x: hidden;
  /* Better mobile rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 25%, #7c3aed 50%, #db2777 75%, #dc2626 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  /* iOS scroll improvements */
  -webkit-overflow-scrolling: touch;
  /* Prevent zoom on input focus */
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Glass morphism effect */
.backdrop-blur-md {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Custom gradient backgrounds */
.gradient-purple {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-pink {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Button hover effects */
button {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

button:active {
  transform: scale(0.95);
}

/* Image preview animations */
img {
  transition: all 0.3s ease;
}

img:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

/* Progress bar animation */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.progress-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Floating animation for cards */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

.float-animation {
  animation: float 6s ease-in-out infinite;
}

/* Pulse animation for loading states */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.pulse-animation {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Glow effects */
.glow {
  box-shadow: 0 0 20px rgba(147, 51, 234, 0.5);
}

.glow-pink {
  box-shadow: 0 0 20px rgba(236, 72, 153, 0.5);
}

/* Success animation */
@keyframes success-bounce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.success-animation {
  animation: success-bounce 0.6s ease-in-out;
}

/* Error shake animation */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

.shake-animation {
  animation: shake 0.6s ease-in-out;
}

/* Loading spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  animation: spin 1s linear infinite;
}

/* Mobile responsiveness improvements */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }
  
  h1 {
    font-size: 2.5rem !important;
  }
  
  .grid-cols-2 {
    grid-template-columns: 1fr;
  }
}

/* Dark theme enhancements */
input:focus {
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

/* Custom checkbox styling */
input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='m13.854 3.646-7.5 7.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6 10.293l7.146-7.147a.5.5 0 0 1 .708.708z'/%3e%3c/svg%3e");
}

/* Card 3D effect on hover */
.card-3d {
  transition: transform 0.3s ease-out;
}

.card-3d:hover {
  transform: perspective(1000px) rotateX(2deg) rotateY(2deg);
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Enhanced button effects */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transition: width 0.6s, height 0.6s;
  transform: translate(-50%, -50%);
}

.ripple:active::before {
  width: 300px;
  height: 300px;
}

/* Advanced animations */
@keyframes blob {
  0% { transform: translate(0px, 0px) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
  100% { transform: translate(0px, 0px) scale(1); }
}

@keyframes textGlow {
  0%, 100% { text-shadow: 0 0 20px rgba(147, 51, 234, 0.5); }
  50% { text-shadow: 0 0 30px rgba(219, 39, 119, 0.8), 0 0 40px rgba(147, 51, 234, 0.5); }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rainbow {
  0% { color: #ff6b6b; }
  16.67% { color: #4ecdc4; }
  33.33% { color: #45b7d1; }
  50% { color: #96ceb4; }
  66.67% { color: #feca57; }
  83.33% { color: #ff9ff3; }
  100% { color: #ff6b6b; }
}

/* Enhanced glass morphism */
.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Animated gradient backgrounds */
.gradient-animated {
  background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
  background-size: 400% 400%;
  animation: gradientShift 4s ease infinite;
}

/* Enhanced hover effects */
.hover-glow:hover {
  box-shadow: 0 0 30px rgba(147, 51, 234, 0.6), 0 0 60px rgba(219, 39, 119, 0.4);
  transform: translateY(-2px);
}

/* Loading states */
.loading-shimmer {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* Particle effect background */
.particles::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255, 255, 255, 0.2), transparent),
    radial-gradient(1px 1px at 90px 40px, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 130px 80px, rgba(255, 255, 255, 0.3), transparent);
  background-repeat: repeat;
  background-size: 150px 100px;
  animation: particleMove 20s linear infinite;
  pointer-events: none;
}

@keyframes particleMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-150px, -100px); }
}

/* Enhanced mobile responsiveness */
@media (max-width: 640px) {
  .text-6xl { font-size: 3rem !important; }
  .text-8xl { font-size: 4rem !important; }
  .p-8 { padding: 1rem !important; }
  .gap-8 { gap: 1rem !important; }
}

/* Gallery animations */
.gallery-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Modal animations */
.modal-backdrop {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Success animations */
@keyframes successBounce {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.1); }
  50% { transform: scale(0.95); }
  75% { transform: scale(1.05); }
}

.success-animation {
  animation: successBounce 0.6s ease-in-out;
}

/* Text effects */
.text-gradient {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-rainbow {
  animation: rainbow 3s ease-in-out infinite;
}

/* Enhanced scroll effects */
.scroll-fade {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.scroll-fade.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Face Match Analysis Styles */
#faceMatchSection {
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

#faceMatchSection .progress-bar {
  transition: width 2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Face Match Score Animation */
@keyframes scoreReveal {
  0% {
    opacity: 0;
    transform: scale(0.8) rotateY(-90deg);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1) rotateY(0deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
  }
}

.face-match-score {
  animation: scoreReveal 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Match Status Indicators */
.match-indicator {
  position: relative;
  overflow: hidden;
}

.match-indicator::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.match-indicator:hover::before {
  left: 100%;
}

/* Similarity Progress Bar */
.similarity-progress {
  background: linear-gradient(45deg, #1e3a8a, #3730a3, #7c3aed, #c026d3);
  background-size: 300% 300%;
  animation: progressGradient 3s ease infinite;
}

@keyframes progressGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Face Match Loading Animation */
.face-match-loading {
  position: relative;
}

.face-match-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Enhanced Face Match Styles */
.face-crop-container {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.face-crop-container:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.face-crop-image {
  transition: all 0.3s ease;
  cursor: pointer;
}

.face-crop-image:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

/* Demographics and Stats Animation */
@keyframes statReveal {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-item {
  animation: statReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: both;
}

.stat-item:nth-child(1) { animation-delay: 0.1s; }
.stat-item:nth-child(2) { animation-delay: 0.2s; }
.stat-item:nth-child(3) { animation-delay: 0.3s; }
.stat-item:nth-child(4) { animation-delay: 0.4s; }

/* Quality Score Indicators */
.quality-indicator {
  position: relative;
  display: inline-block;
}

.quality-indicator::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981);
  border-radius: 1px;
  opacity: 0.7;
}

/* Analysis Section Hover Effects */
.analysis-section {
  transition: all 0.3s ease;
}

.analysis-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Issue/Warning Animations */
@keyframes warningPulse {
  0%, 100% { 
    background-color: rgba(234, 88, 12, 0.1);
    border-color: rgba(234, 88, 12, 0.3);
  }
  50% { 
    background-color: rgba(234, 88, 12, 0.2);
    border-color: rgba(234, 88, 12, 0.5);
  }
}

.warning-item {
  animation: warningPulse 2s ease-in-out infinite;
}

/* Technical Details Styling */
.tech-detail {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
}

/* Upscaling Progress Animations */
@keyframes upscaleProcess {
  0% { 
    background-position: 0% 50%;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
  }
  50% { 
    background-position: 100% 50%;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.6);
  }
  100% { 
    background-position: 0% 50%;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
  }
}

@keyframes enhanceGlow {
  0%, 100% { 
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
  }
  50% { 
    text-shadow: 0 0 20px rgba(34, 197, 94, 0.8), 0 0 30px rgba(34, 197, 94, 0.5);
  }
}

.upscale-processing {
  background: linear-gradient(45deg, #10b981, #059669, #047857, #10b981);
  background-size: 300% 300%;
  animation: upscaleProcess 2s ease infinite;
}

.enhance-text {
  animation: enhanceGlow 2s ease-in-out infinite;
}

/* Quality Enhancement Indicator */
.quality-boost {
  position: relative;
  overflow: hidden;
}

.quality-boost::before {
  content: '✨';
  position: absolute;
  top: -20px;
  left: -20px;
  font-size: 1.5em;
  animation: sparkle 3s linear infinite;
}

@keyframes sparkle {
  0% { 
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  25% { 
    transform: translate(100px, 20px) rotate(90deg);
    opacity: 1;
  }
  50% { 
    transform: translate(200px, 0) rotate(180deg);
    opacity: 0.8;
  }
  75% { 
    transform: translate(300px, -10px) rotate(270deg);
    opacity: 0.6;
  }
  100% { 
    transform: translate(400px, 0) rotate(360deg);
    opacity: 0;
  }
}

/* T4 Server Loading Animations */
@keyframes t4Processing {
  0% { 
    background-position: 0% 50%;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
  }
  50% { 
    background-position: 100% 50%;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.6);
  }
  100% { 
    background-position: 0% 50%;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
  }
}

@keyframes serverBoot {
  0%, 100% { 
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.3);
  }
  50% { 
    border-color: rgba(249, 115, 22, 0.8);
    box-shadow: 0 0 25px rgba(249, 115, 22, 0.6);
  }
}

@keyframes gpuWorkload {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.02) rotate(1deg); }
  50% { transform: scale(1) rotate(0deg); }
  75% { transform: scale(1.02) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.t4-processing {
  background: linear-gradient(45deg, #10b981, #059669, #047857, #10b981);
  background-size: 300% 300%;
  animation: t4Processing 2s ease infinite;
}

.server-boot-animation {
  animation: serverBoot 1.5s ease-in-out infinite;
}

.gpu-workload {
  animation: gpuWorkload 3s ease-in-out infinite;
}

/* High Load Warning Animation */
@keyframes highLoadPulse {
  0%, 100% { 
    background-color: rgba(249, 115, 22, 0.2);
    border-color: rgba(249, 115, 22, 0.5);
  }
  50% { 
    background-color: rgba(249, 115, 22, 0.4);
    border-color: rgba(249, 115, 22, 0.8);
  }
}

.high-load-warning {
  animation: highLoadPulse 2s ease-in-out infinite;
}

/* Processing Status Indicators */
.processing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin: 0 2px;
  animation: processingPulse 1.4s infinite ease-in-out both;
}

.processing-dot:nth-child(1) { animation-delay: -0.32s; }
.processing-dot:nth-child(2) { animation-delay: -0.16s; }
.processing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes processingPulse {
  0%, 80%, 100% { 
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% { 
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Mobile Optimizations & Touch Enhancements */
@media (max-width: 768px) {
  /* Prevent zoom on inputs */
  input, textarea, select {
    font-size: 16px !important;
    -webkit-appearance: none;
    border-radius: 8px;
  }
  
  /* Better touch targets */
  button {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
  }
  
  /* Improved drag & drop zones for mobile */
  .drag-drop-zone {
    min-height: 120px;
    border-width: 3px;
    border-style: dashed;
    padding: 20px;
  }
  
  /* Better spacing for mobile */
  .mobile-spacing {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  /* Prevent horizontal scroll */
  .container {
    max-width: 100vw;
    overflow-x: hidden;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .hover-effect:hover {
    transform: none !important;
  }
  
  /* Enhanced active states for touch */
  button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  /* Better focus states for accessibility */
  input:focus, button:focus {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
  }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Crisp rendering for high DPI */
  * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Landscape mobile improvements */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .hero-section {
    padding-top: 20px;
    padding-bottom: 20px;
  }
  
  .hero-title {
    font-size: 2rem !important;
    margin-bottom: 1rem;
  }
}

/* Performance optimizations */
.gpu-accelerated {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}