/* ============================================================
   HolaDoc! — Animations (animations.css)
   Keyframes, utility classes, 3D transforms, stagger, and
   page-transition helpers.
   ============================================================ */

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

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

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

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

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

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

@keyframes bounceIn {
  0%   { transform: scale(0); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

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

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

@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

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

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(232, 41, 28, 0.2); }
  50%      { box-shadow: 0 0 40px rgba(232, 41, 28, 0.4); }
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

@keyframes heartbeat {
  0%   { transform: scale(1); }
  14%  { transform: scale(1.15); }
  28%  { transform: scale(1); }
  42%  { transform: scale(1.15); }
  70%  { transform: scale(1); }
}

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

/* -------------------------------------------------------
   Animation utility classes
   ------------------------------------------------------- */
.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

.slide-up {
  animation: slideUp 0.4s ease forwards;
}

.slide-down {
  animation: slideDown 0.4s ease forwards;
}

.slide-in-right {
  animation: slideInRight 0.3s ease forwards;
}

.slide-in-left {
  animation: slideInLeft 0.3s ease forwards;
}

.bounce-in {
  animation: bounceIn 0.4s ease forwards;
}

.scale-in {
  animation: scaleIn 0.3s ease forwards;
}

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

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

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

.shimmer {
  background: linear-gradient(90deg,
    var(--bg-secondary) 25%,
    var(--bg-primary) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.shake {
  animation: shake 0.5s ease;
}

.heartbeat {
  animation: heartbeat 1.4s ease-in-out infinite;
}

/* -------------------------------------------------------
   3D Transform effects
   ------------------------------------------------------- */
.transform-3d {
  perspective: 1000px;
  transform-style: preserve-3d;
}

.hover-lift {
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

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

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

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

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(3, 76, 129, 0.2);
}

/* -------------------------------------------------------
   Stagger children animation (for lists / grids)
   ------------------------------------------------------- */
.stagger-children > * {
  opacity: 0;
  animation: slideUp 0.4s ease forwards;
}

.stagger-children > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2)  { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3)  { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4)  { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5)  { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6)  { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7)  { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8)  { animation-delay: 0.40s; }
.stagger-children > *:nth-child(9)  { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.50s; }

/* Faster variant for dense lists */
.stagger-fast > * {
  opacity: 0;
  animation: fadeIn 0.25s ease forwards;
}

.stagger-fast > *:nth-child(1) { animation-delay: 0.03s; }
.stagger-fast > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-fast > *:nth-child(3) { animation-delay: 0.09s; }
.stagger-fast > *:nth-child(4) { animation-delay: 0.12s; }
.stagger-fast > *:nth-child(5) { animation-delay: 0.15s; }
.stagger-fast > *:nth-child(6) { animation-delay: 0.18s; }
.stagger-fast > *:nth-child(7) { animation-delay: 0.21s; }
.stagger-fast > *:nth-child(8) { animation-delay: 0.24s; }

/* -------------------------------------------------------
   Page transitions
   ------------------------------------------------------- */
.page-enter {
  animation: fadeIn 0.3s ease, slideUp 0.3s ease;
}

.page-exit {
  animation: fadeOut 0.2s ease forwards;
}

/* -------------------------------------------------------
   Skeleton loading placeholder
   ------------------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-secondary) 25%,
    #dce3eb 37%,
    var(--bg-secondary) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: 0.6em;
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-circle {
  border-radius: 50%;
}

.skeleton-card {
  height: 140px;
  border-radius: var(--radius-lg);
}

/* -------------------------------------------------------
   Animation delay utilities
   ------------------------------------------------------- */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* -------------------------------------------------------
   Animation fill-mode helpers
   ------------------------------------------------------- */
.anim-forwards {
  animation-fill-mode: forwards;
}

.anim-both {
  animation-fill-mode: both;
}
