/* ============================================================
   animation.css — Transitions, Hover Effects & Keyframes
   ============================================================ */

/* --- Page Fade In ----------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main {
  animation: fadeIn 0.5s ease forwards;
}

/* --- Staggered Section Entrance --------------------------- */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section:nth-child(1) { animation: slideUp 0.4s ease 0.04s both; }
.section:nth-child(2) { animation: slideUp 0.4s ease 0.08s both; }
.section:nth-child(3) { animation: slideUp 0.4s ease 0.12s both; }
.section:nth-child(4) { animation: slideUp 0.4s ease 0.16s both; }
.section:nth-child(5) { animation: slideUp 0.4s ease 0.20s both; }
.section:nth-child(6) { animation: slideUp 0.4s ease 0.24s both; }

/* --- Card Hover ------------------------------------------- */
.kpi-card,
.viz-card,
.detail-card,
.exec-header,
.insight-panel,
.filter-chip {
  transition: transform var(--transition-slow),
              box-shadow var(--transition-slow),
              border-color var(--transition-slow);
}

.kpi-card:hover,
.viz-card:hover,
.detail-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(59, 130, 246, 0.25);
}

.filter-chip:hover {
  transform: translateY(-1px);
}

/* --- Executive Header Hover ------------------------------- */
.exec-header:hover {
  border-color: rgba(59, 130, 246, 0.18);
}

/* --- Insight Panel Hover ---------------------------------- */
.insight-panel:hover {
  border-color: rgba(245, 158, 11, 0.18);
}

/* --- Glassmorphism Base ----------------------------------- */
.navbar {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* --- Sidebar Item Hover Transition ------------------------ */
.sidebar__item {
  transition: background var(--transition-base),
              color var(--transition-base),
              padding-left var(--transition-base);
}

.sidebar__item:hover {
  padding-left: calc(var(--space-md) + 6px);
}

.sidebar__item--active {
  padding-left: calc(var(--space-md) + 6px);
}

/* --- Pulse Indicator -------------------------------------- */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* --- Shimmer Loader (skeleton placeholder) ---------------- */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.08) 25%,
    rgba(148, 163, 184, 0.18) 50%,
    rgba(148, 163, 184, 0.08) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* --- Sidebar Slide Transition (mobile) -------------------- */
.sidebar {
  transition: transform var(--transition-slow);
}

/* --- Navbar Icon Button Ripple ---------------------------- */
.navbar__icon-btn {
  position: relative;
  overflow: hidden;
}

.navbar__icon-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 10%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.navbar__icon-btn:hover::after {
  opacity: 1;
}

/* --- Notification Badge Entrance -------------------------- */
@keyframes badgePop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.navbar__badge {
  animation: badgePop 0.3s ease 0.5s both;
}

/* --- Viz Card Toolbar Button Hover ------------------------ */
.viz-card__toolbar-btn {
  transition: background var(--transition-base),
              color var(--transition-base),
              transform var(--transition-base);
}

.viz-card__toolbar-btn:hover {
  transform: scale(1.1);
}

/* --- KPI Trend Arrow Animation ---------------------------- */
@keyframes trendUp {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi-card__trend {
  animation: trendUp 0.3s ease 0.3s both;
}

/* --- Insight Item Entrance -------------------------------- */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.insight-item:nth-child(1) { animation: fadeInLeft 0.35s ease 0.25s both; }
.insight-item:nth-child(2) { animation: fadeInLeft 0.35s ease 0.32s both; }
.insight-item:nth-child(3) { animation: fadeInLeft 0.35s ease 0.39s both; }

/* --- Filter Chip Focus Animation -------------------------- */
@keyframes chipFocus {
  from {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
  }
  to {
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
  }
}

/* --- Soft Border Glow on Focus ---------------------------- */
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* --- Reduce Motion (respects user preference) ------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
