/* ============================================
   MODE PROJECTION / TBI (Tableau Blanc Interactif)
   Optimise n'importe quelle page pour la projection
   en classe : cache le chrome (header, footer, FAB,
   sidebar, etc.), zoom le contenu, fond uniforme.

   Active via :
   - URL ?projection=1 (lecture par projection-mode.js)
   - localStorage oplc_projection_mode = '1'
   - Bouton FAB "Mode projection"
   - Raccourci clavier : touche P seule + Shift (Shift+P)
   - Echap pour quitter

   Cree le 2026-05-16 (item roadmap aout 2026 #3).
   ============================================ */

html.oplc-projection-mode body,
body.oplc-projection-mode {
    background: #ffffff !important;
    overflow-x: hidden;
}

/* === ÉLÉMENTS À CACHER === */
html.oplc-projection-mode header,
html.oplc-projection-mode .site-header,
html.oplc-projection-mode .main-header,
html.oplc-projection-mode #mainHeader,
html.oplc-projection-mode footer,
html.oplc-projection-mode .site-footer,
html.oplc-projection-mode .main-footer,
html.oplc-projection-mode #mainFooter,
html.oplc-projection-mode #fab-menu,
html.oplc-projection-mode .fab-menu,
html.oplc-projection-mode .plume-fab-companion,
html.oplc-projection-mode #cookie-banner,
html.oplc-projection-mode .cookie-banner,
html.oplc-projection-mode #onboarding-tour,
html.oplc-projection-mode .breadcrumb,
html.oplc-projection-mode .breadcrumbs,
html.oplc-projection-mode .skip-link,
html.oplc-projection-mode .news-banner {
    display: none !important;
}

/* === MAXIMISER LA ZONE DE CONTENU === */
/* body avait padding-top: 103px pour compenser le header sticky : on l'efface
   en mode projection (header cache => padding inutile qui poussait l'outil
   hors du viewport en bas). Idem padding-bottom du footer. */
html.oplc-projection-mode body {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}
html.oplc-projection-mode main,
html.oplc-projection-mode .main-content,
html.oplc-projection-mode #main-content {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    min-height: 0 !important;
}

/* === ZOOM TEXTE POUR LISIBILITÉ EN CLASSE === */
html.oplc-projection-mode {
    font-size: 110%;
}
html.oplc-projection-mode h1 {
    font-size: 2.5rem !important;
}
html.oplc-projection-mode h2 {
    font-size: 2rem !important;
}
html.oplc-projection-mode p,
html.oplc-projection-mode li,
html.oplc-projection-mode label,
html.oplc-projection-mode td,
html.oplc-projection-mode .hub-card-desc {
    font-size: 1.05rem !important;
    line-height: 1.55 !important;
}

/* === OUTILS INTERACTIFS : MODE COMPACT (1 ecran sans scroll) ===
   Pour horloge, tableau-blanc, patrons-solides, geometrie, symetrie,
   plan-de-classe, etc. : on ne zoome PAS (l'outil est deja la zone
   d'attention), on compacte pour que tout tienne en 1080p (TBI typique). */
/* Liste des conteneurs verifies presents dans les vraies vues (audit 20/05/26).
   Les classes inventees du commit precedent (.geom-page, .plan-classe-page, etc.)
   ont ete corrigees pour matcher les vraies racines : .geo-hub (geometrie),
   .plan-page (plan-de-classe), .mm-page (mots-meles), .app (editeur-fiches +
   patrons-solides), .page-container (formateur-texte + generateur-dictees). */
html.oplc-projection-mode :where(
    .clock-page, .tb-page, .app, /* horloge, tableau-blanc, patrons-solides, editeur-fiches */
    .sym-page, .geo-hub,
    .plan-page, .mm-page, .page-container, .construction-page
) {
    font-size: 100%;
}
html.oplc-projection-mode .clock-page h1,
html.oplc-projection-mode .tb-page h1,
html.oplc-projection-mode .page-title h1, /* patrons-solides */
html.oplc-projection-mode .sym-page h1,
html.oplc-projection-mode .geo-hub h1,
html.oplc-projection-mode .plan-page h1,
html.oplc-projection-mode .mm-page h1,
html.oplc-projection-mode .page-container h1 {
    font-size: 1.25rem !important;
    margin: 0 0 0.25rem 0 !important;
}
/* Cache les en-tetes "Retour" et sous-titres decoratifs sur outils en projection */
html.oplc-projection-mode .clock-header,
html.oplc-projection-mode .tb-subtitle,
html.oplc-projection-mode .page-title p,
html.oplc-projection-mode .clock-instructions {
    display: none !important;
}
/* Reduit l'espace vertical perdu autour des outils */
html.oplc-projection-mode .clock-container,
html.oplc-projection-mode .tb-page,
html.oplc-projection-mode .app,
html.oplc-projection-mode .sym-page,
html.oplc-projection-mode .geo-hub,
html.oplc-projection-mode .plan-page,
html.oplc-projection-mode .mm-page,
html.oplc-projection-mode .page-container {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* clock-page et tb-page ont height: calc(100vh - 60px) en mode normal pour
   compenser le header. En projection (header cache) on prend tout : 100vh. */
html.oplc-projection-mode .clock-page,
html.oplc-projection-mode .tb-page {
    height: 100vh !important;
    max-height: 100vh !important;
}

/* Cache les modales/toasts/confettis latents qui peuvent etre dans le flow
   (display: block par defaut sur certaines, ce qui ajoutait 400px de scroll). */
html.oplc-projection-mode #contact-modal,
html.oplc-projection-mode .contact-modal,
html.oplc-projection-mode .toast,
html.oplc-projection-mode .confetti-container,
html.oplc-projection-mode #feedback-reaction-widget,
html.oplc-projection-mode #feedback-nps-toast,
html.oplc-projection-mode #feedback-down-modal {
    display: none !important;
}

/* Compactage agressif du panneau de droite de l'horloge :
   - Toggles d'affichage (8) en 2 colonnes au lieu de 8 lignes
   - Boutons d'action (8) en 2 colonnes au lieu de 8 lignes
   - Reglages d'heure en bas en 2 colonnes au lieu de 1
   Permet a clock-controls de passer de 980px a ~690px (assez pour 1080p). */
html.oplc-projection-mode .clock-controls .toggle-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem 0.5rem;
}
html.oplc-projection-mode .clock-controls .toggle-item {
    padding: 0.15rem 0 !important;
}
html.oplc-projection-mode .clock-controls .toggle-label {
    font-size: 0.75rem !important;
}
html.oplc-projection-mode .clock-controls .action-buttons {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
}
html.oplc-projection-mode .clock-controls .action-btn {
    padding: 0.45rem 0.4rem !important;
    font-size: 0.78rem !important;
}
html.oplc-projection-mode .clock-time-settings {
    grid-template-columns: 1fr 1fr !important;
}

/* === BARRE DE CONTRÔLE PROJECTION === */
.oplc-proj-bar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(15, 23, 42, 0.85);
    color: white;
    padding: 0.5rem 0.75rem 0.5rem 1rem;
    border-radius: 0 0 0 0.75rem;
    font-size: 0.9rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.oplc-proj-bar-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 0.9;
}
.oplc-proj-bar-label::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: oplcProjPulse 1.6s infinite;
}
@keyframes oplcProjPulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
.oplc-proj-bar-quit {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.35rem 0.75rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s;
    font-family: inherit;
}
.oplc-proj-bar-quit:hover,
.oplc-proj-bar-quit:focus-visible {
    background: rgba(255, 255, 255, 0.25);
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* === DARK MODE : adapter la barre === */
[data-theme='dark'] .oplc-proj-bar {
    background: rgba(15, 23, 42, 0.92);
}
html.oplc-projection-mode[data-theme='dark'] body {
    background: #0f172a !important;
    color: #e2e8f0 !important;
}

/* === IMPRESSION EN MODE PROJECTION : tout afficher === */
@media print {
    html.oplc-projection-mode .oplc-proj-bar {
        display: none !important;
    }
}

/* === MOBILE : ajustement du label === */
@media (max-width: 640px) {
    .oplc-proj-bar {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
    .oplc-proj-bar-label span {
        display: none;
    }
}

/* =====================================================
   Bouton plein écran TBI - harmonisé sur les 5 outils
   (horloge, tableau-blanc, patrons-solides, symetrie,
   construction-geometrique). Position canonique : top-right
   du conteneur d'en-tête de l'outil (qui doit être en
   position: relative).
   ===================================================== */
.tbi-fs-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition:
        transform 0.15s,
        box-shadow 0.15s;
    z-index: 10;
    line-height: 1;
}
.tbi-fs-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}
.tbi-fs-btn:focus-visible {
    outline: 3px solid #6366f1;
    outline-offset: 2px;
}
.tbi-fs-btn i {
    font-size: 1rem;
}
@media (max-width: 600px) {
    .tbi-fs-btn {
        padding: 0.5rem;
    }
    .tbi-fs-btn span {
        display: none;
    }
}

/* =====================================================
   Section "Comment ça marche" — réutilisable sur les
   pages d'accueil des modes collectifs (spectacle,
   défi-classe, boss-fight, sondage, arena, ...).
   Classes : .oplc-howto > .howto-header + .howto-steps
   + .howto-requirements.
   V2 (2026-05-20) : design plus marqué, gradient indigo
   subtil, etapes connectees par une ligne, numeros plus
   gros et plus styles, hover animation.
   ===================================================== */
.oplc-howto {
    position: relative;
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(236, 72, 153, 0.03) 100%), #ffffff;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    margin: 1.5rem auto 3rem;
    max-width: 1100px;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 10px 40px -10px rgba(99, 102, 241, 0.18);
    border: 1px solid rgba(99, 102, 241, 0.12);
    overflow: hidden;
}
/* Decoration "blob" indigo en haut-droite pour donner du caractere */
.oplc-howto::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, transparent 70%);
    pointer-events: none;
}
.oplc-howto .howto-header {
    text-align: center;
    margin-bottom: 2.25rem;
    position: relative;
}
.oplc-howto .howto-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1e1b4b;
    margin: 0 0 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: -0.01em;
}
.oplc-howto .howto-header h2 i {
    color: #6366f1;
    font-size: 1.4rem;
}
.oplc-howto .howto-header p {
    color: #4b5563;
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 720px;
    margin: 0 auto;
}
.oplc-howto .howto-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2.25rem;
    position: relative;
}
/* Ligne horizontale qui connecte les 4 etapes (desktop only) */
.oplc-howto .howto-steps::before {
    content: '';
    position: absolute;
    top: 28px;
    left: 12.5%;
    right: 12.5%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(99, 102, 241, 0.25) 12%,
        rgba(99, 102, 241, 0.25) 88%,
        transparent 100%
    );
    z-index: 0;
}
.oplc-howto .howto-step {
    position: relative;
    text-align: center;
    padding: 0;
    background: transparent;
    border: none;
    z-index: 1;
    transition: transform 0.2s ease;
}
.oplc-howto .howto-step:hover {
    transform: translateY(-4px);
}
.oplc-howto .howto-step-num {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.5rem;
    box-shadow:
        0 4px 12px rgba(99, 102, 241, 0.35),
        0 0 0 4px white;
    margin: 0 auto 1rem;
    letter-spacing: -0.02em;
}
.oplc-howto .howto-step-icon {
    font-size: 2.25rem;
    line-height: 1;
    margin-bottom: 0.6rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}
.oplc-howto .howto-step h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e1b4b;
    margin: 0 0 0.5rem;
}
.oplc-howto .howto-step p {
    font-size: 0.88rem;
    color: #6b7280;
    line-height: 1.55;
    margin: 0;
    padding: 0 0.25rem;
}
.oplc-howto .howto-requirements {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
    padding-top: 1.75rem;
    border-top: 1px solid rgba(99, 102, 241, 0.15);
    position: relative;
}
.oplc-howto .howto-req {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 1rem;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 10px;
    font-size: 0.88rem;
    color: #374151;
    transition: background 0.2s ease;
}
.oplc-howto .howto-req:hover {
    background: rgba(99, 102, 241, 0.12);
}
.oplc-howto .howto-req i {
    color: #6366f1;
    font-size: 1.15rem;
    flex-shrink: 0;
}
@media (max-width: 900px) {
    .oplc-howto .howto-steps {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    .oplc-howto .howto-steps::before {
        display: none;
    }
}
@media (max-width: 540px) {
    .oplc-howto {
        padding: 1.75rem 1.25rem;
    }
    .oplc-howto .howto-steps {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .oplc-howto .howto-header h2 {
        font-size: 1.35rem;
    }
    .oplc-howto .howto-step-num {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }
}

/* =====================================================
   Variante dark de .oplc-howto pour les pages avec
   background sombre (defi-classe, boss-fight, poll,
   arena). Inverse les couleurs : card semi-transparente
   sur fond sombre, textes clairs, accents indigo
   conservés pour la cohérence de marque.
   Usage : <section class="oplc-howto oplc-howto--dark">
   ===================================================== */
.oplc-howto--dark {
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(236, 72, 153, 0.06) 100%),
        rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(99, 102, 241, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.3),
        0 10px 40px -10px rgba(99, 102, 241, 0.4);
}
.oplc-howto--dark::before {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.35) 0%, transparent 70%);
}
.oplc-howto--dark .howto-header h2 {
    color: #f8fafc;
}
.oplc-howto--dark .howto-header h2 i {
    color: #a5b4fc;
}
.oplc-howto--dark .howto-header p {
    color: #cbd5e1;
}
.oplc-howto--dark .howto-steps::before {
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(165, 180, 252, 0.4) 12%,
        rgba(165, 180, 252, 0.4) 88%,
        transparent 100%
    );
}
.oplc-howto--dark .howto-step-num {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    box-shadow:
        0 4px 14px rgba(129, 140, 248, 0.5),
        0 0 0 4px rgba(30, 41, 59, 0.8);
}
.oplc-howto--dark .howto-step h3 {
    color: #f8fafc;
}
.oplc-howto--dark .howto-step p {
    color: #cbd5e1;
}
.oplc-howto--dark .howto-requirements {
    border-top-color: rgba(165, 180, 252, 0.2);
}
.oplc-howto--dark .howto-req {
    background: rgba(99, 102, 241, 0.15);
    color: #e2e8f0;
}
.oplc-howto--dark .howto-req:hover {
    background: rgba(99, 102, 241, 0.25);
}
.oplc-howto--dark .howto-req i {
    color: #a5b4fc;
}
.oplc-howto--dark .howto-req strong {
    color: #f8fafc;
}
