/* ===========================================
   Le QR code d'un cahier (cahier/qr.js)
   Fenêtre de la page « Les cahiers » de l'enseignant. Ne dépend d'aucune
   autre feuille de style.
   =========================================== */

.cqr {
    width: min(92vw, 420px);
    max-height: 92vh;
    overflow-y: auto;
    margin: auto;               /* au cas où le style du site remet les marges à zéro */
    padding: 1.5rem 1.25rem 1.25rem;
    border: 0;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    background: #fff;
    color: #1f2933;
    text-align: center;
}

.cqr::backdrop { background: rgba(0, 0, 0, 0.55); }

.cqr-fermer {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}

.cqr-fermer:hover { background: rgba(0, 0, 0, 0.07); }

.cqr-fermer:focus-visible,
.cqr-btn:focus-visible {
    outline: 3px solid var(--primary-dark, #1f2933);
    outline-offset: 2px;
}

.cqr-titre {
    margin: 0 2.2rem 0.9rem;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.cqr-dessin {
    display: block;
    width: min(100%, 300px);
    height: auto;
    margin: 0 auto;
}

.cqr-consigne {
    margin: 0.8rem 0 0.3rem;
    font-size: 0.95rem;
}

.cqr-lien {
    margin: 0;
    font-size: 0.72rem;
    color: #52606d;
    overflow-wrap: anywhere;
}

.cqr-panne {
    margin: 1rem 0;
    padding: 0.8rem;
    border-radius: 8px;
    background: #fff4e5;
    font-size: 0.9rem;
}

.cqr-boutons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.1rem;
}

.cqr-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 44px;
    padding: 0.55rem 1rem;
    border: 1px solid #9aa5b1;
    border-radius: 8px;
    background: #fff;
    color: #1f2933;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.cqr-btn:hover { background: #f1f3f5; }

.cqr-btn-plein,
.cqr-btn-plein:hover {
    border-color: #1f2933;
    background: #1f2933;
    color: #fff;
}

.cqr-btn svg { width: 16px; height: 16px; }
.cqr-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.cqr .hidden { display: none; }

/* À l'impression, tant que la fenêtre est ouverte : elle seule, sans boutons. */
@media print {
    body.cqr-ouverte > *:not(.cqr) { display: none !important; }

    body.cqr-ouverte .cqr {
        position: static;
        width: auto;
        max-width: none;
        max-height: none;
        overflow: visible;
        margin: 0 auto;
        padding: 2cm 1cm 0;
        box-shadow: none;
        color: #000;
    }

    body.cqr-ouverte .cqr::backdrop { display: none; }
    body.cqr-ouverte .cqr-fermer,
    body.cqr-ouverte .cqr-boutons { display: none; }
    body.cqr-ouverte .cqr-titre { margin: 0 0 1cm; font-size: 22pt; }
    body.cqr-ouverte .cqr-dessin { width: 10cm; }
    body.cqr-ouverte .cqr-consigne { font-size: 14pt; margin-top: 0.8cm; }
    body.cqr-ouverte .cqr-lien { font-size: 9pt; color: #000; }
}
