/* assets/css/style.css – Angaza TVET Management System Design System */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ──────────────────────────────────────────────
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
────────────────────────────────────────────── */
:root {
  /* Brand Palette */
  --primary:       #2563EB;
  --primary-dark:  #1D4ED8;
  --primary-light: #DBEAFE;
  --accent:        #0EA5E9;
  --success:       #10B981;
  --warning:       #F59E0B;
  --danger:        #EF4444;
  --info:          #6366F1;

  /* Neutrals */
  --bg:            #F0F4F8;
  --surface:       #FFFFFF;
  --surface-2:     #F8FAFC;
  --border:        #E2E8F0;
  --text:          #0F172A;
  --text-muted:    #64748B;
  --text-light:    #94A3B8;

  /* Sidebar */
  --sidebar-bg:    #0F172A;
  --sidebar-text:  #94A3B8;
  --sidebar-hover: #1E293B;
  --sidebar-active:#2563EB;
  --sidebar-width: 260px;

  /* Topbar */
  --topbar-height: 65px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04);

  /* Radius */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition: .2s ease;
  --transition-slow: .35s ease;
}

/* ──────────────────────────────────────────────
   2. RESET & BASE
────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ──────────────────────────────────────────────
   3. LAYOUT: SIDEBAR + MAIN
────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform var(--transition-slow);
  overflow-y: auto;
}
.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid #1E293B;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff;
  flex-shrink: 0;
}
.sidebar-brand .brand-text h2 {
  font-size: .875rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sidebar-brand .brand-text span {
  font-size: .7rem;
  color: var(--sidebar-text);
}

.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
  padding: 18px 20px 6px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  font-size: .85rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  border-radius: 0;
  position: relative;
}
.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-nav a.active {
  background: rgba(37,99,235,.18);
  color: #60A5FA;
}
.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.sidebar-nav a svg, .sidebar-nav a .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #1E293B;
  font-size: .8rem;
  color: #475569;
}

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 1.05rem; font-weight: 700; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--primary); }
.breadcrumb span { color: var(--text-light); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.topbar-user:hover { background: var(--surface-2); }
.topbar-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff;
}
.topbar-user-info .name { font-weight: 600; font-size: .85rem; }
.topbar-user-info .role-badge {
  font-size: .65rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* PAGE BODY */
.page-body { padding: 28px; flex: 1; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
}
.page-header p { color: var(--text-muted); font-size: .88rem; margin-top: 2px; }

/* ──────────────────────────────────────────────
   4. STAT CARDS
────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 0 0 80px;
  opacity: .08;
}
.stat-card.blue::before   { background: var(--primary); }
.stat-card.green::before  { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.purple::before { background: var(--info); }
.stat-card.teal::before   { background: var(--accent); }
.stat-card.red::before    { background: var(--danger); }

.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.stat-card.blue   .stat-icon { background: #DBEAFE; color: var(--primary); }
.stat-card.green  .stat-icon { background: #D1FAE5; color: var(--success); }
.stat-card.orange .stat-icon { background: #FEF3C7; color: var(--warning); }
.stat-card.purple .stat-icon { background: #EDE9FE; color: var(--info); }
.stat-card.teal   .stat-icon { background: #E0F2FE; color: var(--accent); }
.stat-card.red    .stat-icon { background: #FEE2E2; color: var(--danger); }

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
}
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.stat-trend {
  font-size: .75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ──────────────────────────────────────────────
   5. CARDS & PANELS
────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2, .card-header h3 {
  font-size: 1rem;
  font-weight: 700;
}
.card-body { padding: 22px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ──────────────────────────────────────────────
   6. TABLES
────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
table thead th {
  background: var(--surface-2);
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--surface-2); }

/* ──────────────────────────────────────────────
   7. FORMS
────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=file],
select, textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .88rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
input[type=file] { cursor: pointer; }
select { cursor: pointer; }
textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: 4px; }

/* ──────────────────────────────────────────────
   8. BUTTONS
────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,.4); }
.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,.3);
}
.btn-success:hover { background: #059669; }
.btn-warning {
  background: var(--warning);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245,158,11,.3);
}
.btn-warning:hover { background: #D97706; }
.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,.3);
}
.btn-danger:hover { background: #DC2626; }
.btn-light {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-light:hover { background: var(--border); }
.btn-sm { padding: 5px 11px; font-size: .78rem; }
.btn-lg { padding: 12px 26px; font-size: .95rem; }

/* ──────────────────────────────────────────────
   9. BADGES & PILLS
────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #EDE9FE; color: #4C1D95; }
.badge-muted   { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }

/* ──────────────────────────────────────────────
   10. ALERTS
────────────────────────────────────────────── */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: .86rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}
.alert-success { background: #D1FAE5; color: #064E3B; border-left: 4px solid var(--success); }
.alert-error   { background: #FEE2E2; color: #7F1D1D; border-left: 4px solid var(--danger); }
.alert-warning { background: #FEF3C7; color: #78350F; border-left: 4px solid var(--warning); }
.alert-info    { background: #EFF6FF; color: #1E3A8A; border-left: 4px solid var(--primary); }

/* ──────────────────────────────────────────────
   11. TOAST NOTIFICATIONS
────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: .84rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight .3s ease;
  max-width: 340px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); color: #000; }
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  to { opacity: 0; transform: translateX(60%); }
}
.toast.hide { animation: fadeOut .3s ease forwards; }

/* ──────────────────────────────────────────────
   12. MODALS
────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 30px;
  max-width: 560px;
  width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(.95) translateY(20px);
  transition: transform var(--transition-slow);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: var(--text-muted);
  padding: 4px; border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.modal-close:hover { color: var(--danger); }

/* ──────────────────────────────────────────────
   13. PAGINATION
────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 6px;
  justify-content: center; padding-top: 16px; flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  font-size: .84rem; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: all var(--transition);
}
.pagination a:hover  { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ──────────────────────────────────────────────
   14. PROGRESS BARS
────────────────────────────────────────────── */
.progress {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .5s ease;
}

/* ──────────────────────────────────────────────
   15. CLEARANCE STEPS
────────────────────────────────────────────── */
.clearance-steps {
  display: flex; gap: 16px; flex-wrap: wrap;
}
.clearance-step {
  flex: 1; min-width: 150px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
  transition: border-color var(--transition);
}
.clearance-step.cleared { border-color: var(--success); background: #F0FDF4; }
.clearance-step.pending { border-color: var(--border); }
.clearance-step-icon { font-size: 2rem; margin-bottom: 8px; }
.clearance-step h4 { font-size: .88rem; font-weight: 700; }
.clearance-step p  { font-size: .75rem; color: var(--text-muted); }

/* ──────────────────────────────────────────────
   16. GRADEBOOK CELLS
────────────────────────────────────────────── */
.mark-input {
  width: 70px;
  padding: 5px 8px;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
}
.mark-input:focus { border-color: var(--primary); outline: none; }

/* ──────────────────────────────────────────────
   17. LOGIN PAGE
────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 60%, #2563EB 100%);
}
.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px;
  color: #fff;
  text-align: center;
}
.login-logo {
  width: 80px; height: 80px;
  background: rgba(255,255,255,.1);
  border: 2px solid rgba(255,255,255,.2);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  margin: 0 auto 24px;
  backdrop-filter: blur(10px);
}
.login-left h1 { font-size: 2rem; font-weight: 800; margin-bottom: 10px; }
.login-left p  { color: rgba(255,255,255,.7); max-width: 360px; }
.login-right {
  width: 440px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 48px;
}
.login-right h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; }
.login-right .sub { color: var(--text-muted); font-size: .88rem; margin-bottom: 30px; }

/* ──────────────────────────────────────────────
   18. MISCELLANEOUS & UTILITIES
────────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-3 { margin-bottom: 24px; }
.gap-3 { gap: 12px; }
.flex { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* Avatar initials chip */
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-weight: 700; font-size: .78rem;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* MOBILE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .login-left  { display: none; }
  .login-right { width: 100%; padding: 40px 28px; }
  .form-row    { grid-template-columns: 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr; }
  .page-body   { padding: 18px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid  { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) {
  .stats-grid { grid-template-columns: 1fr; }
}
