@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;700;800&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0");

/* ========== TOKENS ========== */
:root {
  --moe-blue:       #004d99;
  --moe-blue-dark:  #003b75;
  --moe-light-blue: #e6f0fa;
  --moe-cyan:       #009eb3;
  --moe-accent:     #ffb300;
  --bg-gray:        #f4f6f9;
  --text-dark:      #212529;
  --text-muted:     #6c757d;
  --white:          #ffffff;
  --success:        #28a745;
  --danger:         #dc3545;
  --border:         #dee2e6;
  --transition:     all 0.22s ease-in-out;
}

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

html, body {
  height: 100%;
  margin: 0;
  font-family: 'Rubik', sans-serif;
  background-color: var(--bg-gray);
  color: var(--text-dark);
  direction: rtl;
}

/* ========== HEADER ========== */
.quiz-header {
  background: linear-gradient(135deg, var(--moe-blue) 0%, #0066cc 55%, var(--moe-cyan) 100%);
  color: var(--white);
  padding: 18px 24px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,77,153,0.35);
}

.quiz-header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  max-width: 820px;
  margin: 0 auto 14px;
}

.quiz-title {
  font-family: 'Heebo', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 4px;
  line-height: 1.2;
}

.quiz-subtitle {
  font-size: 0.82rem;
  opacity: 0.82;
  margin: 0;
}

.quiz-chips {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chip {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--white);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.progress-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-track {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,0.25);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--moe-accent);
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(.4,0,.2,1);
  width: 2.5%;
}

.progress-label {
  font-size: 0.78rem;
  opacity: 0.9;
  white-space: nowrap;
  font-weight: 500;
}

/* ========== MAIN ========== */
.quiz-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 110px);
}

/* ========== PART BADGE ========== */
.part-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.part-badge {
  background: var(--moe-blue);
  color: var(--white);
  font-family: 'Heebo', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.part-pts {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ========== QUESTION CARD ========== */
.q-card {
  background: var(--white);
  border-radius: 18px;
  padding: 28px 28px 24px;
  box-shadow: 0 4px 28px rgba(0,77,153,0.1);
  border-right: 5px solid var(--moe-cyan);
  flex: 1;
  animation: slideIn 0.28s ease;
  transition: border-right-color 0.3s;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.q-num {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--moe-cyan);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.q-text {
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.75;
  margin-bottom: 22px;
  color: var(--text-dark);
}

/* Words displayed inside question (class="modgash") */
.modgash {
  display: block;
  font-family: 'Heebo', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--moe-blue);
  background: var(--moe-light-blue);
  padding: 10px 18px;
  border-radius: 10px;
  text-align: center;
  margin: 10px 0 18px;
  line-height: 1.6;
}

/* ========== RADIO ANSWERS (Part 1) ========== */
.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.opt {
  cursor: pointer;
  display: block;
}

.opt input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.opt-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-gray);
  transition: var(--transition);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1.45;
  min-height: 52px;
}

.opt-label:hover {
  border-color: var(--moe-cyan);
  background: var(--moe-light-blue);
}

.opt input[type="radio"]:checked + .opt-label {
  border-color: var(--moe-blue);
  background: var(--moe-light-blue);
  color: var(--moe-blue);
  font-weight: 600;
}

/* Post-finish states */
.opt.correct-ans .opt-label {
  border-color: var(--success);
  background: #d4edda;
  color: #155724;
  font-weight: 600;
}
.opt.wrong-ans .opt-label {
  border-color: var(--danger);
  background: #f8d7da;
  color: #721c24;
}

/* ========== TEXT INPUTS (Parts 2 & 3) ========== */
.sub-q {
  margin-bottom: 18px;
}

.sub-q-label {
  font-size: 0.97rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sub-q-label .fb-icon {
  font-size: 1rem;
  line-height: 1;
}

.text-in {
  width: 80%;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: 'Rubik', sans-serif;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-gray);
  color: var(--text-dark);
  direction: rtl;
  display: block;
}

.text-in:focus {
  outline: none;
  border-color: var(--moe-cyan);
  background: var(--white);
}

.text-in.in-correct {
  border-color: var(--success);
  background: #d4edda;
}
.text-in.in-wrong {
  border-color: var(--danger);
  background: #f8d7da;
}

/* ========== NAV ROW ========== */
.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  gap: 12px;
}

.btn-nav {
  background: var(--white);
  border: 2px solid var(--moe-blue);
  color: var(--moe-blue);
  border-radius: 30px;
  padding: 10px 22px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: 'Rubik', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.btn-nav:hover:not(:disabled) {
  background: var(--moe-blue);
  color: var(--white);
  box-shadow: 0 3px 12px rgba(0,77,153,0.25);
}

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

.nav-counter {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--moe-blue);
  background: var(--moe-light-blue);
  border-radius: 20px;
  padding: 6px 18px;
  white-space: nowrap;
  text-align: center;
  min-width: 90px;
}

/* ========== FINISH BUTTON ========== */
.finish-row {
  margin-top: 18px;
  text-align: center;
}

.btn-finish {
  background: linear-gradient(135deg, var(--moe-blue), var(--moe-cyan));
  color: var(--white);
  border: none;
  border-radius: 30px;
  padding: 14px 44px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Heebo', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 18px rgba(0,77,153,0.3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.3px;
}

.btn-finish:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0,77,153,0.4);
}

/* ========== NOTICE ========== */
.notice-bar {
  background: #fff8e1;
  border-right: 4px solid var(--moe-accent);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.84rem;
  color: #5d4037;
  display: none;
}

.notice-bar.visible { display: block; }

/* ========== SCORE MODAL ========== */
.modal-content.score-panel {
  border-radius: 16px;
  overflow: hidden;
  border: none;
  box-shadow: 0 20px 60px rgba(0,77,153,0.25);
}

.score-mhead {
  background: linear-gradient(135deg, var(--moe-blue), var(--moe-cyan));
  color: var(--white);
  padding: 28px 24px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
}

.score-emoji {
  font-size: 2.8rem;
  line-height: 1;
}

.score-mhead h4 {
  font-family: 'Heebo', sans-serif;
  font-weight: 800;
  font-size: 1.45rem;
  margin: 0;
  color: var(--white);
}

.score-number {
  font-family: 'Heebo', sans-serif;
  font-size: 5rem;
  font-weight: 800;
  color: var(--moe-blue);
  line-height: 1;
  text-align: center;
  margin: 24px 0 4px;
}

.score-of {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.score-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.95rem;
}

.score-row.r1 { background: var(--moe-light-blue); color: var(--moe-blue); }
.score-row.r2 { background: #e1f5f8; color: #006575; }
.score-row.r3 { background: #fff8e1; color: #7a5c00; }

.score-row .val {
  font-family: 'Heebo', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
}

.score-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-review-ans {
  background: var(--white);
  border: 2px solid var(--moe-blue);
  color: var(--moe-blue);
  border-radius: 22px;
  padding: 10px 22px;
  font-weight: 600;
  font-family: 'Rubik', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-review-ans:hover { background: var(--moe-light-blue); }

.btn-retry-exam {
  background: var(--moe-blue);
  border: 2px solid var(--moe-blue);
  color: var(--white);
  border-radius: 22px;
  padding: 10px 22px;
  font-weight: 600;
  font-family: 'Rubik', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-retry-exam:hover { background: var(--moe-cyan); border-color: var(--moe-cyan); }

/* ========== CONFIRM MODAL ========== */
.confirm-panel {
  border-radius: 16px;
  border: none;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,77,153,0.2);
}

.confirm-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.confirm-title {
  font-family: 'Heebo', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.confirm-msg {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 22px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-confirm-cancel {
  background: var(--white);
  border: 2px solid var(--border);
  color: var(--text-muted);
  border-radius: 22px;
  padding: 9px 20px;
  font-weight: 600;
  font-family: 'Rubik', sans-serif;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-confirm-cancel:hover {
  border-color: var(--moe-blue);
  color: var(--moe-blue);
}

.btn-confirm-ok {
  background: var(--moe-blue);
  border: 2px solid var(--moe-blue);
  color: var(--white);
  border-radius: 22px;
  padding: 9px 20px;
  font-weight: 600;
  font-family: 'Rubik', sans-serif;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-confirm-ok:hover {
  background: var(--moe-cyan);
  border-color: var(--moe-cyan);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 580px) {
  .answers-grid { grid-template-columns: 1fr; }
  .quiz-title { font-size: 1.1rem; }
  .quiz-chips { display: none; }
  .q-text { font-size: 1rem; }
  .q-card { padding: 20px 18px; }
  .text-in { width: 100%; }
  .btn-finish { padding: 12px 28px; font-size: 0.95rem; }
}
