App Flask complète pour https://dynamic.alpinux.org : - 10 quiz Linux, 5 niveaux (Découverte → Expert), 50+ questions - Public : Découverte, Débutant, Intermédiaire (6 quiz) - Membres AlpID : Avancé, Expert (4 quiz — Git, Admin, Sécurité, Bash) - Navigation question par question avec avance automatique après choix - Score calculé côté serveur, enregistré en SQLite si connecté - Page profil : meilleurs scores par quiz + historique des tentatives Authentification : - OIDC via authlib + AlpID (Keycloak), SSO partagé avec Gitea/Nextcloud - Décorateur @login_required, redirection post-login sur l'URL d'origine - /auth/login, /auth/callback, /auth/logout Structure : - dynamic/app.py, db.py, quiz.py, auth_utils.py - dynamic/routes/ (public.py, auth.py, protected.py) - dynamic/templates/ (base, index, quiz/*, profil/) - dynamic/static/ (style.css thème Alpinux, quiz.js vanilla) - dynamic/data/quizzes.json (source de vérité des questions) - dynamic/.env.example Infrastructure : - scripts/dynamic.alpinux.org.vhost.conf (Apache reverse proxy) - scripts/dynamic.alpinux.org.service (systemd Gunicorn) - docs/technique/deploiement-dynamic.md (procédure complète) - mkdocs.yml : page de déploiement ajoutée à la nav Technique - .gitignore : exclut venv/ et .env Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
219 lines
17 KiB
CSS
219 lines
17 KiB
CSS
/* ── Variables ────────────────────────────────────────────────── */
|
|
:root {
|
|
--blue: #1a6bbf;
|
|
--blue-dark: #0f4e8f;
|
|
--blue-light: #e8f1fb;
|
|
--orange: #e8820c;
|
|
--bg: #f3f6fb;
|
|
--text: #1a1a2e;
|
|
--text-muted: #666;
|
|
--card-shadow: 0 2px 12px rgba(26,107,191,.1);
|
|
--radius: 10px;
|
|
}
|
|
|
|
/* ── Reset / base ─────────────────────────────────────────────── */
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
|
|
a { color: var(--blue); text-decoration: none; }
|
|
a:hover { text-decoration: underline; }
|
|
main { flex: 1; max-width: 1000px; margin: 0 auto; padding: 2rem 1.5rem; width: 100%; }
|
|
h1, h2, h3 { line-height: 1.2; }
|
|
|
|
/* ── Header ───────────────────────────────────────────────────── */
|
|
header { background: var(--blue-dark); color: #fff; }
|
|
.header-inner { max-width: 1000px; margin: 0 auto; padding: .8rem 1.5rem; display: flex; align-items: center; gap: 1.5rem; }
|
|
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-size: 1.15rem; font-weight: 400; flex-shrink: 0; }
|
|
.brand:hover { text-decoration: none; opacity: .9; }
|
|
.brand strong { font-weight: 800; }
|
|
.brand-sub { font-weight: 300; font-size: .9em; opacity: .8; }
|
|
.brand-logo { border-radius: 6px; }
|
|
.main-nav { display: flex; align-items: center; gap: .3rem; margin-left: auto; flex-wrap: wrap; }
|
|
.main-nav a { color: rgba(255,255,255,.85); font-size: .88rem; padding: .4rem .8rem; border-radius: 5px; transition: background .15s; }
|
|
.main-nav a:hover { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
|
|
.btn-nav { background: var(--blue); color: #fff !important; border-radius: 5px; padding: .4rem .9rem !important; }
|
|
.btn-nav-outline { border: 1px solid rgba(255,255,255,.5); border-radius: 5px; padding: .35rem .8rem !important; }
|
|
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; margin-left: auto; }
|
|
|
|
/* ── Footer ───────────────────────────────────────────────────── */
|
|
footer { background: var(--blue-dark); color: rgba(255,255,255,.7); padding: 1rem 1.5rem; font-size: .85rem; }
|
|
.footer-inner { max-width: 1000px; margin: 0 auto; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
|
|
.footer-links { display: flex; gap: 1rem; }
|
|
.footer-links a { color: rgba(255,255,255,.75); }
|
|
.footer-links a:hover { color: #fff; }
|
|
|
|
/* ── Buttons ──────────────────────────────────────────────────── */
|
|
.btn { display: inline-block; padding: .6rem 1.4rem; border-radius: 6px; font-size: .95rem; font-weight: 600; cursor: pointer; border: none; transition: all .15s; text-decoration: none !important; }
|
|
.btn-primary { background: var(--blue); color: #fff; }
|
|
.btn-primary:hover { background: var(--blue-dark); }
|
|
.btn-outline { background: transparent; color: var(--blue); border: 2px solid var(--blue); }
|
|
.btn-outline:hover { background: var(--blue-light); }
|
|
.btn-success { background: #1e8a3e; color: #fff; }
|
|
.btn-success:hover { background: #166b30; }
|
|
.btn-lg { padding: .8rem 2rem; font-size: 1.05rem; }
|
|
.btn-sm { padding: .35rem .8rem; font-size: .84rem; }
|
|
|
|
/* ── Badges ───────────────────────────────────────────────────── */
|
|
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 20px; font-size: .78rem; font-weight: 700; }
|
|
.badge.public { background: #d4f0dc; color: #1a6b35; }
|
|
.badge.members { background: #fde8cc; color: #a35800; }
|
|
.lock-badge { font-size: .8rem; color: #a35800; }
|
|
|
|
.level-badge { display: inline-block; padding: .15rem .55rem; border-radius: 20px; font-size: .78rem; font-weight: 700; }
|
|
.level-badge-1 { background: #d4f0dc; color: #1a6b35; }
|
|
.level-badge-2 { background: #d0edf5; color: #0d6779; }
|
|
.level-badge-3 { background: #fff3d4; color: #8a5c00; }
|
|
.level-badge-4 { background: #ffe0d0; color: #8a2800; }
|
|
.level-badge-5 { background: #ead4f5; color: #5e0a8a; }
|
|
|
|
/* ── Flash messages ───────────────────────────────────────────── */
|
|
.flash { padding: .8rem 1.2rem; border-radius: 6px; margin-bottom: 1rem; }
|
|
.flash-error { background: #fde8e8; color: #8a0000; border-left: 4px solid #c0392b; }
|
|
.flash-success { background: #d4f0dc; color: #1a6b35; border-left: 4px solid #27ae60; }
|
|
|
|
/* ── Section titles ───────────────────────────────────────────── */
|
|
.section-title { font-size: 1.1rem; font-weight: 700; color: var(--blue-dark); margin-bottom: 1.2rem; display: flex; align-items: center; gap: .6rem; }
|
|
.section-title::after { content: ''; flex: 1; height: 2px; background: var(--blue-light); }
|
|
|
|
/* ── Hero ─────────────────────────────────────────────────────── */
|
|
.hero { background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 100%); color: #fff; border-radius: var(--radius); padding: 3rem 2rem; text-align: center; margin-bottom: 2.5rem; }
|
|
.hero h1 { font-size: 2.2rem; font-weight: 800; }
|
|
.hero-sub { font-weight: 300; opacity: .8; }
|
|
.hero-desc { margin: 1rem auto; max-width: 560px; opacity: .88; line-height: 1.6; font-size: 1.05rem; }
|
|
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
|
|
|
|
/* ── Levels grid ──────────────────────────────────────────────── */
|
|
.levels-section { margin-bottom: 2.5rem; }
|
|
.levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
|
|
.level-card { background: #fff; border-radius: var(--radius); padding: 1.2rem 1rem; text-align: center; box-shadow: var(--card-shadow); }
|
|
.level-card p { font-size: .82rem; color: var(--text-muted); margin: .3rem 0 .5rem; }
|
|
.level-icon { font-size: 1.8rem; display: block; margin-bottom: .4rem; }
|
|
|
|
/* ── Quiz grid / cards ────────────────────────────────────────── */
|
|
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
|
|
.quiz-card { display: flex; gap: 1rem; background: #fff; border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--card-shadow); color: var(--text); transition: transform .15s, box-shadow .15s; text-decoration: none !important; border: 2px solid transparent; }
|
|
.quiz-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(26,107,191,.15); border-color: var(--blue-light); }
|
|
.quiz-card--members { border-left: 3px solid var(--orange); }
|
|
.quiz-icon { font-size: 2rem; flex-shrink: 0; align-self: flex-start; }
|
|
.quiz-card-body h3 { font-size: 1rem; margin-bottom: .3rem; }
|
|
.quiz-card-body p { font-size: .84rem; color: var(--text-muted); line-height: 1.4; margin-bottom: .5rem; }
|
|
.quiz-meta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
|
|
.quiz-duration, .quiz-count { font-size: .78rem; color: var(--text-muted); }
|
|
|
|
/* ── Members CTA ──────────────────────────────────────────────── */
|
|
.members-cta { display: flex; align-items: center; gap: 1.5rem; background: #fff8f0; border: 2px solid #f5d0a0; border-radius: var(--radius); padding: 1.4rem 1.8rem; margin-top: 2rem; flex-wrap: wrap; }
|
|
.cta-icon { font-size: 2rem; flex-shrink: 0; }
|
|
.members-cta strong { display: block; margin-bottom: .2rem; }
|
|
.members-cta p { font-size: .9rem; color: var(--text-muted); margin: 0; }
|
|
.members-cta .btn { margin-left: auto; }
|
|
|
|
/* ── Level sections in list ───────────────────────────────────── */
|
|
.level-section { margin-bottom: 2.5rem; }
|
|
.level-heading { font-size: 1.2rem; font-weight: 700; padding-bottom: .6rem; border-bottom: 2px solid var(--blue-light); margin-bottom: 1.2rem; display: flex; align-items: center; gap: .7rem; }
|
|
.level-heading-4, .level-heading-5 { border-bottom-color: #f5d0a0; }
|
|
|
|
/* ── Quiz intro ───────────────────────────────────────────────── */
|
|
.quiz-intro-wrap { display: flex; justify-content: center; padding: 2rem 0; }
|
|
.quiz-intro-card { background: #fff; border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 2.5rem 2rem; max-width: 560px; width: 100%; text-align: center; }
|
|
.quiz-intro-icon { font-size: 3.5rem; display: block; margin-bottom: .8rem; }
|
|
.quiz-intro-card h1 { font-size: 1.6rem; margin-bottom: .6rem; }
|
|
.quiz-intro-desc { color: var(--text-muted); line-height: 1.6; margin-bottom: 1.5rem; }
|
|
.quiz-intro-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; background: var(--bg); border-radius: 8px; padding: 1.2rem; margin-bottom: 1.8rem; text-align: left; }
|
|
.meta-item { display: flex; flex-direction: column; gap: .2rem; }
|
|
.meta-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
|
|
.intro-lock-notice { background: #fff8f0; border: 1px solid #f5d0a0; border-radius: 8px; padding: 1.2rem; margin-bottom: 1.5rem; }
|
|
.intro-lock-notice p { color: var(--text-muted); margin-bottom: 1rem; }
|
|
.intro-note { font-size: .85rem; color: var(--text-muted); margin-top: .8rem; }
|
|
|
|
/* ── Quiz play ────────────────────────────────────────────────── */
|
|
.quiz-play-wrap { max-width: 680px; margin: 0 auto; }
|
|
.quiz-play-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
|
|
.quiz-play-title { font-weight: 700; font-size: 1.05rem; flex: 1; }
|
|
.progress-bar-wrap { flex: 1; height: 8px; background: var(--blue-light); border-radius: 4px; overflow: hidden; min-width: 100px; }
|
|
.progress-bar { height: 100%; background: var(--blue); transition: width .3s; border-radius: 4px; }
|
|
.progress-text { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
|
|
|
|
.question-block { background: #fff; border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 2rem 1.8rem; }
|
|
.question-num { font-size: .82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .6rem; }
|
|
.question-text { font-size: 1.2rem; line-height: 1.5; margin-bottom: 1.5rem; }
|
|
.choices { display: flex; flex-direction: column; gap: .7rem; }
|
|
.choice-label { display: flex; align-items: center; gap: .9rem; padding: .9rem 1.1rem; border: 2px solid var(--blue-light); border-radius: 8px; cursor: pointer; transition: all .15s; }
|
|
.choice-label:hover { border-color: var(--blue); background: var(--blue-light); }
|
|
.choice-label.selected { border-color: var(--blue); background: var(--blue-light); }
|
|
.choice-label input[type=radio] { position: absolute; opacity: 0; width: 0; }
|
|
.choice-letter { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--blue-light); color: var(--blue); font-weight: 700; font-size: .85rem; flex-shrink: 0; transition: all .15s; }
|
|
.choice-label.selected .choice-letter { background: var(--blue); color: #fff; }
|
|
.choice-text { font-size: .95rem; }
|
|
|
|
.quiz-nav { display: flex; gap: 1rem; justify-content: space-between; margin-top: 1.5rem; flex-wrap: wrap; }
|
|
|
|
/* ── Quiz result ──────────────────────────────────────────────── */
|
|
.result-wrap { display: flex; justify-content: center; }
|
|
.result-card { background: #fff; border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 2.5rem 2rem; max-width: 680px; width: 100%; }
|
|
.result-icon { font-size: 3.5rem; display: block; text-align: center; margin-bottom: .8rem; }
|
|
.result-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: 1.2rem; }
|
|
.score-display { display: flex; align-items: baseline; justify-content: center; gap: .5rem; margin-bottom: .8rem; }
|
|
.score-num { font-size: 4rem; font-weight: 800; color: var(--blue); line-height: 1; }
|
|
.score-sep { font-size: 2rem; color: var(--text-muted); }
|
|
.score-total { font-size: 2rem; color: var(--text-muted); }
|
|
.score-bar-wrap { height: 12px; background: var(--blue-light); border-radius: 6px; overflow: hidden; margin-bottom: .8rem; }
|
|
.score-bar { height: 100%; border-radius: 6px; transition: width .5s ease; }
|
|
.score-bar-great { background: #27ae60; }
|
|
.score-bar-good { background: var(--blue); }
|
|
.score-bar-ok { background: var(--orange); }
|
|
.score-bar-low { background: #e74c3c; }
|
|
.score-comment { text-align: center; font-size: 1.05rem; margin-bottom: .6rem; font-weight: 600; }
|
|
.result-saved { text-align: center; font-size: .9rem; color: var(--text-muted); margin-bottom: 1.8rem; }
|
|
|
|
.detail-title { font-size: 1.05rem; margin-bottom: 1rem; padding-top: 1rem; border-top: 2px solid var(--blue-light); }
|
|
.answer-review { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1.8rem; }
|
|
.answer-item { padding: .9rem 1.1rem; border-radius: 8px; border-left: 4px solid; }
|
|
.answer-correct { background: #f0fdf4; border-color: #27ae60; }
|
|
.answer-wrong { background: #fff5f5; border-color: #e74c3c; }
|
|
.answer-q { font-weight: 600; margin-bottom: .3rem; font-size: .93rem; }
|
|
.answer-given { font-size: .9rem; }
|
|
.answer-correct-text { font-size: .88rem; color: #1a6b35; margin-top: .2rem; }
|
|
.tag-correct { background: #d4f0dc; color: #1a6b35; padding: .1rem .5rem; border-radius: 4px; font-size: .8rem; font-weight: 700; margin-left: .4rem; }
|
|
.tag-wrong { background: #fde8e8; color: #8a0000; padding: .1rem .5rem; border-radius: 4px; font-size: .8rem; font-weight: 700; margin-left: .4rem; }
|
|
.result-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
|
|
|
|
/* ── Profile ──────────────────────────────────────────────────── */
|
|
.page-header { margin-bottom: 2rem; }
|
|
.page-header h1 { font-size: 1.8rem; }
|
|
.text-muted { color: var(--text-muted); }
|
|
.profil-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2.5rem; }
|
|
.stat-card { background: #fff; border-radius: var(--radius); padding: 1.4rem 1rem; text-align: center; box-shadow: var(--card-shadow); }
|
|
.stat-num { display: block; font-size: 2.2rem; font-weight: 800; color: var(--blue); }
|
|
.stat-label { font-size: .85rem; color: var(--text-muted); }
|
|
.scores-grid { display: flex; flex-direction: column; gap: .8rem; }
|
|
.score-item { display: flex; align-items: center; gap: 1rem; background: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--card-shadow); }
|
|
.score-item-icon { font-size: 1.8rem; flex-shrink: 0; }
|
|
.score-item-body { flex: 1; }
|
|
.score-item-body strong { display: block; margin-bottom: .2rem; }
|
|
.mini-score-bar-wrap { height: 6px; background: var(--blue-light); border-radius: 3px; overflow: hidden; margin: .3rem 0; }
|
|
.mini-score-bar { height: 100%; border-radius: 3px; }
|
|
.mini-score-bar.great { background: #27ae60; }
|
|
.mini-score-bar.good { background: var(--blue); }
|
|
.mini-score-bar.ok { background: var(--orange); }
|
|
.mini-score-text { font-size: .82rem; color: var(--text-muted); }
|
|
.history-table-wrap { overflow-x: auto; }
|
|
.history-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow); }
|
|
.history-table th { background: var(--blue); color: #fff; padding: .7rem 1rem; text-align: left; font-size: .9rem; }
|
|
.history-table td { padding: .6rem 1rem; border-bottom: 1px solid var(--blue-light); font-size: .9rem; }
|
|
.history-table tr:last-child td { border-bottom: none; }
|
|
.score-great { color: #1a6b35; font-weight: 700; }
|
|
.score-good { color: var(--blue); font-weight: 700; }
|
|
.score-ok { color: #a35800; font-weight: 700; }
|
|
|
|
/* ── Responsive ───────────────────────────────────────────────── */
|
|
@media (max-width: 600px) {
|
|
.hero h1 { font-size: 1.6rem; }
|
|
.hero-actions { flex-direction: column; }
|
|
.levels-grid { grid-template-columns: repeat(2, 1fr); }
|
|
.quiz-grid { grid-template-columns: 1fr; }
|
|
.profil-stats { grid-template-columns: 1fr; }
|
|
.nav-toggle { display: block; }
|
|
.main-nav { display: none; flex-direction: column; width: 100%; background: var(--blue-dark); padding: .5rem 1.5rem 1rem; }
|
|
header.nav-open .main-nav { display: flex; }
|
|
.main-nav a { padding: .6rem .8rem; }
|
|
.members-cta .btn { margin-left: 0; width: 100%; text-align: center; }
|
|
}
|