/**
 * Animations - Glow effects, hover states, gradientes
 */

/* =========================
   KEYFRAME ANIMATIONS
   ========================= */

/* Glow pulse effect */
@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 80px rgba(0, 212, 255, 0.6);
  }
}

/* Rotate animation */
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide in from left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale in */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Shimmer effect */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Floating animation */
@keyframes floating {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Border rotate */
@keyframes borderRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* =========================
   UTILITY ANIMATION CLASSES
   ========================= */

.animate-fadeIn {
  animation: fadeIn 0.6s ease-out;
}

.animate-slideInLeft {
  animation: slideInLeft 0.6s ease-out;
}

.animate-slideInRight {
  animation: slideInRight 0.6s ease-out;
}

.animate-scaleIn {
  animation: scaleIn 0.4s ease-out;
}

.animate-glow {
  animation: glow-pulse 2s ease-in-out infinite;
}

.animate-floating {
  animation: floating 3s ease-in-out infinite;
}

/* =========================
   TOAST ANIMATIONS
   ========================= */

.toast-container {
  position: fixed;
  top: var(--spacing-xl);
  right: var(--spacing-xl);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  max-width: 400px;
}

.toast {
  background: var(--color-bg-lighter);
  border: 2px solid rgba(0, 212, 255, 0.3);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateX(100%);
  transition: all var(--transition-slow);
}

.toast.toast-show {
  opacity: 1;
  transform: translateX(0);
}

.toast.toast-hide {
  opacity: 0;
  transform: translateX(100%);
}

.toast-content {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
}

.toast-content svg {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.toast-message {
  flex: 1;
  font-size: var(--font-size-sm);
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: var(--font-size-xl);
  padding: 0;
  line-height: 1;
  transition: color var(--transition-base);
}

.toast-close:hover {
  color: var(--color-text);
}

/* Toast types */
.toast-success {
  border-color: var(--color-success);
}

.toast-success svg {
  stroke: var(--color-success);
}

.toast-error {
  border-color: var(--color-error);
}

.toast-error svg {
  stroke: var(--color-error);
}

.toast-warning {
  border-color: var(--color-warning);
}

.toast-warning svg {
  stroke: var(--color-warning);
}

.toast-info {
  border-color: var(--color-info);
}

.toast-info svg {
  stroke: var(--color-info);
}

/* =========================
   MODAL ANIMATIONS
   ========================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(var(--blur-sm));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  transition: opacity var(--transition-slow);
  padding: var(--spacing-lg);
}

.modal-overlay.modal-show {
  opacity: 1;
}

.modal-overlay.modal-closing {
  opacity: 0;
}

.modal {
  background: var(--color-bg-lighter);
  border: 2px solid rgba(0, 212, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform var(--transition-slow);
}

.modal-overlay.modal-show .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-xl);
  border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-2xl);
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: var(--font-size-3xl);
  line-height: 1;
  padding: 0;
  transition: color var(--transition-base);
}

.modal-close:hover {
  color: var(--color-primary);
}

.modal-body {
  padding: var(--spacing-xl);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-md);
  padding: var(--spacing-xl);
  border-top: 1px solid rgba(0, 212, 255, 0.2);
}

/* =========================
   LOADING ANIMATIONS
   ========================= */

.loading-spinner {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  gap: var(--spacing-lg);
}

.spinner {
  position: relative;
  width: 80px;
  height: 80px;
}

/* Outer ring */
.spinner::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid rgba(231, 76, 60, 0.1);
  border-radius: 50%;
}

/* Animated ring */
.spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spinnerRotate 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-circle {
  position: absolute;
  inset: 8px;
  border: 3px solid transparent;
  border-top-color: rgba(231, 76, 60, 0.5);
  border-radius: 50%;
  animation: spinnerRotate 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
}

/* Inner dot */
.spinner-circle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: var(--color-primary);
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes spinnerRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.5;
  }
}

/* Loading text */
.loading-spinner::after {
  content: 'LOADING...';
  font-family: var(--font-heading);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-primary);
  letter-spacing: 3px;
  animation: loadingText 1.5s ease-in-out infinite;
}

@keyframes loadingText {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.loading-hide {
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}

/* Inline loading (for content areas) */
.loading-inline {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-3xl);
  gap: var(--spacing-lg);
  background: transparent;
  backdrop-filter: none;
}

.loading-inline .spinner {
  display: none;
}

.loading-inline::before {
  content: '';
  width: 200px;
  height: 4px;
  background: rgba(231, 76, 60, 0.1);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.loading-inline::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  border-radius: 10px;
  animation: loadingBar 1.2s ease-in-out infinite;
}

@keyframes loadingBar {
  0% {
    transform: translate(-50%, -50%) translateX(-100%);
  }
  50% {
    transform: translate(-50%, -50%) translateX(0%);
  }
  100% {
    transform: translate(-50%, -50%) translateX(100%);
  }
}

/* Progress bar wrapper for better effect */
.loading-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-3xl);
  gap: var(--spacing-lg);
}

.progress-bar-container {
  width: 250px;
  height: 6px;
  background: rgba(231, 76, 60, 0.15);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #ff6b5b);
  border-radius: 10px;
  animation: progressFill 0.8s ease-out forwards;
  box-shadow: 0 0 10px var(--color-primary);
}

@keyframes progressFill {
  0% { width: 0%; }
  20% { width: 20%; }
  50% { width: 60%; }
  80% { width: 85%; }
  100% { width: 100%; }
}

.progress-text {
  font-family: var(--font-heading);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* =========================
   HOVER EFFECTS
   ========================= */

.hover-lift {
  transition: transform var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
}

.hover-glow {
  transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
  box-shadow: var(--shadow-glow);
}

.hover-scale {
  transition: transform var(--transition-base);
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* =========================
   PAGE TRANSITIONS
   ========================= */

.page-enter {
  animation: fadeIn 0.4s ease-out;
}

.page-exit {
  animation: fadeOut 0.4s ease-out;
}

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

/* =========================
   RESPONSIVE ANIMATIONS
   ========================= */

@media (width <= 768px) {
  .toast-container {
    top: var(--spacing-md);
    right: var(--spacing-md);
    left: var(--spacing-md);
    max-width: none;
  }

  .modal {
    margin: var(--spacing-md);
    max-width: none;
  }
}

/* =========================
   PREMIUM ANIMATIONS
   ========================= */

/* Gradient text animation */
@keyframes gradientText {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.gradient-text-animated {
  background: linear-gradient(
    90deg,
    var(--color-primary),
    #ff6b5b,
    #ffb347,
    var(--color-primary)
  );
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientText 4s ease infinite;
}

/* Animated gradient border */
@keyframes borderGradient {
  0%, 100% {
    border-color: var(--color-primary);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
  }
  50% {
    border-color: #ff6b5b;
    box-shadow: 0 0 30px rgba(255, 107, 91, 0.4);
  }
}

.border-glow-animated {
  animation: borderGradient 3s ease-in-out infinite;
}

/* Text reveal from bottom */
@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-up {
  opacity: 0;
  transform: translateY(30px);
}

.reveal-up.revealed {
  animation: revealUp 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Staggered reveal for children */
.stagger-children.revealed > * {
  animation: revealUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  opacity: 0;
}

.stagger-children.revealed > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-children.revealed > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-children.revealed > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-children.revealed > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-children.revealed > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-children.revealed > *:nth-child(6) { animation-delay: 0.6s; }
.stagger-children.revealed > *:nth-child(7) { animation-delay: 0.7s; }
.stagger-children.revealed > *:nth-child(8) { animation-delay: 0.8s; }
.stagger-children.revealed > *:nth-child(9) { animation-delay: 0.9s; }
.stagger-children.revealed > *:nth-child(10) { animation-delay: 1.0s; }
.stagger-children.revealed > *:nth-child(11) { animation-delay: 1.1s; }
.stagger-children.revealed > *:nth-child(12) { animation-delay: 1.2s; }

/* Scale reveal */
@keyframes revealScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.8);
}

.reveal-scale.revealed {
  animation: revealScale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* 3D Card tilt effect on hover */
.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.card-3d:hover {
  transform: perspective(1000px) rotateX(2deg) rotateY(-2deg) translateY(-8px);
}

/* Premium glow effect */
@keyframes premiumGlow {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(231, 76, 60, 0.2),
      0 0 40px rgba(231, 76, 60, 0.1),
      inset 0 0 60px rgba(231, 76, 60, 0.05);
  }
  50% {
    box-shadow:
      0 0 30px rgba(231, 76, 60, 0.3),
      0 0 60px rgba(231, 76, 60, 0.2),
      inset 0 0 80px rgba(231, 76, 60, 0.1);
  }
}

.premium-glow {
  animation: premiumGlow 3s ease-in-out infinite;
}

/* Shine sweep effect */
@keyframes shineSweep {
  0% {
    transform: translateX(-100%) skewX(-15deg);
  }
  100% {
    transform: translateX(300%) skewX(-15deg);
  }
}

.shine-effect {
  position: relative;
  overflow: hidden;
}

.shine-effect::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: translateX(-100%) skewX(-15deg);
}

.shine-effect:hover::after {
  animation: shineSweep 0.8s ease-out;
}

/* Floating particles background */
@keyframes float1 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(10px, -15px) rotate(5deg); }
  50% { transform: translate(-5px, -25px) rotate(-5deg); }
  75% { transform: translate(-15px, -10px) rotate(3deg); }
}

@keyframes float2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(-20px, -20px) rotate(-10deg); }
  66% { transform: translate(15px, -30px) rotate(10deg); }
}

@keyframes float3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -40px); }
}

.particles-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(231, 76, 60, 0.3), transparent);
  filter: blur(1px);
}

.particle:nth-child(1) {
  width: 4px;
  height: 4px;
  top: 20%;
  left: 10%;
  animation: float1 15s ease-in-out infinite;
}

.particle:nth-child(2) {
  width: 6px;
  height: 6px;
  top: 40%;
  left: 80%;
  animation: float2 18s ease-in-out infinite;
}

.particle:nth-child(3) {
  width: 3px;
  height: 3px;
  top: 60%;
  left: 30%;
  animation: float3 12s ease-in-out infinite;
}

.particle:nth-child(4) {
  width: 5px;
  height: 5px;
  top: 80%;
  left: 70%;
  animation: float1 20s ease-in-out infinite reverse;
}

.particle:nth-child(5) {
  width: 4px;
  height: 4px;
  top: 30%;
  left: 50%;
  animation: float2 16s ease-in-out infinite;
}

.particle:nth-child(6) {
  width: 3px;
  height: 3px;
  top: 70%;
  left: 15%;
  animation: float3 14s ease-in-out infinite reverse;
}

/* Animated underline */
@keyframes underlineExpand {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.animated-underline {
  position: relative;
  display: inline-block;
}

.animated-underline::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.animated-underline:hover::after {
  transform: scaleX(1);
}

/* Pulse ring effect for buttons */
@keyframes pulseRing {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.pulse-ring {
  position: relative;
}

.pulse-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--color-primary);
  opacity: 0;
  z-index: -1;
}

.pulse-ring:hover::before {
  animation: pulseRing 0.6s ease-out;
}

/* Text glow effect */
@keyframes textGlow {
  0%, 100% {
    text-shadow:
      0 0 10px rgba(231, 76, 60, 0.5),
      0 0 20px rgba(231, 76, 60, 0.3),
      0 0 30px rgba(231, 76, 60, 0.2);
  }
  50% {
    text-shadow:
      0 0 20px rgba(231, 76, 60, 0.7),
      0 0 40px rgba(231, 76, 60, 0.5),
      0 0 60px rgba(231, 76, 60, 0.3);
  }
}

.text-glow {
  animation: textGlow 2s ease-in-out infinite;
}

/* Smooth counter animation */
@keyframes countUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.count-animated {
  overflow: hidden;
}

.count-animated span {
  display: inline-block;
  animation: countUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Magnetic button effect holder */
.magnetic-btn {
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Card hover lift with shadow */
@keyframes cardLiftShadow {
  from {
    transform: translateY(0);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  }
  to {
    transform: translateY(-8px);
    box-shadow:
      0 20px 40px rgba(0, 0, 0, 0.3),
      0 0 30px rgba(231, 76, 60, 0.1);
  }
}

.card-lift-shadow {
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card-lift-shadow:hover {
  transform: translateY(-8px);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 30px rgba(231, 76, 60, 0.1);
}

/* Border animation rotation */
@keyframes borderRotate {
  from {
    --angle: 0deg;
  }
  to {
    --angle: 360deg;
  }
}

@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.animated-border {
  position: relative;
  background: var(--color-bg-card);
}

.animated-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  z-index: -1;
  background: conic-gradient(
    from var(--angle),
    var(--color-primary),
    #ff6b5b,
    var(--color-primary)
  );
  border-radius: inherit;
  animation: borderRotate 4s linear infinite;
}

.animated-border::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-bg-card);
  border-radius: inherit;
  z-index: -1;
}

/* Typewriter effect */
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blinkCursor {
  50% { border-color: transparent; }
}

.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--color-primary);
  animation:
    typewriter 3s steps(30) forwards,
    blinkCursor 0.75s step-end infinite;
}

/* Smooth page transition */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
