/* =========================================================
   EDUGURU — Design System
   Modern, card-based, animated, mobile-first / app-like
   ========================================================= */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --secondary: #06b6d4;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0284c7;
  --info-light: #e0f2fe;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e6e8f0;
  --text: #1e2233;
  --text-muted: #6b7280;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 3px rgba(30, 34, 51, 0.06);
  --shadow: 0 8px 24px rgba(30, 34, 51, 0.08);
  --shadow-lg: 0 16px 40px rgba(30, 34, 51, 0.14);

  --sidebar-w: 264px;
  --topbar-h: 64px;
  --bottomnav-h: 64px;

  --transition: 200ms cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg: #12141f;
  --surface: #1a1d2b;
  --border: #2b2f42;
  --text: #eef0f8;
  --text-muted: #9598ab;
  --primary-light: #21254a;
  --success-light: #103322;
  --warning-light: #3a2c0d;
  --danger-light: #3a1620;
  --info-light: #0d2636;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Roboto, -apple-system, sans-serif;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c7cbe0; border-radius: 10px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #363a52; }

/* =========================== Fade/slide in animations =========================== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); }
}
.animate-in { animation: fadeSlideUp .45s cubic-bezier(.4,0,.2,1) both; }
.animate-pop { animation: popIn .3s cubic-bezier(.4,0,.2,1) both; }
.stagger > * { animation: fadeSlideUp .45s cubic-bezier(.4,0,.2,1) both; }
.stagger > *:nth-child(1){animation-delay:.02s}
.stagger > *:nth-child(2){animation-delay:.07s}
.stagger > *:nth-child(3){animation-delay:.12s}
.stagger > *:nth-child(4){animation-delay:.17s}
.stagger > *:nth-child(5){animation-delay:.22s}
.stagger > *:nth-child(6){animation-delay:.27s}

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

/* ---- Sidebar (desktop) ---- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform var(--transition);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo-badge {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 16px rgba(79,70,229,.35);
}
.sidebar-brand .brand-text strong { display: block; font-size: 16px; }
.sidebar-brand .brand-text span { font-size: 11.5px; color: var(--text-muted); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-section-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 14px 12px 6px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  position: relative;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--primary-light); color: var(--primary); transform: translateX(2px); }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.3); }
.nav-item .chev { margin-left: auto; font-size: 11px; transition: transform var(--transition); }
.nav-item.open .chev { transform: rotate(90deg); }

.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition);
  padding-left: 12px;
}
.nav-submenu.open { max-height: 600px; }
.nav-submenu .nav-item { font-size: 13px; padding-left: 30px; }

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

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar .btn-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}
.topbar .btn-icon:hover { background: var(--primary-light); color: var(--primary); }
.topbar-title { font-weight: 700; font-size: 16px; }
.topbar-crumb { font-size: 12px; color: var(--text-muted); }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 30px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Main content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--transition);
}
.content-body { padding: 22px; flex: 1; }

/* ---- Bottom Navigation (mobile app-style) ---- */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottomnav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 20px rgba(30,34,51,.06);
}
.bottom-nav-inner { display: flex; height: 100%; }
.bottom-nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  position: relative;
}
.bottom-nav-item i { font-size: 18px; transition: transform var(--transition); }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active i { transform: translateY(-2px); }
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: -1px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 3px;
  background: var(--primary);
}
.bottom-nav-fab {
  position: relative;
  top: -18px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 22px rgba(79,70,229,.45);
  font-size: 20px;
}

/* Mobile sheet menu (full app menu on phone) */
.mobile-menu-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(15,17,26,.5);
  z-index: 60; opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.mobile-menu-overlay.show { opacity: 1; pointer-events: auto; display: block; }
.mobile-menu-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-height: 78vh;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  z-index: 61;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.mobile-menu-overlay.show .mobile-menu-sheet { transform: translateY(0); }
.sheet-handle { width: 40px; height: 5px; border-radius: 4px; background: var(--border); margin: 8px auto 14px; }

/* =========================== Cards & widgets =========================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-body { padding: 20px; }
.card-header-flex {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
}

.stat-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px;
}
.stat-icon {
  width: 50px; height: 50px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.indigo { background: var(--primary-light); color: var(--primary); }
.stat-icon.cyan { background: #e0fbff; color: var(--secondary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-value { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

.page-title { font-size: 20px; font-weight: 800; margin: 0 0 3px; }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin: 0; }

/* =========================== Buttons =========================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), opacity var(--transition);
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.3); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-icon-only { width: 34px; height: 34px; padding: 0; border-radius: 9px; }
.btn-block { width: 100%; }

/* =========================== Forms =========================== */
.form-label { font-weight: 700; font-size: 12.5px; margin-bottom: 6px; display: block; color: var(--text); }
.form-control, .form-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 10px 13px;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,.12);
}
.form-group { margin-bottom: 16px; }
.input-icon-wrap { position: relative; }
.input-icon-wrap i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.input-icon-wrap .form-control { padding-left: 38px; }
.input-icon-wrap .toggle-pass { left: auto; right: 13px; cursor: pointer; }

/* =========================== Table =========================== */
.table-wrap { overflow-x: auto; }
table.dt { width: 100%; border-collapse: collapse; }
table.dt thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); padding: 12px 14px; border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
table.dt tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
table.dt tbody tr { transition: background var(--transition); }
table.dt tbody tr:hover { background: var(--bg); }

.badge-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.badge-status.active { background: var(--success-light); color: var(--success); }
.badge-status.inactive { background: var(--danger-light); color: var(--danger); }
.badge-status.warning { background: var(--warning-light); color: var(--warning); }
.badge-status.info { background: var(--info-light); color: var(--info); }

.avatar-sm { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }

/* =========================== Login page =========================== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 15% 15%, #6366f1 0%, transparent 45%),
              radial-gradient(circle at 85% 85%, #06b6d4 0%, transparent 45%),
              #0f1120;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 38px 32px;
  animation: popIn .5s cubic-bezier(.4,0,.2,1) both;
}
.login-logo {
  width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px; font-weight: 800;
  box-shadow: 0 10px 24px rgba(79,70,229,.35);
}
.login-title { text-align: center; font-size: 20px; font-weight: 800; margin-bottom: 2px; }
.login-subtitle { text-align: center; font-size: 12.5px; color: var(--text-muted); margin-bottom: 26px; }
.role-toggle { display: flex; gap: 8px; background: var(--bg); padding: 5px; border-radius: 12px; margin-bottom: 22px; }
.role-toggle label { flex: 1; text-align: center; padding: 8px; border-radius: 9px; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--text-muted); transition: var(--transition); }
.role-toggle input { display: none; }
.role-toggle input:checked + label { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* =========================== Chip / dropdown / misc =========================== */
.dropdown-menu-custom {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); min-width: 200px; padding: 8px; z-index: 50;
  opacity: 0; transform: translateY(-6px); pointer-events: none;
  transition: var(--transition);
}
.dropdown-menu-custom.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.dropdown-menu-custom a, .dropdown-menu-custom button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text);
  background: none; border: none; cursor: pointer;
}
.dropdown-menu-custom a:hover, .dropdown-menu-custom button:hover { background: var(--bg); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: .5; }

.spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,17,26,.5); z-index: 90;
  display: none; align-items: flex-start; justify-content: center; padding: 40px 16px;
  overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--surface); border-radius: 20px; width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); animation: popIn .28s cubic-bezier(.4,0,.2,1) both;
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 22px; max-height: 65vh; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* =========================== Responsive =========================== */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .content-body { padding: 16px 14px 90px; }
  .bottom-nav { display: block; }
  .desktop-only { display: none !important; }
  .topbar { padding: 0 14px; }
}
@media (min-width: 992px) {
  .mobile-only { display: none !important; }
}

/* Utility */
.d-flex{display:flex}.align-center{align-items:center}.justify-between{justify-content:space-between}
.gap-2{gap:8px}.gap-3{gap:12px}.mb-0{margin-bottom:0}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:16px}.mb-4{margin-bottom:24px}
.text-muted{color:var(--text-muted)}.fw-700{font-weight:700}.small{font-size:12px}
.grid{display:grid;gap:18px}
.grid-4{grid-template-columns:repeat(4,1fr)}
.grid-3{grid-template-columns:repeat(3,1fr)}
.grid-2{grid-template-columns:repeat(2,1fr)}
@media (max-width: 1200px){.grid-4{grid-template-columns:repeat(2,1fr)}}
@media (max-width: 700px){.grid-4,.grid-3,.grid-2{grid-template-columns:1fr 1fr}}
@media (max-width: 460px){.grid-4,.grid-3,.grid-2{grid-template-columns:1fr}}
