/* ============================================
   NEXUS OS - ANIMATIONS STYLESHEET
   animations.css
   ============================================ */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 16px var(--accent-glow); }
  50%       { box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(59,130,246,0.1); }
}

@keyframes progressFill {
  from { width: 0; }
}

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

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

/* ---- Page Entrance ---- */
.page-content {
  animation: fadeInUp 0.4s cubic-bezier(0.4,0,0.2,1) both;
}

/* ---- Staggered Children ---- */
.stagger > * {
  animation: fadeInUp 0.4s cubic-bezier(0.4,0,0.2,1) both;
}

.stagger > *:nth-child(1)  { animation-delay: 0.04s; }
.stagger > *:nth-child(2)  { animation-delay: 0.09s; }
.stagger > *:nth-child(3)  { animation-delay: 0.14s; }
.stagger > *:nth-child(4)  { animation-delay: 0.19s; }
.stagger > *:nth-child(5)  { animation-delay: 0.24s; }
.stagger > *:nth-child(6)  { animation-delay: 0.29s; }
.stagger > *:nth-child(7)  { animation-delay: 0.34s; }
.stagger > *:nth-child(8)  { animation-delay: 0.39s; }
.stagger > *:nth-child(9)  { animation-delay: 0.44s; }
.stagger > *:nth-child(10) { animation-delay: 0.49s; }

/* ---- Utility Animations ---- */
.anim-fade-in     { animation: fadeIn 0.3s ease both; }
.anim-fade-up     { animation: fadeInUp 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.anim-fade-down   { animation: fadeInDown 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.anim-fade-left   { animation: fadeInLeft 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.anim-fade-right  { animation: fadeInRight 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.anim-scale-in    { animation: scaleIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both; }
.anim-float       { animation: float 3s ease-in-out infinite; }
.anim-pulse       { animation: pulse 2s ease-in-out infinite; }
.anim-bounce      { animation: bounce 1.5s ease-in-out infinite; }
.anim-glow        { animation: glowPulse 2.5s ease-in-out infinite; }

/* ---- Skeleton / Loading ---- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-card-hover) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text  { height: 12px; margin-bottom: 8px; }
.skeleton-title { height: 20px; width: 60%; margin-bottom: 10px; }
.skeleton-card  { height: 120px; border-radius: var(--radius-lg); }

/* ---- Progress Bars (animated fill) ---- */
.progress-bar { animation: progressFill 0.8s cubic-bezier(0.4,0,0.2,1) both; }

/* ---- Ripple Effect ---- */
.ripple-container { position: relative; overflow: hidden; }

.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: scale(0);
  animation: ripple 0.5s linear;
  pointer-events: none;
}

/* ---- Sidebar Entrance ---- */
.sidebar { animation: fadeInLeft 0.4s cubic-bezier(0.4,0,0.2,1) both; }

/* ---- Card Hover Lift ---- */
.card-lift { transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease; }
.card-lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* ---- Active Press ---- */
.btn, .nav-item, .quick-action, .bookmark-card, .file-card, .note-card {
  user-select: none;
}

.btn:active { transform: scale(0.97) !important; }
.quick-action:active { transform: scale(0.97) !important; }

/* ---- Glow Border on Active ---- */
.accent-glow-border {
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-accent);
}

/* ---- Number Counter ---- */
.counter { animation: numberCountUp 0.4s ease both; }

/* ---- Typing Indicator ---- */
.typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 0.9s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

/* ---- Notification Badge Pulse ---- */
.badge-pulse {
  position: relative;
}

.badge-pulse::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
  border: 2px solid var(--bg-primary);
}

/* ---- Transition Groups ---- */
.transition-all   { transition: var(--transition); }
.transition-slow  { transition: var(--transition-slow); }
.transition-spring { transition: var(--transition-spring); }

/* ---- Focus ring ---- */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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