/* ============================================================
   GROOVY LMS - Stylesheet
   Tema: Futuristic White | Accent: Violet | Font: Poppins
   ============================================================ */

:root {
  /* ------------------------------------------------------------------
     Palet merek Groovy:
       Primary   — Groovy Purple  #5B2FD1  rgb(91, 47, 209)
       Secondary — Groovy Blue    #168FEF  rgb(22, 143, 239)
     Nama variabel --violet-* dan --amber-* dipertahankan agar seluruh
     komponen lama tetap berfungsi: --violet-* kini berisi skala UNGU,
     --amber-* berisi skala BIRU sebagai warna sekunder.
     ------------------------------------------------------------------ */
  --violet-50:  #F4F0FE;
  --violet-100: #E7DFFC;
  --violet-200: #CDBCF8;
  --violet-300: #AC93F2;
  --violet-400: #8560E4;
  --violet-500: #6B3FDA;
  --violet-600: #5B2FD1;
  --violet-700: #4823A8;
  --violet-800: #351A7C;

  /* Warna sekunder — Groovy Blue */
  --amber-50:   #E8F4FE;
  --amber-100:  #CDE8FD;
  --amber-400:  #4FA9F3;
  --amber-500:  #168FEF;
  --amber-600:  #0E74C6;
  --lime-500:   #57B6F5;

  --ink:        #1A1626;   /* teks utama */
  --ink-soft:   #4A4459;
  --muted:      #868099;   /* teks redup */
  --line:       #E9E5F2;   /* garis/border */
  --bg:         #F8F7FC;   /* latar halaman */
  --surface:    #FFFFFF;   /* kartu/panel */

  --success:    #15803D;   /* hijau — berhasil */
  --warning:    #D97706;   /* kuning — perhatian */
  --danger:     #DC2626;   /* merah — gagal */
  --info:       #168FEF;   /* Groovy Blue — informasi */

  /* Bentuk & bayangan */
  --radius:     16px;
  --radius-sm:  10px;
  --radius-lg:  22px;
  --shadow:     0 4px 24px rgba(38, 20, 88, 0.06);
  --shadow-md:  0 8px 32px rgba(38, 20, 88, 0.10);
  --shadow-lg:  0 16px 48px rgba(38, 20, 88, 0.14);
  --grad:       linear-gradient(135deg, #5B2FD1 0%, #7A4FE8 100%);
  --grad-amber: linear-gradient(135deg, #168FEF 0%, #4FA9F3 100%);

  --sidebar-w:  260px;
  --topbar-h:   70px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   HALAMAN AUTH (Login)
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--bg);
}

.auth-hero {
  position: relative;
  background: var(--grad);
  color: #fff;
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth-hero::before,
.auth-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
}
.auth-hero::before { width: 420px; height: 420px; top: -140px; right: -120px; }
.auth-hero::after  { width: 280px; height: 280px; bottom: -100px; left: -80px; background: rgba(255,255,255,0.07); }

.auth-hero .brand-mark {
  display: flex; align-items: center; gap: 12px;
  position: relative; z-index: 1;
}
.auth-hero .brand-mark .logo-badge { background: rgba(255,255,255,0.18); }

.auth-hero-content { position: relative; z-index: 1; }
.auth-hero-content h1 {
  font-size: 38px; font-weight: 600; line-height: 1.2;
  letter-spacing: -0.5px; margin-bottom: 16px;
}
.auth-hero-content p { font-size: 16px; opacity: 0.9; max-width: 420px; }

.auth-features {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 14px;
}
.auth-features .feat { display: flex; align-items: center; gap: 12px; font-size: 14px; opacity: 0.95; }
.auth-features .feat .dot {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,0.18);
  display: grid; place-items: center; font-size: 16px;
}

.auth-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 26px; font-weight: 600; letter-spacing: -0.4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 30px; font-size: 14px; }

/* --------------- Form --------------- */
.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--ink-soft); margin-bottom: 7px;
}
.field small { display: block; margin-top: 6px; line-height: 1.45; color: var(--muted); font-size: 11.5px; }
.field .input-icon { position: relative; }
.field .input-icon i {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 18px; pointer-events: none;
}
.field .input-icon input { padding-left: 44px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select, textarea {
  width: 100%;
  padding: 13px 16px;
  font-family: inherit; font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--violet-400);
  box-shadow: 0 0 0 4px var(--violet-100);
}
input::placeholder { color: #B8B7C7; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; transition: transform .12s, box-shadow .18s, background .18s;
  text-align: center;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(91, 47, 209, 0.28); }
.btn-primary:hover { box-shadow: 0 8px 24px rgba(91, 47, 209, 0.38); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface); color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--violet-200); color: var(--violet-700); }
.btn-sm { padding: 9px 16px; font-size: 13px; }

.form-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; font-size: 13px; }
.checkbox { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); cursor: pointer; }
.checkbox input { width: auto; }
.link-muted { color: var(--violet-600); font-weight: 500; }

.demo-creds {
  margin-top: 26px; padding: 16px;
  background: var(--violet-50); border: 1px dashed var(--violet-200);
  border-radius: var(--radius-sm); font-size: 12.5px; color: var(--ink-soft);
}
.demo-creds b { color: var(--violet-700); }
.demo-creds .row { display: flex; justify-content: space-between; padding: 3px 0; }

/* ============================================================
   BRAND / LOGO
   ============================================================ */
.brand-mark { display: flex; align-items: center; gap: 11px; }
.logo-badge {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 20px; letter-spacing: -1px;
  box-shadow: 0 6px 16px rgba(91, 47, 209, 0.30);
}
.brand-mark .brand-name { font-size: 19px; font-weight: 600; letter-spacing: -0.4px; }
.brand-mark .brand-name span { color: var(--violet-600); }

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

/* --------------- Sidebar --------------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 50; transition: transform .25s ease;
}
.sidebar-head { padding: 22px 22px 18px; }
.sidebar-nav { flex: 1; padding: 8px 14px; overflow-y: auto; }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--muted);
  padding: 16px 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 13px; margin-bottom: 3px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item i { font-size: 20px; color: var(--muted); transition: color .15s; }
.nav-item:hover { background: var(--violet-50); color: var(--violet-700); }
.nav-item:hover i { color: var(--violet-600); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(91, 47, 209,0.25); }
.nav-item.active i { color: #fff; }

.sidebar-foot { padding: 16px; border-top: 1px solid var(--line); }
.user-chip {
  display: flex; align-items: center; gap: 11px;
  padding: 10px; border-radius: var(--radius-sm);
  background: var(--bg);
}
.user-chip .meta { overflow: hidden; }
.user-chip .meta .nm { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .meta .rl { font-size: 11.5px; color: var(--muted); }

.avatar {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: var(--violet-100); color: var(--violet-700);
  display: grid; place-items: center; font-weight: 600; font-size: 14px;
}
.avatar.lg { width: 52px; height: 52px; font-size: 18px; border-radius: 14px; }

/* --------------- Main area --------------- */
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
}
.topbar .left { display: flex; align-items: center; gap: 14px; }
.topbar h1 { font-size: 19px; font-weight: 600; letter-spacing: -0.3px; }
.topbar .sub { font-size: 12.5px; color: var(--muted); }
.topbar .right { display: flex; align-items: center; gap: 14px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line);
  display: grid; place-items: center; cursor: pointer;
  color: var(--ink-soft); font-size: 20px; position: relative;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--violet-50); color: var(--violet-700); }
.icon-btn .badge-dot {
  position: absolute; top: 9px; right: 10px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}

.menu-toggle { display: none; }

.content { padding: 28px; }

/* --------------- Page heading --------------- */
.page-head { margin-bottom: 24px; }
.page-head h2 { font-size: 23px; font-weight: 600; letter-spacing: -0.4px; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* --------------- Cards & grids --------------- */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-head h3 { font-size: 16px; font-weight: 600; }
.card-head a { font-size: 13px; color: var(--violet-600); font-weight: 500; }

/* --------------- Stat cards --------------- */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat .ico {
  width: 50px; height: 50px; border-radius: 14px;
  display: grid; place-items: center; font-size: 24px; margin-bottom: 16px;
}
.stat .ico.v { background: var(--violet-100); color: var(--violet-700); }
.stat .ico.g { background: #D1FAE5; color: #059669; }
.stat .ico.a { background: #FEF3C7; color: #D97706; }
.stat .ico.b { background: #DBEAFE; color: #2563EB; }
.stat .val { font-size: 30px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 6px; }
.stat .trend { font-size: 12px; margin-top: 10px; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.stat .trend.up { color: var(--success); }
.stat .trend.down { color: var(--danger); }

/* --------------- Table --------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
  text-transform: uppercase; color: var(--muted);
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 14px; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: var(--violet-50); }

/* --------------- Badge / pill --------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
}
.pill.green  { background: #D1FAE5; color: #047857; }
.pill.amber  { background: #FEF3C7; color: #B45309; }
.pill.gray   { background: #F1F1F6; color: #6B6A7C; }
.pill.violet { background: var(--violet-100); color: var(--violet-700); }
.pill.blue   { background: #DBEAFE; color: #1D4ED8; }
.pill.red    { background: #FEE2E2; color: #B91C1C; }

/* --------------- Toggle switch --------------- */
.switch { position:relative; display:inline-block; width:46px; height:26px; flex-shrink:0; }
.switch input { opacity:0; width:0; height:0; }
.switch .slider {
  position:absolute; cursor:pointer; inset:0;
  background:var(--line); border-radius:999px; transition:.2s;
}
.switch .slider::before {
  content:''; position:absolute; height:20px; width:20px; left:3px; top:3px;
  background:#fff; border-radius:50%; transition:.2s; box-shadow:0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background:var(--violet-600); }
.switch input:checked + .slider::before { transform:translateX(20px); }
.switch-row { display:flex; align-items:center; gap:12px; }
.switch-row .switch-text .t { font-size:14px; font-weight:500; }
.switch-row .switch-text .d { font-size:12px; color:var(--muted); }

/* --------------- Progress bar --------------- */
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--grad); border-radius: 999px; }

/* --------------- List item (course / activity) --------------- */
.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .thumb {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: var(--violet-100); color: var(--violet-700);
  display: grid; place-items: center; font-size: 20px;
}
.list-row .info { flex: 1; min-width: 0; }
.list-row .info .t { font-size: 14px; font-weight: 500; }
.list-row .info .d { font-size: 12.5px; color: var(--muted); }

/* --------------- Flash message --------------- */
.flash {
  padding: 13px 18px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
.flash.success { background: #D1FAE5; color: #065F46; }
.flash.danger  { background: #FEE2E2; color: #991B1B; }
.flash.warning { background: #FEF3C7; color: #92400E; }
.flash.info    { background: #DBEAFE; color: #1E40AF; }

/* --------------- Misc --------------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty i { font-size: 44px; opacity: 0.4; display: block; margin-bottom: 12px; }

.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(30, 27, 46, 0.4); z-index: 45;
}

/* --------------- Animations --------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .5s ease both; }
.d1 { animation-delay: .05s; } .d2 { animation-delay: .10s; }
.d3 { animation-delay: .15s; } .d4 { animation-delay: .20s; }

/* ============================================================
   RESPONSIVE (Mobile First friendly)
   ============================================================ */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .overlay.show { display: block; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 0 16px; }
}

/* --------------- Baris berulang (repeatable rows) --------------- */
.rep-list { margin-bottom: 12px; }
.rep-row {
  position: relative; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 44px 14px 14px; margin-bottom: 10px; background: var(--bg);
}
.rep-del {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--danger); cursor: pointer;
  display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.rep-del:hover { background: #FEE2E2; border-color: #FCA5A5; }
.rep-del i { font-size: 16px; }

/* --------------- Editor teks sederhana --------------- */
.rte { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.rte-bar {
  display: flex; align-items: center; gap: 3px; flex-wrap: wrap;
  padding: 8px 10px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.rte-bar button {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent;
  color: var(--ink-soft); cursor: pointer; display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.rte-bar button:hover { background: var(--violet-100); color: var(--violet-700); }
.rte-bar button i { font-size: 17px; }
.rte-sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; }
.rte-area {
  min-height: 180px; max-height: 460px; overflow-y: auto;
  padding: 15px 17px; font-size: 14px; line-height: 1.75; color: var(--ink);
  outline: none;
}
.rte-area:focus { box-shadow: inset 0 0 0 2px var(--violet-200); }
.rte-area:empty::before {
  content: 'Tulis keterangan tambahan di sini...';
  color: var(--muted);
}

/* --------------- Tampilan teks kaya --------------- */
.rich-text { font-size: 14px; line-height: 1.8; color: var(--ink-soft); word-wrap: break-word; }
.rich-text br { display: block; content: ''; margin-top: 2px; }
.rich-text h3 { font-size: 16px; font-weight: 600; color: var(--ink); margin: 16px 0 8px; }
.rich-text h4 { font-size: 14.5px; font-weight: 600; color: var(--ink); margin: 14px 0 7px; }
.rich-text p { margin: 0 0 10px; }
.rich-text ul, .rich-text ol { margin: 0 0 12px; padding-left: 22px; }
.rich-text li { margin-bottom: 5px; }
.rich-text a { color: var(--violet-700); text-decoration: underline; }
.rich-text blockquote {
  margin: 12px 0; padding: 10px 16px; border-left: 3px solid var(--violet-300);
  background: var(--violet-50); border-radius: 0 10px 10px 0;
}

/* --------------- Baris pendidikan pada profil --------------- */
.edu-row {
  display: flex; gap: 14px;
  padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.edu-row:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }

/* --------------- Tombol instruktur pada kartu kursus --------------- */
.course-actions { display: flex; gap: 8px; align-items: stretch; }
.course-actions form { flex: 1; }
.btn-instructor {
  flex-shrink: 0; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--violet-700);
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500;
  max-width: 44%; transition: background .15s, border-color .15s;
}
.btn-instructor:hover { background: var(--violet-50); border-color: var(--violet-300); }
.btn-instructor span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------- Lencana merek dengan logo unggahan --------------- */
.logo-badge.has-logo {
  background: #fff !important;
  border: 1px solid var(--line);
  padding: 4px;
  overflow: hidden;
}
.logo-badge.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Logo pada kartu login/daftar (tampil lebih besar) */
.auth-card .brand-logo { text-align: center; margin-bottom: 18px; }
.auth-card .brand-logo img { max-width: 150px; max-height: 92px; object-fit: contain; }

/* --------------- Logo pada sidebar --------------- */
/* Memakai tata letak block (bukan flex) agar lebar gambar
   benar-benar mengisi sidebar di semua peramban. */
.sidebar-head.has-logo { padding: 14px 12px 12px; }
.sidebar-head.has-logo .brand-mark {
  display: block;
  width: 100%;
  gap: 0;
}
.sidebar-head.has-logo .sidebar-logo {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 120px;   /* pengaman untuk logo berbentuk persegi */
  object-fit: contain;
  margin: 0 auto;
}

/* Penanda versi — untuk memastikan berkas CSS terbaru sudah termuat.
   Buka Ctrl+U / DevTools lalu cari "LOGO-V3" di berkas style.css. */
.css-version-LOGO-V3 { display: none; }
