/* =============================================
   GRAVITI - Animaciones
   ============================================= */

/* ---- Keyframes ---- */

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.3); }
}

@keyframes fillBar {
  from { width: 0; }
  to   { width: var(--fill, 75%); }
}

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

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

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

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

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

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

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

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

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

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

/* ---- Clases de animación ---- */

.anim-fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.anim-fade-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.anim-fade-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.anim-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Se activan cuando el elemento entra al viewport */
.is-visible {
  opacity: 1 !important;
  transform: none !important;
}

/* Delays escalonados */
.delay-100 { transition-delay: 0.10s; }
.delay-200 { transition-delay: 0.20s; }
.delay-300 { transition-delay: 0.30s; }
.delay-400 { transition-delay: 0.40s; }
.delay-500 { transition-delay: 0.50s; }
.delay-600 { transition-delay: 0.60s; }

/* ---- Elementos decorativos flotantes ---- */

.float-anim {
  animation: float 5s ease-in-out infinite;
}

.float-anim-slow {
  animation: float 7s ease-in-out infinite;
}

/* ---- Shimmer (loading / badge) ---- */

.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.0) 0%,
    rgba(255,255,255,0.06) 50%,
    rgba(255,255,255,0.0) 100%
  );
  background-size: 200% auto;
  animation: shimmer 2.5s linear infinite;
}

/* ---- Barra de progreso animada ---- */

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gradient-main, linear-gradient(135deg, #4361ee, #4cc9f0));
  border-radius: 3px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Partículas decorativas ---- */

.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: float var(--dur, 6s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

/* ---- Línea de escritura ---- */

.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--accent, #4361ee);
  animation:
    typing 3.5s steps(40, end) forwards,
    blink-caret 0.7s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to   { width: 100%; }
}

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

/* ---- Hover glow en cards ---- */

.card-glow {
  transition: box-shadow 0.3s ease;
}

.card-glow:hover {
  box-shadow:
    0 0 20px rgba(67, 97, 238, 0.2),
    0 0 60px rgba(67, 97, 238, 0.08),
    0 8px 32px rgba(0,0,0,0.5);
}

/* ---- Ripple en botones ---- */

.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  width: 10px;
  height: 10px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: transform 0.5s ease, opacity 0.5s ease;
}

.btn-ripple:active::after {
  transform: translate(-50%, -50%) scale(20);
  opacity: 0;
  transition: 0s;
}

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

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 25%,
    rgba(255,255,255,0.05) 50%,
    var(--bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* ---- Gradient border animado ---- */

.gradient-border {
  position: relative;
  border-radius: var(--radius-lg);
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, #4361ee, #4cc9f0, #f72585, #4361ee);
  background-size: 300% 300%;
  animation: shimmer 4s linear infinite;
  z-index: -1;
}

/* ---- Notificación toast ---- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  box-shadow: var(--shadow-accent);
  z-index: 9999;
  animation: slideDown 0.3s ease;
  max-width: 360px;
}

.toast i { font-size: 1.2rem; }
.toast.success i { color: var(--accent-green); }
.toast.error   i { color: var(--accent-pink); }

/* ---- Scroll indicator ---- */

.scroll-indicator {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  animation: float 3s ease-in-out infinite;
}

.scroll-indicator .mouse {
  width: 24px;
  height: 40px;
  border: 2px solid var(--text-muted);
  border-radius: 12px;
  position: relative;
  display: flex;
  justify-content: center;
}

.scroll-indicator .mouse::after {
  content: '';
  width: 4px;
  height: 8px;
  background: var(--accent-light);
  border-radius: 2px;
  position: absolute;
  top: 6px;
  animation: scrollDown 1.5s ease infinite;
}

@keyframes scrollDown {
  0%   { opacity: 1; top: 6px; }
  100% { opacity: 0; top: 20px; }
}
