/* ============================================================
   QUIZ PAGE REDESIGN - Modern Theme
   ============================================================ */

/* ── Quiz Layout ───────────────────────────────────────────── */
.quiz-body {
  background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: var(--font);
}

/* ── Quiz Header ───────────────────────────────────────────── */
.quiz-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(13, 27, 62, 0.1);
  box-shadow: 0 8px 32px rgba(13, 27, 62, 0.08);
  padding: 0;
}

.quiz-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.qh-logo img {
  height: 36px;
  width: auto;
  /* logo di atas background putih — jangan diinvert */
}

.qh-progress {
  flex: 1;
}

.qh-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.qh-meta span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  padding: 6px 14px;
  background: rgba(14, 165, 165, 0.08);
  border-radius: 20px;
}

.qh-meta span:last-child {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.qh-bar {
  background: var(--gray-200);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  position: relative;
}

.qh-fill {
  background: linear-gradient(90deg, var(--teal), #0ea5a5);
  height: 100%;
  border-radius: 20px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.qh-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.qh-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--white);
  flex-shrink: 0;
  min-width: 120px;
  justify-content: center;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  box-shadow: 0 4px 12px rgba(13, 27, 62, 0.2);
}

.qh-timer.timer-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #f59e0b;
  animation: pulseWarning 1s infinite;
}

.qh-timer.timer-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-color: #ef4444;
  animation: pulseDanger 0.5s infinite;
}

@keyframes pulseWarning {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes pulseDanger {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
  50% { transform: scale(1.03); box-shadow: 0 6px 18px rgba(239, 68, 68, 0.5); }
}

#timerDisplay {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 1px;
}

/* ── Quiz Container ────────────────────────────────────────── */
.quiz-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 100px 24px 60px;
}

/* ── Quiz Card ─────────────────────────────────────────────── */
.quiz-card {
  background: var(--white);
  border-radius: 24px;
  padding: 48px;
  box-shadow: 0 20px 60px rgba(13, 27, 62, 0.15);
  border: 1px solid var(--gray-100);
  position: relative;
  overflow: hidden;
}

.quiz-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--violet));
}

.q-level-badge {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}

.q-level-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  z-index: 1;
}

.q-level-badge span {
  position: relative;
  z-index: 2;
}

.level-foundation {
  background: linear-gradient(135deg, var(--emerald), #10b981);
  color: var(--white);
  border-color: rgba(16, 185, 129, 0.3);
}

.level-reasoning {
  background: linear-gradient(135deg, var(--blue), #2563eb);
  color: var(--white);
  border-color: rgba(37, 99, 235, 0.3);
}

.level-challenge {
  background: linear-gradient(135deg, var(--violet), #7c3aed);
  color: var(--white);
  border-color: rgba(124, 58, 237, 0.3);
}

.level-advance {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: var(--white);
  border-color: rgba(217, 119, 6, 0.3);
}

.q-text {
  font-size: 1.3rem;
  line-height: 1.6;
  color: var(--navy);
  margin-bottom: 36px;
  font-weight: 500;
  padding: 0 4px;
}

.q-text::first-letter {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--teal);
}

/* ── Quiz Options ──────────────────────────────────────────── */
.q-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 36px;
}

.q-option {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border: 2px solid var(--gray-200);
  border-radius: 16px;
  background: var(--white);
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
  color: var(--gray-700);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.q-option::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent;
  transition: background 0.3s ease;
  z-index: 1;
}

.q-option:hover::before {
  background: rgba(14, 165, 165, 0.05);
}

.q-option:hover {
  border-color: var(--teal);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(14, 165, 165, 0.15);
}

.q-option.selected {
  border-color: var(--teal);
  background: linear-gradient(135deg, var(--teal-light), #e6fafa);
  color: var(--teal-dark);
  transform: translateX(8px);
  box-shadow: 0 8px 24px rgba(14, 165, 165, 0.2);
}

.q-option.selected::before {
  background: linear-gradient(135deg, rgba(14, 165, 165, 0.1), transparent);
}

.opt-letter {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.q-option:hover .opt-letter {
  background: var(--teal-light);
  color: var(--teal);
}

.q-option.selected .opt-letter {
  background: var(--teal);
  color: var(--white);
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(14, 165, 165, 0.3);
}

.opt-text {
  flex: 1;
  font-weight: 500;
  line-height: 1.5;
  position: relative;
  z-index: 2;
}

.q-option.selected .opt-text {
  font-weight: 600;
}

/* ── Quiz Actions ──────────────────────────────────────────── */
.q-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 2px solid var(--gray-100);
}

.btn-skip {
  background: transparent;
  border: 2px solid var(--gray-300);
  color: var(--gray-500);
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-skip:hover {
  border-color: var(--gray-500);
  color: var(--gray-700);
  background: var(--gray-50);
  transform: translateY(-2px);
}

#submitBtn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 36px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, var(--teal), #0ea5a5);
  color: var(--white);
  min-width: 200px;
  justify-content: center;
}

#submitBtn:not(:disabled):hover {
  background: linear-gradient(135deg, var(--teal-dark), #0b8a8a);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(14, 165, 165, 0.3);
}

#submitBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--gray-400);
}

/* ── Progress Dots ─────────────────────────────────────────── */
.q-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 32px;
  padding: 24px;
  background: var(--white);
  border-radius: 20px;
  border: 1px solid var(--gray-100);
  box-shadow: 0 8px 24px rgba(13, 27, 62, 0.08);
}

.q-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.q-dot:hover {
  transform: scale(1.2);
}

.dot-pending {
  background: var(--gray-300);
  border: 2px solid var(--gray-200);
}

.dot-current {
  background: var(--teal);
  border: 2px solid var(--teal-light);
  animation: currentDot 1.5s infinite;
}

.dot-correct {
  background: var(--emerald);
  border: 2px solid var(--emerald-light);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.dot-wrong {
  background: var(--red);
  border: 2px solid var(--red-light);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

@keyframes currentDot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ── Keyboard Shortcut Hint ────────────────────────────────── */
.keyboard-hint {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--gray-400);
  padding: 12px;
  background: rgba(13, 27, 62, 0.02);
  border-radius: 12px;
  border: 1px solid var(--gray-100);
}

.keyboard-hint kbd {
  display: inline-block;
  padding: 4px 8px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.9rem;
  margin: 0 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ── Quiz Form ─────────────────────────────────────────────── */
#quizForm {
  margin: 0;
}

/* ── Focus States ──────────────────────────────────────────── */
.q-option:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.btn-skip:focus-visible,
#submitBtn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ── Responsive Design ─────────────────────────────────────── */
@media (max-width: 768px) {
  .quiz-header-inner {
    padding: 10px 16px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .qh-logo {
    display: flex;
    justify-content: center;
  }
  
  .qh-logo img {
    height: 28px;
  }

  .qh-meta span:first-child {
    font-size: 0.82rem;
    padding: 4px 10px;
  }

  .qh-meta span:last-child {
    font-size: 0.78rem;
  }
  
  .qh-timer {
    width: 100%;
    min-width: auto;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.9rem;
  }
  
  .quiz-wrap {
    /* header stacked: logo ~32px + progress ~50px + timer ~36px + padding ~32px ≈ 150px */
    padding: 160px 16px 40px;
  }
  
  .quiz-card {
    padding: 28px 20px;
  }
  
  .q-text {
    font-size: 1.1rem;
  }
  
  .q-option {
    padding: 14px 16px;
    gap: 12px;
  }
  
  .opt-letter {
    width: 36px;
    height: 36px;
  }
  
  .q-actions {
    flex-direction: column-reverse;
    gap: 16px;
  }
  
  .btn-skip,
  #submitBtn {
    width: 100%;
    justify-content: center;
  }
  
  .q-dots {
    padding: 16px;
    gap: 6px;
  }
  
  .q-dot {
    width: 12px;
    height: 12px;
  }
}

@media (max-width: 480px) {
  .quiz-header-inner {
    padding: 10px 16px;
  }
  
  .quiz-card {
    padding: 24px 20px;
    border-radius: 20px;
  }
  
  .q-text {
    font-size: 1.1rem;
    margin-bottom: 28px;
  }
  
  .q-option {
    padding: 14px 18px;
    gap: 14px;
  }
  
  .opt-letter {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }
  
  .opt-text {
    font-size: 0.95rem;
  }
  
  #submitBtn {
    padding: 14px 28px;
    font-size: 0.95rem;
  }
  
  .btn-skip {
    padding: 12px 24px;
  }
}

/* Final responsive polish */
.quiz-body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.quiz-header-inner,
.quiz-wrap {
  width: min(100%, 1200px);
}

.quiz-card,
.q-option,
.opt-text,
.q-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .quiz-header-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 14px;
    padding: 10px 16px 12px;
  }

  .qh-logo {
    grid-column: 1;
    grid-row: 1;
    align-items: center;
    justify-content: flex-start;
  }

  .qh-logo img {
    width: auto;
    height: 36px;
    max-width: 120px;
    object-fit: contain;
  }

  .qh-timer {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: auto;
    min-width: 105px;
    padding: 8px 13px;
  }

  .qh-progress {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .qh-meta {
    gap: 12px;
    margin-bottom: 6px;
  }

  .qh-meta span:first-child {
    overflow: hidden;
    max-width: 68%;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .quiz-wrap {
    padding: 122px 16px 36px;
  }

  .q-option:hover,
  .q-option.selected {
    transform: none;
  }

  .keyboard-hint {
    display: none;
  }
}

@media (max-width: 420px) {
  .quiz-header-inner {
    padding-inline: 12px;
  }

  .quiz-wrap {
    padding-inline: 12px;
  }

  .quiz-card {
    padding: 22px 16px;
  }

  .q-option {
    padding: 13px 12px;
  }

  .q-dots {
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-body *,
  .quiz-body *::before,
  .quiz-body *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
