/* ==========================================================================
   CPES AI — animations.css
   All CSS animations & transitions for the interface
   ========================================================================== */


/* --------------------------------------------------------------------------
   Loader animations
   -------------------------------------------------------------------------- */

/* Fullscreen loader overlay */
.app-loader {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background-color: #000000;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.app-loader.loader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Pulsing rings behind the logo */
.loader-logo {
  position: relative;
  width: 96px;
  height: 96px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-logo svg {
  width: 60px;
  height: 60px;
  color: #ffffff;
  animation: logoBreath 1.6s ease-in-out infinite;
}

.loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  animation: ringPulse 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loader-ring::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 24px;
  border-top: 2px solid #ffffff;
  transform: rotate(0deg);
  animation: ringSpin 1.8s linear infinite;
}

.loader-name {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  animation: fadeInUp 0.6s ease both;
}

.loader-tagline {
  color: #9a9aa5;
  font-size: 0.85rem;
  margin-bottom: 1.75rem;
  letter-spacing: 0.04em;
  animation: fadeInUp 0.6s ease 0.15s both;
}

.loader-progress {
  width: 220px;
  height: 4px;
  border-radius: 8px;
  background-color: #26262a;
  overflow: hidden;
  animation: fadeInUp 0.6s ease 0.3s both;
}

.loader-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 8px;
  background-color: #ffffff;
  transition: width 0.15s ease;
}

.loader-percent {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: #9a9aa5;
  font-weight: 600;
  letter-spacing: 0.08em;
  animation: fadeInUp 0.6s ease 0.4s both;
}

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

@keyframes ringPulse {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

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


/* --------------------------------------------------------------------------
   Message & content entrance
   -------------------------------------------------------------------------- */

@keyframes msgIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

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

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

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

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes successIn {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  60% {
    transform: scale(1.03);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Entrance helper classes */
.animate-fade {
  animation: fadeIn 0.5s ease both;
}

.animate-fade-up {
  animation: fadeInUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.animate-fade-down {
  animation: fadeInDown 0.5s ease both;
}

.animate-scale {
  animation: scaleIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Staggered delays for suggestion cards / auth elements */
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }
.delay-4 { animation-delay: 0.32s; }
.delay-5 { animation-delay: 0.4s; }
.delay-6 { animation-delay: 0.48s; }
.delay-7 { animation-delay: 0.56s; }
.delay-8 { animation-delay: 0.64s; }


/* --------------------------------------------------------------------------
   Typing indicator dots
   -------------------------------------------------------------------------- */

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}


/* --------------------------------------------------------------------------
   Button ripple effect
   -------------------------------------------------------------------------- */

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background-color: var(--ripple-bg, rgba(255, 255, 255, 0.45));
  transform: scale(0);
  animation: rippleAnim 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleAnim {
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}


/* --------------------------------------------------------------------------
   Skeleton loading shine
   -------------------------------------------------------------------------- */

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


/* --------------------------------------------------------------------------
   Theme switching
   -------------------------------------------------------------------------- */

/* Smoothly cross-fade colors while switching themes */
body.theme-transition,
body.theme-transition * {
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease, box-shadow 0.3s ease !important;
}


/* --------------------------------------------------------------------------
   Misc micro-interactions
   -------------------------------------------------------------------------- */

/* Hover lift for cards */
.hover-lift {
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.22s ease;
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
}

/* Pulsing status dot */
.pulse-dot {
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-color: currentColor;
  animation: pulseDot 1.6s ease-out infinite;
}

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


/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
