/* Editor delle verifiche: copia di quiz_editor/editor.css (commit 130ba45).
   Tutte le regole sono annidate in .quiz-editor, così non toccano la testata
   e le altre aree di Nexus. Le classi in fondo sostituiscono gli stili che
   nell'originale sono scritti nell'HTML, vietati dalla politica di sicurezza. */
.quiz-editor {
& {
            --primary: #2f5d50;
            --primary-hover: #244a40;
            --success: #10b981;
            --success-hover: #059669;
            --bg: #f3f4f6;
            --card-bg: #ffffff;
            --card-header: #ddd;
            --text: #1f2937;
            --border: #e5e7eb;
            --danger: #ef4444;
            --radius: 2px;
            --header-bg: #dfe9e1;
            --header-text: #23463c;
            --header-line: #a9c2b3;
        }

        & {
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: var(--bg);
            color: var(--text);
            margin: 0;
            line-height: 1.5;
            scroll-behavior: smooth;
        }

        .container {
            max-width: 900px;
            margin: 0 auto;
            padding: 24px 20px 100px;
        }

        /* Header e Toolbar */
        header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            /* Testata a tutta larghezza, fuori dal contenitore centrale */
            background: var(--header-bg);
            color: var(--header-text);
            padding: 12px 24px;
            border-bottom: 1px solid var(--header-line);
            box-shadow: 0 1px 3px rgba(35, 70, 60, 0.14);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        h1 {
            margin: 0;
            font-size: 1.25rem;
            font-weight: 600;
            letter-spacing: 0.01em;
            color: var(--header-text);
            align-self: center;
        }

        /* Contenitore destro per Bottoni e Nome File */
        .header-right {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            /* Allinea tutto a destra */
            gap: 8px;
        }

        .btn-group {
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-end;
            gap: 10px;
        }

        .file-info-display {
            font-size: 0.85rem;
            color: #6b7280;
            font-family: monospace;
            background: #f9fafb;
            padding: 2px 8px;
            border-radius: var(--radius);
            border: 1px solid #e5e7eb;
            display: none;
            /* Nascosto finché non carichi un file */
        }

        button {
            padding: 10px 20px;
            border: none;
            border-radius: var(--radius);
            font-weight: 600;
            cursor: pointer;
            transition: background 0.2s, transform 0.2s;
            white-space: nowrap;
        }

        .btn-primary {
            background-color: var(--primary);
            color: white;
        }

        .btn-primary:hover {
            background-color: var(--primary-hover);
        }

        .btn-success {
            background-color: var(--success);
            color: white;
        }

        .btn-success:hover {
            background-color: var(--success-hover);
        }

        .btn-secondary {
            background-color: white;
            border: 1px solid var(--border);
            color: var(--text);
        }

        .btn-secondary:hover {
            background-color: var(--bg);
        }

        .btn-danger {
            background-color: #fee2e2;
            color: var(--danger);
        }

        .btn-danger:hover {
            background-color: #fecaca;
        }

        /* Pulsanti della testata: su fondo pastello, con pochi colori */
        header button {
            padding: 8px 14px;
            font-size: 0.9rem;
            border: 1px solid transparent;
        }

        header .btn-secondary {
            background-color: transparent;
            border-color: var(--header-line);
            color: var(--header-text);
        }

        header .btn-secondary:hover {
            background-color: rgba(255, 255, 255, 0.6);
        }

        header .btn-success {
            background-color: #ffffff;
            border-color: var(--primary);
            color: var(--primary-hover);
        }

        header .btn-success:hover {
            background-color: #f1f6f2;
        }

        header .btn-primary {
            border-color: var(--primary);
        }

        header .file-info-display {
            background: rgba(255, 255, 255, 0.6);
            color: var(--primary);
            border-color: var(--header-line);
        }

        header button:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        /* Card Stile */
        .card {
            background: var(--card-bg);
            padding: 25px;
            border-radius: var(--radius);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
            margin-bottom: 20px;
            border: 1px solid var(--border);
        }

        .section-title {
            font-size: 1.1rem;
            font-weight: bold;
            margin-bottom: 15px;
            border-bottom: 2px solid var(--bg);
            padding-bottom: 10px;
        }

        /* Form Elements */
        .form-group {
            margin-bottom: 15px;
        }

        label {
            display: block;
            font-size: 0.9rem;
            margin-bottom: 5px;
            font-weight: 500;
            color: #6b7280;
        }

        input[type="text"],
        input[type="number"],
        textarea,
        select {
            width: 100%;
            padding: 10px;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            box-sizing: border-box;
            font-size: 1rem;
        }

        textarea {
            font-family: inherit;
            line-height: 1.4;
            /* L'altezza segue il contenuto (autoSizeTextarea in editor.js) */
            resize: none;
            overflow: hidden;
        }

        input:focus,
        textarea:focus,
        select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(47, 93, 80, 0.14);
        }

        .row {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
        }

        .col {
            flex: 1;
            min-width: 140px;
        }

        /* Punti: pulsanti − e + ai lati del numero, al posto delle freccette native */
        .stepper {
            display: flex;
            align-items: stretch;
        }

        .stepper input[type="number"] {
            flex: 1;
            min-width: 0;
            text-align: center;
            border-left: none;
            border-right: none;
            border-radius: 0;
            -moz-appearance: textfield;
            appearance: textfield;
        }

        .stepper input[type="number"]::-webkit-inner-spin-button,
        .stepper input[type="number"]::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        .stepper-btn {
            flex: 0 0 42px;
            padding: 0;
            font-size: 1.25rem;
            line-height: 1;
            background: #ffffff;
            color: var(--primary);
            border: 1px solid var(--border);
            touch-action: manipulation;
            user-select: none;
        }

        .stepper-btn:hover {
            background: var(--header-bg);
        }

        .stepper-btn:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 1px;
        }

        .time-field input { max-width: 220px; }
        .time-field small { display: block; margin-top: 5px; color: #6b7280; }
        .export-help { color: #6b7280; font-size: 0.9rem; }
        .validation-panel { scroll-margin-top: 130px; }
        .validation-panel h2 { margin-top: 0; font-size: 1.15rem; }
        .validation-group { margin-top: 12px; border-left: 4px solid; padding-left: 12px; }
        .validation-error { border-color: #b91c1c; }
        .validation-warning { border-color: #a16207; }
        .validation-group summary { cursor: pointer; font-weight: 600; }
        .validation-group ul { padding-left: 20px; }
        .validation-link { background: transparent; color: var(--primary); text-align: left; white-space: normal; padding: 6px 0; text-decoration: underline; font-weight: 400; }
        .validation-link:hover { color: #16302a; }
        .validation-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
        header { gap: 16px; flex-wrap: wrap; }
        .header-right { min-width: 0; flex: 1 1 400px; }
        .file-info-display { max-width: 100%; overflow-wrap: anywhere; box-sizing: border-box; }
        @media (max-width: 600px) {
            .container { padding: 16px 12px 100px; }
            header { position: static; padding: 12px; }
            .card { padding: 16px; }
            .header-right { align-items: stretch; }
            .btn-group { justify-content: flex-start; }
            .btn-group button { padding: 10px 12px; }
            .row > .col { flex: 1 1 100% !important; min-width: 0; }
            .question-header { gap: 8px; flex-wrap: wrap; }
            .modal-box { min-width: 0; box-sizing: border-box; }
        }

        /* Question List */
        .question-item {
            position: relative;
            border-left: 4px solid var(--primary);
        }

        .question-header {
            display: flex;
            justify-content: space-between;
            margin-bottom: 15px;
        }

        .remove-q-btn {
            background: transparent;
            color: var(--danger);
            border: 1px solid var(--danger);
            padding: 5px 10px;
            font-size: 0.8rem;
        }

        /* Options List */
        .options-list {
            margin-top: 15px;
            background: #f9fafb;
            padding: 15px;
            border-radius: var(--radius);
        }

        .option-row {
            display: flex;
            gap: 10px;
            align-items: center;
            margin-bottom: 10px;
        }

        .option-marker {
            width: 30px;
            text-align: center;
            font-weight: bold;
            color: var(--primary);
        }

        .btn-icon {
            padding: 8px;
            width: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* Utilities */
        .hidden {
            display: none;
        }

        .empty-state {
            text-align: center;
            padding: 50px;
            color: #9ca3af;
        }

        /* Torna Su */
        #backToTop {
            position: fixed;
            bottom: 30px;
            right: 30px;
            width: 50px;
            height: 50px;
            background-color: var(--primary);
            color: white;
            border-radius: var(--radius);
            border: none;
            font-size: 24px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
            cursor: pointer;
            opacity: 0;
            pointer-events: none;
            transition: all 0.3s ease;
            z-index: 999;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        /* Modali Custom */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2000;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s;
        }

        .modal-overlay.active {
            opacity: 1;
            pointer-events: auto;
        }

        .modal-box {
            background: var(--card-bg);
            padding: 25px;
            border-radius: var(--radius);
            min-width: 320px;
            max-width: 90%;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            transform: translateY(-20px);
            transition: transform 0.2s;
            text-align: center;
            border: 1px solid var(--border);
        }

        .modal-overlay.active .modal-box {
            transform: translateY(0);
        }

        .modal-title {
            font-size: 1.25rem;
            font-weight: bold;
            margin-bottom: 10px;
            color: var(--primary);
        }

        .modal-message {
            margin-bottom: 25px;
            color: var(--text);
        }

        .modal-actions {
            display: flex;
            justify-content: center;
            gap: 15px;
        }

        #backToTop.visible {
            opacity: 1;
            pointer-events: auto;
            bottom: 30px;
        }

        .question-label { font-weight: bold; color: var(--primary); }
        .row-spaced { margin-bottom: 15px; }
        .form-group.flush { margin-bottom: 0; }
        .col.narrow { flex: 0 0 150px; }
        .answer-box { background: #f9fafb; padding: 15px; border-radius: var(--radius); margin-top: 15px; }
        .add-option { margin-top: 10px; font-size: 0.8rem; }
        .correct-marker { width: 20px; height: 20px; margin-right: 10px; cursor: pointer; }
}
