/* ==================== VARIABLES ==================== */
:root {
    --primary: #6366F1;
    --primary-light: #E0E7FF;
    --primary-dark: #4338CA;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --bg-primary: #F9FAFB;
    --bg-white: #FFFFFF;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    /* Module colors */
    --risques: #059669;
    --ortho: #3B82F6;
    --digestif: #F97316;
    --gyneco: #EC4899;
    --uro: #8B5CF6;
    --instru: #06B6D4;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

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

/* ==================== NAVIGATION ==================== */
.main-nav {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.main-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-back {
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.nav-back:hover { background: rgba(255,255,255,0.2); }

.nav-title {
    color: rgba(255,255,255,0.9);
    font-weight: 600;
}

/* ==================== HERO ==================== */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.hero-icon { font-size: 4rem; margin-bottom: 20px; }

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 30px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.hero-stats .stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ==================== MODULE SELECTOR ==================== */
.module-selector {
    margin: -30px 0 40px;
    position: relative;
    z-index: 10;
}

.module-selector h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

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

.module-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    border-left: 5px solid var(--primary);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.module-card.risques { border-left-color: var(--risques); }
.module-card.ortho { border-left-color: var(--ortho); }
.module-card.digestif { border-left-color: var(--digestif); }
.module-card.gyneco { border-left-color: var(--gyneco); }
.module-card.uro { border-left-color: var(--uro); }
.module-card.instru { border-left-color: var(--instru); }

.module-icon { font-size: 2.5rem; margin-bottom: 15px; }

.module-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.module-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.question-count {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ==================== RANDOM QCM ==================== */
.random-qcm {
    margin: 40px 0;
    padding: 30px;
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-radius: var(--radius-lg);
    border: 2px dashed #F59E0B;
}

.random-qcm h2 {
    text-align: center;
    margin-bottom: 10px;
    color: #92400E;
}

.random-qcm > p {
    text-align: center;
    margin-bottom: 25px;
    color: #78350F;
}

.random-qcm .module-card {
    background: linear-gradient(to bottom right, white, #FFFBEB);
    border-left: 5px solid var(--warning);
}

.random-qcm .module-card.risques { border-left-color: var(--risques); }
.random-qcm .module-card.ortho { border-left-color: var(--ortho); }
.random-qcm .module-card.digestif { border-left-color: var(--digestif); }
.random-qcm .module-card.gyneco { border-left-color: var(--gyneco); }
.random-qcm .module-card.uro { border-left-color: var(--uro); }
.random-qcm .module-card.instru { border-left-color: var(--instru); }

.random-qcm .question-count {
    background: #FEF3C7;
    color: #92400E;
}

/* ==================== GLOBAL LEVELS ==================== */
.global-levels {
    background: linear-gradient(135deg, #F3F4F6 0%, #E5E7EB 100%);
    padding: 40px;
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
}

.global-levels h2 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.global-levels > p {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-secondary);
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.level-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    border-top: 5px solid;
    text-align: center;
}

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

.level-card.facile { border-top-color: #10B981; }
.level-card.moyen { border-top-color: #F59E0B; }
.level-card.difficile { border-top-color: #DC2626; }

.level-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.level-card h3 {
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.level-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.level-info {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.level-info span {
    background: var(--bg-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.level-card.facile .level-info span { background: #D1FAE5; color: #059669; }
.level-card.moyen .level-info span { background: #FEF3C7; color: #92400E; }
.level-card.difficile .level-info span { background: #FEE2E2; color: #991B1B; }

/* ==================== EXPERT MODE ==================== */
.expert-mode {
    background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
    color: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.expert-mode::before {
    content: '🎓';
    position: absolute;
    font-size: 8rem;
    opacity: 0.1;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.expert-mode h2 { margin-bottom: 10px; }
.expert-mode p { opacity: 0.9; margin-bottom: 20px; }

.btn-expert {
    display: inline-block;
    background: white;
    color: #DC2626;
    padding: 16px 32px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.2s;
    border: 2px solid white;
}

.btn-expert:hover {
    background: transparent;
    color: white;
    transform: scale(1.05);
}

/* ==================== EXAM MODE ==================== */
.exam-mode {
    background: linear-gradient(135deg, #1F2937 0%, #374151 100%);
    color: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 40px;
}

.exam-mode h2 { margin-bottom: 10px; }
.exam-mode p { opacity: 0.8; margin-bottom: 20px; }

.btn-exam {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 16px 32px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    transition: background 0.2s, transform 0.2s;
}

.btn-exam:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* ==================== TIPS ==================== */
.tips-section h2 {
    text-align: center;
    margin-bottom: 30px;
}

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

.tip-card {
    background: var(--bg-white);
    padding: 25px;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.tip-icon { font-size: 2rem; margin-bottom: 12px; }
.tip-card h4 { margin-bottom: 8px; color: var(--primary-dark); }
.tip-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* ==================== QCM STYLES ==================== */
.qcm-header {
    background: var(--bg-white);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin: -30px 20px 30px;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.qcm-progress {
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-bar {
    width: 200px;
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 5px;
    transition: width 0.3s;
}

.score-display {
    font-weight: 700;
    color: var(--primary-dark);
}

.qcm-container {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.question-number {
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
}

.question-category {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
}

.question-text {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 25px;
    line-height: 1.5;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

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

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

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

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

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

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

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

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

.option-text { flex: 1; }

/* ==================== FEEDBACK ==================== */
.feedback {
    display: none;
    margin-top: 25px;
    padding: 25px;
    border-radius: var(--radius-md);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.feedback.visible { display: block; }

.feedback.correct {
    background: var(--success-light);
    border: 2px solid var(--success);
}

.feedback.incorrect {
    background: var(--danger-light);
    border: 2px solid var(--danger);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.feedback.correct .feedback-header { color: var(--success); }
.feedback.incorrect .feedback-header { color: var(--danger); }

.feedback-explanation {
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.7;
}

/* ==================== MNEMONIC ==================== */
.mnemonic-box {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border: 2px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 15px;
}

.mnemonic-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #92400E;
    margin-bottom: 12px;
}

.mnemonic-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.mnemonic-visual {
    font-size: 3rem;
    text-align: center;
    min-width: 80px;
}

.mnemonic-text {
    flex: 1;
    min-width: 200px;
}

.mnemonic-phrase {
    font-weight: 700;
    font-size: 1.1rem;
    color: #92400E;
    margin-bottom: 8px;
}

.mnemonic-explanation {
    font-size: 0.9rem;
    color: #78350F;
}

/* ==================== BUTTONS ==================== */
.btn-container {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

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

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

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== RESULTS ==================== */
.results-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin: 30px 0;
}

.results-score {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 10px;
}

.results-message {
    font-size: 1.3rem;
    margin-bottom: 30px;
}

.results-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.breakdown-item {
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
}

.breakdown-value {
    font-size: 2rem;
    font-weight: 700;
}

.breakdown-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ==================== FOOTER ==================== */
footer {
    background: var(--text-primary);
    color: white;
    padding: 30px 0;
    text-align: center;
    margin-top: 50px;
}

footer p {
    margin: 5px 0;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .hero-stats { gap: 20px; }
    .stat-value { font-size: 2rem; }
    .modules-grid { grid-template-columns: 1fr; }
    .qcm-header { flex-direction: column; text-align: center; }
    .progress-bar { width: 100%; }
    .qcm-container { padding: 20px; }
    .question-text { font-size: 1rem; }
    .btn-container { flex-direction: column; }
    .btn { width: 100%; }
}
