/* --- QUIZ BLOKK (Teszt) --- */
/* modosit_255.py: a blokk háttere #f8fafc (mint a beágyazott
   HTML-nél a külső rész), a keret #cbd5e1. */
.block.quiz-block {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
  }

/* modosit_254.py: a flash-highlight outline csak a tanárnál. */
body.teacher-mode .quiz-block.flash-highlight {
  outline: 3px solid #1e293b;
  outline-offset: 2px;
}
body:not(.teacher-mode) .quiz-block.flash-highlight {
  outline: none !important;
}
  .block.quiz-block .quiz-textarea {
    width: 100%; min-height: 200px;
    border: 1px solid #fdba74; border-radius: 6px;
    padding: 10px 12px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.88rem; line-height: 1.55;
    resize: vertical; background: white; color: #1e293b;
    outline: none; overflow-y: auto; overflow-x: hidden;
    transition: height 0.12s ease; max-height: 60vh;
    user-select: text; -webkit-user-select: text;
  }
  .block.quiz-block .quiz-textarea:focus {
    outline: 2px solid #ea580c; border-color: transparent;
  }
  .quiz-config-panel {
    display: none; margin-bottom: 10px; padding: 10px 12px;
    background: #fff7ed; border: 1px dashed #fdba74;
    border-radius: 6px; font-size: 0.85rem;
  }
  .quiz-config-panel.show { display: block; }
  .quiz-config-row {
    display: flex; flex-wrap: wrap; gap: 12px 20px;
    align-items: center; margin-bottom: 6px;
  }
  .quiz-config-row:last-child { margin-bottom: 0; }
  .quiz-config-row > label {
    display: inline-flex; align-items: center; gap: 5px;
    cursor: pointer; user-select: none;
    color: #7c2d12; font-weight: 500;
  }
  .quiz-config-row input[type="radio"],
  .quiz-config-row input[type="checkbox"] {
    margin: 0; cursor: pointer; accent-color: #ea580c;
  }
  .quiz-config-row input[type="number"] {
    width: 70px; padding: 4px 8px;
    border: 1px solid #fdba74; border-radius: 4px;
    font-family: inherit; font-size: 0.85rem;
  }
  .quiz-config-hint {
    color: #9a3412; font-style: italic; font-size: 0.78rem;
  }
  .quiz-student-view { padding: 4px 0; }
  .quiz-empty {
    padding: 20px; text-align: center;
    color: #94a3b8; font-style: italic;
  }
  .quiz-question {
    margin-bottom: 16px; padding: 12px 14px;
    background: white; border: 1px solid #e2e8f0;
    border-radius: 6px;
  }
  .quiz-question:last-child { margin-bottom: 0; }
  /* Kérdés-fejléc: a szám és a szöveg egy kis dobozban */
  .quiz-question-header {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 0 6px 6px 0;
    padding: 8px 12px;
    margin-bottom: 10px;
  }
  .quiz-question-title {
    font-size: 0.75rem; font-weight: 700; color: #1e40af;
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-bottom: 4px;
    display: flex; align-items: center; flex-wrap: wrap;
  }
  .quiz-question-text {
    font-size: 0.95rem; font-weight: 400; color: #1e293b;
    margin-bottom: 0;
    line-height: 1.4;
    /* A \n karaktereket valódi sortörésként jelenítjük meg */
    white-space: pre-wrap;
  }
  /* A kérdés első sora mindig vastag (a renderQuizText <strong>-gal jelöli). */
  .quiz-question-text strong {
    font-weight: 700;
  }
  .quiz-answer {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 6px 10px; margin-bottom: 4px;
    border-radius: 4px; cursor: pointer;
    user-select: none; transition: background 0.12s;
    border: 1px solid transparent;
  }
  /* Hover: csak kiértékelés ELŐTT. Kiértékelés után nincs hover-effekt. */
  .quiz-student-view:not(.has-results) .quiz-answer:hover { background: #fef3c7; }
  .quiz-answer input[type="checkbox"] {
    margin: 3px 0 0 0; cursor: pointer;
    accent-color: #ea580c; flex-shrink: 0;
  }
  /* Egyválaszos kérdés: a checkbox KEREK (rádiógomb-szerű) megjelenése.
     A DOM-ban checkbox marad, csak vizuálisan lesz kerek – így a
     kijelölést is vissza lehet vonni (a rádiógomb nem engedné). */
  .quiz-question[data-single-choice="1"] input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 2px solid #94a3b8;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    margin: 3px 0 0 0;
    flex-shrink: 0;
    position: relative;
    box-sizing: border-box;
    transition: border-color 0.12s, background 0.12s;
  }
  .quiz-question[data-single-choice="1"] input[type="checkbox"]:hover {
    border-color: #ea580c;
  }
  .quiz-question[data-single-choice="1"] input[type="checkbox"]:checked {
    border-color: #ea580c;
  }
  .quiz-question[data-single-choice="1"] input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ea580c;
  }
  .quiz-question[data-single-choice="1"] input[type="checkbox"]:disabled {
    cursor: not-allowed;
  }
  /* GIFT / szövegfájl drag & drop vizuális jelzése a teszt blokkon */
  .block.quiz-block.quiz-drop-active {
    outline: 2px dashed #ea580c;
    outline-offset: 3px;
  }
  .quiz-answer-text {
    flex: 1;
    font-size: 0.92rem;
    /* A \n karaktereket valódi sortörésként jelenítjük meg */
    white-space: pre-wrap;
  }
  /* Helyes válasz (bejelölve): zöld háttér */
  .quiz-answer.correct { background: #dcfce7; border-color: #86efac; }
  /* Rossz válasz (bejelölve): piros háttér */
  .quiz-answer.wrong { background: #fee2e2; border-color: #fca5a5; }
  /* Kihagyott helyes válasz: világos sárga háttér */
  .quiz-answer.missed {
    background: #fef3c7;
    border-color: #fcd34d;
  }
  /* Kérdésenkénti pontszám – a jobb szélre igazítva */
  .quiz-question-score {
    font-size: 0.82rem;
    font-weight: 700;
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
  }
  /* Pontszám bontás: +X (jó válaszokért) −Y (rossz válaszokért).
     A scoreHtml része, közvetlenül a .quiz-question-score előtt. */
  .quiz-question-points-detail {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    background: white;
    border: 1px solid #cbd5e1;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.82rem;
    font-weight: 700;
    margin-left: 6px;
  }
  .quiz-question-points-detail .q-pos { color: #16a34a; }
  .quiz-question-points-detail .q-neg { color: #dc2626; }

/* --- Válasz-ikon (ellenőrzés után) --- */
.quiz-answer-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    color: white;
    flex-shrink: 0;
    margin-top: 1px;
  }
  .quiz-answer-icon.correct { background: #16a34a; }
  .quiz-answer-icon.wrong { background: #dc2626; }
  .quiz-answer-icon.missed { background: #94a3b8; }
  .quiz-answer-icon.wrong-unselected {
    background: #e2e8f0;
    color: #64748b;
  }
  .quiz-question-score.perfect {
    background: #dcfce7;
    color: #166534;
  }
  .quiz-question-score.partial {
    background: #fef3c7;
    color: #92400e;
  }
  .quiz-question-score.zero {
    background: #fee2e2;
    color: #991b1b;
  }

/* --- TESZT FEJLÉC – csak az ellenőrzés után jelenik meg --- */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 14px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
  }
  .quiz-header.perfect { background: #f0fdf4; border-color: #86efac; }
  .quiz-header.failed { background: #fef2f2; border-color: #fca5a5; }
  .quiz-header-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
  }
  .quiz-header-row {
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: 0.85rem;
  }
  .quiz-header-label {
    color: #64748b;
    font-weight: 600;
    min-width: 130px;
    flex-shrink: 0;
  }
  .quiz-header-value {
    color: #1e293b;
    font-family: "Consolas", "Courier New", monospace;
    font-weight: 600;
  }
  .quiz-header-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 20px;
    min-width: 140px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
  }
  .quiz-header.perfect .quiz-header-right { border-color: #86efac; }
  .quiz-header.failed .quiz-header-right { border-color: #fca5a5; }
  .quiz-header-score-value {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
    color: #1e293b;
  }
  .quiz-header.perfect .quiz-header-score-value { color: #166534; }
  .quiz-header.failed .quiz-header-score-value { color: #991b1b; }
  .quiz-header-score-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 4px;
  }
  .quiz-header-score-sub {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 6px;
    text-align: center;
  }
  .quiz-header-score-sub:empty { display: none; }

/* --- TESZT ELŐNÉZET MODAL --- */
.modal.quiz-preview-modal {
    max-width: 800px !important;
    width: 95% !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .quiz-preview-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
  }
  .quiz-preview-header h3 {
    margin: 0; font-size: 1.05rem;
    word-break: break-word;
  }
  .quiz-preview-close {
    background: transparent; border: none;
    font-size: 1.1rem; font-weight: 700;
    cursor: pointer; padding: 4px 10px;
    border-radius: 6px; line-height: 1;
    color: #64748b;
  }
  .quiz-preview-close:hover { background: #e2e8f0; color: #1e293b; }
  .quiz-preview-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    background: #f1f5f9;
  }
  .quiz-preview-body .block.quiz-block { margin: 0; }
  .quiz-preview-hint {
    font-size: 0.82rem;
    color: #64748b;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 14px;
    line-height: 1.5;
  }

/* --- TESZT KÉPEK – kezelőpanel (csak tanárnál) --- */
.quiz-images-panel {
    margin-top: 10px;
    border: 1px solid #fdba74;
    border-radius: 6px;
    background: #fff7ed;
    overflow: hidden;
  }
  .quiz-images-header {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: #ffedd5;
    border-bottom: 1px solid #fdba74;
    font-size: 0.82rem;
    font-weight: 700;
    color: #9a3412;
  }
  .quiz-images-header .quiz-images-count {
    color: #78350f;
    font-weight: 500;
  }
  .quiz-images-header .quiz-image-upload-btn {
    margin-left: auto;
    font-size: 0.78rem;
    padding: 3px 8px;
    color: #9a3412;
    border-color: #fdba74;
    background: white;
  }
  .quiz-images-header .quiz-image-upload-btn:hover { background: #ffedd5; }
  .quiz-images-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .quiz-image-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px;
    background: white;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    font-size: 0.82rem;
  }
  .quiz-image-thumb {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: #f1f5f9;
    flex-shrink: 0;
    cursor: zoom-in;
  }
  .quiz-image-info {
    flex: 1;
    min-width: 0;
    display: flex; flex-direction: column;
    gap: 2px;
  }
  .quiz-image-num {
    font-weight: 700;
    color: #9a3412;
    font-family: "Consolas", monospace;
    font-size: 0.78rem;
  }
  .quiz-image-name {
    color: #1e293b;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .quiz-image-actions { display: flex; gap: 4px; flex-shrink: 0; }
  .quiz-image-actions .icon-btn { padding: 4px 8px; font-size: 0.78rem; }
  .quiz-images-empty {
    padding: 12px;
    text-align: center;
    color: #9a3412;
    font-style: italic;
    font-size: 0.8rem;
  }

  /* A textarea drag-over jelzése */
  .quiz-textarea.dragover {
    outline: 2px dashed #ea580c;
    outline-offset: 2px;
    background: #fff7ed;
  }

  /* Képek a megjelenítésben */
  .quiz-question-text img.quiz-image,
  .quiz-answer-text img.quiz-image,
  .quiz-feedback img.quiz-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 6px;
    display: block;
    margin: 8px 0;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    cursor: zoom-in;
    background: #f1f5f9;
  }
  .quiz-image-missing {
    display: inline-block;
    padding: 2px 6px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 4px;
    font-size: 0.82rem;
    font-style: italic;
  }

  /* Kontextusmenü (kép beszúrása) */
  .quiz-image-context-menu {
    position: fixed;
    z-index: 10010;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    padding: 4px;
    min-width: 240px;
    max-width: 400px;
    display: none;
    font-size: 0.9rem;
  }
  .quiz-image-context-menu.show { display: block; }
  .quiz-image-context-menu .menu-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 12px 4px;
  }
  .quiz-image-context-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    font-family: inherit;
  }
  .quiz-image-context-menu button:hover { background: #f1f5f9; }
  .quiz-image-context-menu .menu-icon { width: 20px; text-align: center; flex-shrink: 0; }
  .quiz-image-context-menu .menu-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .quiz-image-context-menu .menu-num {
    color: #9a3412;
    font-family: "Consolas", monospace;
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
  }
  .quiz-image-context-menu .menu-separator {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
  }
  .quiz-image-context-menu .menu-empty {
    padding: 12px;
    font-size: 0.85rem;
    color: #64748b;
    font-style: italic;
    text-align: center;
  }

  /* Kép nagyító modal */
  .modal.image-viewer-modal {
    max-width: 90vw !important;
    width: auto !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .image-viewer-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
  }
  .image-viewer-header h3 {
    margin: 0; font-size: 1rem;
    word-break: break-word;
  }
  .image-viewer-close {
    background: transparent; border: none;
    font-size: 1.2rem; font-weight: 700;
    cursor: pointer; padding: 4px 10px;
    border-radius: 6px; line-height: 1;
    color: #64748b;
  }
  .image-viewer-close:hover { background: #e2e8f0; color: #1e293b; }
  .image-viewer-body {
    padding: 0;
    overflow: auto;
    flex: 1;
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .image-viewer-body img {
    max-width: 100%;
    max-height: 85vh;
    display: block;
  }

  .quiz-actions {
    margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap;
    align-items: center;
  }
  .quiz-page-info {
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    margin-left: auto;
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 12px;
    font-family: "Consolas", "Courier New", monospace;
  }
  .quiz-prev-btn,
  .quiz-next-btn {
    background: #2563eb;
    color: white;
    border: 1px solid #1d4ed8;
  }
  .quiz-prev-btn:hover,
  .quiz-next-btn:hover { background: #1d4ed8; opacity: 1; }
  .quiz-result {
    margin-top: 14px; padding: 12px 14px;
    background: #f8fafc; border: 1px solid #cbd5e1;
    border-radius: 6px;
  }
  .quiz-result.perfect { background: #f0fdf4; border-color: #86efac; }
  .quiz-result.failed { background: #fef2f2; border-color: #fca5a5; }
  .quiz-result-title {
    font-size: 1rem; font-weight: 700;
    margin-bottom: 6px; color: #1e293b;
  }
  .quiz-result-score { font-size: 0.95rem; color: #1e293b; }
  .quiz-feedback {
    margin-top: 10px; padding: 8px 12px;
    background: #eff6ff; border-left: 3px solid #3b82f6;
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem; color: #1e40af;
    /* A \n karaktereket valódi sortörésként jelenítjük meg */
    white-space: pre-wrap;
  }

  /* Markdown kód stílusok a teszten belül */
  .quiz-question-text code,
  .quiz-answer-text code,
  .quiz-feedback code {
    background: #e0e7ff;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.9em;
    color: #be185d;
  }
  .quiz-question-text pre,
  .quiz-answer-text pre,
  .quiz-feedback pre {
    background: #cbd5e1;
    color: #1e293b;
    padding: 8px 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre;
    border: 1px solid #94a3b8;
  }
  .quiz-question-text pre code,
  .quiz-answer-text pre code,
  .quiz-feedback pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
  }
  .quiz-feedback-label { font-weight: 700; margin-right: 4px; }
  .quiz-attempts-info {
    font-size: 0.82rem; color: #64748b;
    margin-top: 6px; font-style: italic;
  }
  .tool-btn.quiz-btn {
    color: #ea580c; border-color: #fdba74; background: #fff7ed;
  }
  .tool-btn.quiz-btn:hover { background: #ffedd5; border-color: #fb923c; }

  /* Elválasztó vonal: a kezelőgombok ugyanolyan lebegő
     "pirula" formában jelennek meg a vonalon, mint a feladatok
     közötti elválasztónál (▲ ▼ ✕), lakat és ? nélkül. */
  .block.divider-block {
    background: transparent;
    border: none;
    padding: 4px 8px;
    position: relative;
    box-shadow: none;
  }
  .block.divider-block .divider-line {
    border: none;
    border-top: 2px solid #cbd5e1;
    margin: 6px 0;
  }
  .block.divider-block > .block-toolbar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    justify-content: center !important;
    margin: 0 !important;
    padding: 2px 4px;
    gap: 4px;
    background: white;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
  }
  .block.divider-block:hover > .block-toolbar {
    opacity: 1;
    visibility: visible;
  }
  .block.divider-block > .block-toolbar .icon-btn {
    padding: 2px 7px;
    font-size: 0.72rem;
    line-height: 1;
  }
  .block.divider-block > .block-toolbar .icon-btn.danger {
    color: #b91c1c;
  }
  .block.divider-block > .block-toolbar .icon-btn.danger:hover {
    background: #fee2e2;
  }
  .block.divider-block > .block-toolbar .icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }
/* ============================================================
   modosit_249.py — Teljes blokk kerete
   Ugyanaz, mint a .html-embed-frame-wrap-nál
   (1px solid #e2e8f0, border-radius: 6px).
   ============================================================ */
.quiz-block {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}


/* ============================================================
   modosit_564.py — A teszt gombjainak elrejtése beadás után
   ============================================================
   A body.locked osztály a beadás után kerül a body-ra
   (a finalizeDoc() hívja az applyLockedMode()-ot).
   A .quiz-check-btn és a .quiz-reset-btn a teszt gombjai.
   ============================================================ */
body.locked .quiz-check-btn,
body.locked .quiz-reset-btn {
  display: none !important;
}
