/* Force sharp, crisp text rendering - ENHANCED */

body {
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
  letter-spacing: -0.01em;
}

/* Apply to all elements for maximum sharpness */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Heading sharpness */
h1, h2, h3, h4, h5, h6 {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Sharp button and input rendering */
button, input, select, textarea {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  backface-visibility: hidden;
  transform: translateZ(0);
  font-weight: 500;
}

/* Mode Toggle Buttons */
.mode-toggle-btn {
  color: #6b7280;
  background: transparent;
  transition: all 0.2s ease;
}

.mode-toggle-btn.active {
  color: #10b981;
  background: #f0fdf4;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.15);
}
.mode-toggle-btn.text {
  color: gray;
  background: #f0fdf4;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.15);
}

.mode-toggle-btn:hover:not(.active) {
  background: #f9fafb;
  color: #374151;
}

.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .04);
  transition: all 0.3s ease;
}

.tool-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

.info-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-left: 4px solid #10b981;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

.content-section {
  margin-bottom: 2rem;
}

.content-section h2 {
  color: #111827;
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
}

.content-section h3 {
  color: #374151;
  font-weight: 600;
  font-size: 1.125rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

/* Drop zone styling */
#dropZone {
  border: 2px dashed #d1d5db;
  transition: all 0.3s ease;
}

#dropZone.drag-over {
  border-color: #10b981;
  background: #f0fdf4;
}

/* Canvas with sharp rendering */
#previewCanvas {
  max-width: 100%;
  max-height: 600px;
  height: auto;
  width: auto;
  border-radius: 0.5rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  display: block;
  margin: 0 auto;
}

/* Two-column layout on desktop */
@media (min-width: 1024px) {
  .tool-section {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 2.5rem;
    align-items: start;
  }

  #controls {
    max-width: 420px;
  }
}

.gradient-box {
  width: 100%;
  height: 36px; 
  border-radius: 0.5rem;
  cursor: pointer;
  border: 2px solid transparent; /* Reduced from 3px */
  transition: all 0.2s ease;
  backface-visibility: hidden;
  transform: translateZ(0);
  position: relative;
}

.gradient-box:hover {
  transform: scale(1.05) translateZ(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gradient-box.active {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

/* Tooltip on hover for gradient names */
.gradient-box:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  padding: 4px 8px;
  background: #111827;
  color: white;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

/* Color preview box */
#colorPreview {
  transition: all 0.2s ease;
}

#colorPreview:hover {
  transform: scale(1.05);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .content-section h2 {
    font-size: 1.25rem;
  }
  
  .tool-card {
    padding: 1.25rem;
  }
  
  .gradient-box {
    height: 40px; /* Slightly larger on mobile for easier tapping */
  }
  
  button {
    min-height: 44px;
  }
  
  .mode-toggle-btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  /* Ensure color inputs are usable on mobile */
  input[type="number"],
  input[type="text"] {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Number input styling */
input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Better focus states */
input:focus,
button:focus {
  outline: none;
  ring: 2px;
  ring-color: #10b981;
}
