/* ==========================================================================
   Sentra School — Design System Stylesheet
   Premium SaaS aesthetic. Inter type, generous whitespace, quiet motion.
   ========================================================================== */

:root {
  --primary: #2563EB;
  --secondary: #3B82F6;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --dark: #0F172A;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-secondary: #64748B;
  --ring: rgba(37, 99, 235, 0.14);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px -4px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15,23,42,.04);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.14);
}

.dark {
  --bg: #0B1220;
  --surface: #10192B;
  --border: #1E293B;
  --text: #F1F5F9;
  --text-secondary: #94A3B8;
  --ring: rgba(59, 130, 246, 0.18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px -4px rgba(0,0,0,.5), 0 2px 4px -2px rgba(0,0,0,.3);
  --shadow-lg: 0 20px 40px -12px rgba(0,0,0,.6);
}

* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

/* Focus states — accessible + on-brand */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
  border-radius: 8px;
}

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

/* ---------- Surfaces ---------- */
.surface { background: var(--surface); border: 1px solid var(--border); }
.bg-app { background: var(--bg); }
.text-main { color: var(--text); }
.text-muted { color: var(--text-secondary); }
.border-main { border-color: var(--border); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.card-hover:hover { box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--primary) 25%, var(--border)); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 600; font-size: .875rem; line-height: 1.25rem;
  padding: .625rem 1rem; border-radius: 10px;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.3); }
.btn-primary:hover { background: #1d4fd1; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: .4rem .75rem; font-size: .8125rem; border-radius: 8px; }
.btn-icon { width: 2.5rem; height: 2.5rem; padding: 0; border-radius: 10px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 600; padding: .25rem .625rem; border-radius: 999px; letter-spacing: .01em; }
.badge-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: #067a56; }
.dark .badge-success { color: #34d399; }
.badge-warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: #92620a; }
.dark .badge-warning { color: #fbbf24; }
.badge-danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: #b91c1c; }
.dark .badge-danger { color: #f87171; }
.badge-info { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.dark .badge-info { color: #60a5fa; }
.badge-neutral { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text-secondary); }

/* ---------- Inputs ---------- */
.input {
  width: 100%; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: .625rem .875rem; font-size: .875rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--text-secondary); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.label { font-size: .8125rem; font-weight: 600; color: var(--text); margin-bottom: .375rem; display: block; }

/* ---------- Tables ---------- */
.table-row { transition: background-color .12s ease; }
.table-row:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
th.th { text-align: left; font-size: .75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; padding: .75rem 1.25rem; }
td.td { padding: 1rem 1.25rem; font-size: .875rem; border-top: 1px solid var(--border); }

/* ---------- Sidebar ---------- */
.nav-link { display: flex; align-items: center; gap: .75rem; padding: .625rem .75rem; border-radius: 10px; font-size: .875rem; font-weight: 500; color: var(--text-secondary); transition: all .15s ease; position: relative; }
.nav-link:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.nav-link.active { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); font-weight: 600; }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Avatar ---------- */
.avatar { border-radius: 999px; object-fit: cover; background: var(--border); }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-weight: 600; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }

/* ---------- Fade/slide utilities (Alpine transitions) ---------- */
.fade-enter { transition: opacity .18s ease, transform .18s ease; }
[x-cloak] { display: none !important; }

/* ---------- Misc ---------- */
.divider { height: 1px; background: var(--border); }
.kbd { font-family: ui-monospace, monospace; font-size: .7rem; padding: .1rem .4rem; border: 1px solid var(--border); border-radius: 5px; color: var(--text-secondary); background: var(--bg); }
.skeleton { background: linear-gradient(90deg, color-mix(in srgb, var(--text) 6%, transparent) 25%, color-mix(in srgb, var(--text) 10%, transparent) 37%, color-mix(in srgb, var(--text) 6%, transparent) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Chart tooltip container polish */
.chart-legend-dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }

/* Scroll-snap for mobile bottom nav safe area */
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
