/* =====================================================================
   آزمون آنلاین پایتون — استایل اختصاصی
   ===================================================================== */

/* ------------------------------ بلوک کد ------------------------------ */
.code-block {
  direction: ltr;
  text-align: left;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #1e293b;
  border-radius: 13px;
  padding: 13px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.85;
  overflow: auto;
  margin: 12px 0 4px;
  white-space: pre;
  tab-size: 4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.code-block .cm { color: #64748b; }
.code-block::-webkit-scrollbar { height: 8px; }
.code-block::-webkit-scrollbar-thumb { background: #334155; border-radius: 8px; }
.code-block.sample { background: #111827; border-color: #24307a; }

.q-prompt { font-size: 13.5px; color: var(--ink-2); line-height: 2; }
.q-prompt .hl { background: #eef2ff; color: #3730a3; padding: 1px 6px; border-radius: 6px; font-family: ui-monospace, monospace; font-size: 12px; direction: ltr; display: inline-block; }
.q-sub { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.q-score {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #e0e5ff;
  white-space: nowrap;
}
.q-hints { margin: 8px 0 0; padding-right: 18px; font-size: 12.5px; color: var(--muted); line-height: 2; }

/* --------------------------- گزینه‌های تستی --------------------------- */
.opt .letter {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
  background: #f1f2fa;
  color: #5b6180;
  border: 1px solid #e3e5f0;
  order: 3;
}
.opt:has(input:checked) .letter { background: var(--brand); color: #fff; border-color: var(--brand); }
.opt .mono { font-family: ui-monospace, monospace; direction: ltr; display: inline-block; font-size: 13px; }
.opts.two-col { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ------------------------------ ویرایشگر کد -------------------------- */
.editor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 6px;
  font-weight: 600;
}
.editor {
  display: flex;
  gap: 0;
  border: 1.5px solid #1e293b;
  border-radius: 13px;
  overflow: hidden;
  background: #0f172a;
  direction: ltr;
  transition: 0.18s;
}
.editor:focus-within { border-color: #6366f1; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16); }
.editor .gutter {
  flex: none;
  padding: 12px 8px 12px 10px;
  background: #0b1220;
  color: #475569;
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.85;
  text-align: right;
  user-select: none;
  overflow: hidden;
  min-width: 38px;
}
.editor textarea {
  flex: 1;
  min-height: 130px;
  resize: vertical;
  border: none;
  outline: none;
  background: transparent;
  color: #e2e8f0;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.85;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
  caret-color: #a5b4fc;
}
.editor textarea::placeholder { color: #475569; }
.editor-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
  flex-wrap: wrap;
}
.editor-foot .btn { padding: 3px 9px; font-size: 11px; border-radius: 8px; }

/* ------------------- پاسخ‌های متنی (تحلیل کد) ----------------------- */
.ans-field { margin-top: 12px; }
.ans-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.ans-field label i { color: var(--brand); font-size: 11px; }
.ans-field textarea.textarea { min-height: 64px; font-size: 13.5px; }

/* ---------------------------- تایمر و هدر ---------------------------- */
.chip.timer-warn { background: #fff8eb; border-color: #fbe3c4; color: #b45309; }
.chip.timer-danger {
  background: #fef2f2;
  border-color: #fbd5d5;
  color: #b91c1c;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.25); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}
.step-dot .cnt {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.06);
  padding: 0 5px;
  border-radius: 999px;
  margin-inline-start: 2px;
}
.step-dot.active .cnt { background: rgba(255, 255, 255, 0.22); }

/* ------------------------------- رسید ------------------------------- */
.receipt {
  margin: 18px auto 0;
  max-width: 420px;
  border: 1.5px dashed #d9dcf0;
  border-radius: 16px;
  padding: 16px;
  background: #fbfbff;
  text-align: right;
  font-size: 13px;
}
.receipt .row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #eceefb; }
.receipt .row:last-child { border-bottom: none; }
.receipt .row b { font-weight: 600; }
.receipt .code {
  font-family: ui-monospace, monospace;
  direction: ltr;
  letter-spacing: 1px;
  background: #eef2ff;
  color: #3730a3;
  padding: 2px 10px;
  border-radius: 8px;
}

/* --------------------------- جدول بارم‌بندی ------------------------- */
.grade-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.grade-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 11px;
  background: #fafbff;
  border: 1px solid var(--line);
  font-size: 12.5px;
}
.grade-item b { color: var(--brand); font-weight: 700; }
.grade-item.total { background: #eef2ff; border-color: #dfe3ff; font-weight: 700; color: #3730a3; }

/* ------------------------------ موبایل ------------------------------ */
@media (max-width: 620px) {
  .code-block { font-size: 12px; padding: 11px 12px; }
  .editor textarea { font-size: 12.5px; min-height: 110px; }
  .q-score { font-size: 11px; }
  .topbar-inner { flex-wrap: nowrap; }
  #timerChip { font-size: 12px; padding: 5px 10px; }
}

/* ---------------------------- ویرایشگر: حالت تمرکز ---------------- */
.q.focus { border-color: #c7cbf7; box-shadow: 0 10px 30px -18px rgba(79, 70, 229, 0.5); }

/* ------------------------------- چاپ ------------------------------- */
@media print {
  .topbar, .navbar-form, .progress-wrap, .btn, .editor-foot { display: none !important; }
  body { background: #fff; }
  .code-block { background: #f4f5fa; color: #111; border-color: #ddd; }
}
