/* Animations + custom controls (colors mostly via Tailwind dark: on pages) */

@keyframes ng-chip-in {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.94) rotate(-0.5deg);
  }
  70% {
    opacity: 1;
    transform: translateY(-2px) scale(1.02) rotate(0.3deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

.ng-chip {
  position: relative;
  opacity: 0;
  animation: ng-chip-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--ng-stagger, 0ms);
}

/* Copy flash on ::after so we never replace ng-chip-in (which would snap opacity back to 0). */
.ng-chip::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 0 0 0 rgb(16 185 129 / 0);
}

.ng-chip.ng-chip-copied::after {
  animation: ng-chip-copied-overlay 0.75s ease-out;
}

.ng-chip:focus {
  outline: none;
}

.ng-chip:focus-visible {
  outline: 2px solid rgb(16 185 129);
  outline-offset: 2px;
}

.dark .ng-chip:focus-visible {
  outline-color: rgb(45 212 191);
}

@keyframes ng-chip-copied-overlay {
  0% {
    box-shadow: 0 0 0 0 rgb(16 185 129 / 0);
  }
  40% {
    box-shadow: 0 0 0 4px rgb(16 185 129 / 0.5);
  }
  100% {
    box-shadow: 0 0 0 0 rgb(16 185 129 / 0);
  }
}

.dark .ng-chip.ng-chip-copied::after {
  animation-name: ng-chip-copied-overlay-dark;
}

@keyframes ng-chip-copied-overlay-dark {
  0% {
    box-shadow: 0 0 0 0 rgb(45 212 191 / 0);
  }
  40% {
    box-shadow: 0 0 0 4px rgb(45 212 191 / 0.55);
  }
  100% {
    box-shadow: 0 0 0 0 rgb(45 212 191 / 0);
  }
}

#home-preview-name.ng-home-copied {
  animation: ng-home-name-copied 0.65s ease-out;
}

@keyframes ng-home-name-copied {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.04);
    filter: brightness(1.12);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.ng-gen-pulse {
  animation: ng-gen-pulse 0.55s ease-out;
}

@keyframes ng-gen-pulse {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

#field-count-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  border-radius: 9999px;
  background: linear-gradient(
    to right,
    rgb(16 185 129 / 0.35),
    rgb(16 185 129 / 0.12)
  );
  outline: none;
}

.dark #field-count-slider {
  background: linear-gradient(
    to right,
    rgb(45 212 191 / 0.45),
    rgb(45 212 191 / 0.12)
  );
}

#field-count-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: #10b981;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
  cursor: pointer;
}

.dark #field-count-slider::-webkit-slider-thumb {
  background: #2dd4bf;
  border-color: #1c1917;
}

#field-count-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: #10b981;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
  cursor: pointer;
}

.dark #field-count-slider::-moz-range-thumb {
  background: #2dd4bf;
  border-color: #1c1917;
}

@media (prefers-reduced-motion: reduce) {
  .ng-chip {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .ng-chip.ng-chip-copied::after {
    animation: none;
  }
  .ng-gen-pulse {
    animation: none;
  }
}
