/* ═══════════════════════════════════════════════════════════════════════════
   NGA Design System — shared.css
   Imported by all three portals (admin, parent, teacher).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Light Theme (Default) ─────────────────────────────────────────────── */
:root {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --card: #ffffff;
  --card-hover: #fafbfc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-light: #dbeafe;

  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 10px;

  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: rgba(255,255,255,0.1);
  --sidebar-accent: #3b82f6;
}

/* ── Dark Theme ────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-alt: #0b1120;
  --card: #1e293b;
  --card-hover: #253346;
  --border: #334155;
  --border-light: #1e293b;

  --text: #e2e8f0;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59,130,246,0.15);

  --success: #4ade80;
  --success-bg: rgba(74,222,128,0.15);
  --warning: #fbbf24;
  --warning-bg: rgba(251,191,36,0.15);
  --danger: #f87171;
  --danger-bg: rgba(248,113,113,0.15);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);

  --sidebar-bg: #0b1120;
  --sidebar-text: #64748b;
  --sidebar-active: rgba(255,255,255,0.08);
  --sidebar-accent: #3b82f6;
}

/* ── Typography ────────────────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { color: var(--text); margin: 0; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  min-height: 36px;
  transition: background 0.15s, box-shadow 0.15s;
  text-decoration: none;
}
.btn:hover { opacity: 0.92; }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); opacity: 1; }

.btn-outline { background: var(--card); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg-alt); opacity: 1; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; opacity: 1; }

.btn-sm { padding: 5px 12px; font-size: 12px; min-height: 28px; }
.btn-lg { padding: 10px 20px; font-size: 14px; min-height: 40px; }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success, .badge-paid { background: var(--success-bg); color: var(--success); }
.badge-warning, .badge-partial { background: var(--warning-bg); color: var(--warning); }
.badge-danger, .badge-unpaid { background: var(--danger-bg); color: var(--danger); }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
}

/* ── Tables ────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
tbody tr:hover td { background: var(--card-hover); }

/* ── Forms ──────────────────────────────────────────────────────────────── */
input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="tel"], input[type="date"],
input[type="search"], select, textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  min-height: 36px;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: transparent;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  background: var(--card);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s;
}
.tab:hover { background: var(--bg-alt); }
.tab.active { background: var(--primary); color: white; border-color: var(--primary); font-weight: 600; }
.tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Filter Groups (dropdowns in page headers) ─────────────────────────── */
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.filter-group select { min-width: 140px; }

/* ── Balance Banner ────────────────────────────────────────────────────── */
.balance-banner {
  text-align: center;
  padding: 12px 0 16px;
}
.balance-banner .balance-amount {
  font-size: 28px;
  font-weight: 700;
}
.balance-banner .balance-label {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ── Child Cards (parent portal) ───────────────────────────────────────── */
.child-card {
  display: inline-block;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  margin: 2px 4px;
  font-size: 12px;
}
.child-card strong { color: var(--primary); }
.child-card .grade { color: var(--text-muted); }

/* ── Theme Toggle ──────────────────────────────────────────────────────── */
.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
}
.theme-toggle:hover { background: var(--card-hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* Variant for dark/colored topbars (admin, teacher) */
.theme-toggle-topbar {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.3);
  color: white;
}
.theme-toggle-topbar:hover { background: rgba(255,255,255,0.25); }

/* ── Sortable Table Headers ────────────────────────────────────────────── */
thead th[style*="cursor"]:hover { background: var(--card-hover); }
.sort-arrow { margin-left: 4px; font-size: 10px; opacity: 0.35; }
.sort-arrow.active { opacity: 1; }

/* ── Utilities ─────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.fw-semi { font-weight: 600; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ── Error Message ─────────────────────────────────────────────────────── */
.error-msg { color: var(--danger); text-align: center; margin-top: 12px; font-size: 13px; display: none; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  table { font-size: 12px; }
  th, td { padding: 6px 8px; }
  .btn { padding: 6px 12px; font-size: 12px; }
  .tab { padding: 5px 10px; font-size: 12px; }
}

@media (max-width: 480px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 5px 6px; white-space: nowrap; }
  .tabs { gap: 3px; }
  .tab { padding: 5px 8px; font-size: 11px; }
}
