/* ===================================
   QUIZAR - Styles du Quiz Frontend
   =================================== */

/* Container principal */
.quizar-quiz-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header du quiz */
.quizar-quiz-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.quizar-quiz-title {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: bold;
}

.quizar-quiz-description {
    margin: 10px 0 20px 0;
    font-size: 16px;
    opacity: 0.9;
}

.quizar-quiz-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.3);
}

.quizar-quiz-info span {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Questions */
.quizar-question {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.quizar-question:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.quizar-question-number {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 15px;
}

.quizar-question-image {
    margin: 20px 0;
    text-align: center;
}

.quizar-question-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.quizar-question-text {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Réponses */
.quizar-answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quizar-answer-option {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quizar-answer-option:hover {
    background: #e8f0fe;
    border-color: #667eea;
    transform: translateX(5px);
}

.quizar-answer-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    cursor: pointer;
    accent-color: #667eea;
}

.quizar-answer-text {
    font-size: 16px;
    color: #333;
    flex: 1;
}

/* Réponses textuelles */
.quizar-text-answer {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.quizar-text-answer:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Bouton de soumission */
.quizar-submit-section {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.quizar-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.quizar-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.quizar-submit-btn:active {
    transform: translateY(0);
}

.quizar-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Résultats */
.quizar-results {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.quizar-results-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.quizar-results-header h3 {
    font-size: 32px;
    margin: 0 0 20px 0;
}

.quizar-score {
    font-size: 64px;
    font-weight: bold;
    margin: 20px 0;
}

.quizar-score.passed {
    color: #4caf50;
}

.quizar-score.failed {
    color: #f44336;
}

/* Détails des résultats */
.quizar-results-details {
    margin-top: 30px;
}

.quizar-result-item {
    background: #f8f9fa;
    border-left: 4px solid #e0e0e0;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.quizar-result-item.correct {
    border-left-color: #4caf50;
    background: #f1f8f4;
}

.quizar-result-item.incorrect {
    border-left-color: #f44336;
    background: #fef5f5;
}

.quizar-result-question {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 16px;
}

.quizar-result-answer {
    margin: 5px 0;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.quizar-result-answer.user-answer {
    background: #e3f2fd;
}

.quizar-result-answer.correct-answer {
    background: #e8f5e9;
    color: #2e7d32;
}

.quizar-result-explanation {
    margin-top: 10px;
    padding: 10px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    font-size: 14px;
    color: #856404;
}

/* Actions des résultats */
.quizar-results-actions {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.quizar-retry-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quizar-retry-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

/* Historique utilisateur */
.quizar-user-history {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
}

.quizar-user-history h3 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
}

.quizar-history-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.quizar-history-table thead {
    background: #667eea;
    color: white;
}

.quizar-history-table th,
.quizar-history-table td {
    padding: 15px;
    text-align: left;
}

.quizar-history-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s ease;
}

.quizar-history-table tbody tr:hover {
    background: #f8f9fa;
}

.quizar-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: bold;
}

.quizar-badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.quizar-badge-fail {
    background: #ffebee;
    color: #c62828;
}

.quizar-link-btn {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.quizar-link-btn:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Statistiques utilisateur */
.quizar-user-stats {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
}

.quizar-user-stats h3 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
}

.quizar-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.quizar-stat-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-value {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 16px;
    color: #666;
}

/* Leaderboard */
.quizar-leaderboard {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
}

.quizar-leaderboard h3 {
    font-size: 28px;
    margin-bottom: 30px;
    color: #333;
}

.quizar-leaderboard-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.quizar-leaderboard-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.quizar-leaderboard-table th,
.quizar-leaderboard-table td {
    padding: 15px;
    text-align: left;
}

.quizar-leaderboard-table .rank {
    font-size: 24px;
    text-align: center;
    width: 80px;
}

.quizar-leaderboard-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.quizar-leaderboard-table tbody tr:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

/* Messages d'erreur */
.quizar-error,
.quizar-login-required,
.quizar-no-history {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .quizar-quiz-container {
        padding: 10px;
    }
    
    .quizar-quiz-header {
        padding: 20px;
    }
    
    .quizar-quiz-title {
        font-size: 24px;
    }
    
    .quizar-question {
        padding: 20px;
    }
    
    .quizar-question-text {
        font-size: 18px;
    }
    
    .quizar-submit-btn {
        padding: 15px 30px;
        font-size: 16px;
    }
    
    .quizar-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Animation de chargement */
.quizar-loading {
    text-align: center;
    padding: 40px;
}

.quizar-loading::after {
    content: "⏳";
    font-size: 48px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Timer */
#quizar-timer {
    font-weight: bold;
    font-family: 'Courier New', monospace;
}
