/* =========================================================
   Santrilogy — theme.css (v3.5 - Scrollbar Terlihat di Semua Perangkat)
   ========================================================= */

/* =========================================================
   1. TOKENS & DESIGN SYSTEM
   ========================================================= */
:root {
  color-scheme: dark light;

  /* Color Palette (Dark Mode - Default) */
  --surface: #121317;       /* Main background */
  --surface-2: #171923;     /* Card background, sidebar */
  --surface-3: #1b1e2a;     /* Hover states, input fields */
  --txt-base: #c7c9d1;      /* Body text */
  --txt-strong: #f7f7fb;    /* Headings, strong text */
  --txt-mute: #8b8f9b;       /* Muted text, icons */
  --stroke-soft: #2a2f3a;   /* Borders */
  --brand: #22c55e;         /* Main brand color (green) */
  --brand-blue: #0ea5e9;    /* Accent color (blue for links) */
  --danger: #ef4444;        /* Error/delete color */
  --white: #ffffff;
  --black: #000000;

  /* Sizing & Spacing */
  --radius-md: 0.75rem;     /* 12px */
  --radius-lg: 1rem;        /* 16px */
  --radius-xl: 1.25rem;     /* 20px */
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

body[data-theme="light"] {
  --surface: #f5f7fb;
  --surface-2: #ffffff;
  --surface-3: #eef2f6;
  --txt-base: #374151;
  --txt-strong: #0f172a;
  --txt-mute: #667085;
  --stroke-soft: #e5e7eb;
}

/* =========================================================
   2. BASE & RESET STYLES
   ========================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background-color: var(--surface);
  color: var(--txt-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Custom Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--stroke-soft) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background-color: var(--stroke-soft);
  border-radius: var(--radius-full);
}

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

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 1rem;
}

.main {
  padding-top: calc(3.5rem + 1rem);
  padding-bottom: calc(3.5rem + 1rem + env(safe-area-inset-bottom));
}

@media (min-width: 1024px) {
  .main {
    padding: 1.5rem;
  }
}

/* =========================================================
   4. COMPONENTS
   ========================================================= */

/* --- Navigation (Sidebar & Bottom Nav) --- */
.sidebar {
  display: none;
  width: 280px;
  background-color: var(--surface-2);
  border-right: 1px solid var(--stroke-soft);
  padding: 1.25rem;
  position: sticky;
  top: 0;
  height: 100dvh;
}
.sidebar .brand {
  font-weight: 600;
  color: var(--txt-strong);
  font-size: 1.25rem;
}

.bottomnav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  background-color: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--stroke-soft);
  height: calc(3.5rem + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 100%;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--txt-base);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.bottomnav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  color: var(--txt-mute);
  gap: 0.25rem;
  transition: color var(--transition-fast);
}
:is(.sidebar nav a, .bottomnav a):is(:hover, :focus-visible) {
  color: var(--txt-strong);
}
:is(.sidebar nav a):is(:hover, :focus-visible) {
  background-color: var(--surface-3);
}
:is(.sidebar nav a.active) {
  background-color: var(--surface-3);
  color: var(--txt-base);
}
:is(.sidebar nav a.active i) {
  color: var(--txt-base);
}
:is(.bottomnav a.active) {
  color: var(--brand);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}
.nav-icon i {
  font-size: 20px;
  line-height: 1;
}

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
    flex-direction: column;
  }
  .bottomnav {
    display: none;
  }
}

/* --- Topbar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--stroke-soft);
}
.topbar-inner {
  height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.topbar .title {
  font-weight: 600;
  color: var(--txt-strong);
}

/* --- Forms --- */
.form-input {
  display: block;
  width: 100%;
  height: 2.75rem;
  padding-inline: 0.75rem;
  background-color: var(--surface-3);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-md);
  color: var(--txt-base);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus, .form-input:focus-visible {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue) 15%, transparent);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding-inline: 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
}
.btn:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-brand {
  background-color: var(--brand);
  color: var(--white);
}
.btn-brand:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-2px);
}
.btn-danger {
  background-color: var(--danger);
  color: var(--white);
}
.btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
}
.btn-secondary {
  background-color: var(--surface-3);
  border-color: var(--stroke-soft);
  color: var(--txt-base);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--txt-mute);
}

/* --- Cards --- */
.card {
  background-color: var(--surface-2);
  border: 1px solid var(--stroke-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px -5px color-mix(in srgb, var(--black) 15%, transparent);
}

/* --- Theme Toggle --- */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--surface-3);
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-full);
}
.switch {
  width: 44px;
  height: 24px;
  background-color: var(--surface);
  border-radius: var(--radius-full);
  position: relative;
  display: inline-block;
  cursor: pointer;
}
#knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background-color: var(--white);
  border-radius: 50%;
  transition: transform var(--transition-fast);
}

/* --- Article Display --- */
.article { max-width: 720px; margin-inline: auto; }
.badge { display: inline-flex; align-items: center; height: 28px; padding-inline: 12px; border-radius: var(--radius-full); background-color: var(--brand); color: var(--white); font-weight: 600; font-size: 12px; margin-bottom: 0.75rem; }
.h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); line-height: 1.25; color: var(--txt-strong); margin-bottom: 1rem; }
.meta { display: flex; align-items: center; gap: 12px; color: var(--txt-mute); font-size: 14px; padding-bottom: 1.25rem; border-bottom: 1px solid var(--stroke-soft); margin-bottom: 2rem; }
.meta img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.hero { border-radius: var(--radius-lg); overflow: hidden; margin-block: 2rem; }

/* --- Professional Prose Styling --- */
.prose {
  font-size: clamp(1rem, 1.2vw, 1.125rem);
  line-height: 1.8;
  color: var(--txt-base);
}
.prose > * + * { margin-top: 1.25em; }
.prose h2, .prose h3 { color: var(--txt-strong); line-height: 1.3; }
.prose h2 { font-size: clamp(1.5rem, 3vw, 1.875rem); margin-top: 2em; }
.prose h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); margin-top: 1.8em; }
.prose p { margin-top: 1.25em; margin-bottom: 1.25em; }
.prose a { color: var(--brand-blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose blockquote {
  padding: 1em 1.25em;
  border-left: 3px solid var(--brand);
  background-color: var(--surface-2);
  border-radius: var(--radius-md);
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}
.prose ul, .prose ol { padding-left: 1.5em; margin-top: 1.25em; margin-bottom: 1.25em; }
.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--txt-mute); }
.prose code {
  background-color: var(--surface-3);
  padding: 0.2em 0.4em;
  border-radius: 6px;
  border: 1px solid var(--stroke-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.prose pre {
  background-color: var(--surface-3);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke-soft);
  overflow-x: auto;
  font-size: 0.9em;
  margin-top: 1.5em;
  margin-bottom: 1.5em;
}
.prose pre code { background: transparent; border: none; padding: 0; }
.prose img { border-radius: var(--radius-md); margin-top: 2em; margin-bottom: 2em; }
.prose hr { border: none; border-top: 1px solid var(--stroke-soft); margin: 2.5em 0; }

/* =========================================================
   5. HELPERS & UTILITIES
   ========================================================= */
.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--stroke-soft);
  background-color: var(--surface-3);
  white-space: nowrap;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}
.chip:hover {
  background-color: color-mix(in srgb, var(--surface-3) 70%, var(--black));
}
.chip.active {
  background-color: var(--brand);
  color: var(--white);
  border-color: var(--brand);
}

.skeleton {
  position: relative;
  overflow: hidden;
  background-color: var(--surface-3);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* [PERBAIKAN] Kode ini dihapus agar scrollbar terlihat di semua perangkat */
/* .hide-scrollbar { ... } */
/* @media (hover: hover) and (pointer: fine) { ... } */

/* =========================================================
   6. PAGE-SPECIFIC & RESPONSIVE TWEAKS
   ========================================================= */

@media (max-width: 1023px) {
  #chips {
    margin-top: 0;
  }
}
/* Navigasi Pohon di Panel Kiri */
.program-tree-item, .module-tree-item {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 150ms ease;
}
.program-tree-item:hover, .module-tree-item:hover {
    background-color: var(--surface-3);
}
.program-tree-item.active {
    background-color: var(--surface-3);
}
.module-tree-item.active {
    background-color: var(--brand);
    color: var(--white);
}
.tree-toggle {
    transition: transform 300ms ease;
}
.tree-toggle.collapsed {
    transform: rotate(-90deg);
}

/* Playlist Timeline di Panel Kanan */
.playlist-module-header {
    padding: 12px;
    border: 1px solid var(--stroke-soft);
    border-radius: 8px;
    background-color: var(--surface-3);
    cursor: pointer;
}
.playlist-lesson-list {
    position: relative;
    padding-left: 28px;
    margin-top: 10px;
}
/* Garis Timeline Vertikal */
.playlist-lesson-list::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 11px;
    width: 2px;
    background-color: var(--stroke-soft);
}
.playlist-lesson-item {
    position: relative;
    padding: 10px 0 10px 10px;
    cursor: pointer;
}
/* Titik pada Timeline */
.playlist-lesson-item::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--surface);
    border: 2px solid var(--stroke-soft);
    transition: all 200ms ease;
}
.playlist-lesson-item.active::before {
    border-color: var(--brand);
    background-color: var(--brand);
}
.playlist-lesson-item.completed::before {
    border-color: var(--brand);
}
.playlist-lesson-item.completed .lesson-status-icon {
    color: var(--brand);
}
