* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', sans-serif; background: #f0f4f8; }

/* Top Bar */
.exam-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: #fff; height: 60px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 25px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.topbar-left h4 { font-size: 20px; font-weight: 700; color: #03a4ed; }
.topbar-left h4 span { color: #0277bd; }
.timer-box {
  background: #e3f2fd; padding: 8px 20px; border-radius: 10px;
  font-size: 18px; font-weight: 700; color: #0277bd;
}
.timer-box i { margin-right: 8px; }
.timer-orange { background: #fff3e0 !important; color: #e65100 !important; }
.timer-red { background: #ffebee !important; color: #c62828 !important; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.7; } }
.topbar-right { display: flex; align-items: center; gap: 15px; font-size: 14px; color: #666; }
.category-badge {
  padding: 4px 12px; border-radius: 6px; font-size: 12px;
  font-weight: 700; color: #fff; background: #03a4ed;
}
.badge-twk { background: #1565c0; }
.badge-tiu { background: #00838f; }
.badge-tkp { background: #2e7d32; }

/* Layout */
.exam-container {
  display: flex; margin-top: 60px; min-height: calc(100vh - 60px);
}
.exam-main { flex: 1; padding: 30px; max-width: 800px; margin: 0 auto; }

/* Question Card */
.question-card {
  background: #fff; border-radius: 16px; padding: 35px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.question-header { display: flex; justify-content: space-between; margin-bottom: 20px; }
.question-number { font-size: 16px; font-weight: 700; color: #333; }
.question-type {
  padding: 4px 14px; border-radius: 6px; font-size: 13px;
  font-weight: 600; background: #e3f2fd; color: #1565c0;
}
.question-text { font-size: 16px; line-height: 28px; color: #333; margin-bottom: 25px; white-space: pre-line; }

/* Options */
.option-item {
  display: flex; align-items: flex-start; gap: 15px; padding: 16px 20px;
  border: 2px solid #e8e8e8; border-radius: 12px; margin-bottom: 12px;
  cursor: pointer; transition: all 0.2s;
}
.option-item:hover { border-color: #03a4ed; background: #f8fbff; }
.option-item.selected { border-color: #03a4ed; background: #e3f2fd; }
.option-letter {
  width: 36px; height: 36px; min-width: 36px; border-radius: 50%;
  background: #f0f0f0; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #555;
}
.option-item.selected .option-letter { background: #03a4ed; color: #fff; }
.option-text { font-size: 15px; color: #333; line-height: 24px; padding-top: 5px; }

/* Navigation */
.exam-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 25px; gap: 10px;
}
.btn-nav {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px;
  border: 2px solid #e0e0e0; border-radius: 10px; background: #fff;
  font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 500;
  color: #555; cursor: pointer; transition: all 0.2s;
}
.btn-nav:hover { border-color: #03a4ed; color: #03a4ed; }
.btn-next { background: #03a4ed; color: #fff; border-color: #03a4ed; }
.btn-next:hover { background: #0288d1; }
.btn-flag.flagged { background: #fff3e0; border-color: #ff9800; color: #e65100; }
.exam-submit { margin-top: 20px; text-align: center; }
.btn-submit-exam {
  padding: 15px 40px; background: linear-gradient(135deg, #4caf50, #388e3c);
  color: #fff; border: none; border-radius: 12px; font-size: 16px;
  font-weight: 600; cursor: pointer; font-family: 'Poppins', sans-serif;
  transition: all 0.3s;
}
.btn-submit-exam:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(76,175,80,0.3); }

/* Sidebar */
.exam-sidebar {
  width: 300px; background: #fff; padding: 20px; border-left: 1px solid #e8e8e8;
  overflow-y: auto; position: fixed; right: 0; top: 60px; bottom: 0;
}
.sidebar-header h5 { font-size: 16px; font-weight: 700; color: #333; margin-bottom: 15px; }
.sidebar-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.legend-item { font-size: 11px; color: #888; display: flex; align-items: center; gap: 5px; }
.dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.dot-current { background: #03a4ed; }
.dot-answered { background: #4caf50; }
.dot-flagged { background: #ff9800; }
.dot-empty { background: #e0e0e0; }
.sidebar-section { margin-bottom: 15px; }
.sidebar-section h6 { font-size: 13px; font-weight: 600; color: #888; margin-bottom: 8px; }
.question-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.grid-btn {
  width: 36px; height: 36px; border: 2px solid #e0e0e0; border-radius: 8px;
  background: #fff; font-size: 12px; font-weight: 600; color: #555;
  cursor: pointer; transition: all 0.2s; font-family: 'Poppins', sans-serif;
}
.grid-btn:hover { border-color: #03a4ed; }
.grid-btn.current { background: #03a4ed; color: #fff; border-color: #03a4ed; }
.grid-btn.answered { background: #e8f5e9; color: #2e7d32; border-color: #4caf50; }
.grid-btn.flagged { background: #fff3e0; color: #e65100; border-color: #ff9800; }
.sidebar-summary { margin-top: 15px; padding: 15px; background: #f8f9fa; border-radius: 10px; }
.sidebar-summary p { font-size: 13px; color: #666; margin-bottom: 5px; }
.btn-submit-sidebar {
  width: 100%; margin-top: 15px; padding: 12px; background: linear-gradient(135deg,#4caf50,#388e3c);
  color: #fff; border: none; border-radius: 10px; font-size: 14px;
  font-weight: 600; cursor: pointer; font-family: 'Poppins', sans-serif;
}

/* Mobile sidebar toggle */
.mobile-sidebar-toggle {
  display: none; position: fixed; bottom: 20px; right: 20px; z-index: 99;
  width: 56px; height: 56px; border-radius: 50%; background: #03a4ed;
  color: #fff; border: none; font-size: 22px; cursor: pointer;
  box-shadow: 0 4px 15px rgba(3,164,237,0.4);
}

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200;
  background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 20px; padding: 35px; max-width: 420px; width: 90%; text-align: center;
}
.modal-box h4 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.modal-stats { background: #f8f9fa; border-radius: 12px; padding: 15px; margin-bottom: 15px; }
.modal-stats p { font-size: 14px; margin-bottom: 5px; color: #555; }
.modal-warning { font-size: 13px; color: #e53935; margin-bottom: 20px; }
.modal-buttons { display: flex; gap: 12px; justify-content: center; }
.btn-cancel {
  padding: 12px 30px; border: 2px solid #e0e0e0; border-radius: 10px;
  background: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: 'Poppins', sans-serif; color: #666;
}
.btn-confirm {
  padding: 12px 30px; border: none; border-radius: 10px;
  background: linear-gradient(135deg,#4caf50,#388e3c); font-size: 14px;
  font-weight: 600; cursor: pointer; font-family: 'Poppins', sans-serif; color: #fff;
}

/* Result Page */
.result-page { padding: 30px; max-width: 700px; margin: 0 auto; }
.result-card {
  background: #fff; border-radius: 20px; padding: 40px; text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.result-card h2 { font-size: 26px; font-weight: 700; margin-bottom: 20px; color: #333; }
.status-pass { background: #e8f5e9; color: #2e7d32; padding: 15px; border-radius: 12px; font-size: 18px; font-weight: 700; margin-bottom: 25px; }
.status-fail { background: #ffebee; color: #c62828; padding: 15px; border-radius: 12px; font-size: 18px; font-weight: 700; margin-bottom: 25px; }
.score-cards { display: flex; gap: 15px; margin-bottom: 25px; justify-content: center; }
.score-item {
  flex: 1; background: #f8f9fa; border-radius: 14px; padding: 20px; text-align: center;
}
.score-item h5 { font-size: 14px; font-weight: 700; color: #888; margin-bottom: 8px; }
.score-value { font-size: 32px; font-weight: 800; color: #333; }
.score-pg { font-size: 12px; color: #999; margin: 5px 0 10px; }
.score-bar { height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 3px; transition: width 1s ease; }
.score-label { display: block; font-size: 13px; font-weight: 700; margin-top: 8px; }
.total-score { margin-bottom: 25px; }
.total-score h3 { font-size: 22px; color: #333; }
.total-score span { color: #03a4ed; }
.result-actions { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }
.btn-review, .btn-back {
  padding: 13px 28px; border-radius: 12px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: 'Poppins', sans-serif; display: inline-flex;
  align-items: center; gap: 8px; border: none;
}
.btn-review { background: #03a4ed; color: #fff; }
.btn-back { background: #f0f0f0; color: #555; text-decoration: none; }

/* Review */
.review-section { margin-top: 30px; }
.review-section h3 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.review-item {
  background: #fff; border-radius: 14px; padding: 25px; margin-bottom: 15px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04); border-left: 4px solid #e0e0e0;
}
.review-item.review-correct { border-left-color: #4caf50; }
.review-item.review-wrong { border-left-color: #e53935; }
.review-item.review-answered { border-left-color: #1e88e5; }
.review-item.review-empty { border-left-color: #ff9800; }
.review-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.review-num { font-size: 14px; font-weight: 700; color: #333; }
.review-result { font-size: 13px; font-weight: 600; }
.review-question { font-size: 14px; line-height: 24px; color: #555; margin-bottom: 15px; white-space: pre-line; }
.review-opt { padding: 8px 14px; margin-bottom: 6px; border-radius: 8px; font-size: 13px; background: #f8f9fa; }
.review-opt.correct-answer { background: #e8f5e9; color: #2e7d32; font-weight: 600; }
.review-opt.wrong-answer { background: #ffebee; color: #c62828; }
.review-opt.best-answer { background: #e8f5e9; color: #2e7d32; font-weight: 600; }
.review-opt.user-pick { border: 2px solid #03a4ed; }
.review-opt small { color: #999; }
.review-pembahasan {
  margin-top: 15px; padding: 15px; background: #e3f2fd; border-radius: 10px;
  font-size: 13px; line-height: 22px; color: #333;
}

/* Responsive */
@media (max-width: 992px) {
  .exam-sidebar {
    position: fixed; right: -320px; top: 60px; bottom: 0;
    transition: right 0.3s; z-index: 90; box-shadow: -5px 0 20px rgba(0,0,0,0.1);
  }
  .exam-sidebar.open { right: 0; }
  .mobile-sidebar-toggle { display: block; }
  .exam-main { max-width: 100%; }
}

@media (max-width: 600px) {
  .exam-topbar { padding: 0 12px; }
  .topbar-left h4 { font-size: 16px; }
  .timer-box { font-size: 15px; padding: 6px 14px; }
  .topbar-right { display: none; }
  .exam-main { padding: 15px; }
  .question-card { padding: 20px; }
  .option-item { padding: 12px 15px; }
  .exam-nav { flex-wrap: wrap; }
  .btn-nav { padding: 10px 16px; font-size: 13px; }
  .score-cards { flex-direction: column; }
  .result-card { padding: 25px; }
}