/* ========================================
   ANIMACIONES - NotIA Design System
   ======================================== */

/* ========================================
   TRANSICIONES BASE
   ======================================== */

* {
  transition: var(--transition-base);
}

/* ========================================
   ANIMACIONES DE ENTRADA
   ======================================== */

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

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

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

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

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

/* ========================================
   ANIMACIONES DE HOVER
   ======================================== */

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translateY(0);
  }
  40%, 43% {
    transform: translateY(-10px);
  }
  70% {
    transform: translateY(-5px);
  }
  90% {
    transform: translateY(-2px);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* ========================================
   ANIMACIONES DE CARGA
   ======================================== */

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

@keyframes loadingDots {
  0%, 20% {
    color: transparent;
    text-shadow: 0.25em 0 0 transparent, 0.5em 0 0 transparent;
  }
  40% {
    color: var(--primary-color);
    text-shadow: 0.25em 0 0 transparent, 0.5em 0 0 transparent;
  }
  60% {
    text-shadow: 0.25em 0 0 var(--primary-color), 0.5em 0 0 transparent;
  }
  80%, 100% {
    text-shadow: 0.25em 0 0 var(--primary-color), 0.5em 0 0 var(--primary-color);
  }
}

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

/* ========================================
   CLASES DE ANIMACIÓN
   ======================================== */

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

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

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

.animate-slide-in-up {
  animation: slideInUp 0.6s ease-out;
}

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

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-bounce {
  animation: bounce 1s infinite;
}

.animate-shake {
  animation: shake 0.5s ease-in-out;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-loading-dots::after {
  content: '...';
  animation: loadingDots 1.5s infinite;
}

/* ========================================
   TRANSICIONES DE COMPONENTES
   ======================================== */

/* Cards */
.card {
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card:active {
  transform: translateY(-2px);
}

/* Botones */
.btn {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

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

.btn:active {
  transform: translateY(0);
}

/* Formularios */
.form-control {
  transition: all 0.3s ease;
}

.form-control:focus {
  transform: scale(1.02);
}

/* Sidebar */
.sidebar {
  transition: all 0.3s ease;
}

.sidebar.collapsed {
  transition: all 0.3s ease;
}

/* Navegación */
.nav-link {
  transition: all 0.3s ease;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--text-white);
  transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ========================================
   ANIMACIONES DE PÁGINA
   ======================================== */

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

.page-exit {
  animation: fadeOut 0.3s ease-in;
}

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

/* ========================================
   LOADING STATES
   ======================================== */

.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary-color);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ========================================
   NOTIFICACIONES
   ======================================== */

.notification {
  animation: slideInRight 0.5s ease-out;
}

.notification.hide {
  animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideOutRight {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* ========================================
   MODALES
   ======================================== */

.modal {
  animation: scaleIn 0.3s ease-out;
}

.modal-backdrop {
  animation: fadeIn 0.3s ease-out;
}

/* ========================================
   TABLAS
   ======================================== */

.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-sm);
}

/* ========================================
   BADGES Y ALERTAS
   ======================================== */

.badge {
  transition: all 0.3s ease;
}

.badge:hover {
  transform: scale(1.1);
}

.alert {
  animation: slideInUp 0.5s ease-out;
}

.alert.dismissing {
  animation: slideOutUp 0.3s ease-in forwards;
}

@keyframes slideOutUp {
  to {
    transform: translateY(-100%);
    opacity: 0;
  }
}

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

@media (max-width: 768px) {
  .card:hover {
    transform: none;
  }
  
  .btn:hover {
    transform: none;
  }
  
  .table tbody tr:hover {
    transform: none;
  }
}

/* ========================================
   PREFERENCIAS DE REDUCCIÓN DE MOVIMIENTO
   ======================================== */

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

/* ========================================
   UTILIDADES DE ANIMACIÓN
   ======================================== */

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

.animate-duration-fast { animation-duration: 0.3s; }
.animate-duration-normal { animation-duration: 0.6s; }
.animate-duration-slow { animation-duration: 1s; }

.animate-iteration-1 { animation-iteration-count: 1; }
.animate-iteration-2 { animation-iteration-count: 2; }
.animate-iteration-infinite { animation-iteration-count: infinite; }
