/* ============================================================
   Quiz RUI - Stile principale
   ============================================================ */

:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
}

html, body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
}

#bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: -1;
}

/* --- Navbar --- */
.navbar {
    background: rgba(44, 62, 80, 0.95) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}
.navbar-brand { font-weight: 700; font-size: 1.3rem; letter-spacing: 0.5px; }
.navbar-brand i { color: #f39c12; }

/* --- Container --- */
.main-container { padding-top: 30px; padding-bottom: 50px; }

/* --- Card --- */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: rgba(255,255,255,0.92) !important;
    backdrop-filter: blur(10px);
}
.card:hover { box-shadow: 0 8px 35px rgba(0,0,0,0.12); }
.card-header { border-radius: 16px 16px 0 0 !important; font-weight: 600; }

/* --- Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none; border-radius: 10px; padding: 10px 24px; font-weight: 600;
    transition: all 0.3s ease;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}
.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    border: none; border-radius: 10px; padding: 10px 24px; font-weight: 600;
}
.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none; border-radius: 10px;
}
.btn-outline-light { border-radius: 10px; font-weight: 500; }

/* --- Stat cards --- */
.stat-card {
    border-radius: 16px; padding: 20px; text-align: center;
    color: white; transition: transform 0.2s ease;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .stat-number { font-size: 2.2rem; font-weight: 800; }
.stat-card .stat-label {
    font-size: 0.85rem; opacity: 0.9;
    text-transform: uppercase; letter-spacing: 1px;
}

.bg-gradient-blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.bg-gradient-green { background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%); }
.bg-gradient-red { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }
.bg-gradient-orange { background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); }
.bg-gradient-teal { background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%); }

/* --- Welcome section --- */
.welcome-section {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px; padding: 30px;
    color: white; margin-bottom: 30px;
}
.welcome-section h2 { font-weight: 700; }

/* --- Quiz card --- */
.start-quiz-card {
    border: 2px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.92) !important;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}
.start-quiz-card:hover {
    background: rgba(255,255,255,0.97) !important;
    transform: translateY(-3px);
}

/* --- Quiz domande --- */
.question-card {
    border-radius: 16px;
    margin-bottom: 20px;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}
.question-card.answered { border-color: #667eea; }
.question-number {
    width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.answer-option {
    display: block; padding: 12px 16px; margin-bottom: 8px;
    border: 2px solid #e0e0e0; border-radius: 12px;
    cursor: pointer; transition: all 0.2s ease;
    background: white;
}
.answer-option:hover { border-color: #667eea; background: rgba(102,126,234,0.05); }
.answer-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.answer-option.selected { border-color: #667eea; background: rgba(102,126,234,0.1); font-weight: 600; }
.answer-letter {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: #e0e0e0; color: #333; font-weight: 700;
    font-size: 0.85rem; margin-right: 10px;
    transition: all 0.2s ease;
}
.answer-option.selected .answer-letter { background: #667eea; color: white; }

/* --- Navigazione domande --- */
.question-nav {
    position: sticky; top: 70px; z-index: 100;
    background: rgba(255,255,255,0.95); backdrop-filter: blur(10px);
    border-radius: 16px; padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}
.q-nav-btn {
    width: 36px; height: 36px; border-radius: 50%;
    border: 2px solid #dee2e6; background: white;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; margin: 2px;
    text-decoration: none; color: #333;
}
.q-nav-btn:hover { border-color: #667eea; color: #667eea; }
.q-nav-btn.answered { background: #667eea; color: white; border-color: #667eea; }
.q-nav-btn.current { border-color: #f39c12; box-shadow: 0 0 0 2px rgba(243,156,18,0.3); }

/* --- Risultati --- */
.result-score {
    font-size: 4rem; font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.result-passed { color: #27ae60; }
.result-failed { color: #e74c3c; }

/* --- Badge --- */
.badge-pass {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    padding: 5px 12px; border-radius: 20px; font-weight: 600;
}
.badge-fail {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    padding: 5px 12px; border-radius: 20px; font-weight: 600;
}

/* --- History table --- */
.history-table { border-radius: 12px; overflow: hidden; }
.history-table th {
    background: #f8f9fa; font-weight: 600;
    font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px;
}

/* --- Login --- */
.login-card {
    max-width: 420px; margin: 0 auto;
    border-radius: 20px; overflow: hidden;
}
.login-header {
    background: linear-gradient(135deg, rgba(44,62,80,0.9), rgba(44,62,80,0.95));
    padding: 40px 30px; text-align: center; color: white;
}
.login-header i { font-size: 3rem; color: #f39c12; }
.login-header h3 { font-weight: 700; margin-top: 15px; }

/* --- Flash messages --- */
.flash-messages {
    position: fixed; top: 70px; right: 20px;
    z-index: 1050; max-width: 400px;
}
.flash-messages .alert {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: none;
}

/* --- Footer --- */
.footer {
    text-align: center; color: rgba(255,255,255,0.7);
    padding: 20px 0; font-size: 0.85rem;
}

/* --- Materia badge --- */
.materia-badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600;
    background: rgba(102,126,234,0.15); color: #667eea; margin: 2px;
}

/* --- Admin --- */
.admin-card {
    border-left: 4px solid #667eea;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #888; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .stat-card .stat-number { font-size: 1.6rem; }
    .question-nav { position: relative; top: 0; }
    .q-nav-btn { width: 30px; height: 30px; font-size: 0.7rem; }
}
