/* ============================================================
   SchoolSys design system v2 — royal purple / sky blue, SaaS-clean.
   Design tokens below are the single source of truth; component
   rules translate them onto our existing Tailwind-CDN markup so
   every page (Students, Staff, Fees, Exams…) reads as one product.
   ============================================================ */

:root {
  /* Brand */
  --primary: #6366f1;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #0ea5e9;
  --secondary-light: #e0f2fe;
  --accent: #10b981;
  --accent-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;

  /* Neutral surface */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #eef2f7;

  /* Sidebar */
  --sidebar: #0f172a;
  --sidebar-2: #172554;
  --sidebar-hover: rgba(255,255,255,.08);

  /* Radius scale */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(15,23,42,.04);
  --shadow-md: 0 8px 24px rgba(15,23,42,.07);
  --shadow-lg: 0 20px 50px rgba(15,23,42,.12);
  --elev-1: var(--shadow-sm);
  --elev-2: var(--shadow-md);
  --elev-3: var(--shadow-lg);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0ea5e9 100%);
  --gradient-purple: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-green: linear-gradient(135deg, #059669, #10b981);
  --gradient-orange: linear-gradient(135deg, #f59e0b, #f97316);
  --gradient-blue: linear-gradient(135deg, #0284c7, #0ea5e9);
  --gradient-hero: linear-gradient(110deg, #4c1d95 0%, #6366f1 48%, #0ea5e9 100%);

  --ease: cubic-bezier(.2,.7,.3,1);
}

html { -webkit-font-smoothing: antialiased; background: var(--bg); }
body {
  font-family: "Inter", "Roboto", ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* Icons ----------------------------------------------------- */
.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 22px; line-height: 1; vertical-align: middle;
  user-select: none;
}
.msr-fill { font-variation-settings: 'FILL' 1, 'wght' 500; }

/* ============================================================
   Cards, tables, badges — global element rules so every page
   (most of which build markup with plain Tailwind classes) picks
   up the same radius/shadow/color system automatically.
   ============================================================ */
.bg-white.rounded-xl,
.bg-white.rounded-2xl {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm);
  border-color: var(--border) !important;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease);
}
.bg-white.rounded-xl:hover,
.bg-white.rounded-2xl:hover { box-shadow: var(--shadow-md); border-color: #c7d2fe !important; }

.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg) !important; }

table.w-full thead th {
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
table.w-full tbody tr { transition: background-color .15s var(--ease); }
table.w-full tbody tr:hover { background: var(--surface-soft); }

/* Status badges — semantic colors regardless of which Tailwind bg-*/text-*
   combo a template happens to use, since those already map 1:1 to these. */
.rounded-full.text-xs { font-weight: 600; letter-spacing: .01em; }

/* Buttons: smooth, tactile ------------------------------------ */
button, [type="submit"], .btn, a.btn {
  transition: transform .12s var(--ease), box-shadow .2s var(--ease),
              background-color .2s var(--ease), filter .2s var(--ease);
  position: relative; overflow: hidden;
  border-radius: var(--radius-md);
}
button:active, [type="submit"]:active { transform: scale(.97); }
.bg-indigo-600, .bg-slate-800, .bg-slate-900 { box-shadow: var(--shadow-sm); }
.bg-indigo-600:hover { box-shadow: var(--shadow-md); filter: brightness(1.03); }

/* Ripple */
.ripple-ink {
  position: absolute; border-radius: 9999px; transform: scale(0);
  background: rgba(255,255,255,.5); pointer-events: none;
  animation: ripple .6s var(--ease); mix-blend-mode: overlay;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* Sidebar nav links: animated active indicator -------------- */
.nav-link { position: relative; border-radius: var(--radius-md); transition: background-color .2s var(--ease), color .2s var(--ease), padding-left .2s var(--ease); }
.nav-link:hover { padding-left: 1.1rem; }
.nav-link.active {
  background: var(--gradient-purple) !important;
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(99,102,241,.25);
}
.nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  height: 60%; width: 3px; border-radius: 0 3px 3px 0; background: rgba(255,255,255,.7);
  animation: growBar .3s var(--ease);
}
@keyframes growBar { from { height: 0; opacity: 0; } to { height: 60%; opacity: 1; } }

/* Motion: entrance ----------------------------------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

main { animation: fadeIn .35s var(--ease); }
.animate-up { animation: fadeUp .45s var(--ease) both; }
.animate-scale { animation: scaleIn .4s var(--ease) both; }

.stagger > * { animation: fadeUp .5s var(--ease) both; }
.stagger > *:nth-child(1){animation-delay:.03s}
.stagger > *:nth-child(2){animation-delay:.09s}
.stagger > *:nth-child(3){animation-delay:.15s}
.stagger > *:nth-child(4){animation-delay:.21s}
.stagger > *:nth-child(5){animation-delay:.27s}
.stagger > *:nth-child(6){animation-delay:.33s}
.stagger > *:nth-child(7){animation-delay:.39s}
.stagger > *:nth-child(8){animation-delay:.45s}
.stagger > *:nth-child(9){animation-delay:.51s}
.stagger > *:nth-child(10){animation-delay:.57s}

.toast { animation: slideInRight .4s var(--ease) both; }

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   Gradient stat tiles, icon chips, buttons.
   ============================================================ */
.tile-grad { color: #fff; border: none !important; position: relative; overflow: hidden; border-radius: var(--radius-lg) !important; }
.tile-grad::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background: radial-gradient(120px 80px at 85% 15%, rgba(255,255,255,.35), transparent 70%);
}
.tile-grad .tile-icon { background: rgba(255,255,255,.18); color: #fff; }
.tile-grad .tile-value { color: #fff; }
.tile-grad .tile-label { color: rgba(255,255,255,.85); }

.tile-violet  { background: var(--gradient-purple); }
.tile-emerald { background: var(--gradient-green); }
.tile-amber   { background: var(--gradient-orange); }
.tile-rose    { background: linear-gradient(135deg, #e11d48, #fb7185); }
.tile-sky     { background: var(--gradient-blue); }
.tile-fuchsia { background: linear-gradient(135deg, #c026d3, #e879f9); }

/* Semantic icon chips — pair with any module icon. */
.chip-violet  { background: #f3e8ff; color: #9333ea; }
.chip-fuchsia { background: #fce7f3; color: #db2777; }
.chip-sky     { background: #e0f2fe; color: #0284c7; }
.chip-green   { background: #dcfce7; color: #16a34a; }
.chip-orange  { background: #fef3c7; color: #d97706; }

.btn-grad {
  background: var(--gradient-primary);
  color: #fff; box-shadow: var(--shadow-sm);
}
.btn-grad:hover { filter: brightness(1.08); box-shadow: var(--shadow-md); }

.nav-link[data-accent="violet"]:hover::before { background: #c4b5fd; }
.nav-link[data-accent="fuchsia"]:hover::before { background: #f0abfc; }
.nav-link[data-accent="emerald"]:hover::before { background: #6ee7b7; }
.nav-link[data-accent="amber"]:hover::before { background: #fcd34d; }
.nav-link[data-accent="sky"]:hover::before { background: #7dd3fc; }

/* ============================================================
   Global form polish
   ============================================================ */
input:not([type="checkbox"]):not([type="radio"]),
select, textarea {
  background-color: var(--surface-soft) !important;
  border-radius: var(--radius-md) !important;
  border-color: var(--border) !important;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease) !important;
}
input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover, textarea:hover { border-color: #c4b5fd !important; }
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus, textarea:focus {
  background-color: #fff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px var(--primary-light) !important;
  outline: none !important;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* Search box (topbar) */
.search-box {
  background: var(--surface-soft); border: 1px solid transparent;
  border-radius: var(--radius-md); transition: all .2s var(--ease);
}
.search-box:focus-within {
  background: #fff; border-color: #c7d2fe; box-shadow: 0 0 0 4px var(--primary-light);
}

/* ============================================================
   Floating sidebar shell
   ============================================================ */
.shell-radial { background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%); }
.shell-float {
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px -20px rgba(15,23,42,.5), 0 2px 8px rgba(0,0,0,.08);
  overflow: hidden;
}

.glass {
  background: rgba(255,255,255,.66);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid rgba(255,255,255,.7);
}

/* Feature / module cards on the dashboard */
.feature-card {
  position: relative; overflow: hidden; border-radius: var(--radius-lg);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.feature-card:hover { transform: translateY(-3px); border-color: #c7d2fe !important; box-shadow: var(--shadow-md); }
.feature-card .feature-icon { transition: transform .3s var(--ease); }
.feature-card:hover .feature-icon { transform: scale(1.1) rotate(-4deg); }

.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.animate-floaty { animation: floaty 6s ease-in-out infinite; }

@keyframes pillPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(244,63,94,.5); } 50% { box-shadow: 0 0 0 5px rgba(244,63,94,0); } }
.badge-pulse { animation: pillPulse 2s ease-in-out infinite; }

/* Timeline (schedule widget) */
.timeline { border-left: 2px solid var(--border); padding-left: 18px; }
.timeline-dot {
  position: absolute; left: -23px; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 2px currentColor;
}

/* Quick link rows */
.quick-link { transition: transform .15s var(--ease), background-color .15s var(--ease); }
.quick-link:hover { transform: translateX(3px); }
