:root {
  --primary: #6366f1;          /* indigo cerah */
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #64748b;
  --success: #10b981;
  --danger:  #ef4444;
  --warning: #f59e0b;
  --info:    #06b6d4;
  --pink:    #ec4899;
  --purple:  #8b5cf6;
  --teal:    #14b8a6;

  --bg-light: #f5f7ff;
  --sidebar-bg: #ffffff;
  --sidebar-width: 260px;

  /* Gradient ceria */
  --grad-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --grad-success: linear-gradient(135deg, #34d399, #10b981);
  --grad-warning: linear-gradient(135deg, #fbbf24, #f59e0b);
  --grad-danger:  linear-gradient(135deg, #fb7185, #ef4444);
  --grad-info:    linear-gradient(135deg, #22d3ee, #06b6d4);
  --grad-purple:  linear-gradient(135deg, #a78bfa, #8b5cf6);
  --grad-pink:    linear-gradient(135deg, #f472b6, #ec4899);
  --grad-sky:     linear-gradient(135deg, #38bdf8, #6366f1);
}

* { box-sizing: border-box; }

body {
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-light);
  background-image:
    radial-gradient(at 0% 0%, rgba(99,102,241,0.08) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(236,72,153,0.06) 0, transparent 50%),
    radial-gradient(at 100% 100%, rgba(20,184,166,0.06) 0, transparent 50%);
  background-attachment: fixed;
  color: #1e293b;
  font-size: 0.95rem;
}

/* === NAVBAR === */
.navbar {
  background: var(--grad-primary) !important;
}
.navbar .navbar-brand { letter-spacing: 0.3px; }

/* === USER AVATAR === */
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.4);
  overflow: hidden;
  flex-shrink: 0;
}
img.user-avatar { padding: 0; }

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar .nav-link {
  color: #475569;
  padding: 0.7rem 1.2rem;
  margin: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  display: flex; align-items: center;
  transition: all 0.2s ease;
}
.sidebar .nav-link i {
  width: 26px; font-size: 1.1rem;
  color: var(--primary);
}
.sidebar .nav-link:hover {
  background: rgba(99,102,241,0.08);
  color: var(--primary-dark);
  transform: translateX(2px);
}
.sidebar .nav-link.active {
  background: var(--grad-primary);
  color: white !important;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}
.sidebar .nav-link.active i { color: white; }
.sidebar .sidebar-section {
  padding: 1rem 1.25rem 0.4rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  font-weight: 700;
}

/* === MAIN === */
.main-content { min-width: 0; }

/* === CARDS === */
.card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(99,102,241,0.06);
  transition: all 0.25s ease;
  background: #fff;
}
.card:hover { box-shadow: 0 8px 24px rgba(99,102,241,0.12); transform: translateY(-2px); }
.card-header {
  background: white;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  border-radius: 16px 16px 0 0 !important;
  padding: 1rem 1.25rem;
}
/* gradient headers */
.card-header.bg-gradient-primary { background: var(--grad-primary) !important; color:#fff; border:none; }
.card-header.bg-gradient-success { background: var(--grad-success) !important; color:#fff; border:none; }
.card-header.bg-gradient-warning { background: var(--grad-warning) !important; color:#fff; border:none; }
.card-header.bg-gradient-danger  { background: var(--grad-danger)  !important; color:#fff; border:none; }
.card-header.bg-gradient-info    { background: var(--grad-info)    !important; color:#fff; border:none; }
.card-header.bg-gradient-purple  { background: var(--grad-purple)  !important; color:#fff; border:none; }
.card-header.bg-gradient-pink    { background: var(--grad-pink)    !important; color:#fff; border:none; }

/* === STAT CARDS === */
.stat-card {
  border-radius: 16px;
  padding: 1.25rem;
  color: white;
  display: flex; align-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  transition: transform 0.2s ease;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .stat-icon {
  font-size: 2.4rem; opacity: 0.95;
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.25); border-radius: 14px;
  margin-right: 1rem;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { font-size: 0.85rem; opacity: 0.95; margin-top: 4px; }
.stat-card.bg-gradient-primary { background: var(--grad-sky); }
.stat-card.bg-gradient-success { background: var(--grad-success); }
.stat-card.bg-gradient-warning { background: var(--grad-warning); }
.stat-card.bg-gradient-danger  { background: var(--grad-danger); }
.stat-card.bg-gradient-info    { background: var(--grad-info); }
.stat-card.bg-gradient-purple  { background: var(--grad-purple); }
.stat-card.bg-gradient-pink    { background: var(--grad-pink); }

/* === BUTTONS === */
.btn { border-radius: 10px; font-weight: 500; transition: all 0.2s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary  { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 4px 12px rgba(99,102,241,0.35); }
.btn-success  { background: var(--success); border-color: var(--success); }
.btn-warning  { background: var(--warning); border-color: var(--warning); color:#fff; }
.btn-warning:hover { color:#fff; }
.btn-danger   { background: var(--danger);  border-color: var(--danger); }
.btn-info     { background: var(--info);    border-color: var(--info); color:#fff; }

/* === TABLES === */
.table { font-size: 0.9rem; }
.table thead th {
  background: linear-gradient(180deg, #f8fafc, #eef2ff);
  font-weight: 700;
  color: #4338ca;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-bottom: 2px solid #e0e7ff;
}
.table tbody tr:hover { background: rgba(99,102,241,0.04); }
.table-responsive { border-radius: 12px; }

/* === FORMS === */
.form-control, .form-select {
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 0.55rem 0.85rem;
  transition: all 0.2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.15);
}

/* === BADGES === */
.badge { font-weight: 600; padding: 0.4em 0.7em; border-radius: 8px; letter-spacing: 0.02em; }

/* === ALERTS === */
.alert { border-radius: 12px; border: none; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger  { background: #fee2e2; color: #991b1b; }

/* === NAV TABS === */
.nav-tabs { border-bottom: 2px solid #e0e7ff; }
.nav-tabs .nav-link {
  border: none;
  color: #64748b;
  font-weight: 600;
  border-radius: 10px 10px 0 0;
  padding: 0.6rem 1rem;
}
.nav-tabs .nav-link.active {
  background: var(--grad-primary);
  color: white;
  border: none;
}

/* === LOGIN PAGE === */
.login-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 35%, #ec4899 70%, #f59e0b 100%);
  padding: 1rem;
}
.login-card {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%; max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
}
.login-logo {
  width: 78px; height: 78px;
  background: var(--grad-primary);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 2.1rem;
  margin: 0 auto 1rem;
  box-shadow: 0 10px 25px rgba(99,102,241,0.4);
}

/* === RESPONSIVE === */
@media (max-width: 991px) {
  .stat-card .stat-value { font-size: 1.4rem; }
  .stat-card .stat-icon { font-size: 2rem; width: 50px; height: 50px; }
}
@media (max-width: 576px) {
  body { font-size: 0.9rem; }
  .login-card { padding: 1.75rem; }
  .stat-card { padding: 1rem; }
  .card-header { padding: 0.85rem 1rem; }
}

/* Materi card */
.materi-card { transition: all 0.25s; cursor: pointer; }
.materi-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(99,102,241,0.18); }

/* Quiz */
.soal-card { border-left: 4px solid var(--primary-light); }
.timer-box {
  position: sticky; top: 70px;
  background: white; padding: 1rem;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(99,102,241,0.15);
  text-align: center;
  z-index: 100;
}
.timer-box .time { font-size: 1.85rem; font-weight: 800; color: var(--primary); }

/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

/* =====================================================
   v10 — Sidebar Profesional & Dinamis + Brand Mark
   ===================================================== */

/* Navbar refined */
.app-navbar {
  background: var(--grad-primary) !important;
  min-height: 64px;
  padding-top: .5rem;
  padding-bottom: .5rem;
  backdrop-filter: saturate(180%) blur(8px);
}
.app-navbar .navbar-brand { font-size: 1.05rem; }

/* Brand mark (logo container) */
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.35);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 1.15rem;
  overflow: hidden; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.brand-mark.sm { width: 42px; height: 42px; border-radius: 12px; }
.sidebar-brand .brand-mark.sm {
  background: var(--grad-primary);
  border: none;
  box-shadow: 0 6px 18px rgba(99,102,241,0.35);
}

/* Sidebar layout */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #ffffff 0%, #fafbff 100%);
  border-right: 1px solid #e5e9f5;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  box-shadow: 1px 0 0 rgba(99,102,241,0.04);
}
.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid #eef0f8;
  background: #fff;
}
.sidebar-brand .brand-info { min-width: 0; }
.sidebar-brand .brand-title {
  font-weight: 700; font-size: .95rem; color: #1e293b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
}
.sidebar-brand .brand-role {
  font-size: .7rem; color: #6366f1; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
}
.sidebar-scroll {
  flex: 1 1 auto; overflow-y: auto; padding-bottom: .5rem;
}
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.sidebar-footer {
  border-top: 1px solid #eef0f8;
  padding: .65rem .85rem;
  background: #fff;
}
.sidebar-footer .min-w-0 { min-width: 0; }

/* Nav links — more polished */
.sidebar .nav-link {
  position: relative;
  color: #475569;
  padding: .6rem .9rem;
  margin: 2px 10px;
  border-radius: 10px;
  font-weight: 500;
  font-size: .88rem;
  display: flex; align-items: center; gap: .65rem;
  transition: all .2s ease;
}
.sidebar .nav-link i {
  width: 22px; font-size: 1.05rem;
  color: #6366f1; flex-shrink: 0; text-align: center;
}
.sidebar .nav-link span { flex: 1; min-width: 0; }
.sidebar .nav-link:hover {
  background: rgba(99,102,241,0.08);
  color: var(--primary-dark);
  transform: translateX(3px);
}
.sidebar .nav-link.active {
  background: var(--grad-primary);
  color: white !important;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(99,102,241,0.35);
}
.sidebar .nav-link.active i { color: white; }
.sidebar .nav-link.active::before {
  content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 4px; border-radius: 0 4px 4px 0;
  background: var(--pink);
  box-shadow: 0 0 8px rgba(236,72,153,0.6);
}
.sidebar .nav-link.text-danger i { color: #ef4444; }
.sidebar .nav-link.text-danger.active { background: var(--grad-danger); box-shadow: 0 6px 16px rgba(239,68,68,0.35); }

.sidebar .sidebar-section {
  padding: .9rem 1.4rem .35rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #94a3b8;
  font-weight: 700;
}

/* Offcanvas mobile sidebar tweaks */
.sidebar-offcanvas { width: 280px !important; }
.sidebar-offcanvas .sidebar-brand { width: 100%; }
