/* ============================================================
   Pengembangan SDM — MJM Battery
   Design system: modern learning platform (light, gradient indigo->violet)
   ============================================================ */

:root {
  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --ink: #111827;
  --muted: #6B7280;
  --primary: #4F46E5;
  --primary-2: #7C3AED;
  --grad: linear-gradient(135deg, #4F46E5, #7C3AED);
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(17, 24, 39, .06);
  --shadow-lg: 0 18px 45px rgba(79, 70, 229, .18);
  --border: #E5E7EB;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

.container { max-width: 1100px; margin: 0 auto; }

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; font: inherit; font-weight: 600;
  font-size: 14px; border: none; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .3); }
.btn-primary:hover { box-shadow: var(--shadow-lg); }
.btn-ghost { background: #EEF2FF; color: var(--primary); }
.btn-ghost:hover { background: #E0E7FF; }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }
.btn-danger { background: #FEE2E2; color: #B91C1C; }
.btn-danger:hover { background: #FECACA; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------
   Alerts / flash
   ------------------------------------------------------------ */
.alert {
  padding: 13px 18px; border-radius: 12px; margin-bottom: 22px;
  font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #D1FAE5; color: #065F46; }
.alert-error { background: #FEE2E2; color: #B91C1C; }

/* ------------------------------------------------------------
   Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-admin { background: #EEF2FF; color: var(--primary); }
.badge-mekanik { background: #FEF3C7; color: #B45309; }
.badge-done { background: #D1FAE5; color: #065F46; }
.badge-new { background: #F3F4F6; color: var(--muted); }
.badge-off { background: #F3F4F6; color: var(--muted); }

/* ------------------------------------------------------------
   Auth (login) — split layout
   ------------------------------------------------------------ */
.auth-layout { display: flex; min-height: 100vh; }

.auth-brand {
  flex: 1; background: var(--grad); color: #fff;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 64px; position: relative; overflow: hidden;
}
.auth-brand::after {
  content: ''; position: absolute; right: -140px; bottom: -140px;
  width: 420px; height: 420px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.auth-brand::before {
  content: ''; position: absolute; left: -90px; top: -90px;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.auth-brand .brand { display: flex; align-items: center; gap: 14px; margin-bottom: 40px; position: relative; z-index: 1; }
.auth-brand .brand img { width: 52px; height: 52px; border-radius: 50%; background: #fff; padding: 4px; }
.auth-brand .brand strong { font-size: 22px; letter-spacing: .3px; }
.auth-brand h1 { font-size: 34px; font-weight: 800; line-height: 1.25; margin-bottom: 14px; position: relative; z-index: 1; }
.auth-brand p { font-size: 15px; opacity: .9; max-width: 420px; margin-bottom: 34px; position: relative; z-index: 1; }
.auth-benefits { list-style: none; position: relative; z-index: 1; display: grid; gap: 14px; }
.auth-benefits li { display: flex; gap: 12px; align-items: center; font-size: 14.5px; font-weight: 600; }
.auth-benefits .ico {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  background: rgba(255, 255, 255, .18); display: grid; place-items: center; font-size: 15px;
}

.auth-side {
  width: 480px; flex: none; display: grid; place-items: center; padding: 40px 32px;
}
.auth-card { width: 100%; max-width: 384px; }
.auth-card h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.auth-card .back-site { margin-top: 22px; text-align: center; font-size: 13.5px; }

/* ------------------------------------------------------------
   App shell — sidebar + main
   ------------------------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  display: flex; flex-direction: column; padding: 22px 16px;
}
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.sidebar .brand img { width: 40px; height: 40px; border-radius: 50%; }
.sidebar .brand .b-name { font-size: 15px; font-weight: 800; line-height: 1.2; }
.sidebar .brand .b-site { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.nav-group-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 12px; color: var(--ink); font-weight: 600; font-size: 14px;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: #F3F4F6; text-decoration: none; }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(79, 70, 229, .28); }
.nav-item .n-ico { width: 20px; text-align: center; }

.sidebar .spacer { flex: 1; }
.sidebar .side-user { display: flex; align-items: center; gap: 12px; padding: 12px 8px 4px; border-top: 1px solid var(--border); margin-top: 14px; }
.sidebar .side-user .u-name { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.sidebar .side-user .u-role { font-size: 12px; color: var(--muted); }
.sidebar .logout-link { display: block; padding: 8px 10px; border-radius: 10px; color: var(--danger); font-size: 13.5px; font-weight: 600; margin-left: auto; }
.sidebar .logout-link:hover { background: #FEE2E2; text-decoration: none; }

.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 55;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

.main { flex: 1; margin-left: var(--sidebar-w); padding: 28px 40px 60px; min-width: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.topbar .page-title { font-size: 22px; font-weight: 800; }

.hamburger {
  display: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; font-size: 18px; cursor: pointer; color: var(--ink);
}
.user-chip { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); padding: 7px 16px 7px 8px; border-radius: 999px; box-shadow: var(--shadow); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.user-chip .u-name { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.user-chip .u-role { font-size: 11.5px; color: var(--muted); }

/* ------------------------------------------------------------
   Dashboard: stat cards + course grid
   ------------------------------------------------------------ */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.stat-card .value { font-size: 30px; font-weight: 800; letter-spacing: -.5px; }
.stat-card .value small { font-size: 15px; color: var(--muted); font-weight: 600; }
.stat-card .s-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; }
.s-ico.indigo { background: #EEF2FF; }
.s-ico.green { background: #D1FAE5; }
.s-ico.amber { background: #FEF3C7; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 16px; }
.section-head h2 { font-size: 18px; font-weight: 800; }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.course-card {
  background: var(--surface); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
  transition: transform .15s ease, box-shadow .15s ease; border: 1px solid transparent;
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #E0E7FF; }
.course-card .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.course-card h3 { font-size: 17px; font-weight: 800; line-height: 1.35; }
.course-card .desc { font-size: 13.5px; color: var(--muted); flex: 1; }
.course-card .meta { display: flex; align-items: center; gap: 16px; }
.course-card .meta .m-item { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.course-card .footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }

/* Progress ring (SVG) */
.ring { width: 62px; height: 62px; position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: #E5E7EB; }
.ring .bar { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset .4s ease; }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 800; }

/* ------------------------------------------------------------
   Course page + materi list
   ------------------------------------------------------------ */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb .sep { opacity: .5; }

.course-hero { background: var(--surface); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); margin-bottom: 24px; }
.course-hero h1 { font-size: 24px; font-weight: 800; margin: 10px 0 8px; }
.course-hero .desc { color: var(--muted); font-size: 14.5px; max-width: 640px; }
.course-hero .progress-meta { display: flex; align-items: center; gap: 14px; margin-top: 18px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.progress-track { flex: 1; height: 9px; background: #E5E7EB; border-radius: 999px; overflow: hidden; max-width: 520px; }
.progress-fill { height: 100%; background: var(--grad); border-radius: 999px; transition: width .4s ease; }

.materi-list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.materi-row { display: flex; align-items: center; gap: 16px; padding: 16px 22px; border-bottom: 1px solid #F3F4F6; transition: background .1s ease; }
.materi-row:last-child { border-bottom: none; }
.materi-row:hover { background: #F8FAFF; }
.materi-row .materi-num {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: #EEF2FF; color: var(--primary); font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.materi-row.done .materi-num { background: #D1FAE5; color: #065F46; }
.materi-row .materi-body { flex: 1; min-width: 0; }
.materi-row .materi-title { font-weight: 700; font-size: 14.5px; }
.materi-row.done .materi-title { text-decoration: line-through; color: var(--muted); }
.materi-row .materi-sub { font-size: 12.5px; color: var(--muted); }
.materi-row .chev { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------
   Reader (materi.php)
   ------------------------------------------------------------ */
.reader-layout { display: grid; grid-template-columns: 290px 1fr; gap: 24px; align-items: start; }
.reader-side { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; position: sticky; top: 24px; }
.reader-side .rs-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); padding: 8px 8px 10px; }
.reader-side .rs-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
.reader-side .rs-item:hover { background: #F3F4F6; text-decoration: none; }
.reader-side .rs-item.active { background: #EEF2FF; color: var(--primary); }
.reader-side .rs-item .dot { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11px; background: #F3F4F6; color: var(--muted); font-weight: 700; }
.reader-side .rs-item.done .dot { background: #D1FAE5; color: #065F46; }
.reader-side .rs-item.active .dot { background: var(--grad); color: #fff; }

.reader-main { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px; min-width: 0; }
.reader-main .rm-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.reader-main h1 { font-size: 22px; font-weight: 800; line-height: 1.3; }
.reader-content { color: var(--ink); font-size: 15.5px; }
.reader-content p { margin-bottom: 14px; }
.reader-content h2, .reader-content h3 { margin: 20px 0 10px; }
.reader-content ul, .reader-content ol { margin: 0 0 14px 22px; }
.reader-content li { margin-bottom: 6px; }
.reader-content strong { font-weight: 700; }
.reader-content img { border-radius: 12px; margin: 8px 0; }
.reader-nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.form-card { background: var(--surface); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); max-width: 760px; }
.form-card h3 { font-size: 17px; font-weight: 800; margin-bottom: 18px; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 7px; }
.form-label .req { color: var(--danger); }
.form-control {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--border);
  font: inherit; font-size: 14px; color: var(--ink); background: #fff; transition: border-color .12s ease, box-shadow .12s ease;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3.5px rgba(79, 70, 229, .13); }
textarea.form-control { min-height: 180px; resize: vertical; line-height: 1.6; }
select.form-control { appearance: auto; }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* ------------------------------------------------------------
   Admin tables
   ------------------------------------------------------------ */
.admin-table-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 800; padding: 14px 18px; border-bottom: 1px solid var(--border); background: #FAFBFF; }
.admin-table td { padding: 14px 18px; border-bottom: 1px solid #F3F4F6; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #F8FAFF; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btn { font-size: 13px; font-weight: 700; }
.link-btn.edit { color: var(--primary); }
.link-btn.delete { color: var(--danger); }

/* ------------------------------------------------------------
   Empty state
   ------------------------------------------------------------ */
.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state .e-ico { font-size: 42px; margin-bottom: 12px; opacity: .6; }
.empty-state p { font-size: 14.5px; }

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 0 rgba(0,0,0,0); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(17, 24, 39, .25); }
  .main { margin-left: 0; padding: 22px 20px 60px; }
  .hamburger { display: inline-block; }
  .stat-grid { grid-template-columns: 1fr; }
  .reader-layout { grid-template-columns: 1fr; }
  .reader-side { position: static; }
}

@media (max-width: 768px) {
  .auth-brand { display: none; }
  .auth-side { width: 100%; }
  .course-grid { grid-template-columns: 1fr; }
  .topbar .page-title { font-size: 18px; }
}

@media (max-width: 480px) {
  .main { padding: 18px 14px 50px; }
  .reader-main { padding: 24px 18px; }
  .course-hero { padding: 22px; }
}