/* GPD LMS — Guru Pejuang Digital
   Mobile-First, Clean, Human-First Design */

:root {
  --primary: #1565C0;
  --primary-dark: #0D47A1;
  --primary-light: #42A5F5;
  --level1: #1565C0;
  --level2: #E65100;
  --level3: #00838F;
  --success: #2E7D32;
  --warning: #F57F17;
  --danger: #C62828;
  --bg: #F0F4F8;
  --card: #FFFFFF;
  --text: #1A2B3C;
  --text-muted: #546E7A;
  --border: #E0E8F0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(21,101,192,0.10);
  --shadow-hover: 0 6px 24px rgba(21,101,192,0.18);
  font-size: 16px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; margin-top: 1.2rem; margin-bottom: 0.5rem; }
p { margin-bottom: 0.8rem; }
ul, ol { padding-left: 1.4rem; margin-bottom: 0.8rem; }
li { margin-bottom: 0.3rem; }
strong { font-weight: 700; }
em { font-style: italic; }
code { background: #E3F2FD; padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 0.9em; }

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

/* ── Layout ── */
.container { max-width: 680px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}
.header-logo-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.header-avatar {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}
.btn-logout {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #1B5E20; }
.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }

/* ── Auth Page ── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1565C0 0%, #0D47A1 50%, #1A237E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  padding: 36px 28px;
  width: 100%;
  max-width: 420px;
}
.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}
.auth-brand-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #1565C0, #42A5F5);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin: 0 auto 12px;
}
.auth-brand h1 { font-size: 1.4rem; color: var(--primary); }
.auth-brand p { font-size: 0.85rem; color: var(--text-muted); }

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}
.auth-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color 0.2s;
  background: #fff;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
}
.form-input.error { border-color: var(--danger); }

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}
.form-error.visible { display: block; }

/* ── Dashboard ── */
.dash-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1E88E5 100%);
  color: #fff;
  padding: 28px 0 32px;
  margin-bottom: -20px;
}
.dash-greeting { font-size: 0.9rem; opacity: 0.85; margin-bottom: 4px; }
.dash-name { font-size: 1.6rem; font-weight: 700; }
.dash-subtitle { font-size: 0.9rem; opacity: 0.8; margin-top: 4px; }

.progress-overview {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}
.progress-overview-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.progress-bar-wrap {
  background: var(--border);
  border-radius: 100px;
  height: 8px;
  margin-bottom: 8px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.5s ease;
}
.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Level Sections ── */
.level-section { margin-bottom: 28px; }
.level-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  margin-bottom: 12px;
}
.level-badge {
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
}
.level1 { background: var(--level1); }
.level2 { background: var(--level2); }
.level3 { background: var(--level3); }
.level-title-text { font-weight: 700; color: var(--text); }

/* ── Module Cards ── */
.module-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: block;
  border: 2px solid transparent;
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}
.module-card.completed { border-color: var(--success); }
.module-card.locked { opacity: 0.6; cursor: not-allowed; }
.module-card-inner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.module-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.module-info { flex: 1; min-width: 0; }
.module-title { font-weight: 700; font-size: 0.9rem; color: var(--text); margin-bottom: 2px; }
.module-subtitle { font-size: 0.78rem; color: var(--text-muted); }
.module-meta { display: flex; gap: 10px; margin-top: 6px; align-items: center; }
.module-duration { font-size: 0.75rem; color: var(--text-muted); }
.module-status {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}
.status-done { background: #E8F5E9; color: var(--success); }
.status-start { background: #E3F2FD; color: var(--primary); }
.status-locked { background: #ECEFF1; color: #90A4AE; }
.module-chevron { color: var(--text-muted); flex-shrink: 0; font-size: 0.9rem; }

/* Quiz Card */
.quiz-card {
  background: linear-gradient(135deg, #1A237E, #1565C0);
  border-radius: var(--radius);
  padding: 20px;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: block;
  margin-bottom: 28px;
}
.quiz-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(21,101,192,0.3); text-decoration: none; }
.quiz-card h3 { color: #fff; font-size: 1.1rem; }
.quiz-card p { color: rgba(255,255,255,0.8); font-size: 0.85rem; margin: 6px 0 0; }
.quiz-card.locked { opacity: 0.5; cursor: not-allowed; }

/* ── Module Page ── */
.module-hero {
  padding: 24px 0 20px;
  color: #fff;
}
.module-hero-level {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.85;
  margin-bottom: 4px;
}
.module-hero-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 6px; }
.module-hero-sub { font-size: 0.9rem; opacity: 0.8; }
.module-hero-meta {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.82rem;
  opacity: 0.85;
}

.section-nav {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 16px;
  overflow-x: auto;
  white-space: nowrap;
  display: flex;
  gap: 8px;
}
.section-nav-btn {
  padding: 6px 14px;
  border-radius: 100px;
  border: 2px solid var(--border);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.section-nav-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.section-nav-btn.done {
  border-color: var(--success);
  color: var(--success);
}
.section-nav-btn.done::after { content: " ✓"; }

.section-content {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  display: none;
}
.section-content.active { display: block; }
.section-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }

/* ── Rich Content ── */
.callout {
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 0.92rem;
}
.callout-info { background: #E3F2FD; border-left: 4px solid var(--primary); }
.callout-tip { background: #E8F5E9; border-left: 4px solid var(--success); }
.callout-warning { background: #FFF8E1; border-left: 4px solid var(--warning); }
.callout-danger { background: #FFEBEE; border-left: 4px solid var(--danger); }

.step-card {
  display: flex;
  gap: 14px;
  background: var(--bg);
  border-radius: 10px;
  padding: 14px;
  margin: 10px 0;
}
.step-number {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 14px 0;
}
.info-table th, .info-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.info-table th {
  background: #E3F2FD;
  font-weight: 700;
  color: var(--primary-dark);
}
.info-table tr:nth-child(even) td { background: #F8FAFC; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.col-card { border-radius: 10px; padding: 14px; }
.col-blue { background: #E3F2FD; border: 1px solid #90CAF9; }
.col-amber { background: #FFF3E0; border: 1px solid #FFCC02; }
.col-card h4 { margin-top: 0; }

.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.module-card-small {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.85rem;
}

/* ── Section Footer ── */
.section-footer {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.complete-btn {
  width: 100%;
  margin-top: 16px;
}
.complete-btn.done {
  background: var(--success);
}

/* ── Quiz Page ── */
.quiz-header {
  background: linear-gradient(135deg, #1A237E, #1565C0);
  color: #fff;
  padding: 24px 0;
}
.quiz-header h1 { font-size: 1.4rem; color: #fff; }
.quiz-header p { opacity: 0.8; font-size: 0.9rem; margin-top: 4px; }
.quiz-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  opacity: 0.8;
  margin-top: 10px;
}

.quiz-container { padding: 20px 0; }
.question-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}
.question-level {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.question-text { font-size: 1rem; font-weight: 700; line-height: 1.5; margin-bottom: 20px; }
.question-number { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }

.options-list { list-style: none; padding: 0; }
.option-item { margin-bottom: 10px; }
.option-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.92rem;
}
.option-label:hover { border-color: var(--primary); background: #F3F8FF; }
.option-radio { display: none; }
.option-marker {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
  transition: all 0.2s;
  font-size: 0.8rem;
}
.option-item.selected .option-marker {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.option-item.selected .option-label { border-color: var(--primary); background: #E3F2FD; }
.option-item.correct .option-label { border-color: var(--success); background: #E8F5E9; }
.option-item.correct .option-marker { background: var(--success); border-color: var(--success); color: #fff; }
.option-item.wrong .option-label { border-color: var(--danger); background: #FFEBEE; }
.option-item.wrong .option-marker { background: var(--danger); border-color: var(--danger); color: #fff; }

.explanation-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  display: none;
}
.explanation-box.visible { display: block; }
.explanation-box.correct { background: #E8F5E9; border-left: 4px solid var(--success); }
.explanation-box.wrong { background: #FFEBEE; border-left: 4px solid var(--danger); }

.quiz-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 16px;
}

/* ── Quiz Result ── */
.result-page { text-align: center; padding: 40px 20px; }
.result-emoji { font-size: 4rem; margin-bottom: 16px; }
.result-score {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 8px;
}
.result-grade { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.result-detail {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.result-breakdown {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  margin-bottom: 24px;
}
.result-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.result-breakdown-item:last-child { border-bottom: none; }

/* ── Toast / Alert ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1A2B3C;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  z-index: 1000;
  transition: transform 0.3s;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ── Loading ── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 9999;
  transition: opacity 0.4s;
}
.loading-screen.hidden { opacity: 0; pointer-events: none; }
.loading-logo { font-size: 3rem; margin-bottom: 16px; }
.loading-text { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.loading-sub { font-size: 0.85rem; opacity: 0.7; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-top: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }

/* ── Responsive Tweaks ── */
@media (max-width: 480px) {
  .two-col { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .auth-card { padding: 28px 20px; }
  .info-table { font-size: 0.82rem; }
  .info-table th, .info-table td { padding: 8px 10px; }
}

/* ── Completed module overlay ── */
.completed-overlay {
  background: linear-gradient(135deg, #1B5E20, #2E7D32);
  border-radius: 8px;
  padding: 14px 16px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.completed-overlay-icon { font-size: 1.5rem; }

/* ── Back button ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  margin-bottom: 12px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}
.back-btn:hover { color: #fff; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Section progress indicator ── */
.read-progress {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 12px;
}
.read-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}
.read-dot.done { background: var(--primary); }
.read-dot.current { background: var(--primary-light); }

/* ── Page spacing ── */
.page-content { padding: 20px 0 40px; }

/* ── Certificate hint ── */
.cert-hint {
  background: linear-gradient(135deg, #F57F17, #FF8F00);
  border-radius: var(--radius);
  padding: 16px;
  color: #fff;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.cert-hint strong { display: block; font-size: 1rem; margin-bottom: 4px; }
