/* ============================================================
   MAIN.CSS  —  Design tokens, reset, typography
   Donor-Student Management Portal
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;400;500;600&display=swap');

/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  /* Brand */
  --primary:          #1A3C5E;
  --primary-hover:    #14304F;
  --primary-light:    #E8F0F9;
  --primary-mid:      #2E6DA4;

  --accent:           #E8923A;
  --accent-hover:     #D47D28;
  --accent-light:     #FEF3E8;

  --success:          #2D7D5A;
  --success-light:    #E6F4EE;
  --warning:          #C77C2B;
  --warning-light:    #FEF3E8;
  --danger:           #C0392B;
  --danger-light:     #FBEAEA;
  --info:             #2471A3;
  --info-light:       #EAF4FB;

  /* Neutrals */
  --white:            #FFFFFF;
  --gray-50:          #F8F9FB;
  --gray-100:         #F0F2F6;
  --gray-200:         #E2E6ED;
  --gray-300:         #C8CFDA;
  --gray-400:         #A0AAB8;
  --gray-500:         #6B7689;
  --gray-600:         #4A5568;
  --gray-700:         #2D3748;
  --gray-800:         #1A202C;
  --gray-900:         #0F1420;

  /* Text */
  --text-primary:     #1A202C;
  --text-secondary:   #4A5568;
  --text-muted:       #718096;
  --text-light:       #A0AAB8;
  --text-inverse:     #FFFFFF;

  /* Backgrounds */
  --bg-page:          #F4F6FA;
  --bg-white:         #FFFFFF;
  --bg-surface:       #F8F9FB;

  /* Borders */
  --border:           #E2E6ED;
  --border-focus:     #2E6DA4;

  /* Shadows */
  --shadow-xs:        0 1px 3px rgba(0,0,0,0.06);
  --shadow-sm:        0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:        0 8px 32px rgba(0,0,0,0.12);
  --shadow-xl:        0 16px 48px rgba(0,0,0,0.14);

  /* Radius */
  --radius-sm:        6px;
  --radius-md:        10px;
  --radius-lg:        16px;
  --radius-xl:        24px;
  --radius-full:      9999px;

  /* Typography */
  --font-display:     'DM Serif Display', Georgia, serif;
  --font-body:        'DM Sans', system-ui, sans-serif;

  /* Spacing scale */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;
  --space-12:  48px;
  --space-16:  64px;

  /* Transitions */
  --transition:       150ms ease;
  --transition-md:    250ms ease;

  /* Sidebar */
  --sidebar-width:    260px;
  --topbar-height:    64px;
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary-mid);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent); }

ul, ol { list-style: none; }

/* ── TYPOGRAPHY ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.25;
  color: var(--text-primary);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem;     }
h6 { font-size: 0.875rem; }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

small { font-size: 0.8125rem; }

.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-primary  { color: var(--primary); }
.text-accent   { color: var(--accent); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }

.font-display  { font-family: var(--font-display); }
.font-body     { font-family: var(--font-body); }

.fw-300 { font-weight: 300; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.text-sm   { font-size: 0.8125rem; }
.text-base { font-size: 0.9375rem; }
.text-lg   { font-size: 1.0625rem; }
.text-xl   { font-size: 1.25rem; }

/* ── UTILITIES ─────────────────────────────────────────────── */
.d-flex     { display: flex; }
.d-grid     { display: grid; }
.d-none     { display: none; }
.d-block    { display: block; }

.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-col      { flex-direction: column; }
.gap-1  { gap: var(--space-1); }
.gap-2  { gap: var(--space-2); }
.gap-3  { gap: var(--space-3); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }

.mt-1  { margin-top: var(--space-1); }
.mt-2  { margin-top: var(--space-2); }
.mt-3  { margin-top: var(--space-3); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }

.w-full  { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── TOAST NOTIFICATIONS ───────────────────────────────────── */
#toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
  animation: toastIn 0.3s ease;
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }

.toast-icon { font-size: 1.1rem; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); }
.toast-msg   { font-size: 0.8125rem; color: var(--text-secondary); }

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

/* ── PAGE LOADER ───────────────────────────────────────────── */
#page-loader {
  position: fixed; inset: 0;
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  z-index: 99999;
  transition: opacity 0.4s ease;
}
#page-loader.hide { opacity: 0; pointer-events: none; }

.loader-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }