/* UstadAPK Custom Styles — Animations, Glassmorphism, Reduced Motion & Helpers */

/* Clean, distraction-free inputs (no colored focus outlines/rings while typing or selecting) */
input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible,
select:focus,
select:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

/* Animated gradient text for hero headline */
.gradient-text-animated {
  background: linear-gradient(110deg, #7c3aed 0%, #2563eb 30%, #06b6d4 55%, #7c3aed 85%, #2563eb 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientFlow 7s ease infinite;
}

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

/* Soft ambient hero background mesh */
.hero-mesh {
  background-image:
    radial-gradient(at 15% 15%, rgba(124, 58, 237, 0.14) 0px, transparent 50%),
    radial-gradient(at 85% 20%, rgba(37, 99, 235, 0.14) 0px, transparent 50%),
    radial-gradient(at 50% 90%, rgba(6, 182, 212, 0.12) 0px, transparent 50%);
}

.dark .hero-mesh {
  background-image:
    radial-gradient(at 15% 15%, rgba(124, 58, 237, 0.24) 0px, transparent 52%),
    radial-gradient(at 85% 20%, rgba(37, 99, 235, 0.22) 0px, transparent 52%),
    radial-gradient(at 50% 90%, rgba(6, 182, 212, 0.18) 0px, transparent 52%);
}

/* Floating ambient orb */
.float-slow {
  animation: floatSlow 9s ease-in-out infinite;
}

.float-slower {
  animation: floatSlow 13s ease-in-out infinite reverse;
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-16px) scale(1.04); }
}

/* Scroll reveal via IntersectionObserver */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Loading skeleton shimmer */
.skeleton {
  position: relative;
  overflow: hidden;
  background-color: rgba(148, 163, 184, 0.18);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: shimmer 1.5s infinite;
}

.dark .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

/* Toast notification transitions */
.toast-enter {
  animation: toastSlideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.toast-exit {
  animation: toastSlideOut 0.22s ease forwards;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* Custom sleek scrollbar */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.35);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.6);
}

/* Range slider styling */
input[type='range'].brand-range {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #2563eb, #06b6d4);
  outline: none;
}

input[type='range'].brand-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #6d28d9;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease;
}

input[type='range'].brand-range::-webkit-slider-thumb:hover {
  transform: scale(1.12);
}

input[type='range'].brand-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #6d28d9;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
  cursor: pointer;
}

/* Typing test active caret */
.typing-caret {
  position: relative;
  background: rgba(124, 58, 237, 0.18);
  border-bottom: 2px solid #7c3aed;
  border-radius: 2px;
}

.dark .typing-caret {
  background: rgba(167, 139, 250, 0.22);
  border-bottom-color: #a78bfa;
}

/* Regex match highlights */
.regex-match-even {
  background-color: rgba(124, 58, 237, 0.22);
  border-bottom: 2px solid #7c3aed;
  border-radius: 3px;
}

.regex-match-odd {
  background-color: rgba(6, 182, 212, 0.24);
  border-bottom: 2px solid #06b6d4;
  border-radius: 3px;
}

.dark .regex-match-even {
  background-color: rgba(167, 139, 250, 0.28);
  border-bottom-color: #a78bfa;
}

.dark .regex-match-odd {
  background-color: rgba(34, 211, 238, 0.26);
  border-bottom-color: #22d3ee;
}

/* JSON Tree View */
.json-tree-toggle {
  cursor: pointer;
  user-select: none;
}

/* Ad slot fixed min-height to prevent CLS */
.ad-slot-wrapper {
  contain: layout style;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .gradient-text-animated,
  .float-slow,
  .float-slower,
  .skeleton::after,
  .toast-enter,
  .toast-exit {
    animation: none !important;
  }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
