/* =============================================
   Quiz Page Styles — IQ Test (Pattern Recognition)
   Per QUIZUI.md — Navy + Orange design system
   ============================================= */

/* ---- CSS Variables (Quiz Design Tokens per QUIZUI.md §2) ---- */
:root {
  --qnavy: #16324F;
  /* --qorange: #F5821F; */
  --qorange: #EC4899;
  /* --qorange-hover: #F7941D; */
  --qorange-hover: #f57bb8;
  --qwhite: #FFFFFF;
  --qbg: #F2F3F5;
  --qgray-900: #333333;
  --qgray-500: #8A8F98;
  --qgray-300: #D9DEE4;
  --qgray-light: #E8ECF0;
  --qshadow: 0 4px 12px rgba(0,0,0,0.06);
  --qradius-card: 18px;
  --qradius-pill: 9999px;
  --qfont: 'Poppins', 'Nunito', system-ui, sans-serif;
}

/* ---- Base Container ---- */
.quiz-page {
  background: var(--qbg);
  min-height: 100vh;
  font-family: var(--qfont);
  padding: 20px 16px 16px;
}


/* ---- Quiz Header (per QUIZ_HEADER.md) ---- */
.quiz-header {
  background: var(--qwhite);
  border-radius: 22px;
  padding: 10px 14px;
  transform: translateY(-4px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* ---- 1. Info Tes (Left Section) ---- */
.quiz-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.quiz-header-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7C6FF0, #5B4FE0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiz-header-title {
  display: flex;
  flex-direction: column;
}

.quiz-header-title h2 {
  font-family: var(--qfont);
  font-size: 16px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0;
  line-height: 1.3;
}

.quiz-header-title p {
  font-family: var(--qfont);
  font-size: 13px;
  font-weight: 400;
  color: #8A8A9E;
  margin: 0;
  line-height: 1.3;
}

/* ---- 2. Progress Tes (Section) ---- */
.quiz-header-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  max-width: 300px;
}

.quiz-progress-label {
  font-family: var(--qfont);
  font-size: 12px;
  font-weight: 400;
  color: #8A8A9E;
  line-height: 1;
  text-align: center;
}

/* .quiz-progress-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.quiz-progress-bar {
  width: 100%;
  max-width: 220px;
  height: 8px;
  border-radius: var(--qradius-pill);
  background: #E8E8F0;
  overflow: hidden;
} */

.quiz-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.quiz-progress-bar {
    flex: 1;
    max-width: none;
}

.quiz-progress-fill {
  height: 100%;
  border-radius: var(--qradius-pill);
  background: #5B4FE0;
  height: 7px;
  transition: width 0.25s ease;
}

.quiz-progress-counter {
  font-family: var(--qfont);
  font-size: 13px;
  font-weight: 500;
  color: #1A1A2E;
  white-space: nowrap;
}

/* ---- 3. Waktu Tersisa (Timer Section) ---- */
.quiz-timer-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0px;
  border-radius: 9px;
  border: 1px solid #D9D9E6;
  background: var(--qwhite);
  flex-shrink: 0;
}

.quiz-timer-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #EDEBFF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiz-timer-text {
  display: flex;
  flex-direction: column;
  padding: 0 8px 0 0;
}

.quiz-timer-text small {
  font-family: var(--qfont);
  font-size: 11px;
  font-weight: 400;
  color: #8A8A9E;
  line-height: 1.2;
}

.quiz-timer-text strong {
  font-family: var(--qfont);
  font-size: 16px;
  font-weight: 700;
  color: #1A1A2E;
  line-height: 1.3;
}

/* ---- 4. Tombol Aksi (Right Section) ---- */
.quiz-end-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid #D9D9E6;
  background: var(--qwhite);
  color: #1A1A2E;
  font-family: var(--qfont);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  line-height: 1;
  white-space: nowrap;
}

.quiz-end-btn:hover {
  color: #DC2626;
  border-color: #DC2626;
}

.quiz-end-btn svg {
  flex-shrink: 0;
}

/* ---- Body Layout: Desktop side-by-side, Mobile stacked ---- */
.quiz-body {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .quiz-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
  }

  .quiz-body {
    flex-direction: row;
  }
  .quiz-body-question {
    flex: 2;
    min-width: 0;
  }
  .quiz-body-answer {
    flex: 1.2;
    min-width: 0;
  }
}

@media (max-width: 767px) {
  .quiz-body {
    flex-direction: column;
  }
}

/* ---- Card Base (per QUIZUI.md §2.3-2.4) ---- */
.quiz-card {
  background: var(--qwhite);
  border-radius: var(--qradius-card);
  padding: 24px 20px;
  box-shadow: var(--qshadow);
}

@media (max-width: 639px) {
  .quiz-card {
    padding: 16px;
  }
}

.quiz-card-title {
  font-family: var(--qfont);
  font-size: 22px;
  font-weight: 700;
  color: var(--qnavy);
  margin: 0 0 12px;
  line-height: 1.3;
}

.quiz-card-divider {
  height: 2px;
  background: var(--qgray-300);
  border: none;
  margin: 0 0 20px;
}

/* ---- Matrix Question Image (per QUIZUI.md §6.3) ---- */
.matrix-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px 0;
}

.quiz-question-matrix {
  width: 100%;
  height: auto;
  max-width: 320px;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

/* ---- Answer Grid (2 columns x 3 rows, per QUIZUI.md §6.4) ---- */
.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

@media (min-width: 640px) {
  .answer-grid {
    gap: 20px 32px;
  }
}

/* ---- Answer Option (per QUIZUI.md §6.4) ---- */
.answer-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: var(--qfont);
  user-select: none;
  -webkit-user-select: none;
}

.answer-option:hover {
  background: #F5F7FA;
}

.answer-option.is-selected {
  border: 2px solid var(--qorange);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(245, 130, 31, 0.06);
}

.answer-option-label {
  font-family: var(--qfont);
  font-size: 16px;
  font-weight: 700;
  color: var(--qnavy);
  flex-shrink: 0;
  line-height: 1;
}

.answer-option-shape {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.answer-option-shape img {
  max-width: 100%;
  max-height: 64px;
  object-fit: contain;
  display: block;
}

@media (max-width: 639px) {
  .answer-option-shape img {
    max-height: 48px;
  }
}

/* ---- Action Buttons (per QUIZUI.md §6.5) ---- */
.quiz-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.btn-quiz-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 28px;
  border-radius: var(--qradius-pill);
  font-family: var(--qfont);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  background: var(--qorange);
  color: var(--qwhite);
  box-shadow: 0 2px 6px rgba(245,130,31,0.3);
  text-decoration: none;
  line-height: 1.3;
}

.btn-quiz-action:hover {
  background: var(--qorange-hover);
}

.btn-quiz-action:focus-visible {
  outline: 2px solid var(--qorange);
  outline-offset: 2px;
}

/* ---- Question Navigator (per QUIZUI.md §6.6) ---- */
.quiz-navigator {
  /* background: var(--qgray-900); */
  background: #5b4fe0;
  border-radius: var(--qradius-card);
  padding: 16px 20px;
}

.nav-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--qfont);
  font-size: 19px;
  font-weight: 600;
  color: var(--qwhite);
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  line-height: 1;
}

.nav-item:hover {
  background: rgba(255,255,255,0.12);
}

.nav-item.is-active {
  background: var(--qwhite);
  color: var(--qnavy);
}

.nav-item.is-answered {
  color: var(--qwhite);
}

.nav-item-answer-sup {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 9px;
  font-weight: 700;
  /* color: var(--qorange); */
  color: #ffa5d1;
  line-height: 1;
}

/* ---- Skeleton / Loading States ---- */

.skeleton-header-block {
  height: 52px;
  background: linear-gradient(90deg, #e0e3e7 25%, #eaedf0 50%, #e0e3e7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--qradius-card);
  margin-bottom: 20px;
}

.skeleton-card-block {
  height: 200px;
  background: linear-gradient(90deg, #e0e3e7 25%, #eaedf0 50%, #e0e3e7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--qradius-card);
  margin-bottom: 16px;
}

.skeleton-card-block-sm {
  height: 160px;
  background: linear-gradient(90deg, #e0e3e7 25%, #eaedf0 50%, #e0e3e7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--qradius-card);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 767px) {
  .quiz-header {
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
  }

  .quiz-header-brand {
    display: none;
  }

  .quiz-header-progress {
    order: 1;
    flex: 1 1 100%;
    align-items: flex-start;
  }

  .quiz-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
  }

  .quiz-timer-card {
    padding: 0px;
  }

  .quiz-end-btn span {
    display: none;
  }

  .quiz-end-btn {
    padding: 10px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-header-block,
  .skeleton-card-block,
  .skeleton-card-block-sm {
    animation: none;
    background: #e0e3e7;
  }
  .quiz-progress-fill {
    transition: none;
  }
}

/* ---- Identity Step (post-quiz form) ---- */
.identity-step {
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

.identity-card {
  max-width: 520px;
  width: 100%;
  padding: 32px;
}

@media (max-width: 639px) {
  .identity-card {
    padding: 24px;
  }
}

.identity-heading {
  font-family: var(--qfont);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
  color: var(--qnavy);
  margin: 0 0 4px;
  line-height: 1.3;
}

.identity-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
}

.identity-check {
  color: var(--qorange);
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.identity-summary-text {
  font-family: var(--qfont);
  font-size: 0.875rem;
  color: var(--qgray-500);
  line-height: 1.5;
}

.identity-description {
  font-family: var(--qfont);
  font-size: 0.875rem;
  color: var(--qgray-500);
  margin: 0 0 24px;
  line-height: 1.5;
}

.quiz-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quiz-field-label {
  font-family: var(--qfont);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--qnavy);
}

.quiz-input {
  padding: 12px 16px;
  border: 1px solid var(--qgray-300);
  border-radius: 10px;
  font-family: var(--qfont);
  font-size: 0.95rem;
  background: var(--qwhite);
  color: var(--qnavy);
  transition: border-color 0.2s ease;
  outline: none;
}

.quiz-input::placeholder {
  color: var(--qgray-500);
}

.quiz-input:focus {
  border-color: var(--qorange);
  outline: none;
}

.quiz-input.has-error {
  border-color: #ef4444;
}

.quiz-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.quiz-btn-submit {
  width: 100%;
  justify-content: center;
}

.quiz-btn-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Submitting Overlay ---- */
.submitting-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

@keyframes spinner-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---- Finish Confirmation Modal ---- */
.finish-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.finish-modal-card {
  background: #FFFFFF;
  border-radius: 22px;
  padding: 32px 28px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  text-align: center;
  font-family: var(--qfont);
}

.finish-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #FFF3E6;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.finish-modal-title {
  font-family: var(--qfont);
  font-size: 1.25rem;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 8px;
  line-height: 1.3;
}

.finish-modal-desc {
  font-family: var(--qfont);
  font-size: 0.875rem;
  font-weight: 400;
  color: #8A8A9E;
  margin: 0 0 20px;
  line-height: 1.5;
}

.finish-modal-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
  padding: 16px;
  background: #F5F5FA;
  border-radius: 14px;
}

.finish-modal-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.finish-modal-stat-label {
  font-family: var(--qfont);
  font-size: 0.75rem;
  font-weight: 500;
  color: #8A8A9E;
  line-height: 1;
}

.finish-modal-stat-value {
  font-family: var(--qfont);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.finish-modal-stat-answered .finish-modal-stat-value {
  color: #16A34A;
}

.finish-modal-stat-unanswered .finish-modal-stat-value {
  color: #DC2626;
}

.finish-modal-stat-divider {
  width: 1px;
  height: 36px;
  background: #D9D9E6;
}

.finish-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.finish-modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--qradius-pill);
  font-family: var(--qfont);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  line-height: 1.3;
  width: 100%;
}

.finish-modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.finish-modal-btn-secondary {
  background: #F2F3F5;
  color: #333333;
}

.finish-modal-btn-secondary:hover {
  background: #E8ECF0;
}

.finish-modal-btn-primary {
  background: var(--qorange);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(245,130,31,0.3);
}

.finish-modal-btn-primary:hover {
  background: var(--qorange-hover);
}

@media (max-width: 639px) {
  .finish-modal-card {
    padding: 28px 20px 20px;
  }
}
