/* ===================================================================
   VynaaAPI — animations.css
   Global animation system: page loader, transitions, scroll reveals,
   hover effects, button pulses, floating elements.
   =================================================================== */

/* =============================================
   1. PAGE LOADER (Full-screen branded splash)
   ============================================= */
#page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#page-loader.loader-hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: loaderLogoIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes loaderLogoIn {
  from { opacity: 0; transform: scale(0.7) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.loader-logo-img {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(255, 11, 125, 0.35);
  animation: loaderLogoPulse 2s ease-in-out infinite;
}

@keyframes loaderLogoPulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(255, 11, 125, 0.35); }
  50%       { box-shadow: 0 12px 48px rgba(255, 11, 125, 0.6); }
}

.loader-brand {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.03em;
  font-family: 'Outfit', sans-serif;
}

.loader-bar-wrap {
  margin-top: 28px;
  width: 160px;
  height: 3px;
  background: var(--border-card);
  border-radius: 99px;
  overflow: hidden;
  animation: fadeInUp 0.5s 0.3s both;
}

.loader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #ff6ba8);
  border-radius: 99px;
  animation: loaderBarAnim 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

@keyframes loaderBarAnim {
  0%   { width: 0%; }
  40%  { width: 65%; }
  70%  { width: 85%; }
  100% { width: 100%; }
}

.loader-tagline {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  animation: fadeInUp 0.5s 0.4s both;
}

/* =============================================
   2. ROUTE TRANSITION OVERLAY (login → dashboard)
   ============================================= */
#route-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: rgba(10, 10, 18, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#route-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.route-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  color: white;
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Mascot image */
.route-mascot {
  width: 110px;
  height: 110px;
  max-width: 28vw;
  object-fit: contain;
  animation: routeMascotBounce 1.6s ease-in-out infinite;
  filter: drop-shadow(0 6px 18px rgba(255, 11, 125, 0.35));
  margin-bottom: 10px;
}

@media (max-width: 480px) {
  .route-mascot {
    width: 85px;
    height: 85px;
    max-width: 40vw;
  }
}

@keyframes routeMascotBounce {
  0%, 100% { transform: translateY(0px) scale(1); }
  30%       { transform: translateY(-14px) scale(1.04); }
  60%       { transform: translateY(-6px) scale(1.01); }
}

/* Dots loader */
.route-dots {
  display: flex;
  gap: 7px;
  margin-bottom: 16px;
}
.route-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary, #ff0b7d);
  animation: routeDotPulse 1.2s ease-in-out infinite;
}
.route-dots span:nth-child(2) { animation-delay: 0.2s; background: #ff6ba8; }
.route-dots span:nth-child(3) { animation-delay: 0.4s; background: rgba(255,11,125,0.5); }

@keyframes routeDotPulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%           { transform: scale(1.2); opacity: 1; }
}

/* Progress bar */
.route-progress-wrap {
  width: 180px;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 16px;
}
.route-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #ff0b7d, #ff6ba8, #ff0b7d);
  background-size: 200% 100%;
  animation: routeProgressAnim 1.4s ease-in-out infinite,
             routeProgressShimmer 1.4s linear infinite;
}
@keyframes routeProgressAnim {
  0%   { width: 0%; }
  50%  { width: 75%; }
  100% { width: 95%; }
}
@keyframes routeProgressShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.route-overlay-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.04em;
  font-family: 'Outfit', sans-serif;
  animation: routeTextPulse 1.8s ease-in-out infinite;
}
@keyframes routeTextPulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

/* Keep spinner class for backward compat, but hidden now */
.route-spinner { display: none; }

/* =============================================
   3. SCROLL REVEAL ANIMATIONS
   ============================================= */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.reveal-left {
  transform: translateX(-28px);
}

.reveal.reveal-right {
  transform: translateX(28px);
}

.reveal.reveal-scale {
  transform: scale(0.94) translateY(16px);
}

.reveal.in-view {
  opacity: 1;
  transform: none;
}

/* Staggered children */
.reveal-children > * {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-children.in-view > *:nth-child(1) { transition-delay: 0.05s; opacity: 1; transform: none; }
.reveal-children.in-view > *:nth-child(2) { transition-delay: 0.12s; opacity: 1; transform: none; }
.reveal-children.in-view > *:nth-child(3) { transition-delay: 0.19s; opacity: 1; transform: none; }
.reveal-children.in-view > *:nth-child(4) { transition-delay: 0.26s; opacity: 1; transform: none; }
.reveal-children.in-view > *:nth-child(5) { transition-delay: 0.33s; opacity: 1; transform: none; }
.reveal-children.in-view > *:nth-child(6) { transition-delay: 0.40s; opacity: 1; transform: none; }
.reveal-children.in-view > *:nth-child(n+7) { transition-delay: 0.46s; opacity: 1; transform: none; }

/* =============================================
   4. ENTRY ANIMATIONS (page load)
   ============================================= */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes spinAnim {
  to { transform: rotate(360deg); }
}

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

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 11, 125, 0); }
  50%       { box-shadow: 0 0 20px 4px rgba(255, 11, 125, 0.22); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes borderFlow {
  0%   { border-color: var(--primary); }
  33%  { border-color: #ff6ba8; }
  66%  { border-color: #c00056; }
  100% { border-color: var(--primary); }
}

/* =============================================
   5. NAVBAR ENTRY — only .navbar-anim class gets animated
   ============================================= */
/* Removed broad .navbar rule — caused mobile nav to flash */

/* =============================================
   6. HERO SECTION ANIMATIONS
   ============================================= */
.hero-left {
  animation: fadeInLeft 0.7s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-right {
  animation: fadeInRight 0.7s 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-title { animation: fadeInUp 0.6s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both; }
.hero-desc  { animation: fadeInUp 0.6s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both; }
.hero-actions { animation: fadeInUp 0.6s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
.hero-trust { animation: fadeInUp 0.6s 0.38s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* Terminal card float effect */
.terminal-card {
  animation: fadeInRight 0.7s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both,
             floatY 6s 1s ease-in-out infinite;
}

/* =============================================
   7. AUTH PAGE (login/register) ANIMATIONS
   ============================================= */
.auth-card {
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.auth-logo {
  animation: fadeInDown 0.5s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* form-group inside auth-page only */
.auth-page .form-group {
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.auth-page .form-group:nth-child(1) { animation-delay: 0.2s; }
.auth-page .form-group:nth-child(2) { animation-delay: 0.27s; }
.auth-page .form-group:nth-child(3) { animation-delay: 0.34s; }

/* =============================================
   8. DASHBOARD ENTRY — opt-in classes only
   ============================================= */
/* Removed broad .sidebar, .dash-main, .card rules —
   they were catching dropdowns, mobile nav, and notif popovers.
   Use .anim-slide-left, .anim-fade, .anim-card-in instead. */

.anim-slide-left {
  animation: fadeInLeft 0.5s 0.05s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.anim-fade {
  animation: fadeIn 0.5s 0.1s both;
}

.anim-card-in {
  animation: fadeInUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}


/* =============================================
   9. INTERACTIVE HOVER EFFECTS
   ============================================= */

/* Card transition - scoped to avoid dropdown/popover/nav elements */
.card:not(.notif-dropdown-popover):not(.nav-user-dropdown):not([id*="Dropdown"]):not([id*="dropdown"]) {
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.22s ease;
}

/* Card lift on hover — only on real content cards, not nav/notif elements */
.dash-main .card:hover,
.auth-page .card:hover,
.container .card:hover,
.section .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.12),
              0 4px 16px -4px rgba(255, 11, 125, 0.1);
  border-color: rgba(255, 11, 125, 0.18) !important;
}

/* Button press effect */
.btn {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:active {
  transform: scale(0.96) translateY(1px);
}

.btn-pink:hover,
.btn-primary:hover {
  animation: glowPulse 1.5s ease-in-out infinite;
}

/* Sidebar link hover slide */
.sidebar-link {
  transition: background 0.15s, color 0.15s, padding-left 0.2s !important;
}
.sidebar-link:hover {
  padding-left: 16px !important;
}

/* Nav links */
.nav-links a {
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* =============================================
   10. FORM INPUT FOCUS ANIMATIONS
   ============================================= */
.form-control {
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s !important;
}

.form-control:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 11, 125, 0.12) !important;
}

/* =============================================
   11. TOAST ANIMATIONS
   ============================================= */
.toast {
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both !important;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(80px) scale(0.88); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* =============================================
   12. FLOATING BACKGROUND ORBS
   ============================================= */
.anim-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
}

.anim-orb-1 {
  width: 400px;
  height: 400px;
  background: var(--primary);
  opacity: 0.05;
  top: -100px;
  left: -100px;
  animation: orbDrift1 18s ease-in-out infinite;
}

.anim-orb-2 {
  width: 300px;
  height: 300px;
  background: #ff6ba8;
  opacity: 0.04;
  bottom: -80px;
  right: -80px;
  animation: orbDrift2 22s ease-in-out infinite;
}

@keyframes orbDrift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(60px, 40px) scale(1.1); }
  66%  { transform: translate(-30px, 70px) scale(0.95); }
}

@keyframes orbDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-50px, -30px) scale(1.05); }
  66%  { transform: translate(40px, -60px) scale(0.98); }
}

/* =============================================
   13. STATUS DOT PING ANIMATION
   ============================================= */
.status-dot-nav,
.footer-status-dot {
  position: relative;
}

.status-dot-nav::after,
.footer-status-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0;
  animation: pingAnim 2s ease-out infinite;
}

@keyframes pingAnim {
  0%   { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.4); }
}

/* =============================================
   14. COUNTER NUMBER ANIMATION
   ============================================= */
.counter-animated {
  display: inline-block;
  animation: counterPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes counterPop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* =============================================
   15. GRADIENT SHIMMER (for API key display, badges)
   ============================================= */
.shimmer-text {
  background: linear-gradient(
    90deg,
    var(--primary) 0%,
    #ff6ba8 40%,
    var(--primary) 80%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

/* =============================================
   16. MODAL ANIMATION
   ============================================= */
.modal-overlay {
  animation: fadeIn 0.2s ease both !important;
}

.modal-box {
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both !important;
}

/* =============================================
   17. LOADING STATE (buttons)
   ============================================= */
.btn-loading {
  pointer-events: none;
  opacity: 0.75;
  position: relative;
  overflow: hidden;
}

.btn-loading::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.15) 50%,
    transparent 100%
  );
  animation: shimmer 1.2s linear infinite;
}

/* =============================================
   18. SCROLL PROGRESS BAR (top of page)
   ============================================= */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #ff6ba8);
  z-index: 99997;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* =============================================
   19. PAGE TRANSITION — removed body fadeIn (caused nav flash)
   ============================================= */

/* =============================================
   20. MOBILE RESPONSIVENESS
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .anim-orb { display: none; }
}

