:root {
            --primary: #4f46e5;
            --primary-hover: #4338ca;
            --success: #10b981;
            --success-hover: #059669;
            --bg: #f3f4f6;
            --card-bg: #ffffff;
            --card-header: #ddd;
            --text: #1f2937;
            --border: #e5e7eb;
            --danger: #ef4444;
        }

        body {
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: var(--bg);
            color: var(--text);
            margin: 0;
            padding: 20px;
            line-height: 1.5;
            scroll-behavior: smooth;
        }

        .container {
            max-width: 900px;
            margin: 0 auto;
            padding-bottom: 100px;
        }

        /* Header e Toolbar */
        header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            /* Allinea in alto per gestire le due righe a destra */
            margin-bottom: 30px;
            background: var(--card-header);
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            position: sticky;
            top: 20px;
            z-index: 100;
        }

        h1 {
            margin: 0;
            font-size: 1.5rem;
            color: var(--primary);
            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;
            gap: 10px;
        }

        .file-info-display {
            font-size: 0.85rem;
            color: #6b7280;
            font-family: monospace;
            background: #f9fafb;
            padding: 2px 8px;
            border-radius: 4px;
            border: 1px solid #e5e7eb;
            display: none;
            /* Nascosto finché non carichi un file */
        }

        button {
            padding: 10px 20px;
            border: none;
            border-radius: 6px;
            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;
        }

        /* Card Stile */
        .card {
            background: var(--card-bg);
            padding: 25px;
            border-radius: 12px;
            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: 6px;
            box-sizing: border-box;
            font-size: 1rem;
        }

        input:focus,
        textarea:focus,
        select:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
        }

        .row {
            display: flex;
            gap: 20px;
        }

        .col {
            flex: 1;
        }

        /* 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: 8px;
        }

        .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: 50%;
            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: 12px;
            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;
        }