/* Application installable : boutons « Installer l'application » et fenêtre d'aide (voir js/pwa.js).
   Chargé sur les pages du menu, les pages de connexion et les espaces élève / enseignant.
   Les couleurs suivent le thème quand il existe (clair/sombre) et retombent sur le vert de la marque sinon. */

/* Cachés tant que le navigateur ne peut pas installer */
[data-pwa-install][hidden] { display: none !important; }

/* Menu latéral (fond sombre) */
.btn-installer {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: 100%;
  min-height: 44px; margin: 0 0 8px; padding: 0 0.75rem;
  background: rgba(255, 255, 255, 0.08); color: #e8f1ed;
  border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 8px;
  font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-installer:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.btn-installer:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn-installer svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Pages de connexion et espaces élève / enseignant (fond clair) */
.btn-installer-page {
  display: flex; align-items: center; justify-content: center; gap: 0.55rem; width: 100%;
  min-height: 48px; margin: 18px 0 0; padding: 0 1rem;
  background: transparent; color: #0a6b52; border: 1.5px solid #0a6b52; border-radius: 10px;
  font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-installer-page:hover { background: rgba(10, 123, 92, 0.08); }
.btn-installer-page:focus-visible { outline: 3px solid rgba(10, 123, 92, 0.35); outline-offset: 2px; }
.btn-installer-page svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.btn-installer-entete { margin: 0; width: auto; min-height: 40px; padding: 0 14px; color: #fff; border-color: rgba(255, 255, 255, 0.6); font-size: 0.82rem; }
.btn-installer-entete:hover { background: rgba(255, 255, 255, 0.16); }
.btn-installer-entete:focus-visible { outline-color: #fff; }

/* Fenêtre d'aide à l'installation */
.pwa-feuille-fond {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 10000;
  background: rgba(6, 30, 24, 0.6); display: flex; align-items: flex-end; justify-content: center;
}
.pwa-feuille {
  position: relative; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  background: var(--white, #fff); color: var(--dark, #0f2a22);
  border-radius: 18px 18px 0 0; padding: 22px 20px calc(26px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  font-family: 'Philosopher', Georgia, 'Times New Roman', serif;
  border-top: 4px solid transparent; border-image: linear-gradient(90deg, #0a7b5c, #0e8f8f 58%, #e3a32a) 1;
}
@media (min-width: 576px) {
  .pwa-feuille-fond { align-items: center; }
  .pwa-feuille { border-radius: 18px; border-image: none; border-top: 4px solid #0a7b5c; }
}
.pwa-feuille h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; padding-right: 36px; }
.pwa-feuille .pwa-entete { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pwa-feuille .pwa-entete img { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--border, #dae5df); flex-shrink: 0; }
.pwa-feuille p { margin: 0 0 8px; font-size: 0.95rem; color: var(--mid, #4a5e56); }
.pwa-feuille .pwa-note { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--bg, #f0f5f2); border: 1px solid var(--border, #dae5df); font-size: 0.88rem; }
.pwa-feuille ol { margin: 8px 0 0; padding-left: 22px; font-size: 0.97rem; }
.pwa-feuille li { margin-bottom: 8px; }
.pwa-feuille .pwa-fermer {
  position: absolute; top: 12px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--bg, #f0f5f2); color: var(--dark, #0f2a22); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.pwa-feuille .pwa-ok {
  display: block; width: 100%; margin-top: 14px; min-height: 48px; padding: 12px; border: 0; border-radius: 10px;
  background: linear-gradient(90deg, #0a7b5c, #0c7c80); color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.pwa-feuille .pwa-ok:focus-visible, .pwa-feuille .pwa-fermer:focus-visible { outline: 3px solid rgba(10, 123, 92, 0.45); outline-offset: 2px; }

/* Application ouverte depuis l'écran d'accueil : on tient compte de l'encoche et de la barre du bas (iPhone) */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top, 0px); height: calc(var(--topbar-h, 68px) + env(safe-area-inset-top, 0px)); }
  .sidebar { padding-top: env(safe-area-inset-top, 0px); }
  body { padding-bottom: env(safe-area-inset-bottom, 0px); }
}
