/* QC - QuizCenter - Minimal Stylesheet (Tailwind CDN handles most styling) */

/* ===== Color Tokens ===== */
/*
 * Projektweit gültige Farbwerte – dienen als Referenz für alle Farbentscheidungen.
 * Tailwind-CDN-Klassen verwenden diese Werte implizit; eigene CSS-Klassen können
 * sie über var() direkt nutzen.
 *
 * Primärfarbe:   Blue-600  #2563eb  (bg-blue-600 / text-blue-600)
 * Primär dunkel: Blue-700  #1d4ed8  (hover:bg-blue-700)
 * Primär hell:   Blue-50   #eff6ff  (bg-blue-50)
 * Primär mittel: Blue-100  #dbeafe  (bg-blue-100)
 * Primär Border: Blue-300  #93c5fd  (border-blue-300)
 *
 * Neutral BG:    Gray-50   #f9fafb  (bg-gray-50)
 * Border:        Gray-200  #e5e7eb  (border-gray-200)
 * Border Input:  Gray-300  #d1d5db  (border-gray-300)
 * Text:          Gray-700  #374151  (text-gray-700)
 * Text gedämpft: Gray-500  #6b7280  (text-gray-500)
 *
 * Erfolg:        Green-600 #16a34a  (bg-green-600)
 * Fehler:        Red-600   #dc2626  (bg-red-600)
 * Warnung:       Amber-600 #d97706  (bg-amber-600)
 * Inaktiv/Archiv:Gray-400  #9ca3af  (bg-gray-400)
 */
:root {
    --c-primary:        #2563eb;
    --c-primary-dark:   #1d4ed8;
    --c-primary-light:  #eff6ff;
    --c-primary-mid:    #dbeafe;
    --c-primary-border: #93c5fd;
    --c-border:         #e5e7eb;
    --c-border-input:   #d1d5db;
    --c-text:           #374151;
    --c-text-muted:     #6b7280;
    --c-success:        #16a34a;
    --c-danger:         #dc2626;
    --c-warning:        #d97706;
}

/* ===== Base ===== */
a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Toggle Switch ===== */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 26px;
    transition: 0.2s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s ease;
}

.toggle input:checked + .toggle-slider {
    background: #2563eb;
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

/* ===== QR Code Print ===== */
@media print {
    nav, .print\\:hidden { display: none !important; }
    body { background: white; }

    .qr-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        page-break-inside: auto;
    }

    .qr-item {
        break-inside: avoid;
        border: 1px solid #ccc;
        padding: 1rem;
        text-align: center;
    }
}

/* ===== Tabular Nums for Countdowns ===== */
.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* ===== QC Question Card System (Base Layout – Iteration 1) ===== */

/* Unified question container */
.qc-question-card {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Unanswered highlight – shown after canceled submit with missing answers */
.qc-question-unanswered {
    outline: 3px solid #dc2626;
    outline-offset: 3px;
}

/* Individual input highlight for vocabulary_test unanswered entries */
.qc-input-unanswered {
    outline: 2px solid #dc2626 !important;
    outline-offset: 1px;
    background-color: #fff5f5 !important;
}

/* Header row: question number + points */
.qc-question-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* "Frage X" label */
.qc-question-number {
    font-weight: 700;
    color: #6b7280;
    font-size: 0.875rem;
}

/* "(N Punkte)" badge */
.qc-question-points {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Speicher-Status pro Frage – wird per JS mit Klasse befüllt
 * (is-saving / is-saved / is-error). Default: unsichtbar. */
.qc-save-status {
    font-size: 0.75rem;
    line-height: 1;
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 999px;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    user-select: none;
}
.qc-save-status.is-saving {
    opacity: 1;
    background: #fef3c7;
    color: #92400e;
}
.qc-save-status.is-saved {
    opacity: 1;
    background: #dcfce7;
    color: #166534;
}
.qc-save-status.is-saved.is-fading {
    opacity: 0;
}
.qc-save-status.is-error {
    opacity: 1;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}
.qc-save-status.is-saving::before { content: "⏳ speichert…"; }
.qc-save-status.is-saved::before { content: "✓ gespeichert"; }
.qc-save-status.is-error::before { content: "⚠ nicht gespeichert"; }

/* Session-Conflict-Modal – erscheint, wenn der Test in einem zweiten
 * Browser/Tab geöffnet wird (Soft-Lock, Migration 042). */
.qc-session-conflict-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.qc-session-conflict-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}
.qc-session-conflict-box {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 1.75rem;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    border-top: 6px solid #dc2626;
}
.qc-session-conflict-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #991b1b;
    margin: 0 0 0.75rem 0;
}
.qc-session-conflict-text {
    color: #374151;
    margin: 0 0 0.75rem 0;
    line-height: 1.5;
}
.qc-session-conflict-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}
.qc-session-conflict-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.qc-session-conflict-btn-secondary {
    background: #e5e7eb;
    color: #374151;
}
.qc-session-conflict-btn-secondary:hover {
    background: #d1d5db;
}
.qc-session-conflict-btn-primary {
    background: #dc2626;
    color: #fff;
}
.qc-session-conflict-btn-primary:hover {
    background: #b91c1c;
}

/* Question text */
.qc-question-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

/* Answer widget wrapper */
.qc-answer-area {
    margin-top: 0.5rem;
}

/* Optionales Frage-Bild */
.qc-question-image-wrap {
    display: block;
    margin: 0.25rem 0 0.75rem;
}
.qc-question-image-link {
    display: inline-block;
    max-width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.qc-question-image-link:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.qc-question-image {
    display: block;
    max-width: 100%;
    max-height: 420px;
    height: auto;
    width: auto;
}
.qc-question-image-caption {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 0.25rem;
    font-style: italic;
}

/* ===== QC Selection Types (Iteration 2) ===== */

/* Options list container */
.qc-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Single option card */
.qc-option-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.625rem;
    cursor: pointer;
    background-color: #ffffff;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.qc-option-label:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.qc-option-label:has(:checked) {
    background-color: #eff6ff;
    border-color: #3b82f6;
}

/* Correct answer highlight in student preview (import page) */
.qc-option-label--correct {
    background-color: #f0fdf4;
    border-color: #86efac;
}

.qc-option-label--correct:hover {
    background-color: #dcfce7;
    border-color: #4ade80;
}

.qc-tf-label.qc-option-label--correct {
    background-color: #f0fdf4;
    border-color: #86efac;
}

/* Drag handle for option reordering in preview */
.preview-option-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.preview-drag-handle {
    cursor: grab;
    color: #9ca3af;
    font-size: 1.1rem;
    padding: 0 0.25rem;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
    flex-shrink: 0;
}

.preview-drag-handle:hover {
    color: #4b5563;
}

.preview-option-row[draggable="true"]:active .preview-drag-handle {
    cursor: grabbing;
}

/* The radio / checkbox inside an option card */
.qc-option-input {
    flex-shrink: 0;
    accent-color: #2563eb;
}

/* Option text */
.qc-option-text {
    font-size: 1.125rem;
    line-height: 1.4;
}

/* True/False: two-button row */
.qc-tf-list {
    display: flex;
    gap: 1rem;
}

/* True/False: individual button card */
.qc-tf-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.625rem;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 600;
    background-color: #ffffff;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

/* Hide radio button — the whole label is the click target */
.qc-tf-label .qc-option-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Wahr (true) — green */
.qc-tf-label--true {
    border-color: #86efac;
    color: #166534;
}
.qc-tf-label--true:hover {
    background-color: #f0fdf4;
    border-color: #4ade80;
}
.qc-tf-label--true:has(:checked) {
    background-color: #dcfce7;
    border-color: #16a34a;
    color: #14532d;
}

/* Falsch (false) — red */
.qc-tf-label--false {
    border-color: #fca5a5;
    color: #991b1b;
}
.qc-tf-label--false:hover {
    background-color: #fff1f2;
    border-color: #f87171;
}
.qc-tf-label--false:has(:checked) {
    background-color: #fee2e2;
    border-color: #dc2626;
    color: #7f1d1d;
}

/* Mobile: stack true/false vertically on very small screens */
@media (max-width: 400px) {
    .qc-tf-list {
        flex-direction: column;
    }
}

/* ===== QC Input Types (Iteration 3) ===== */

/* Short answer – full-width text input */
.qc-text-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1.25rem;
    line-height: 1.5;
    background-color: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.qc-text-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Freetext – multi-line answer textarea (shares .qc-text-input base) */
textarea.freetext-answer {
    font-size: 1.05rem;
    resize: vertical;
    min-height: 8rem;
}

/* Numeric – centered, tabular numbers */
.qc-numeric-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
    background-color: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.qc-numeric-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Cloze text container */
.qc-cloze-container {
    font-size: 1.25rem;
    line-height: 2.2;
    padding: 0.5rem 0;
}

/* Inline cloze fill-in input */
.qc-cloze-input {
    display: inline-block;
    border: none;
    border-bottom: 2px solid #3b82f6;
    background: transparent;
    font-size: inherit;
    font-family: inherit;
    text-align: center;
    padding: 0 0.25rem;
    margin: 0 0.25rem;
    min-width: 80px;
    outline: none;
    vertical-align: baseline;
    transition: border-color 0.15s ease, border-bottom-width 0.1s ease;
}

.qc-cloze-input:focus {
    border-bottom-color: #1d4ed8;
    border-bottom-width: 3px;
}

/* ===== QC Structure Types (Iteration 4) ===== */

/* Matching & Categorization: column containers with consistent row gap */
.matching-container,
.categorization-container {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

/* Matching & Categorization: shared row layout */
.qc-match-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.qc-match-label {
    flex: 1;
    font-size: 1.125rem;
    font-weight: 500;
    min-width: 0;
}

.qc-match-select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: #ffffff;
    outline: none;
    min-width: 0;
    transition: border-color 0.15s ease;
}

.qc-match-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Mobile: stack label above select */
@media (max-width: 480px) {
    .qc-match-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }

    .qc-match-label {
        font-weight: 600;
        font-size: 1rem;
    }
}

/* ===== Matching: Drag & Drop UI ===== */
.qc-matching-dnd {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    touch-action: none;
}

.qc-match-slots {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.qc-match-slot {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

.qc-match-left {
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.5;
    min-width: 0;
    overflow-x: auto;
}

.qc-match-drop {
    min-height: 3rem;
    padding: 0.5rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.qc-match-drop-filled {
    border-style: solid;
    border-color: #3b82f6;
    background: #eff6ff;
}

.qc-match-zone-hover {
    border-color: #2563eb;
    background: #dbeafe;
}

.qc-match-placeholder {
    color: #9ca3af;
    font-size: 0.875rem;
    font-style: italic;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.qc-match-bank {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    align-content: flex-start;
    min-height: 4rem;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.qc-match-bank.qc-match-zone-hover {
    background: #dbeafe;
    border-color: #2563eb;
}

.qc-match-card {
    display: block;
    padding: 0.6rem 0.85rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1.0625rem;
    line-height: 1.4;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    touch-action: none;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* MathJax in Karten: Klicks zur Karte durchreichen und Fokusrahmen entfernen.
 * Tabindex wird per JS in matching-dnd.js nach dem Typeset entfernt. */
.qc-match-card mjx-container,
.qc-match-left mjx-container {
    outline: none !important;
    pointer-events: none;
}

.qc-match-card:hover {
    border-color: #3b82f6;
}

.qc-match-card:active {
    cursor: grabbing;
}

.qc-match-card-dragging {
    opacity: 0.4;
}

.qc-match-card-clone {
    box-shadow: 0 10px 20px rgba(0,0,0,0.18);
    transform: rotate(-1.5deg);
}

.qc-dnd-disabled .qc-match-card {
    cursor: not-allowed;
    opacity: 0.7;
}

.qc-match-bank-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

/* Mobile: stack bank under slots */
@media (max-width: 720px) {
    .qc-matching-dnd {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Ordering: list item */
.qc-ordering-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: border-color 0.15s ease;
}

.qc-ordering-handle {
    color: #9ca3af;
    font-size: 1.25rem;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.qc-ordering-text {
    flex: 1;
    font-size: 1.125rem;
    min-width: 0;
}

.qc-ordering-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.qc-ordering-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 1.5rem;
    color: #6b7280;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    transition: background-color 0.1s ease, color 0.1s ease;
}

.qc-ordering-btn:hover:not(:disabled) {
    background-color: #f3f4f6;
    color: #111827;
}

.qc-ordering-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Cloze drag-drop: inline select */
.qc-cloze-dd-select {
    display: inline-block;
    border: 2px solid #3b82f6;
    border-radius: 0.375rem;
    padding: 0.125rem 0.5rem;
    font-size: inherit;
    font-family: inherit;
    background-color: #eff6ff;
    color: #1e40af;
    outline: none;
    margin: 0 0.25rem;
    vertical-align: baseline;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.qc-cloze-dd-select:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ===== QC Vocabulary Test (Iteration 5) ===== */

/* Outer container */
.qc-vocab-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Each word-pair row */
.qc-vocab-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
}

/* Prompt word (given side) */
.qc-vocab-prompt {
    flex-shrink: 0;
    width: 9rem;
    min-width: 5rem;
    font-size: 1.0625rem;
    font-weight: 600;
    color: #1f2937;
    overflow-wrap: break-word;
}

/* Arrow separator */
.qc-vocab-arrow {
    flex-shrink: 0;
    color: #9ca3af;
    font-size: 1rem;
}

/* Answer input */
.qc-vocab-input {
    flex: 1;
    min-width: 0;
    padding: 0.375rem 0.625rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.375rem;
    font-size: 1rem;
    background: #ffffff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qc-vocab-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Mobile: stack prompt above input */
@media (max-width: 420px) {
    .qc-vocab-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
    }

    .qc-vocab-prompt {
        width: auto;
        font-size: 0.9375rem;
    }

    .qc-vocab-arrow {
        display: none;
    }
}

/* ===== QC Responsive System (Iteration 6) ===== */

/*
 * Breakpoints used throughout this system:
 *   xs:  <400px  (very small phones – true_false stacking)
 *   sm:  <420px  (vocab stacking)
 *   md:  <480px  (match/cat stacking, general mobile)
 *   lg:  ≥640px  (tablet+)
 *   xl:  ≥1024px (desktop)
 */

/* ── Cloze overflow fix ──────────────────────────────────────────────────── */
/* Prevents inline inputs/selects from causing horizontal scroll on mobile   */
.qc-cloze-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem; /* prevent clipped focus ring */
}

/* ── Mobile: compact card spacing (<480px) ───────────────────────────────── */
@media (max-width: 480px) {
    /* Slightly smaller question text on narrow screens */
    .qc-question-text {
        font-size: 1.0625rem;
    }

    /* Tighter option card padding */
    .qc-option-label {
        padding: 0.625rem 0.75rem;
    }

    /* True/false: smaller padding, still legible */
    .qc-tf-label {
        padding: 0.75rem 1rem;
        font-size: 1.125rem;
    }

    /* Numeric: slightly smaller font to fit on narrow screens */
    .qc-numeric-input {
        font-size: 1.25rem;
    }

    /* Ordering items: tighter padding */
    .qc-ordering-item {
        padding: 0.625rem;
    }
}

/* ── Touch targets: ordering buttons ────────────────────────────────────── */
/* Ordering up/down – ensure comfortable tap area on touch screens           */
.qc-ordering-btn {
    min-height: 2.25rem; /* 36px – comfortable secondary action */
    min-width: 2.25rem;
}

/* ── Per-question navigation buttons ────────────────────────────────────── */
/* Ensures prev/next meet 44px minimum touch target recommendation           */
#prev-question-btn,
#next-question-btn {
    min-height: 2.75rem; /* 44px */
    min-width: 5rem;
}

/* ── Tablet+ (≥640px): slightly more breathing room ─────────────────────── */
@media (min-width: 640px) {
    .qc-question-text {
        font-size: 1.25rem;
    }

    .qc-option-text {
        font-size: 1.125rem;
    }

    .qc-ordering-item {
        padding: 0.875rem;
    }
}

/* ── Desktop (≥1024px): layout is already max-w-xl (512px) ──────────────── */
/* The narrow column is intentional for a focused test-taking UI.            */
/* No max-width change needed; just ensure the sticky timer aligns cleanly.  */
@media (min-width: 1024px) {
    #test-timer {
        border-radius: 0 0 0.5rem 0.5rem; /* subtle rounding on wide viewports */
    }
}

/* ===== QC Visual Consistency (Iteration 7) ===== */

/*
 * Typography scale (enforced across all question types):
 *   Question text  : 1.25rem  / weight 600  (.qc-question-text)
 *   Option/item    : 1.125rem / weight 400  (.qc-option-text, .qc-match-label,
 *                                            .qc-ordering-text)
 *   Input text     : 1rem–1.25rem            (.qc-text-input, .qc-match-select …)
 *   Meta labels    : 0.875rem / weight 700  (.qc-question-number)
 *   Points badge   : 0.75rem  / weight 400  (.qc-question-points)
 *
 * Design tokens:
 *   --border-default  : #e5e7eb  (gray-200)
 *   --border-hover    : #d1d5db  (gray-300)
 *   --border-focus    : #3b82f6  (blue-500)
 *   --selected-bg     : #eff6ff  (blue-50)
 *   --focus-ring      : 0 0 0 3px rgba(59,130,246,0.15)
 *   --radius-card     : 0.625rem (option/tf cards)
 *   --radius-input    : 0.5rem   (inputs, selects, containers)
 *   --transition      : 0.15s ease
 */

/* Unified disabled state for all answer widgets */
.qc-answer-area .answer-input:disabled,
.qc-answer-area .qc-option-label:has(:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Consistent hint/instruction text across all types */
.qc-answer-area .text-sm.text-gray-500 {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.625rem;
}

/* Ordering list: reset browser defaults for <ol>; spacing provided by Tailwind space-y-2 */
.ordering-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Hint text inside ordering and ordering outer container */
.ordering-container > p {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* =========================================================
 * Bild-Upload im Quiz-Editor (Drag&Drop-Zone, Vorschau, Progress)
 * ========================================================= */

.qc-image-block {
    /* Kontainer wird durch mb-4 positioniert */
}

.qc-image-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 1.25rem 1rem;
    background: #f8fafc;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    outline: none;
}
.qc-image-dropzone:hover,
.qc-image-dropzone:focus-visible {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.qc-image-dropzone-active {
    background: #e0f2fe !important;
    border-color: #0284c7 !important;
}

.qc-image-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}
.qc-image-icon {
    font-size: 2rem;
    line-height: 1;
    opacity: 0.75;
}
.qc-image-hint-primary {
    font-weight: 600;
    color: #334155;
    font-size: 0.9rem;
}
.qc-image-hint-secondary {
    font-size: 0.75rem;
    color: #64748b;
}
.qc-image-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.25rem;
}
.qc-image-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}
.qc-image-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.qc-image-btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.qc-image-btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.qc-image-progress {
    margin-top: 0.5rem;
}
.qc-image-progress-label {
    font-size: 0.75rem;
    color: #475569;
    margin-bottom: 0.35rem;
}
.qc-image-progress-track {
    background: #e2e8f0;
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}
.qc-image-progress-fill {
    background: #2563eb;
    height: 100%;
    width: 0%;
    transition: width 0.2s ease;
}

.qc-image-preview {
    /* Vorschau + Alt-Text */
}
.qc-image-preview-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.5rem;
    background: #fff;
}
.qc-image-preview-wrap img {
    display: block;
    max-width: 100%;
    max-height: 240px;
    border-radius: 6px;
    object-fit: contain;
}
.qc-image-remove-btn {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #dc2626;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}
.qc-image-remove-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
}
.qc-image-alt-row {
    margin-top: 0.75rem;
}

.qc-image-error {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #991b1b;
    font-size: 0.8125rem;
}

/* ============================================================
 * Persoenliche Quiz-Ordner: Drag & Drop Visuals
 * ============================================================ */
.quiz-drag-handle { touch-action: none; }
.quiz-drag-ghost  { opacity: 0.35; }
.quiz-drag-chosen { box-shadow: 0 0 0 2px #3b82f6; }
.quiz-drag-active { cursor: grabbing !important; }

/* Drop-Zone-Overlay auf Ordner-Kacheln */
.quiz-drop-overlay { transition: opacity 120ms ease-out; }
body.quiz-dragging .quiz-drop-overlay {
    opacity: 1;
    pointer-events: auto;
}
.quiz-drop-overlay.quiz-drop-active,
.quiz-folder-card:has(.quiz-drop-overlay.quiz-drop-active) {
    box-shadow: 0 0 0 3px #2563eb inset;
}

/* Tree-Knoten + Breadcrumb: beim Drag highlight-bar */
body.quiz-dragging [data-drop-zone]:not(.quiz-folder-card *) {
    outline: 1px dashed transparent;
    outline-offset: 2px;
    transition: outline-color 100ms ease-out, background-color 100ms ease-out;
}
body.quiz-dragging [data-drop-zone]:not(.quiz-folder-card *):hover {
    outline-color: #3b82f6;
    background-color: rgba(219, 234, 254, 0.6);
}
body.quiz-dragging [data-drop-zone].quiz-drop-active:not(.quiz-folder-card *) {
    outline-color: #2563eb;
    background-color: rgba(219, 234, 254, 0.9);
}
