@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    /* === Tailwind System Variables === */
    --tw-background: 0 0% 100%;
    --tw-foreground: 222.2 84% 4.9%;
    --tw-card: 0 0% 100%;
    --tw-card-foreground: 222.2 84% 4.9%;
    --tw-popover: 0 0% 100%;
    --tw-popover-foreground: 222.2 84% 4.9%;
    --tw-primary: 215 100% 33.5%;
    --tw-primary-foreground: 210 40% 98%;
    --tw-secondary: 210 40% 96.1%;
    --tw-secondary-foreground: 222.2 47.4% 11.2%;
    --tw-muted: 210 40% 96.1%;
    --tw-muted-foreground: 215.4 16.3% 46.9%;
    --tw-accent: 38.8 100% 50%;
    --tw-accent-foreground: 222.2 47.4% 11.2%;
    --tw-destructive: 0 84.2% 60.2%;
    --tw-destructive-foreground: 210 40% 98%;
    --tw-border: 214.3 31.8% 91.4%;
    --tw-input: 214.3 31.8% 91.4%;
    --tw-ring: 215 100% 33.5%;

    /* === Primary Brand Colors === */
    --primary: #0047AB;        /* Royal Blue */
    --primary-dark: #003080;
    --primary-light: #1a5cc0;
    --primary-50: #e6eef9;
    --primary-100: #c2d4f0;

    --accent: #FFA500;          /* Tangerine Orange */
    --accent-dark: #cc8400;
    --accent-light: #ffb733;
    --accent-50: #fff5e0;
    --accent-100: #ffe6b3;

    --slate: #002147;           /* Slate Navy */
    --slate-light: #1a3a66;
    --slate-50: #e6ebf2;

    /* === Surfaces === */
    --background: #ffffff;
    --background-alt: 247 249 252;
    --surface: 255 255 255;
    --card: #ffffff;
    --card-elevated: #ffffff;
    --border: #e3e8ef;
    --border-light: #f0f3f7;
    --divider: #e3e8ef;

    /* === Text Colors === */
    --text: #002147;
    --text-secondary: #1a3a66;
    --text-light: #4a6585;
    --text-muted: #8696ad;
    --text-inverse: #ffffff;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
  }

  .dark {
    --tw-background: 222.2 84% 4.9%;
    --tw-foreground: 210 40% 98%;
    --tw-card: 222.2 84% 4.9%;
    --tw-card-foreground: 210 40% 98%;
    --tw-popover: 222.2 84% 4.9%;
    --tw-popover-foreground: 210 40% 98%;
    --tw-primary: 211 91% 59.4%;
    --tw-primary-foreground: 0 0% 100%;
    --tw-secondary: 217.2 32.6% 17.5%;
    --tw-secondary-foreground: 210 40% 98%;
    --tw-muted: 217.2 32.6% 17.5%;
    --tw-muted-foreground: 215 20.2% 65.1%;
    --tw-accent: 38.8 100% 50%;
    --tw-accent-foreground: 222.2 47.4% 11.2%;
    --tw-destructive: 0 62.8% 30.6%;
    --tw-destructive-foreground: 210 40% 98%;
    --tw-border: 217.2 32.6% 17.5%;
    --tw-input: 217.2 32.6% 17.5%;
    --tw-ring: 212.7 26.8% 83.9%;

    --primary: #3b82f6;
    --slate: #f1f5f9;

    --background: #020617;
    --background-alt: 0 12 36;
    --surface: 0 26 56;
    --card: #001a38;
    --card-elevated: #002147;
    --border: #1a3a66;

    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-light: #94a3b8;
    --text-muted: #64748b;
  }
}

@layer base {
  * {
    @apply border-border transition-colors duration-200;
  }
  body {
    @apply bg-background text-text;
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--slate);
    font-weight: 700;
    letter-spacing: -0.01em;
  }
}

.custom-scrollbar::-webkit-scrollbar { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(0, 71, 171, 0.1); border-radius: 10px; }
.dark .custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); }


/* === NextGen Brand Utilities === */
.ng-gradient { background: linear-gradient(135deg, #0047AB 0%, #002147 100%); }
.ng-gradient-accent { background: linear-gradient(135deg, #FFA500 0%, #FF6B00 100%); }
.ng-lms-bar { background: linear-gradient(90deg, #008080 0%, #00a3a3 100%); }
.ng-sms-bar { background: linear-gradient(90deg, #4CAF50 0%, #6ec071 100%); }

/* === Form Input (mirror .form-input from client) === */
.form-input {
  width: 100%;
  font-family: var(--font-body);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem 0.875rem;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--background);
  transition: all 0.15s ease;
}
.dark .form-input { background: #00112b; }
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 71, 171, 0.12);
}

/* === Card Variants === */
.card { background-color: var(--card); color: var(--text); border-radius: 1.5rem; padding: 1.5rem; border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: all 0.2s ease; }
.card-header { margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--divider); }
.card-title { font-size: 1.125rem; font-weight: 700; color: var(--slate); margin: 0; }
.dark .card-title { color: var(--text); }

/* === Stat Tiles === */
.stat-card { display: flex; align-items: center; gap: 1.25rem; }
.stat-icon { width: 3.5rem; height: 3.5rem; border-radius: 1rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon.blue   { background-color: rgba(0, 71, 171, 0.1); color: #0047AB; }
.stat-icon.green  { background-color: rgba(76, 175, 80, 0.1); color: #4CAF50; }
.stat-icon.purple { background-color: rgba(107, 70, 193, 0.1); color: #6B46C1; }
.stat-icon.orange { background-color: rgba(255, 165, 0, 0.1); color: #FFA500; }
.stat-icon.cyan   { background-color: rgba(6, 182, 212, 0.1); color: #06b6d4; }
.dark .stat-icon.blue   { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.dark .stat-icon.green  { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
.dark .stat-icon.purple { background-color: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.dark .stat-icon.orange { background-color: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.dark .stat-icon.cyan   { background-color: rgba(34, 211, 238, 0.2); color: #22d3ee; }
.stat-info h3 { margin: 0; font-size: 1.5rem; font-weight: 800; color: var(--text); }
.stat-info p { margin: 0; font-size: 0.875rem; color: var(--text-muted); font-weight: 500; }

/* === Adaptive Table System === */
.ng-table-container { @apply overflow-x-auto rounded-xl border border-border bg-surface shadow-sm; }
.ng-table { @apply w-full text-left border-collapse; }
.ng-table-header { @apply bg-background-alt/50 border-b border-border text-xs uppercase tracking-wider text-text-muted font-bold; }
.ng-table-header th { @apply px-6 py-4 font-bold; }
.ng-table-row { @apply border-b border-border/50 last:border-0 hover:bg-background-alt/40 transition-colors duration-200 cursor-default; }
.ng-table-cell { @apply px-6 py-4 text-sm text-text-secondary; }
.dark .ng-table-row:hover { @apply bg-white/5; }
.ng-table-badge { @apply inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-[0.65rem] font-black uppercase border transition-all duration-200; }

/* === Page-level helpers (mirror client) === */
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
html { scroll-behavior: smooth; }
#root { min-height: 100vh; }
