/* ===== VARIABILI CSS ===== */
:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    
    --storia-color: #f97316;
    --geografia-color: #06b6d4;
    --tecnologia-color: #8b5cf6;
    
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --font-main: 'Poppins', sans-serif;
    --font-fun: 'Comic Neue', cursive;
    
    --transition: all 0.3s ease;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== SCREENS ===== */
.screen {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-secondary);
    padding: 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
}

.avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 48px;
    margin: 0 auto 20px;
}

.user-info h2 {
    font-family: var(--font-fun);
    color: var(--text-primary);
    font-size: 24px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== BUTTONS ===== */
.btn-primary,
.btn-secondary,
.btn-back,
.btn-settings,
.btn-close {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-main);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary.large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

.btn-back {
    background: transparent;
    color: var(--text-primary);
    padding: 10px 20px;
}

.btn-back:hover {
    background: var(--bg-primary);
}

.btn-settings {
    background: var(--primary-color);
    color: white;
}

.btn-close {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.btn-close:hover {
    background: var(--bg-primary);
    color: var(--danger-color);
}

/* ===== CARDS ===== */
.welcome-card {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-bottom: 30px;
}

.welcome-card h1 {
    font-family: var(--font-fun);
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ===== MATERIE GRID ===== */
.materie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.materia-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    border: 3px solid transparent;
}

.materia-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.materia-card.storia {
    border-color: var(--storia-color);
}

.materia-card.storia:hover {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.1), rgba(249, 115, 22, 0.05));
}

.materia-card.geografia {
    border-color: var(--geografia-color);
}

.materia-card.geografia:hover {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(6, 182, 212, 0.05));
}

.materia-card.tecnologia {
    border-color: var(--tecnologia-color);
}

.materia-card.tecnologia:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(139, 92, 246, 0.05));
}

.materia-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
}

.storia .materia-icon {
    background: linear-gradient(135deg, #f97316, #fb923c);
}

.geografia .materia-icon {
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
}

.tecnologia .materia-icon {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.materia-card h3 {
    font-size: 24px;
    margin-bottom: 10px;
    font-family: var(--font-fun);
}

.materia-card p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.materia-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 14px;
}

.stat i {
    color: var(--primary-color);
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    text-align: center;
}

/* ===== TESTI LIST ===== */
.action-bar {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.testi-list {
    display: grid;
    gap: 20px;
}

.testo-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    cursor: pointer;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: start;
}

.testo-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.testo-info h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.testo-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.testo-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 14px;
}

.testo-preview {
    color: var(--text-secondary);
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.testo-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--primary-color);
    color: white;
}

.btn-icon.danger:hover {
    background: var(--danger-color);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.empty-state i {
    font-size: 64px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-secondary);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.storia {
    background: rgba(249, 115, 22, 0.2);
    color: var(--storia-color);
}

.badge.geografia {
    background: rgba(6, 182, 212, 0.2);
    color: var(--geografia-color);
}

.badge.tecnologia {
    background: rgba(139, 92, 246, 0.2);
    color: var(--tecnologia-color);
}

.badge.base {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.badge.medio {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.badge.avanzato {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: var(--radius-md);
}

.tab {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab:hover {
    background: var(--bg-primary);
}

.tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ===== SPIEGAZIONE ===== */
.spiegazione-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.section {
    margin-bottom: 40px;
}

.section:last-child {
    margin-bottom: 0;
}

.section h3 {
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-fun);
}

.section h3 i {
    color: var(--primary-color);
}

.riassunto-list {
    list-style: none;
}

.riassunto-list li {
    padding: 15px 20px;
    margin-bottom: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
    font-size: 16px;
    line-height: 1.8;
}

.parole-chiave-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.parola-chiave {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 25px;
    font-weight: 600;
    font-size: 15px;
    box-shadow: var(--shadow-sm);
}

.glossario-container {
    display: grid;
    gap: 15px;
}

.glossario-item {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--secondary-color);
}

.glossario-item strong {
    color: var(--primary-color);
    font-size: 18px;
    display: block;
    margin-bottom: 8px;
}

.mappa-container {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
}

.mappa-nodo {
    padding: 15px 20px;
    margin-bottom: 15px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.mappa-nodo.principale {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 600;
    text-align: center;
    font-size: 18px;
}

.mappa-nodo.secondario {
    margin-left: 40px;
    border-left: 3px solid var(--primary-color);
}

.contenuto-originale {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.contenuto-originale div {
    line-height: 1.8;
    font-size: 16px;
    white-space: pre-wrap;
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== QUIZ ===== */
.quiz-header {
    flex-direction: column;
    align-items: stretch;
}

.quiz-progress-container {
    width: 100%;
}

.quiz-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 600;
}

.timer {
    color: var(--warning-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--primary-color));
    transition: width 0.3s ease;
}

.quiz-container {
    max-width: 800px;
}

.question-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.question-header {
    margin-bottom: 30px;
}

.question-type {
    display: inline-block;
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 15px;
}

.question-text {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.6;
}

.question-source {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

.options-container {
    display: grid;
    gap: 15px;
}

.option-item {
    padding: 20px;
    background: var(--bg-primary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 15px;
}

.option-item:hover {
    border-color: var(--primary-color);
    background: white;
}

.option-item.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.option-item.correct {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.option-item.incorrect {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.option-letter {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.option-item.selected .option-letter {
    background: white;
    color: var(--primary-color);
}

.option-text {
    flex: 1;
    font-size: 16px;
}

.text-answer {
    width: 100%;
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: var(--font-main);
    resize: vertical;
    min-height: 120px;
}

.text-answer:focus {
    outline: none;
    border-color: var(--primary-color);
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
}

/* ===== RISULTATI ===== */
.risultati-header {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.trophy-animation {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.trophy-icon.gold {
    color: #fbbf24;
}

.trophy-icon.silver {
    color: #94a3b8;
}

.trophy-icon.bronze {
    color: #f97316;
}

#risultati-title {
    font-size: 36px;
    font-family: var(--font-fun);
    margin-bottom: 20px;
}

.punteggio-finale {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.badge-risultato {
    font-size: 16px;
    padding: 10px 20px;
}

.risultati-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.stat-card i {
    font-size: 40px;
    margin-bottom: 15px;
}

.stat-card i.fa-check-circle {
    color: var(--success-color);
}

.stat-card i.fa-times-circle {
    color: var(--danger-color);
}

.stat-card i.fa-clock {
    color: var(--warning-color);
}

.stat-card span {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

.feedback-dettagliato {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.feedback-dettagliato h3 {
    font-size: 24px;
    margin-bottom: 20px;
    font-family: var(--font-fun);
}

.feedback-item {
    padding: 20px;
    margin-bottom: 15px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--border-color);
}

.feedback-item.correct {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
}

.feedback-item.incorrect {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
}

.feedback-question {
    font-weight: 600;
    margin-bottom: 10px;
}

.feedback-answer {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.feedback-explanation {
    background: white;
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

/* ===== PROFILE ===== */
.profile-summary {
    text-align: center;
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.profile-summary h2 {
    font-size: 32px;
    font-family: var(--font-fun);
    margin-bottom: 20px;
}

.badges-earned {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.badge-icon {
    font-size: 48px;
}

.stats-per-materia {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 30px;
}

.stats-per-materia h3 {
    font-size: 24px;
    margin-bottom: 20px;
    font-family: var(--font-fun);
}

.materia-stat-card {
    padding: 20px;
    margin-bottom: 15px;
    border-radius: var(--radius-md);
    border-left: 4px solid;
}

.materia-stat-card.storia {
    border-color: var(--storia-color);
    background: rgba(249, 115, 22, 0.05);
}

.materia-stat-card.geografia {
    border-color: var(--geografia-color);
    background: rgba(6, 182, 212, 0.05);
}

.materia-stat-card.tecnologia {
    border-color: var(--tecnologia-color);
    background: rgba(139, 92, 246, 0.05);
}

.recent-attempts {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.recent-attempts h3 {
    font-size: 24px;
    margin-bottom: 20px;
    font-family: var(--font-fun);
}

.attempt-item {
    padding: 20px;
    margin-bottom: 15px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
}

/* ===== DASHBOARD ===== */
.dashboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: var(--radius-md);
}

.dashboard-tab {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dashboard-tab:hover {
    background: var(--bg-primary);
}

.dashboard-tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.dashboard-content {
    display: none;
}

.dashboard-content.active {
    display: block;
}

.gestione-header {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.gestione-header label {
    font-weight: 600;
}

.gestione-header select {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
}

.settings-section {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.settings-section h3 {
    font-size: 22px;
    margin-bottom: 20px;
    font-family: var(--font-fun);
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.setting-item input,
.setting-item select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
}

.setting-item input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
}

/* ===== IMAGE UPLOAD & PREVIEW ===== */
.form-hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-style: italic;
}

.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--bg-primary);
}

.image-preview-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.image-preview-item .remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--danger-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: var(--transition);
}

.image-preview-item .remove-image:hover {
    opacity: 1;
    transform: scale(1.1);
}

.existing-images {
    margin-top: 15px;
}

.existing-images h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.testo-images-gallery {
    margin: 30px 0;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
}

.testo-images-gallery h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.testo-images-gallery h3 i {
    color: var(--primary-color);
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.image-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.image-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.image-item img {
    width: 100%;
    height: 250px;
    object-fit: contain;
    display: block;
    background: white;
    padding: 10px;
}

.image-item .image-caption {
    padding: 10px;
    background: var(--bg-secondary);
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Image Lightbox */
.image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.3);
}

.image-lightbox .close-lightbox {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.image-lightbox .close-lightbox:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.large {
    max-width: 900px;
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 24px;
    font-family: var(--font-fun);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: var(--font-main);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ===== LOADER ===== */
.loader-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.loader-overlay.active {
    display: flex;
}

.loader-content {
    text-align: center;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loader-text {
    font-size: 18px;
    font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .materie-grid {
        grid-template-columns: 1fr;
    }
    
    .quiz-navigation {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .testo-item {
        grid-template-columns: 1fr;
    }
    
    .dashboard-tabs {
        flex-direction: column;
    }
}

/* ===== ACCESSIBILITY ===== */
body.high-contrast {
    --bg-primary: #ffffff;
    --bg-secondary: #000000;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --border-color: #ffffff;
}

body.large-text {
    font-size: 18px;
}

body.large-text .question-text {
    font-size: 26px;
}

body.large-text .option-text {
    font-size: 20px;
}
