/* Mobile Performance Optimizations */
@media (max-width: 768px) {
  .tool-tab {
    padding: 1rem;
  }
  
  .upload-zone {
    padding: 1.5rem !important;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .btn-primary, .btn-secondary {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Improve tap targets */
  .tab-button, button, label {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Optimize images for mobile */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Better touch handling */
  .upload-zone {
    touch-action: manipulation;
  }
}

/* Fix for file input covering entire upload zone */
.upload-zone {
  position: relative;
  overflow: hidden;
}

.upload-zone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.upload-zone label {
  position: relative;
  z-index: 1;
  pointer-events: none; /* Let the file input handle clicks */
}

/* Compression options visibility fix */
.compression-option label {
  color: var(--color-text) !important;
}

.compression-option .text-xs {
  color: var(--color-text-secondary) !important;
}

/* File info visibility */
#file-info {
  color: var(--color-text) !important;
}

/* Mobile file input improvements */
input[type="file"] {
  font-size: 16px; /* Prevents zoom on iOS */
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .upload-zone:hover {
    border-color: var(--color-border);
    transform: none;
  }
  
  .btn-primary:hover, .btn-secondary:hover {
    transform: none;
  }
  
  /* Better scrolling performance */
  .tool-tab {
    -webkit-overflow-scrolling: touch;
  }
}

/* Reduce animations for performance */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Critical above-the-fold content */
.header, .hero-section, .navigation {
  will-change: transform;
}

/* Lazy loading for non-critical images */
img[data-src] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[data-src].loaded {
  opacity: 1;
}

/* Performance optimizations */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Prevent layout shifts */
.aspect-ratio-box {
  position: relative;
  width: 100%;
  padding-top: 75%; /* 4:3 Aspect Ratio */
}

.aspect-ratio-box img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Smooth scrolling and better text rendering */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}
