/* Cahiers de vacances 2026 — overrides mathpad et UI auth/forum
   À charger APRÈS mathpad.css. */

/* -------------------------------------------------------------------------- */
/* Bandeau auth en haut                                                       */
/* -------------------------------------------------------------------------- */
.cdv-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: 56px;
    background: linear-gradient(90deg, #0e7490 0%, #0891b2 100%);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
}
body.has-cdv-banner { padding-top: 88px; }   /* 56px bandeau + marge pour décoller le titre */
body.mp-has-toc-sidebar.has-cdv-banner .mp-toc-list,
body.mp-has-toc-sidebar.has-cdv-banner .mp-toc-sidebar,
body.has-cdv-banner #mp-toc { top: 56px !important; }

.cdv-banner .cdv-greet { font-weight: 600; }
.cdv-banner .cdv-greet .cdv-class { font-weight: 400; opacity: 0.8; }
.cdv-banner .cdv-progress {
    display: flex; align-items: center; gap: 10px;
    background: rgba(0,0,0,0.18); padding: 4px 12px; border-radius: 100px;
}
.cdv-banner .cdv-progress-bar {
    width: 120px; height: 6px; background: rgba(255,255,255,0.25);
    border-radius: 3px; overflow: hidden;
}
.cdv-banner .cdv-progress-bar > i {
    display: block; height: 100%; background: #4ade80;
    transition: width 0.4s ease;
}
.cdv-banner .cdv-progress-text { font-size: 12px; opacity: 0.95; }
.cdv-banner .cdv-spacer { flex: 1; }
.cdv-banner .cdv-action {
    color: white; text-decoration: none; padding: 6px 12px;
    border-radius: 6px; background: rgba(255,255,255,0.15);
    font-size: 13px; cursor: pointer; border: none;
    transition: background 0.2s;
}
.cdv-banner .cdv-action:hover { background: rgba(255,255,255,0.28); }
.cdv-banner .cdv-action.primary {
    background: #f59e0b; color: white; font-weight: 600;
}
.cdv-banner .cdv-action.primary:hover { background: #d97706; }

@media (max-width: 720px) {
    .cdv-banner { height: auto; min-height: 56px; flex-wrap: wrap;
                  padding: 6px 12px; gap: 8px; }
    .cdv-banner .cdv-progress { display: none; }
    .cdv-banner .cdv-greet { font-size: 13px; }
    body.has-cdv-banner { padding-top: 96px; }
}

/* -------------------------------------------------------------------------- */
/* Fenêtre "Mon compte"                                                       */
/* -------------------------------------------------------------------------- */
.cdv-modal-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(15, 23, 42, 0.55);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.cdv-modal {
    background: white; border-radius: 16px; padding: 28px;
    width: 100%; max-width: 420px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.25);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #1f2937;
}
.cdv-modal h2 { margin: 0 0 4px; font-size: 20px; }
.cdv-modal .cdv-modal-sub { margin: 0 0 20px; color: #6b7280; font-size: 14px; }
.cdv-modal label { display: block; font-size: 13px; font-weight: 600;
                   color: #374151; margin: 14px 0 4px; }
.cdv-modal input[type=text] {
    width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 16px;
    border: 1px solid #d1d5db; border-radius: 8px;
}
.cdv-modal input[type=text]:focus { outline: none; border-color: #0891b2;
    box-shadow: 0 0 0 3px rgba(8,145,178,0.25); }
.cdv-modal-radios { display: flex; gap: 8px; }
.cdv-modal-radios label {
    flex: 1; margin: 4px 0 0; padding: 10px; text-align: center;
    border: 1px solid #d1d5db; border-radius: 8px; cursor: pointer;
    font-weight: 400; font-size: 14px;
}
.cdv-modal-radios label.sel { border-color: #0891b2; background: #ecfeff;
    color: #0e7490; font-weight: 700; }
.cdv-modal-radios input { margin-right: 4px; }
.cdv-modal-err {
    display: none; margin-top: 14px; padding: 8px 12px;
    background: #fee2e2; color: #991b1b; border-radius: 8px; font-size: 13px;
}
.cdv-modal-err.show { display: block; }
.cdv-ed-hint { font-size: 12px; margin-top: 5px; min-height: 16px; }
.cdv-ed-hint.ok { color: #16a34a; }
.cdv-ed-hint.no { color: #dc2626; }
.cdv-ed-hint.checking { color: #999; }
.cdv-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }
.cdv-modal-actions .cdv-action {
    padding: 9px 18px; border-radius: 8px; border: 1px solid #d1d5db;
    background: white; color: #1f2937; cursor: pointer; font-size: 14px; font-weight: 600;
}
.cdv-modal-actions .cdv-action:hover { background: #f9fafb; }
.cdv-modal-actions .cdv-action.primary { background: #0891b2; color: white; border-color: #0891b2; }
.cdv-modal-actions .cdv-action.primary:hover { background: #0e7490; }
.cdv-modal-actions .cdv-action:disabled { opacity: 0.6; cursor: wait; }

/* -------------------------------------------------------------------------- */
/* Bouton flottant Forum                                                      */
/* -------------------------------------------------------------------------- */
.cdv-forum-fab {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 900;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #f59e0b;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    font-size: 24px;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.cdv-forum-fab:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    color: white;
}
.cdv-forum-fab .cdv-fab-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: #dc2626; color: white;
    font-size: 11px; font-weight: 700;
    padding: 2px 6px; border-radius: 100px;
    min-width: 18px; text-align: center;
}
body.has-cdv-nav-bar .cdv-forum-fab { bottom: 84px; }
@media (max-width: 720px) {
    .cdv-forum-fab { width: 48px; height: 48px; bottom: 16px; right: 16px; font-size: 20px; }
}

/* -------------------------------------------------------------------------- */
/* Bannière de recommandation post-quiz                                       */
/* -------------------------------------------------------------------------- */
.cdv-reco-banner {
    margin: 16px 0;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.cdv-reco-banner .cdv-reco-head {
    display: flex; align-items: center; gap: 12px;
}
.cdv-reco-banner .cdv-reco-icon { font-size: 28px; }
.cdv-reco-banner .cdv-reco-title { font-weight: 700; font-size: 16px; color: #92400e; }
.cdv-reco-banner .cdv-reco-subtitle { font-size: 13px; color: #78350f; margin-top: 2px; }
.cdv-reco-banner .cdv-reco-link {
    display: inline-block; padding: 4px 10px;
    background: rgba(255,255,255,0.6); border-radius: 6px;
    text-decoration: none; color: #92400e; font-weight: 600; font-size: 13px;
    margin-right: 6px; margin-bottom: 4px;
    border: 1px solid rgba(146, 64, 14, 0.2);
}
.cdv-reco-banner .cdv-reco-link:hover { background: white; }
.cdv-reco-banner .cdv-reco-apps {
    display: flex; gap: 10px; flex-wrap: wrap;
    padding-top: 8px; border-top: 1px dashed #92400e40;
}
.cdv-reco-banner .cdv-reco-app {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px;
    background: #1f2937; color: white;
    text-decoration: none; font-size: 13px; font-weight: 600;
}
.cdv-reco-banner .cdv-reco-app.ios { background: #000; }
.cdv-reco-banner .cdv-reco-app:hover { opacity: 0.9; }

/* -------------------------------------------------------------------------- */
/* Bandeau d'info pour les non-inscrits                                       */
/* -------------------------------------------------------------------------- */
.cdv-anon-cta {
    margin: 20px 0;
    background: #e0f2fe;
    border: 1px solid #0891b2;
    border-radius: 12px;
    padding: 16px 20px;
    text-align: center;
}
.cdv-anon-cta strong { color: #0e7490; }
.cdv-anon-cta .cdv-action {
    display: inline-block; margin-top: 8px;
    padding: 8px 16px; background: #0891b2; color: white;
    border-radius: 6px; text-decoration: none; font-weight: 600;
}
.cdv-anon-cta .cdv-action:hover { background: #0e7490; }

/* -------------------------------------------------------------------------- */
/* Tableaux de formules dans les énoncés : plus d'air entre les lignes        */
/* -------------------------------------------------------------------------- */
mp-statement table td { padding: 10px 12px; vertical-align: top; }

/* Conteneur scrollable : le tableau défile horizontalement DANS sa boîte
   sur les petits écrans, sans jamais élargir la page (pas d'overflow-x page). */
.cdv-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* -------------------------------------------------------------------------- */
/* Boutons « partie rapide » Math-Arena (fin de thème)                        */
/* -------------------------------------------------------------------------- */
.cdv-arena {
    display: inline-block;
    margin: 6px 5px 0;
    padding: 8px 16px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff !important;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(37,99,235,0.3);
    transition: background 0.15s, transform 0.1s;
}
.cdv-arena:hover { background: #1d4ed8; transform: translateY(-1px); }
.cdv-arena::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    content: "\f11b";          /* fa-gamepad, monochrome blanc → net sur le bleu */
    margin-right: 8px;
}

/* -------------------------------------------------------------------------- */
/* Quiz verrouillés (élève non inscrit)                                       */
/* -------------------------------------------------------------------------- */
.cdv-quiz-locked mp-answer {
    opacity: 0.45 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    filter: grayscale(0.6);
}
.cdv-quiz-lock-note {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #e0f2fe;
    border: 1px dashed #0891b2;
    color: #0e7490;
    font-size: 13px;
    text-align: center;
}
.cdv-quiz-lock-note a {
    color: #0891b2;
    font-weight: 700;
    text-decoration: none;
    margin-left: 8px;
    white-space: nowrap;
}
.cdv-quiz-lock-note a:hover { text-decoration: underline; }

/* -------------------------------------------------------------------------- */
/* Quiz: feedback de fin (POST-validation indicator)                          */
/* -------------------------------------------------------------------------- */
.cdv-quiz-result {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    background: #f1f5f9;
    color: #475569;
}
.cdv-quiz-result.good { background: #dcfce7; color: #166534; }
.cdv-quiz-result.bad  { background: #fee2e2; color: #991b1b; }

/* -------------------------------------------------------------------------- */
/* Forum (utilisé par forum.php)                                              */
/* -------------------------------------------------------------------------- */
.cdv-forum-wrap {
    max-width: 800px; margin: auto; padding: 16px;
}
.cdv-forum-compose {
    background: white; border: 1px solid #e5e7eb;
    border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.cdv-forum-compose textarea {
    width: 100%; min-height: 80px; padding: 10px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-family: inherit; font-size: 14px; resize: vertical;
}
.cdv-forum-compose .cdv-preview {
    margin-top: 8px; padding: 10px; background: #f9fafb;
    border-radius: 6px; font-size: 14px; min-height: 30px;
    border: 1px dashed #d1d5db;
}
.cdv-forum-compose .cdv-preview:empty::before {
    content: "Aperçu (les formules $...$ sont rendues)";
    color: #9ca3af; font-style: italic;
}
.cdv-forum-compose .cdv-row {
    display: flex; gap: 12px; align-items: center; margin-top: 12px;
}
.cdv-forum-compose .cdv-row label { font-size: 13px; color: #6b7280; }
.cdv-forum-compose .cdv-row input[type=text] {
    padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px;
}
.cdv-forum-compose button {
    margin-left: auto;
    padding: 8px 20px; background: #0891b2; color: white;
    border: none; border-radius: 6px; font-weight: 600; cursor: pointer;
}
.cdv-forum-compose button:disabled { background: #9ca3af; cursor: not-allowed; }
.cdv-forum-msg {
    background: white; border: 1px solid #e5e7eb;
    border-radius: 12px; padding: 12px 16px; margin-bottom: 10px;
}
.cdv-forum-msg .cdv-msg-head {
    display: flex; align-items: baseline; gap: 8px;
    font-size: 12px; color: #6b7280; margin-bottom: 6px;
}
.cdv-forum-msg .cdv-msg-head strong { color: #1f2937; font-size: 14px; }
.cdv-forum-msg.is-me { border-left: 3px solid #0891b2; }
.cdv-forum-msg .cdv-msg-ref {
    display: inline-block; padding: 1px 6px; border-radius: 100px;
    background: #e0e7ff; color: #4338ca; font-size: 11px;
}
.cdv-forum-msg .cdv-msg-body { line-height: 1.5; }

/* -------------------------------------------------------------------------- */
/* Page inscription                                                           */
/* -------------------------------------------------------------------------- */
.cdv-register {
    max-width: 480px; margin: 60px auto; padding: 32px;
    background: white; border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.cdv-register h1 { margin: 0 0 8px; font-size: 24px; }
.cdv-register p.intro { color: #6b7280; margin-bottom: 24px; line-height: 1.5; }
.cdv-register label { display: block; font-size: 13px; font-weight: 600;
                      color: #374151; margin-bottom: 4px; margin-top: 16px; }
.cdv-register input[type=text],
.cdv-register input[type=password] {
    width: 100%; padding: 10px 12px; font-size: 16px;
    border: 1px solid #d1d5db; border-radius: 8px;
}
.cdv-register input:focus { outline: none; border-color: #0891b2; box-shadow: 0 0 0 3px #0891b240; }
.cdv-register .cdv-radio-group {
    display: flex; gap: 8px; margin-top: 4px;
}
.cdv-register .cdv-radio-group label {
    flex: 1; margin: 0; padding: 12px; border: 1px solid #d1d5db;
    border-radius: 8px; cursor: pointer; text-align: center;
    font-weight: 400; font-size: 14px;
}
.cdv-register .cdv-radio-group input { display: none; }
.cdv-register .cdv-radio-group input:checked + span {
    color: #0891b2; font-weight: 700;
}
.cdv-register .cdv-radio-group label:has(input:checked) {
    border-color: #0891b2; background: #ecfeff;
}
.cdv-register button {
    width: 100%; margin-top: 24px; padding: 12px;
    background: #0891b2; color: white; border: none;
    border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer;
}
.cdv-register button:hover { background: #0e7490; }
.cdv-register button:disabled { background: #9ca3af; cursor: wait; }
.cdv-register .cdv-error {
    background: #fee2e2; color: #991b1b; padding: 10px 12px;
    border-radius: 8px; font-size: 13px; margin-top: 16px; display: none;
}
.cdv-register .cdv-error.show { display: block; }
.cdv-register .cdv-already {
    margin-top: 16px; text-align: center; font-size: 13px; color: #6b7280;
}
.cdv-register .cdv-already a { color: #0891b2; }

/* Badge « Prof » dans le forum */
.cdv-prof-badge {
    display: inline-block; padding: 1px 8px; border-radius: 100px;
    background: #0891b2; color: #fff; font-size: 11px; font-weight: 700;
    vertical-align: middle; letter-spacing: .02em;
}
.cdv-forum-msg.is-prof {
    border-left: 3px solid #0891b2; background: #ecfeff;
}

/* Éditeur de message du forum : onglets + barre de raccourcis */
.cdv-forum-compose .cdv-ed-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.cdv-forum-compose .cdv-ed-tab {
    width: auto; margin: 0; box-shadow: none;
    border: none; background: #eef2f7; color: #475569; padding: 6px 14px;
    border-radius: 8px 8px 0 0; cursor: pointer; font-size: 13px; font-weight: 600;
}
.cdv-forum-compose .cdv-ed-tab.active { background: #0891b2; color: #fff; }
.cdv-forum-compose .cdv-ed-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.cdv-forum-compose .cdv-ed-btn {
    width: auto; margin: 0; box-shadow: none;
    border: 1px solid #d1d5db; background: #fff; color: #1f2937; border-radius: 6px;
    padding: 4px 9px; font-size: 14px; line-height: 1.2; cursor: pointer; min-width: 34px; font-weight: 500;
}
.cdv-forum-compose .cdv-ed-btn:hover { background: #ecfeff; border-color: #0891b2; }

/* Barre de navigation prof (1G / TG / déconnexion), en haut du forum */
.cdv-prof-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
    background: #ecfeff; border: 1px solid #a5f3fc; border-radius: 8px;
    padding: 8px 14px; margin-bottom: 14px; font-size: 14px; color: #0e7490;
}
.cdv-prof-bar .cdv-prof-grp { display: inline-flex; align-items: center; gap: 4px; }
.cdv-prof-bar .cdv-prof-sep { color: #67e8f9; }
.cdv-prof-bar a {
    color: #0e7490; text-decoration: none; font-weight: 600;
    padding: 3px 9px; border-radius: 6px;
}
.cdv-prof-bar a:hover { background: #cffafe; }
.cdv-prof-bar a.on { background: #0891b2; color: #fff; }
