/**
 * @file
 * Quiz component — pixel-perfect from Figma (765:2817).
 *
 * Design tokens:
 * - Heading: Share Tech Mono, Regular
 * - Body: Work Sans, 16px/1.5
 * - Card: 0.8px solid #0F65E4, rounded-16px, glassmorphism
 * - Progress pill: Work Sans 600, 12px, solid orange border, rounded-100px
 * - Progress bar: 3px height, orange-light bg, orange fill
 * - Answers: no border, simple flex rows with radio icons
 * - Validate: CTA style (blue-light bg, 0.8px solid blue)
 *
 * Figma behavior: result replaces question content INSIDE the same card.
 * Pill + progress bar remain visible in both question and result states.
 */

/* ===== QUESTION CONTAINER ===== */
.quiz__question {
  display: none;
}

.quiz__question.is-active {
  display: block;
}

/* ===== CARD ===== */
.quiz__card {
  position: relative;
  border: 0.8px solid var(--color-blue);
  border-radius: var(--radius-lg);
  padding: 42px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  background: linear-gradient(134deg, rgba(255,255,255,0.7) 0%, rgba(251,253,255,0.175) 79%, rgba(253,254,255,0.085) 99%, rgba(255,255,255,0) 115%);
}

/* Decorative 3D glass-effect globule shapes around quiz card */
.quiz__card::before,
.quiz__card::after {
  content: '';
  position: absolute;
  pointer-events: none;
  z-index: -1;
  filter: blur(6px);
  mix-blend-mode: multiply;
}

.quiz__card::before {
  width: 250px;
  height: 230px;
  top: -80px;
  right: -90px;
  border-radius: 50% 40% 60% 45% / 55% 50% 45% 50%;
  background:
    radial-gradient(ellipse at 40% 35%, rgba(255, 182, 150, 0.75) 0%, transparent 50%),
    radial-gradient(ellipse at 65% 55%, rgba(236, 157, 200, 0.5) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 75%, rgba(173, 216, 255, 0.4) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 215, 195, 0.65) 0%, transparent 65%);
  animation: quiz-globule-float 10s ease-in-out infinite;
}

.quiz__card::after {
  width: 200px;
  height: 190px;
  bottom: -60px;
  left: -70px;
  border-radius: 45% 55% 50% 40% / 50% 45% 55% 50%;
  background:
    radial-gradient(ellipse at 55% 40%, rgba(255, 170, 140, 0.7) 0%, transparent 50%),
    radial-gradient(ellipse at 35% 65%, rgba(220, 150, 200, 0.45) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 70%, rgba(160, 200, 255, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 205, 185, 0.6) 0%, transparent 60%);
  animation: quiz-globule-float-reverse 12s ease-in-out infinite;
}

/* ===== PROGRESS HEADER (pill + bar on same row) ===== */
.quiz__header {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ===== PROGRESS PILL ===== */
.quiz__progress-pill {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  color: var(--color-orange);
  background: var(--color-white);
  border: 1px solid var(--color-orange);
  border-radius: 100px;
  padding: 4px 16px;
  white-space: nowrap;
  line-height: normal;
}

/* ===== PROGRESS BAR ===== */
.quiz__progress-bar {
  flex: 1;
  height: 3px;
  background: var(--color-orange-light);
  border-radius: 100px;
  overflow: hidden;
}

.quiz__progress-bar-fill {
  height: 100%;
  background: var(--color-orange);
  border-radius: 100px;
  transition: width 0.3s ease;
}

/* ===== QUESTION CONTENT (hidden when answered) ===== */
.quiz__question-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz__question.is-answered .quiz__question-content {
  display: none;
}

/* ===== QUESTION TEXT ===== */
.quiz__question-text {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  color: var(--color-blue);
  line-height: 1.3;
  margin: 0;
}

/* ===== ANSWERS ===== */
.quiz__answers {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 0;
  border: none;
  padding: 0;
  min-inline-size: auto;
}

.quiz__answer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  color: var(--color-black);
  line-height: 1.5;
  transition: opacity 0.2s;
  user-select: none;
}

.quiz__answer:hover {
  opacity: 0.7;
}

.quiz__answer.is-selected .quiz__radio {
  border-color: var(--color-blue);
  background: var(--color-blue);
  box-shadow: inset 0 0 0 3px var(--color-white);
}

/* Correct/Wrong states */
.quiz__answer.is-correct .quiz__radio {
  border-color: var(--color-success);
  background: var(--color-success);
  box-shadow: inset 0 0 0 3px var(--color-white);
}

.quiz__answer.is-wrong .quiz__radio {
  border-color: var(--color-orange);
  background: var(--color-orange);
  box-shadow: inset 0 0 0 3px var(--color-white);
}

/* Disabled state after answer */
.quiz__question.is-answered .quiz__answer {
  cursor: default;
  pointer-events: none;
}

/* Radio circle — 32px per Figma */
.quiz__radio {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-blue);
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.quiz__answer-text {
  flex: 1;
}

/* ===== NAVIGATION ===== */
.quiz__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz__back {
  display: flex;
  align-items: center;
  gap: 17px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  color: var(--color-blue);
  padding: 0;
  transition: color var(--transition-base);
}

.quiz__back:hover {
  color: var(--color-blue);
}

.quiz__back svg {
  width: 12px;
  height: 12px;
}

.quiz__back-icon {
  transform: rotate(-135deg);
}

.quiz__validate {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  background: var(--color-blue-light);
  border: 0.8px solid var(--color-blue);
  border-radius: 100px;
  padding: 14px 16px;
  color: var(--color-blue);
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base);
}

.quiz__validate:hover {
  background: var(--color-blue);
  color: var(--color-white);
}

.quiz__validate:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.quiz__validate:disabled:hover {
  background: var(--color-blue-light);
  color: var(--color-blue);
}

/* ===== RESULT (inside the card, replaces question content) ===== */
.quiz__result {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Result header — centered per Figma */
.quiz__result-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.quiz__result-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Correct: blue checkmark breaking out of circle — Figma "Checkmark, Done, Check" */
.quiz__result--correct .quiz__result-icon::after {
  content: "";
  width: 24px;
  height: 24px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 19.5 19.5' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.311 5.194L9.755 12.75L5.978 8.972M18.75 9.75C18.75 14.721 14.721 18.75 9.75 18.75C4.779 18.75 0.75 14.721 0.75 9.75C0.75 4.779 4.779 0.75 9.75 0.75C11.203 0.75 12.571 1.103 13.786 1.714' stroke='%230F65E4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Wrong: orange X in circle — Figma "Delete, Disabled" */
.quiz__result--wrong .quiz__result-icon::after {
  content: "";
  width: 24px;
  height: 24px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 19.5 19.5' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.58 6.92L6.92 12.58M12.58 12.58L6.92 6.92M9.75 18.75C4.779 18.75 0.75 14.721 0.75 9.75C0.75 4.779 4.779 0.75 9.75 0.75C14.721 0.75 18.75 4.779 18.75 9.75C18.75 14.721 14.721 18.75 9.75 18.75Z' stroke='%23CC3700' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

.quiz__result-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  line-height: 1.3;
}

.quiz__result--correct .quiz__result-title {
  color: var(--color-blue);
}

.quiz__result--wrong .quiz__result-title {
  color: var(--color-orange);
}

/* Explanation */
.quiz__explanation {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-black);
}

.quiz__reference {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-black);
}

/* Next button — inline, centered per Figma desktop (765:3360) */
.quiz__next {
  display: inline-block;
  align-self: center;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  background: var(--color-blue-light);
  border: 0.8px solid var(--color-blue);
  border-radius: 100px;
  padding: 14px 16px;
  color: var(--color-blue);
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base);
  text-align: center;
}

.quiz__next:hover {
  background: var(--color-blue);
  color: var(--color-white);
}

/* ===== QUIZ COMPLETE ===== */
.quiz__complete {
  text-align: center;
  padding: 48px 24px;
}

.quiz__complete-title {
  font-family: var(--font-heading);
  font-size: 32px;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  color: var(--color-blue);
  margin-bottom: 16px;
}

.quiz__complete-score {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-black);
  margin-bottom: 8px;
}

.quiz__complete-text {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-black);
  margin-bottom: 32px;
}

@media (max-width: 768px) {
  .quiz__card {
    padding: 24px 16px;
  }
}

.quiz__restart {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.05em;
}
