:root {
  --sepia: #704214;
  --coral: #FF6B6B;
  --teal: #2DD4BF;
  --cream: #FFF8F0;
  --charcoal: #1F2937;
  --golden: #FBBF24;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23704214' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  min-height: 100vh;
  color: var(--charcoal);
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Styles */
header {
  background: linear-gradient(135deg, rgba(112, 66, 20, 0.1) 0%, rgba(255, 107, 107, 0.1) 100%);
  position: relative;
}

.header-title {
  font-family: 'Playfair Display', serif;
  background: linear-gradient(135deg, var(--sepia) 0%, var(--coral) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.banana-emoji {
  display: inline-block;
  -webkit-text-fill-color: initial;
}

.banana-emoji.shake {
  animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.sparkle-text {
  -webkit-text-fill-color: initial;
  animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.tagline {
  font-family: 'Dancing Script', cursive;
  font-size: 1.5rem;
}

.sparkle-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--golden);
  border-radius: 50%;
  animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0); }
  50% { opacity: 1; transform: scale(1); }
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Upload Zone */
.upload-zone {
  background: white;
  border: 3px dashed #CBD5E1;
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: #CBD5E1; }
  50% { border-color: var(--teal); }
}

.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--coral);
  background: rgba(255, 107, 107, 0.05);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 4rem;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Workspace */
.workspace {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.controls-panel, .results-panel {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--charcoal);
}

.success-title {
  text-align: center;
  font-size: 1.5rem;
  color: var(--teal);
}

/* Image Preview */
.image-preview-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.image-label {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  z-index: 1;
}

.preview-image {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Preset Selector */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.preset-card {
  background: var(--cream);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
}

.preset-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preset-card.selected {
  border-color: var(--coral);
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(45, 212, 191, 0.1) 100%);
}

.preset-icon {
  font-size: 1.5rem;
}

.preset-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.preset-desc {
  font-size: 0.7rem;
  color: #6B7280;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.transform-btn {
  background: linear-gradient(135deg, var(--coral) 0%, #FF8E8E 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.transform-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.reset-btn {
  background: transparent;
  border: 2px solid #E5E7EB;
  color: #6B7280;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-btn:hover {
  border-color: var(--charcoal);
  color: var(--charcoal);
}

/* Loading State */
.loading-container {
  text-align: center;
  padding: 3rem;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.polaroid-loader {
  margin-bottom: 1.5rem;
}

.polaroid-frame {
  width: 120px;
  height: 140px;
  background: white;
  margin: 0 auto;
  padding: 8px 8px 30px 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  animation: develop 2s ease-in-out infinite;
}

.polaroid-image {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--sepia) 0%, var(--cream) 50%, var(--coral) 100%);
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

@keyframes develop {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

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

.loading-message {
  font-family: 'Dancing Script', cursive;
  font-size: 1.25rem;
  color: var(--charcoal);
  margin-bottom: 1rem;
}

.loading-bar {
  width: 200px;
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  margin: 0 auto;
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--coral), var(--teal), var(--coral));
  background-size: 200% 100%;
  animation: loading-slide 1.5s ease-in-out infinite;
  border-radius: 3px;
}

@keyframes loading-slide {
  0% { width: 0%; background-position: 0% 50%; }
  50% { width: 70%; background-position: 100% 50%; }
  100% { width: 100%; background-position: 0% 50%; }
}

/* Comparison Slider */
.comparison-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 500px;
  border-radius: 12px;
  overflow: hidden;
  cursor: ew-resize;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  margin-bottom: 1.5rem;
}

.comparison-image {
  position: absolute;
  inset: 0;
}

.comparison-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slider-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  transform: translateX(-50%);
  z-index: 10;
}

.slider-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: white;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.slider-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  font-size: 0.75rem;
  color: var(--charcoal);
}

.comparison-labels {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.label-before, .label-after {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
}

/* Result Actions */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.download-btn {
  background: linear-gradient(135deg, var(--teal) 0%, #34D399 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(45, 212, 191, 0.3);
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 212, 191, 0.4);
}

.new-transform-btn {
  background: var(--golden);
  color: var(--charcoal);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.new-transform-btn:hover {
  transform: translateY(-2px);
}

/* Error Message */
.error-message {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 12px;
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
}

.error-message p {
  color: #DC2626;
  margin-bottom: 0.5rem;
}

.error-message button {
  background: #DC2626;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
}

/* Gallery */
.gallery-wrapper {
  margin-top: 2rem;
}

.gallery-section {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.gallery-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
}

.clear-gallery-btn {
  background: transparent;
  border: 1px solid #E5E7EB;
  color: #6B7280;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: scale(1.05);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
  padding: 0.5rem;
  font-size: 0.65rem;
  text-align: center;
}

.delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover .delete-btn {
  opacity: 1;
}

.gallery-empty {
  text-align: center;
  padding: 2rem;
  color: #9CA3AF;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 1rem;
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
}

.modal-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 32px;
  height: 32px;
  background: white;
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

/* Confetti */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Footer */
.app-footer {
  background: white;
  padding: 1.5rem;
  text-align: center;
  margin-top: 2rem;
  border-top: 1px solid #E5E7EB;
}

.footer-content {
  max-width: 600px;
  margin: 0 auto;
}

.powered-by {
  font-size: 0.9rem;
  color: #6B7280;
  margin-bottom: 0.5rem;
}

.banana-badge {
  background: linear-gradient(135deg, var(--golden) 0%, #FCD34D 100%);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.stats {
  font-family: 'Dancing Script', cursive;
  font-size: 1.1rem;
  color: var(--coral);
  margin-bottom: 0.5rem;
}

.privacy-note {
  font-size: 0.75rem;
  color: #9CA3AF;
  margin-bottom: 0.75rem;
}

.berrry-link {
  color: var(--coral);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.berrry-link:hover {
  color: var(--sepia);
}

/* Responsive */
@media (min-width: 768px) {
  .main-content {
    padding: 2rem;
  }
  
  .upload-zone {
    padding: 4rem 3rem;
  }
  
  .preset-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .action-buttons, .result-actions {
    flex-direction: row;
    justify-content: center;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

@media (min-width: 1024px) {
  .workspace {
    max-width: 800px;
    margin: 0 auto;
  }
}