/* ===== PENGATURAN DASAR & TEMA MODERN ===== */
:root {
  --c-primary: #000000;
  --c-primary-dark: #383838;
  --c-primary-text: #ffffff;
  --c-primary-light-bg: #f0f6ff; /* Latar belakang untuk item aktif */
  
  --c-secondary: #6c757d;
  --c-secondary-text: #ffffff;
  
  --c-success: #28a745;
  --c-danger: #dc3545;
  --c-danger-outline: #dc3545;
  --c-danger-outline-hover: #ffffff;
  
  /* PENAMBAHAN: Warna untuk Pie Chart */
  --c-gender-male: #007bff;
  --c-gender-female: #e83e8c;
  --c-gender-other: #6c757d;
  
  --c-age-1: #007bff;
  --c-age-2: #17a2b8;
  --c-age-3: #28a745;
  --c-age-4: #ffc107;
  --c-age-5: #dc3545;


  --c-bg: #f0f2f5;         /* Latar belakang abu-abu modern */
  --c-fg: #1c1e21;         /* Teks hitam pekat (seperti Facebook) */
  --c-muted: #65676b;      /* Teks abu-abu */
  --c-border: #dce0e6;     /* Border abu-abu muda */
  --c-panel: #ffffff;      /* Latar belakang card putih bersih */

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08); /* Bayangan lebih lembut */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  
  --nav-height: 60px; /* Tinggi nav mobile */
  --mobile-topbar-height: 56px; /* PENAMBAHAN: Tinggi top bar mobile */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  /* Perubahan: Ganti font ke Inter */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--c-bg);
  color: var(--c-fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== STRUKTUR UTAMA ===== */
.container {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}

/* ===== DESKTOP - TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--c-panel);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--c-fg);
  text-decoration: none;
}

.topbar .brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar nav a {
  color: var(--c-muted);
  text-decoration: none;
  font-weight: 600; /* Sedikit lebih tebal */
  font-size: 0.95rem;
  transition: color 0.2s;
  padding: 4px 2px;
}
/* Sembunyikan ikon SVG di desktop */
.topbar nav a svg {
  display: none;
}

.topbar nav a:hover {
  color: var(--c-primary);
  border-bottom: none;
}
.topbar nav a.active {
  color: var(--c-primary);
  border-bottom: 2px solid var(--c-primary);
}
.topbar nav a#btnLogout {
  color: var(--c-danger);
  border-bottom: none;
  font-weight: 600;
}
.topbar nav a#btnLogout:hover {
  color: #a71d2a;
}
.topbar nav a.btn { /* Tombol "Daftar" */
  border-bottom: none;
  color: var(--c-primary-text);
  background-color: var(--c-primary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-weight: 500;
}
.topbar nav a.btn:hover {
  background-color: var(--c-primary-dark);
}

/* PENAMBAHAN: Mobile Top Bar (disembunyikan di desktop) */
.mobile-topbar {
  display: none;
}
/* AKHIR PENAMBAHAN */


.foot {
  text-align: center;
  padding: 32px 16px;
  color: var(--c-muted);
  font-size: 0.9rem;
  margin-top: 32px;
  border-top: 1px solid var(--c-border);
}

/* ===== KARTU (CARD) ===== */
.card {
  background-color: var(--c-panel);
  border: none; /* Hapus border, gunakan bayangan */
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
}
.card + .card {
  margin-top: 24px;
}

.card h1 { font-size: 1.75rem; margin-bottom: 8px; font-weight: 700; }
.card h2 { font-size: 1.5rem; margin-bottom: 12px; font-weight: 700; }
.card h3 { font-size: 1.25rem; margin-bottom: 10px; font-weight: 600; }
.card .subtitle {
  color: var(--c-muted);
  margin-top: -8px;
  margin-bottom: 20px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* ===== FORMULIR MODERN ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label,
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--c-fg);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select.form-control {
  width: 100%;
  padding: 12px 14px; /* Sedikit lebih tebal */
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  background-color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="file"] {
  padding: 10px 14px; /* Padding khusus untuk file */
}
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  padding-right: 2.5rem;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light-bg); /* Bayangan fokus */
}

textarea {
  min-height: 100px;
  resize: vertical;
}
.form-text-center {
    text-align: center;
    font-size: 0.9rem;
    margin-top: 12px;
}

/* ===== TOMBOL (BUTTONS) MODERN ===== */
.btn {
  display: inline-block;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-sm {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.btn-primary {
  background-color: var(--c-primary);
  color: var(--c-primary-text);
  box-shadow: 0 2px 4px rgba(0,123,255,0.2);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--c-primary-dark);
  box-shadow: 0 3px 8px rgba(0,123,255,0.3);
}
.btn-primary:disabled {
  background-color: #a0cfff;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary-outline {
  background-color: transparent;
  color: var(--c-primary);
  border: 1px solid var(--c-primary);
}
.btn-primary-outline:hover {
  background-color: var(--c-primary-light-bg);
  color: var(--c-primary);
}

.btn-secondary {
  background-color: var(--c-secondary);
  color: var(--c-secondary-text);
}
.btn-secondary:hover {
  background-color: #5a6268;
}

.btn-danger-outline {
  background-color: transparent;
  color: var(--c-danger-outline);
  border-color: var(--c-danger-outline);
}
.btn-danger-outline:hover {
  background-color: var(--c-danger);
  color: var(--c-danger-outline-hover);
  border-color: var(--c-danger);
}


.btn-block {
  display: block;
  width: 100%;
}
.btn-lg {
  padding: 16px 24px;
  font-size: 1.15rem;
}

/* ===== HALAMAN SPESIFIK ===== */

/* Auth (Login/Register) */
.auth-card {
  max-width: 420px;
  margin: 32px auto;
}
.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 0.95rem;
}
.auth-switch a {
  color: var(--c-primary);
  font-weight: 600;
  text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

/* Home (Dashboard) */
.welcome-header {
  margin-bottom: 24px;
}
.welcome-header h1 { font-size: 2rem; font-weight: 700; }
.welcome-header p { color: var(--c-muted); font-size: 1.1rem; }

.grid-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.grid-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.tile {
  display: block;
  background-color: var(--c-panel);
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: var(--c-fg);
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  border-color: var(--c-primary);
}
.tile h2 { font-size: 1.25rem; margin-bottom: 6px; color: var(--c-primary); font-weight: 600; }
.tile p { font-size: 0.95rem; color: var(--c-muted); }

.card-leaderboard {
  max-height: 400px; /* Batasi tinggi leaderboard */
  overflow-y: auto;
}

/* ================================== */
/* ===== STYLE LEADERBOARD BARU (v2) ===== */
/* ================================== */
.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.leaderboard-list li {
  display: flex;
  align-items: center;
  gap: 16px; /* Jarak antar elemen */
  padding: 12px 8px;
  border-bottom: 1px solid var(--c-border);
}
.leaderboard-list li:last-child {
  border-bottom: none;
}

/* 1. Peringkat (Angka) */
.leaderboard-list .rank {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 1.5rem; /* Lebih besar */
  color: var(--c-muted);
  width: 32px; /* Lebar tetap untuk alignment */
  text-align: center;
  /* Hapus style medali lama */
  background-color: transparent;
  border-radius: 0;
  height: auto;
}

/* Hapus style medali lama (emas, perak, perunggu) */
.leaderboard-list .rank.rank-1,
.leaderboard-list .rank.rank-2,
.leaderboard-list .rank.rank-3 {
  background-color: transparent;
  color: var(--c-muted);
}
/* Peringkat 1-3 bisa dibuat lebih tebal jika mau */
.leaderboard-list .rank.rank-1,
.leaderboard-list .rank.rank-2,
.leaderboard-list .rank.rank-3 {
  color: var(--c-fg); /* Warna teks utama */
}

/* 2. Avatar */
.leaderboard-list .rank-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--c-border);
  background-color: var(--c-bg); /* Warna latar jika gambar gagal dimuat */
}

/* 3. Info (Nama & Skor) */
.leaderboard-list .rank-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden; /* Untuk text-overflow */
}

.leaderboard-list .name {
  font-weight: 600;
  color: var(--c-fg);
  font-size: 1.1rem; /* Sedikit lebih besar */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-list .score {
  font-weight: 500;
  color: var(--c-muted); /* Warna abu-abu */
  font-size: 0.95rem; /* Sedikit lebih kecil */
  margin-top: 2px;
}
/* ================================== */


/* Join Sesi */
.join-card {
  max-width: 500px;
  margin: 32px auto;
}
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--c-bg);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.status {
  font-weight: 600;
  color: var(--c-muted);
}
.timer {
  font-weight: 700;
  color: var(--c-primary);
}
.question {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
}
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.options .btn {
  padding: 20px;
  font-size: 1rem;
  background-color: var(--c-panel);
  border: 1px solid var(--c-border);
  color: var(--c-fg);
  text-align: left;
  line-height: 1.4;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}
.options .btn:hover {
  border-color: var(--c-primary);
  background-color: var(--c-primary-light-bg);
  box-shadow: none;
}
.options .btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background-color: var(--c-bg);
  box-shadow: none;
}
/* State Jawaban */
.btn-correct { background-color: #d4edda !important; border-color: #c3e6cb !important; color: #155724 !important; font-weight: 700; }
.btn-incorrect { background-color: #f8d7da !important; border-color: #f5c6cb !important; color: #721c24 !important; font-weight: 700; }
.btn-disabled { background-color: var(--c-bg) !important; border-color: var(--c-border) !important; color: var(--c-muted) !important; opacity: 0.7; }

.mini-leaderboard {
  margin-top: 24px;
  border-top: 1px solid var(--c-border);
  padding-top: 16px;
}

/* Host Console */
.host-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.card-inner {
  padding: 16px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
}
.card-inner summary {
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
}
.live-controls {
  margin: 16px 0;
  text-align: center;
}
.liveStatus {
  margin-top: 12px;
  font-style: italic;
  color: var(--c-muted);
}

/* ===== PIN HOST MODERN ===== */
.host-pin-display {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: var(--c-primary-text);
  padding: 24px;
  margin: 20px 0;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: 0 6px 16px rgba(0,123,255,0.3);
}
.host-pin-display span {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.9;
  letter-spacing: 0.5px;
}
.host-pin-display strong {
  display: block;
  font-size: 4.5rem; /* Lebih besar lagi */
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 3px;
  margin-top: 8px;
}

/* ===== HOST QR Code ===== */
.qr-code-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.qr-code-container summary {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 16px;
  display: block;
}
.qr-code-container img {
  width: 100%;
  max-width: 250px;
  height: auto;
  border-radius: var(--radius-md);
  margin: 0 auto;
  display: block;
}
.qr-code-container p {
  text-align: center;
  color: var(--c-muted);
  font-size: 0.95rem;
  margin-top: 16px;
}


/* Materi & Survey */
.content-list {
  list-style: none;
  padding-left: 0;
}
.content-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--c-border);
}
.content-list li:last-child { border-bottom: none; }
.content-list li strong { font-size: 1.1rem; }
.content-list li p { color: var(--c-muted); margin-top: 4px; }
.content-list li a { color: var(--c-primary); text-decoration: none; font-weight: 500; }
.content-list li a:hover { text-decoration: underline; }
.content-list li.read a { color: var(--c-muted); }
.content-list li.read a::after { content: ' (dibaca)'; font-style: italic; font-size: 0.9rem; }

/* PENAMBAHAN: Style untuk .gender-options dan .age-options */
.scale-options, .gender-options, .age-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
/* PERUBAHAN: Buat .scale-options menjadi 1 kolom agar label muat */
.scale-options {
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 8px; /* Perbesar gap */
  padding: 10px 14px; /* Perbesar padding */
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  width: auto; /* Biarkan lebar menyesuaikan konten */
}
.radio-label:has(input:checked) {
  background-color: var(--c-primary-light-bg);
  border-color: var(--c-primary);
}

/* PENAMBAHAN: Style untuk label skala baru */
.radio-label .scale-number {
  font-weight: 700;
  color: var(--c-primary);
  background-color: var(--c-bg);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0; /* Mencegah buletan mengecil */
}
.radio-label .scale-text {
  font-weight: 500;
}

/* PERUBAHAN: Warna saat di-check */
.radio-label:has(input:checked) .scale-number {
  background-color: var(--c-primary);
  color: var(--c-primary-text);
}

/* ============================================== */
/* ===== PENAMBAHAN FITUR: STYLE HASIL SURVEY (BARU) ===== */
/* ============================================== */
.survey-result-question {
  background-color: var(--c-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}
.survey-result-question:last-of-type {
  border-bottom: none;
}

/* Style untuk Skala (Grafik Batang) */
.result-scale {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-scale-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1.1rem;
}
.result-scale-label strong {
  font-size: 1.75rem;
  color: var(--c-primary);
  font-weight: 700;
}
.result-scale-label small {
  font-size: 0.9rem;
  color: var(--c-muted);
}
.result-scale-bar-container {
  width: 100%;
  height: 24px;
  background-color: #e9ecef;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.result-scale-bar-value {
  height: 100%;
  background-color: var(--c-primary);
  border-radius: var(--radius-sm);
  transition: width 0.5s ease-out;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.1);
}

/* Style untuk Jawaban Teks */
.result-text-list {
  list-style-type: none;
  padding-left: 0;
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
  border-radius: var(--radius-md);
  padding: 0;
  border: 1px solid var(--c-border);
}
.result-text-list li {
  font-size: 0.95rem;
  color: var(--c-fg);
  padding: 10px 12px;
  background-color: var(--c-panel);
  border-bottom: 1px solid var(--c-border);
}
.result-text-list li:first-child {
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}
.result-text-list li:last-child {
  border-bottom: none;
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}
.result-text-list li:nth-child(even) {
  background-color: var(--c-bg);
}

/* PENAMBAHAN: Style untuk Pie Chart (Distribusi) */
.result-distribution-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}
.pie-chart-visual {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
  /* background-image akan di-set via inline style */
}
.pie-chart-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pie-chart-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}
.legend-color-box {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-sm);
}
.legend-label {
  font-weight: 500;
  color: var(--c-fg);
}
.legend-value {
  color: var(--c-muted);
}


/* Style untuk tombol dan hasil AI */
#aiAnalysisCard {
  border-top: 3px solid var(--c-primary);
}
.ai-result-container {
  background-color: var(--c-primary-light-bg);
  border: 1px dashed var(--c-primary);
  padding: 16px;
  margin-top: 20px;
  border-radius: var(--radius-md);
  line-height: 1.7;
}
.ai-result-container.loading {
  color: var(--c-muted);
  font-style: italic;
}
.ai-result-container strong,
.ai-result-container b {
  color: var(--c-primary-dark);
}
/* ============================================== */


/* ===== PENAMBAHAN FITUR: STYLE WORKSHOP ===== */
.workshop-prompt {
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
  background-color: var(--c-bg);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}
.workshop-submissions-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}
.submission-card {
  background-color: var(--c-panel);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.submission-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--c-border);
}
.submission-header strong {
  font-size: 1.05rem;
}
.submission-card p {
  padding: 16px;
  line-height: 1.7;
  font-size: 1.05rem;
  white-space: pre-wrap; /* Jaga format newline */
}
/* ============================================== */

/* ===== PENAMBAHAN FITUR: STYLE SERTIFIKAT ===== */
#certificateWrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.certificate-container {
  width: 100%;
  max-width: 800px; /* Ukuran A4 Lanskap (approx) */
  aspect-ratio: 1.414 / 1; /* A4 Landscape ratio */
  background-color: #ffffff;
  border: 1px solid var(--c-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}
.certificate-border {
  border: 5px solid var(--c-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  padding: 32px;
  background: radial-gradient(circle, var(--c-primary-light-bg) 0%, #ffffff 70%);
}
.certificate-body {
  font-family: 'Montserrat', sans-serif;
  color: var(--c-fg);
}
.cert-title {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--c-primary-dark);
  display: block;
}
.cert-intro {
  font-size: 1.1rem;
  color: var(--c-muted);
  display: block;
  margin-top: 32px;
}
.cert-name {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--c-primary);
  display: block;
  margin: 16px 0;
  border-bottom: 2px solid var(--c-border);
  padding-bottom: 16px;
}
.cert-desc {
  font-size: 1.1rem;
  color: var(--c-muted);
  display: block;
  margin-top: 24px;
}
.cert-event-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-fg);
  display: block;
  margin-top: 8px;
}
.cert-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 64px;
  gap: 32px;
  font-family: 'Montserrat', sans-serif;
}
.cert-footer > div {
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cert-date, .cert-giver {
  font-size: 1.1rem;
  font-weight: 500;
}
.cert-line {
  width: 100%;
  height: 1px;
  background-color: var(--c-border);
  margin: 8px 0;
}
.cert-label {
  font-size: 0.9rem;
  color: var(--c-muted);
}
/* ============================================== */

/* ===== PENAMBAHAN FITUR: STYLE PDF VIEWER ===== */
.pdf-viewer-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  background-color: var(--c-panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.pdf-renderer {
  width: 100%;
  overflow-x: auto; /* Memungkinkan scroll horizontal jika canvas terlalu lebar */
  overflow-y: hidden;
  background-color: var(--c-bg);
  text-align: center; /* Memusatkan canvas */
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#pdfCanvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.pdf-viewer-status {
  padding: 48px 24px;
  text-align: center;
  color: var(--c-muted);
  font-size: 1.1rem;
}
/* PENAMBAHAN: Style Progress Bar PDF */
.pdf-load-progress-bar {
  width: 80%;
  max-width: 300px;
  height: 8px;
  background-color: var(--c-border);
  border-radius: 4px;
  margin: 16px auto 0;
  overflow: hidden;
}
#pdfLoadProgress {
  width: 0%;
  height: 100%;
  background-color: var(--c-primary);
  transition: width 0.3s;
}
/* AKHIR PENAMBAHAN */

.pdf-viewer-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-top: 1px solid var(--c-border);
  background-color: var(--c-panel);
  flex-wrap: wrap;
  gap: 12px;
}
.pdf-page-info {
  font-weight: 500;
  color: var(--c-muted);
}
#pdfDownload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* ============================================== */


/* ===== MODAL NOTIFIKASI kustom (dari app.js) ===== */
.app-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.app-modal-dialog {
  background-color: var(--c-panel);
  border-radius: var(--radius-lg);
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
  max-width: 400px;
  width: 100%;
  animation: modal-fade-in 0.3s ease-out;
}
@keyframes modal-fade-in {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
.app-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
}
.app-modal-title {
  font-size: 1.2rem;
  font-weight: 600;
}
.app-modal-close {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--c-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
}
.app-modal-close:hover { opacity: 1; }
.app-modal-body {
  padding: 20px;
  font-size: 1rem;
  line-height: 1.6;
}
.app-modal-body p[data-type="error"] { color: var(--c-danger); }
.app-modal-body p[data-type="success"] { color: var(--c-success); }
.app-modal-footer {
  padding: 12px 20px;
  text-align: right;
  border-top: 1px solid var(--c-border);
}

/* ===== LAIN-LAIN & RESPONSIVE ===== */
.hidden {
  display: none !important;
}
.text-danger {
  color: var(--c-danger);
}
.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 600;
}
.back-link:hover {
  text-decoration: underline;
}
hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 20px 0;
}

/* ===== KUIS SAYA (Fase 7) ===== */
.quiz-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--c-border);
}
.quiz-item:last-child { border-bottom: none; }
.quiz-info { display: flex; flex-direction: column; gap: 4px; }
.quiz-info strong { font-size: 1.1rem; font-weight: 600; }
.quiz-info small { color: var(--c-muted); font-size: 0.9rem; }
.quiz-actions { display: flex; gap: 10px; }

/* ===== EDITOR KUIS (Fase 8) ===== */
.quiz-editor-container .card + .card {
  margin-top: 24px;
}
.editor-title {
  margin-top: 12px;
}
.question-editor-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 20px;
  background-color: var(--c-panel); /* Putih agar kontras */
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}
.option-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.option-input-group input[type="radio"] {
  flex-shrink: 0;
}
.option-input-group input[type="text"] {
  flex-grow: 1;
}
.options-editor-tf .option-input-group {
  gap: 6px;
}
.question-editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}


/* =================================================== */
/* ===== PEROMBAKAN MOBILE MODERN (di bawah 960px) ===== */
/* =================================================== */
/* PERBAIKAN BUG CSS: Ubah breakpoint ke 960px */
@media (max-width: 960px) {
  
  /* Beri padding di bawah untuk Nav Bawah */
  body {
    /* PENAMBAHAN: Beri padding atas untuk top bar baru */
    padding-top: var(--mobile-topbar-height);
    padding-bottom: var(--nav-height);
  }

  /* Buat layout utama jadi full-width */
  .container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
  }
  
  /* Halaman Home */
  .welcome-header {
    padding: 20px 16px;
    margin-bottom: 0;
    background-color: var(--c-panel);
    border-bottom: 1px solid var(--c-border);
  }
  .welcome-header h1 { font-size: 1.75rem; }
  .welcome-header p { font-size: 1rem; }
  
  /* Buat kartu jadi full-width tanpa bayangan */
  .card {
    border-radius: 0;
    box-shadow: none;
    margin-top: 0;
    margin-bottom: 8px; /* Jarak antar 'section' */
    padding: 20px 16px;
  }
  .card + .card {
    margin-top: 8px; /* Ganti dari 24px */
  }
  
  /* Grid di Home */
  .grid-main {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .grid-tiles {
    display: grid;
    grid-template-columns: 1fr; /* 1 kolom saja */
    gap: 8px;
    padding: 16px;
  }
  .tile {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md); /* Tile tetap punya bayangan */
  }
  
  /* Leaderboard di Home */
  .card-leaderboard {
    border-radius: var(--radius-lg);
    margin: 0 16px 16px 16px; /* Beri jarak */
    box-shadow: var(--shadow-md);
  }
  /* PERBAIKAN: Padding di mobile */
  .card-leaderboard .leaderboard-list li {
    padding: 12px 4px;
  }


  /* Layout Halaman Join & Host */
  .join-card, .quiz-editor-container, .auth-card,
  #surveyWrap, #surveyResultsWrap, #aiAnalysisCard,
  .card-workshop-host, .card-workshop-join,
  #certificatePage, .pdf-viewer-container { /* Terapkan ke survey, workshop, sertifikat & PDF */
    margin: 0;
    min-height: calc(100vh - var(--nav-height) - var(--mobile-topbar-height));
    border-radius: 0;
    box-shadow: none;
  }
  .auth-card {
    padding-top: 48px;
  }
  
  /* Pilihan Jawaban di Halaman Join */
  .options {
    grid-template-columns: 1fr; /* 1 kolom */
  }
  
  /* Layout Halaman Host */
  .host-grid {
    grid-template-columns: 1fr;
  }
  .host-pin-display strong {
    font-size: 3.5rem; /* Kecilkan sedikit di mobile */
  }

  /* Kustomisasi Halaman Kuis Saya */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header .btn {
    width: 100%;
  }
  .quiz-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .quiz-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  
  /* Editor Kuis */
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  /* Style Sertifikat di Mobile */
  .certificate-container {
    padding: 8px;
    aspect-ratio: auto; /* Hapus rasio A4 */
  }
  .certificate-border {
    padding: 16px;
  }
  .cert-title { font-size: 2rem; }
  .cert-intro { font-size: 1rem; margin-top: 16px; }
  .cert-name { font-size: 1.75rem; margin-top: 8px; }
  .cert-desc { font-size: 1rem; margin-top: 16px; }
  .cert-event-name { font-size: 1.1rem; }
  .cert-footer {
    flex-direction: column;
    gap: 24px;
    margin-top: 32px;
  }
  .cert-footer > div {
    width: 100%;
  }

  /* Style PDF Viewer di Mobile */
  .pdf-viewer-container {
    max-width: 100%;
    height: calc(100vh - var(--nav-height) - var(--mobile-topbar-height));
    display: flex;
    flex-direction: column;
  }
  .pdf-renderer {
    flex-grow: 1;
    overflow-y: auto; /* Izinkan scroll vertikal untuk halaman panjang */
    overflow-x: hidden;
    padding: 8px;
  }
  #pdfCanvas {
    width: 100% !important; /* Paksa canvas agar pas */
    height: auto !important;
    max-width: 100%;
  }
  .pdf-viewer-controls {
    flex-shrink: 0;
    padding: 12px;
  }
  .pdf-viewer-controls .btn-secondary {
    padding: 10px 14px;
  }


  /* ========================================= */
  /* ===== PENAMBAHAN: STYLE MOBILE TOP BAR ===== */
  /* ========================================= */
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--mobile-topbar-height);
    background-color: var(--c-panel);
    border-bottom: 1px solid var(--c-border);
    padding: 0 16px;
    z-index: 90; /* Di bawah desktop topbar, di atas konten */
  }
  .mobile-topbar-back {
    /* PERUBAHAN: Penataan ulang untuk ikon saja */
    flex: 0 0 40px; /* Lebar tetap untuk tombol kembali */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: var(--c-primary);
    text-decoration: none;
    font-weight: 600;
  }
  .mobile-topbar-back.hidden {
    visibility: hidden; /* Sembunyikan tapi tetap ambil ruang */
  }
  .mobile-topbar-back span {
    display: none; /* Sembunyikan teks "Kembali" */
  }
  .mobile-topbar-back svg {
    width: 28px;
    height: 28px;
  }
  .mobile-topbar-title {
    /* PERUBAHAN: Dibuat agar fleksibel dan terpusat */
    flex: 1 1 auto;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* PERUBAHAN: Gunakan flexbox untuk memusatkan teks */
    display: flex;
    align-items: center;
    justify-content: center; /* Default center */
  }
  /* ========================================= */


  /* ========================================= */
  /* ===== NAVIGASI BAWAH MODERN (IKON) ===== */
  /* ========================================= */
  .topbar {
    /* PERBAIKAN BUG: Tambahkan position: fixed */
    position: fixed; 
    top: auto;
    bottom: 0;
    /* PERBAIKAN: Tambahkan left/right agar full-width */
    left: 0;
    right: 0;
    padding: 0;
    border-top: 1px solid var(--c-border);
    border-bottom: none;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    height: var(--nav-height);
    z-index: 100; /* Pastikan di atas mobile top bar */
  }
  
  /* Sembunyikan brand di mobile */
  .topbar .brand {
    display: none;
  }

  /* Buat nav mengisi bar */
  .topbar nav {
    width: 100%;
    height: 100%;
    display: flex;
    /* PERBAIKAN: Hapus space-evenly */
    /* justify-content: space-evenly; */ 
    align-items: center;
    gap: 0;
  }
  
  /* Styling setiap item nav (<a>) */
  .topbar nav a {
    /* PERBAIKAN: Tambahkan flex: 1 */
    flex: 1; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 6px 4px; /* PERBAIKAN: Kurangi padding horizontal */
    font-size: 0.65rem; /* PERBAIKAN: Kecilkan font lagi agar muat */
    font-weight: 500;
    text-align: center;
    border-bottom: none;
    color: var(--c-muted);
    transition: color 0.15s ease-in-out;
  }
  
  /* Styling ikon SVG di dalam <a> */
  .topbar nav a svg {
    display: block;
    width: 22px; /* PERBAIKAN: Kecilkan ikon */
    height: 22px;
    stroke: var(--c-muted); /* Warna ikon */
    transition: stroke 0.15s ease-in-out;
    margin-bottom: 2px;
  }
  
  /* Styling teks <span> di dalam <a> */
  .topbar nav a span {
    display: block;
  }
  
  /* PERBAIKAN: Tombol 'Daftar' dan 'Login' */
  .topbar nav a.btn, .topbar nav a[href*="?page=login"] {
    all: unset; /* Hapus semua style .btn */
    
    /* PERBAIKAN: Terapkan ulang style dari 'nav a' */
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 6px 4px;
    font-size: 0.65rem;
    font-weight: 500;
    text-align: center;
    color: var(--c-muted);
    transition: color 0.15s ease-in-out;
  }
  
  /* Ikon untuk tombol 'Daftar' dan 'Login' */
  .topbar nav a.btn svg, .topbar nav a[href*="?page=login"] svg {
    display: block;
    width: 22px;
    height: 22px;
    stroke: var(--c-muted);
    transition: stroke 0.15s ease-in-out;
    margin-bottom: 2px;
  }
  
  /* Style item nav yangaktif */
  .topbar nav a.active {
    color: var(--c-primary);
    background-color: transparent; /* Hapus latar belakang */
    border-top: none; /* Hapus border atas */
  }
  /* Ikon aktif */
  .topbar nav a.active svg {
    stroke: var(--c-primary); /* Ubah warna ikon */
    fill: var(--c-primary-light-bg); /* Beri sedikit fill jika perlu (atau biarkan none) */
  }
  /* Teks aktif */
  .topbar nav a.active span {
    font-weight: 600; /* Teks aktif lebih tebal */
  }

  /* Tombol Logout di mobile */
  .topbar nav a#btnLogout {
    color: var(--c-danger);
  }
  .topbar nav a#btnLogout svg {
    stroke: var(--c-danger);
  }
  .topbar nav a#btnLogout.active {
    /* Style ini mungkin tidak akan pernah terpakai, tapi untuk konsistensi */
    color: var(--c-danger);
    background-color: #fdf0f0;
  }
  
  /* Footer di mobile */
  .foot {
    display: none; /* Sembunyikan footer di mobile */
  }
}

