/* ==========================================================================
   ACADEMIC EDTECH CLEAN — NATIVE COMPILED DESIGN SYSTEM (ZERO CDN DELAY)
   LMS Muh. Alfin Ramadhan • Plus Jakarta Sans & Inter
   ========================================================================== */

:root {
  --primary: #0053cd;
  --primary-container: #146bfb;
  --primary-dark: #003ea1;
  --primary-soft: #ebf3ff;
  --primary-fixed: #dae2ff;
  --secondary: #6b38d4;
  --secondary-container: #8455ef;
  --purple-soft: #f3e8ff;
  --tertiary: #825100;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --emerald: #10b981;
  --emerald-dark: #065f46;
  --emerald-soft: #d1fae5;
  --crimson: #dc2626;
  --crimson-dark: #991b1b;
  --crimson-soft: #fee2e2;
  --bg-canvas: #f8fafc;
  --surface-low: #eff4ff;
  --surface-mid: #e5eeff;
  --surface-high: #dce9ff;
  --surface-white: #ffffff;
  --text-main: #0f172a;
  --text-variant: #424655;
  --text-muted: #64748b;
  --border-subtle: #e2e8f0;
  --border-input: #cbd5e1;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;
  --shadow-xs: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 10px -2px rgba(15, 23, 42, 0.05), 0 1px 3px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 24px -4px rgba(20, 107, 251, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 20px 36px -8px rgba(15, 23, 42, 0.14), 0 8px 16px -4px rgba(15, 23, 42, 0.06);
  --sidebar-w: 268px;
  --topbar-h: 64px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-canvas);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  margin: 0;
  letter-spacing: -0.015em;
  color: var(--text-main);
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 22;
  vertical-align: middle;
  user-select: none;
  line-height: 1;
}
.icon-fill {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 22;
}

/* ======================== AUTH SCREEN ======================== */
.auth-shell {
  min-height: 100vh;
  background: radial-gradient(circle at 15% 15%, #dce9ff 0%, transparent 40%),
              radial-gradient(circle at 85% 85%, #f3e8ff 0%, transparent 42%),
              linear-gradient(180deg, #f8fafc 0%, #ebf3ff 100%);
  display: flex;
  flex-direction: column;
}

.auth-topbar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
}

.auth-card {
  width: 100%;
  max-width: 468px;
  background: var(--surface-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--primary-container), var(--secondary-container));
}

.role-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--surface-low);
  padding: 5px;
  border-radius: var(--radius-md);
  margin: 18px 0 14px;
}

.role-tab {
  padding: 9px 8px;
  border-radius: 9px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.role-tab.active {
  background: var(--surface-white);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* ======================== APP SHELL ======================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface-white);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 50;
  overflow-y: auto;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sidebar-brand {
  padding: 20px 20px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-container));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(20, 107, 251, 0.28);
  flex-shrink: 0;
}

.sidebar-section-label {
  padding: 14px 22px 6px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text-variant);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  transition: background 0.12s ease, color 0.12s ease;
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: var(--surface-low);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary-container);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(20, 107, 251, 0.24);
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.nav-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--amber-soft);
  color: var(--tertiary);
}

.nav-item.active .nav-badge {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.sidebar-footer {
  padding: 14px 12px 18px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 12px;
}

.workspace {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.workspace.no-sidebar {
  margin-left: 0;
}

.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 40;
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.topbar-search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: var(--surface-low);
  color: var(--text-main);
  transition: all 0.15s ease;
}

.topbar-search input:focus {
  outline: none;
  background: #fff;
  border-color: var(--primary-container);
  box-shadow: 0 0 0 3px rgba(20, 107, 251, 0.12);
}

.topbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 19px;
  pointer-events: none;
}

.main-container {
  padding: 24px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding-bottom: 84px;
}

/* Mobile Bottom Nav (< 960px) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-subtle);
  z-index: 55;
  grid-template-columns: repeat(5, 1fr);
  padding: 4px 6px;
}

.mob-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 10px;
}

.mob-nav-btn.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  z-index: 48;
}

.mobile-menu-trigger {
  display: none;
}

@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop.open {
    display: block;
  }
  .workspace {
    margin-left: 0;
  }
  .mobile-bottom-nav {
    display: grid;
  }
  .mobile-menu-trigger {
    display: inline-flex;
  }
  .main-container {
    padding: 16px 14px 90px;
  }
  .topbar {
    padding: 0 14px;
  }
}

/* ======================== CARDS, GRIDS & SURFACES ======================== */
.card {
  background: var(--surface-white);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.hero-banner {
  background: linear-gradient(125deg, #ebf3ff 0%, #eff4ff 52%, #ffffff 100%);
  border-radius: var(--radius-xl);
  padding: 26px 28px;
  border: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.hero-purple {
  background: linear-gradient(125deg, #ebf3ff 0%, #eff4ff 48%, #f3e8ff 100%);
  border-color: #e9ddff;
}

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}
.col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }
.col-12 { grid-column: span 12; }

.grid-kpi-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

@media (max-width: 1120px) {
  .col-8, .col-7, .col-5, .col-4 { grid-column: span 12; }
  .grid-kpi-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .col-6 { grid-column: span 12; }
  .grid-kpi-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero-banner { flex-direction: column; align-items: flex-start; padding: 20px; }
}

/* ======================== BUTTONS & BADGES ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 11px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 83, 205, 0.24);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-soft:hover:not(:disabled) { background: var(--primary-container); color: #fff; }

.btn-purple {
  background: var(--secondary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(107, 56, 212, 0.24);
}
.btn-purple:hover:not(:disabled) { background: var(--secondary-container); }

.btn-emerald {
  background: var(--emerald);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.24);
}
.btn-emerald:hover:not(:disabled) { filter: brightness(0.93); }

.btn-danger {
  background: var(--crimson-soft);
  color: var(--crimson);
}
.btn-danger:hover:not(:disabled) { background: var(--crimson); color: #fff; }

.btn-outline {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}
.btn-outline:hover:not(:disabled) { background: var(--surface-low); border-color: #b2c5ff; color: var(--primary); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; border-radius: 12px; }
.w-full { width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: var(--emerald-soft); color: var(--emerald-dark); }
.badge-amber { background: var(--amber-soft); color: var(--tertiary); }
.badge-purple { background: var(--purple-soft); color: var(--secondary); }
.badge-red { background: var(--crimson-soft); color: var(--crimson-dark); }
.badge-gray { background: #f1f5f9; color: #475569; }

/* ======================== FORMS & FILTER PILLS ======================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-variant);
}
.form-control {
  width: 100%;
  min-height: 41px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-input);
  background: #ffffff;
  color: var(--text-main);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 83, 205, 0.14);
}
textarea.form-control { min-height: 88px; resize: vertical; }

.pill-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pill-tab {
  padding: 7px 15px;
  border-radius: var(--radius-full);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-low);
  color: var(--text-muted);
  transition: all 0.13s ease;
}
.pill-tab:hover { color: var(--primary); background: var(--surface-high); }
.pill-tab.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(0, 83, 205, 0.22);
}

/* ======================== TABLES ======================== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  text-align: left;
}
.data-table th {
  background: #f8fafc;
  padding: 11px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fbff; }

/* ======================== PROGRESS & DIGITAL CARD ======================== */
.progress-track {
  width: 100%;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--surface-high);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary-container);
  transition: width 0.35s ease;
}
.progress-fill.emerald { background: var(--emerald); }
.progress-fill.purple { background: linear-gradient(90deg, var(--primary), var(--secondary)); }

.id-card-visual {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid #dbeafe;
}
.id-card-header {
  background: linear-gradient(120deg, #003ea1, #0053cd, #146bfb);
  color: #ffffff;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.id-card-stripe {
  height: 6px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--amber));
}

.private-feedback-box {
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  border-radius: 0 12px 12px 0;
  padding: 14px 16px;
}

/* Segmented Attendance Pills */
.att-seg {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
}
.att-seg button {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}
.att-seg button.sel-Hadir { background: var(--emerald); color: #fff; }
.att-seg button.sel-Izin { background: var(--primary-container); color: #fff; }
.att-seg button.sel-Sakit { background: var(--amber); color: #fff; }
.att-seg button.sel-Alpha { background: var(--crimson); color: #fff; }

/* ======================== MODALS & TOASTS ======================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.14s ease;
}
.modal-panel {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast-item {
  background: #0f172a;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  animation: slideUp 0.18s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Utility Helpers */
.flex { display: flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-emerald { color: var(--emerald); }
.text-crimson { color: var(--crimson); }
.text-purple { color: var(--secondary); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }
.text-hero { font-size: 28px; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  flex-shrink: 0;
}

/* Print Stylesheet */
@media print {
  .sidebar, .topbar, .mobile-bottom-nav, .no-print, .toast-stack {
    display: none !important;
  }
  .workspace { margin-left: 0 !important; }
  .main-container { padding: 0 !important; max-width: 100% !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #cbd5e1 !important; }
}
