/* ScholarFee platform console — styles that Tailwind utilities can't express
   (toasts, scrollbars, animations). Everything else is utility classes. */

:root {
  --ink: #0c1512;
  --ink-soft: #132420;
  --ink-line: #1e3630;
  --brand: #0b5d3b;
  --brass: #b77e17;
}

html,
body {
  height: 100%;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Vertical-only overscroll containment. Splitting the axes matters: the
   blanket `overscroll-behavior: contain` on a horizontally-scrolling table
   swallows the page's own vertical scroll on trackpads. */
.table-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
}

/* Slim scrollbars so dense tables don't lose a chunk of width. */
.table-scroll::-webkit-scrollbar,
.sidebar-scroll::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-scroll::-webkit-scrollbar-thumb,
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(12, 21, 18, 0.18);
  border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
}

/* ── Toasts ───────────────────────────────────────────────────────────── */

#sf-toasts {
  position: fixed;
  z-index: 100;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

@media (max-width: 640px) {
  #sf-toasts {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    align-items: stretch;
  }
}

.sf-toast {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 32px rgba(12, 21, 18, 0.28);
  max-width: 26rem;
  animation: sf-toast-in 160ms ease-out;
}

.sf-toast-success {
  background: #0b5d3b;
}

.sf-toast-error {
  background: #9f1239;
}

.sf-toast-icon {
  display: inline-flex;
  width: 1.1rem;
  height: 1.1rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.7rem;
  flex: none;
}

.sf-toast-leaving {
  animation: sf-toast-out 140ms ease-in forwards;
}

@keyframes sf-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes sf-toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ── Entrance animation ───────────────────────────────────────────────── */

@keyframes sf-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sf-slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.animate-fade-in {
  animation: sf-fade-in 0.25s ease-out both;
}

/* Staggered entrance for stat grids. Put this on the container; each direct
   child slides up shortly after the one before it. Only use it where the set
   of children is stable — on a filtered list the indices shift as the user
   types and the delays visibly re-run. */
.stagger-children > * {
  animation: sf-slide-up 0.35s ease-out both;
}
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 45ms; }
.stagger-children > *:nth-child(3) { animation-delay: 90ms; }
.stagger-children > *:nth-child(4) { animation-delay: 135ms; }
.stagger-children > *:nth-child(5) { animation-delay: 180ms; }
.stagger-children > *:nth-child(n + 6) { animation-delay: 225ms; }

/* ── Misc ─────────────────────────────────────────────────────────────── */

.sf-spin {
  animation: sf-spin 700ms linear infinite;
}

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

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

/* Respect the notch/home indicator on phones. */
.pb-safe {
  padding-bottom: env(safe-area-inset-bottom, 0);
}
