/* ============================================================
   CRM Takana — Animations & Micro-interactions
   ============================================================ */

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

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

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

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(20px, -20px); }
  66% { transform: translate(-15px, 15px); }
}

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

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

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

@keyframes bounce-in {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.05); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

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

@keyframes count-up {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   TRANSITIONS DE VISTAS
   ============================================================ */
.view {
  animation: fadeSlideIn 0.3s ease;
}

.modal-container {
  animation: scaleIn 0.25s ease;
}

.modal-overlay {
  animation: fadeIn 0.2s ease;
}

/* ============================================================
   SKELETON LOADERS
   ============================================================ */
.skeleton-line {
  height: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

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

.skeleton-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-muted);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm { width: 16px; height: 16px; }
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(2px);
  border-radius: var(--radius-lg);
  z-index: 10;
}

/* ============================================================
   HOVER EFFECTS
   ============================================================ */
.hover-lift {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

/* ============================================================
   PULSE / ONLINE INDICATOR
   ============================================================ */
.pulse-ring {
  position: relative;
  display: inline-flex;
}
.pulse-ring::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(0.95); opacity: 0.7; }
  70%  { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* ============================================================
   STAGGER ANIMATION (para listas)
   ============================================================ */
.stagger-item {
  animation: fadeSlideIn 0.3s ease both;
}
.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }

/* ============================================================
   KPI COUNTER ANIMATION
   ============================================================ */
.kpi-value.animating {
  animation: count-up 0.5s ease;
}

/* ============================================================
   TOAST EXIT ANIMATION
   ============================================================ */
.toast.removing {
  animation: slideInRight 0.3s ease reverse;
}

/* ============================================================
   DRAG STYLES (Kanban)
   ============================================================ */
.sortable-chosen {
  cursor: grabbing !important;
  transform: rotate(2deg);
  box-shadow: var(--shadow-lg) !important;
}

/* ============================================================
   RIPPLE EFFECT (en botones)
   ============================================================ */
.btn {
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  border-radius: inherit;
  transition: opacity 0.3s ease;
}
.btn:active::after { opacity: 0.1; }
