/* ============================================
   Code en ligne - Quiz Engine Styles
   ============================================ */

/* Quiz Container */
.crp-quiz-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--crt-space-8) var(--crt-space-4);
}

/* Quiz Header */
.crp-quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--crt-space-4) var(--crt-space-6);
    background: var(--crt-white);
    border-radius: var(--crt-radius-xl);
    border: 1px solid var(--crt-gray-200);
    margin-bottom: var(--crt-space-6);
    flex-wrap: wrap;
    gap: var(--crt-space-4);
}

.crp-quiz-progress-info {
    display: flex;
    align-items: center;
    gap: var(--crt-space-4);
}

.crp-quiz-counter {
    font-size: var(--crt-text-sm);
    font-weight: 600;
    color: var(--crt-gray-700);
}

.crp-quiz-counter span {
    color: var(--crt-primary);
    font-size: var(--crt-text-lg);
}

.crp-quiz-timer {
    display: flex;
    align-items: center;
    gap: var(--crt-space-2);
    font-size: var(--crt-text-sm);
    font-weight: 600;
    color: var(--crt-gray-600);
    padding: var(--crt-space-2) var(--crt-space-4);
    background: var(--crt-gray-50);
    border-radius: var(--crt-radius-md);
}

.crp-quiz-timer.warning {
    color: var(--crt-warning);
    background: var(--crt-warning-light);
}

.crp-quiz-timer.danger {
    color: var(--crt-error);
    background: var(--crt-error-light);
    animation: pulse 1s infinite;
}

.crp-quiz-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--crt-gray-100);
    border-radius: var(--crt-radius-full);
    overflow: hidden;
    margin-top: var(--crt-space-3);
}

.crp-quiz-progress-fill {
    height: 100%;
    background: var(--crt-gradient);
    border-radius: var(--crt-radius-full);
    transition: width 0.3s ease;
}

/* Question Card */
.crp-question-card {
    background: var(--crt-white);
    border-radius: var(--crt-radius-2xl);
    border: 1px solid var(--crt-gray-200);
    padding: var(--crt-space-8);
    margin-bottom: var(--crt-space-6);
    animation: fadeIn 0.4s ease-out;
    box-shadow: var(--crt-shadow-sm);
}

.crp-question-meta {
    display: flex;
    align-items: center;
    gap: var(--crt-space-3);
    margin-bottom: var(--crt-space-5);
    flex-wrap: wrap;
}

.crp-question-category {
    padding: var(--crt-space-1) var(--crt-space-3);
    background: var(--crt-primary-50);
    color: var(--crt-primary);
    font-size: var(--crt-text-xs);
    font-weight: 600;
    border-radius: var(--crt-radius-full);
}

.crp-question-difficulty {
    display: flex;
    gap: 3px;
}

.crp-difficulty-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--crt-gray-200);
}

.crp-difficulty-dot.active {
    background: var(--crt-primary);
}

.crp-question-text {
    font-size: var(--crt-text-xl);
    font-weight: 600;
    color: var(--crt-gray-900);
    line-height: 1.5;
    margin-bottom: var(--crt-space-8);
}

.crp-question-media {
    margin-bottom: var(--crt-space-6);
    border-radius: var(--crt-radius-xl);
    overflow: hidden;
    border: 1px solid var(--crt-gray-200);
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    aspect-ratio: 16 / 9;
}

.crp-question-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f8fafc;
}

/* Options */
.crp-options-list {
    display: flex;
    flex-direction: column;
    gap: var(--crt-space-3);
}

.crp-option {
    display: flex;
    align-items: center;
    gap: var(--crt-space-4);
    padding: var(--crt-space-4) var(--crt-space-5);
    background: var(--crt-gray-50);
    border: 2px solid var(--crt-gray-200);
    border-radius: var(--crt-radius-lg);
    cursor: pointer;
    transition: var(--crt-transition);
    font-size: var(--crt-text-base);
    color: var(--crt-gray-700);
    position: relative;
    user-select: none;
}

.crp-option:hover:not(.disabled) {
    border-color: var(--crt-primary-lighter);
    background: var(--crt-primary-50);
    color: var(--crt-primary-dark);
    transform: translateX(4px);
}

.crp-option.selected {
    border-color: var(--crt-primary);
    background: var(--crt-primary-50);
    color: var(--crt-primary-dark);
    font-weight: 500;
}

.crp-option.correct {
    border-color: var(--crt-success);
    background: var(--crt-success-light);
    color: var(--crt-success-dark);
}

.crp-option.wrong {
    border-color: var(--crt-error);
    background: var(--crt-error-light);
    color: var(--crt-error-dark);
}

.crp-option.disabled {
    cursor: default;
    opacity: 0.7;
}

.crp-option-letter {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--crt-white);
    border: 2px solid var(--crt-gray-300);
    border-radius: var(--crt-radius-md);
    font-weight: 700;
    font-size: var(--crt-text-sm);
    color: var(--crt-gray-500);
    flex-shrink: 0;
    transition: var(--crt-transition);
}

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

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

.crp-option.wrong .crp-option-letter {
    background: var(--crt-error);
    border-color: var(--crt-error);
    color: white;
}

.crp-option-text {
    flex: 1;
}

.crp-option-icon {
    flex-shrink: 0;
    opacity: 0;
    transition: var(--crt-transition);
}

.crp-option.correct .crp-option-icon,
.crp-option.wrong .crp-option-icon {
    opacity: 1;
}

/* Explanation */
.crp-explanation {
    margin-top: var(--crt-space-6);
    padding: var(--crt-space-5) var(--crt-space-6);
    background: var(--crt-primary-50);
    border-left: 4px solid var(--crt-primary);
    border-radius: 0 var(--crt-radius-lg) var(--crt-radius-lg) 0;
    animation: fadeIn 0.3s ease-out;
}

.crp-explanation-title {
    font-weight: 700;
    color: var(--crt-primary-dark);
    font-size: var(--crt-text-sm);
    margin-bottom: var(--crt-space-2);
    display: flex;
    align-items: center;
    gap: var(--crt-space-2);
}

.crp-explanation-text {
    font-size: var(--crt-text-sm);
    color: var(--crt-gray-700);
    line-height: 1.7;
    margin: 0;
}

/* Quiz Actions */
.crp-quiz-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--crt-space-4);
}

/* Results */
.crp-results {
    text-align: center;
    padding: var(--crt-space-12) var(--crt-space-8);
    background: var(--crt-white);
    border-radius: var(--crt-radius-2xl);
    border: 1px solid var(--crt-gray-200);
    box-shadow: var(--crt-shadow-md);
    animation: fadeIn 0.5s ease-out;
}

.crp-results-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--crt-radius-full);
    margin: 0 auto var(--crt-space-6);
    animation: countUp 0.5s ease-out;
}

.crp-results-icon.pass {
    background: var(--crt-success-light);
    color: var(--crt-success);
}

.crp-results-icon.fail {
    background: var(--crt-error-light);
    color: var(--crt-error);
}

.crp-results-title {
    font-size: var(--crt-text-3xl);
    font-weight: 800;
    margin-bottom: var(--crt-space-2);
}

.crp-results-title.pass { color: var(--crt-success-dark); }
.crp-results-title.fail { color: var(--crt-error-dark); }

.crp-results-subtitle {
    font-size: var(--crt-text-lg);
    color: var(--crt-gray-500);
    margin-bottom: var(--crt-space-8);
}

.crp-results-score {
    font-size: var(--crt-text-7xl);
    font-weight: 900;
    line-height: 1;
    margin-bottom: var(--crt-space-2);
    animation: countUp 0.8s ease-out;
}

.crp-results-score.pass {
    background: linear-gradient(135deg, var(--crt-success), #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.crp-results-score.fail {
    background: linear-gradient(135deg, var(--crt-error), #dc2626);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.crp-results-label {
    font-size: var(--crt-text-lg);
    color: var(--crt-gray-500);
    margin-bottom: var(--crt-space-8);
}

.crp-results-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--crt-space-6);
    margin-bottom: var(--crt-space-10);
    padding: var(--crt-space-6);
    background: var(--crt-gray-50);
    border-radius: var(--crt-radius-xl);
}

.crp-results-stat-value {
    font-size: var(--crt-text-2xl);
    font-weight: 800;
    color: var(--crt-gray-900);
}

.crp-results-stat-label {
    font-size: var(--crt-text-sm);
    color: var(--crt-gray-500);
}

.crp-results-actions {
    display: flex;
    gap: var(--crt-space-4);
    justify-content: center;
    flex-wrap: wrap;
}

/* Premium Lock */
.crp-premium-lock {
    text-align: center;
    padding: var(--crt-space-16) var(--crt-space-8);
    background: var(--crt-gradient-soft);
    border-radius: var(--crt-radius-2xl);
    border: 2px dashed var(--crt-primary-lighter);
}

.crp-premium-lock-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--crt-primary-50);
    color: var(--crt-primary);
    border-radius: var(--crt-radius-full);
    margin: 0 auto var(--crt-space-6);
}

.crp-premium-lock h3 {
    margin-bottom: var(--crt-space-3);
}

.crp-premium-lock p {
    margin-bottom: var(--crt-space-6);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Category Selector */
.crp-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--crt-space-4);
    margin-bottom: var(--crt-space-8);
}

.crp-category-card {
    display: flex;
    align-items: center;
    gap: var(--crt-space-4);
    padding: var(--crt-space-5);
    background: var(--crt-white);
    border: 2px solid var(--crt-gray-200);
    border-radius: var(--crt-radius-xl);
    cursor: pointer;
    transition: var(--crt-transition);
}

.crp-category-card:hover {
    border-color: var(--crt-primary);
    box-shadow: var(--crt-shadow);
    transform: translateY(-2px);
}

.crp-category-card.selected {
    border-color: var(--crt-primary);
    background: var(--crt-primary-50);
}

.crp-category-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--crt-primary-50);
    color: var(--crt-primary);
    border-radius: var(--crt-radius-lg);
    flex-shrink: 0;
}

.crp-category-name {
    font-weight: 600;
    color: var(--crt-gray-800);
    font-size: var(--crt-text-sm);
}

.crp-category-count {
    font-size: var(--crt-text-xs);
    color: var(--crt-gray-500);
}

/* Start Screen */
.crp-start-screen {
    text-align: center;
    padding: var(--crt-space-12) var(--crt-space-8);
    background: var(--crt-white);
    border-radius: var(--crt-radius-2xl);
    border: 1px solid var(--crt-gray-200);
}

.crp-start-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--crt-gradient);
    color: white;
    border-radius: var(--crt-radius-full);
    margin: 0 auto var(--crt-space-6);
    box-shadow: 0 8px 30px rgba(37,99,235,0.3);
}

.crp-start-title {
    font-size: var(--crt-text-3xl);
    font-weight: 800;
    margin-bottom: var(--crt-space-3);
}

.crp-start-desc {
    font-size: var(--crt-text-lg);
    color: var(--crt-gray-500);
    margin-bottom: var(--crt-space-8);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.crp-start-info {
    display: flex;
    justify-content: center;
    gap: var(--crt-space-8);
    margin-bottom: var(--crt-space-8);
    flex-wrap: wrap;
}

.crp-start-info-item {
    display: flex;
    align-items: center;
    gap: var(--crt-space-2);
    font-size: var(--crt-text-sm);
    color: var(--crt-gray-600);
}

/* Demo Banner */
.crp-demo-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--crt-space-4) var(--crt-space-6);
    background: linear-gradient(135deg, var(--crt-warning-light), #fef9c3);
    border: 1px solid var(--crt-warning);
    border-radius: var(--crt-radius-lg);
    margin-bottom: var(--crt-space-6);
    flex-wrap: wrap;
    gap: var(--crt-space-3);
}

.crp-demo-banner-text {
    display: flex;
    align-items: center;
    gap: var(--crt-space-3);
    font-size: var(--crt-text-sm);
    font-weight: 500;
    color: var(--crt-gray-800);
}



.crp-start-alert{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 16px;margin-bottom:20px;border:1px solid rgba(220,38,38,.18);background:#fff1f2;color:#991b1b;border-radius:16px}.crp-start-alert-copy{display:flex;align-items:center;gap:10px;font-weight:600}.crp-start-alert .crt-btn{white-space:nowrap}@media (max-width:767px){.crp-start-alert{flex-direction:column;align-items:flex-start}}