/* ════════════════════════════════════════════════════════════════════════
   Liseuse v2 — apps.css : lanceur « Mes Apps » (FAB + tiroir latéral)
   Porté de Today v2, re-thémé aux tokens Liseuse (v2.css :root uniquement).
   FAB dégradé violet→cyan ; tiroir en verre profond ; masqué en lecture.
   ════════════════════════════════════════════════════════════════════════ */

/* ───────────────── FAB (bouton flottant grille) ───────────────── */
.apps-fab {
  position: fixed; z-index: 78;
  right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(150deg, var(--acc), var(--acc-3));
  box-shadow: var(--shadow-acc), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .3s var(--spring), box-shadow .3s var(--ease);
  animation: apps-fab-in .5s .35s var(--spring) both;
}
@keyframes apps-fab-in { from { opacity: 0; transform: scale(.4) translateY(12px); } to { opacity: 1; transform: none; } }
.apps-fab:hover {
  transform: translateY(-3px) scale(1.06) rotate(6deg);
  box-shadow: 0 16px 40px rgba(139, 92, 246, .5), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.apps-fab:active { transform: scale(.92); }
.apps-fab svg { width: 24px; height: 24px; }

/* Masqué quand le tiroir est ouvert, et surtout : jamais visible en LECTURE.
   animation:none libère l'opacité figée par le fill-mode « both » de apps-fab-in. */
body.apps-locked .apps-fab,
body[data-screen="reader"] .apps-fab {
  opacity: 0; pointer-events: none; transform: scale(.6); animation: none;
}

/* ───────────────── overlay ───────────────── */
.apps-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(5, 3, 12, .6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
}
.apps-overlay.open { opacity: 1; pointer-events: auto; }
body.apps-locked { overflow: hidden; }

/* ───────────────── tiroir latéral ───────────────── */
.apps-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 91;
  width: min(420px, 92vw);
  background: var(--glass-3);
  backdrop-filter: var(--blur-3); -webkit-backdrop-filter: var(--blur-3);
  border-left: 1px solid var(--stroke-lit);
  box-shadow: var(--shadow-3);
  transform: translateX(100%); pointer-events: none;
  transition: transform .32s var(--ease);
  display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 0 max(14px, env(safe-area-inset-bottom));
}
.apps-drawer.open { transform: translateX(0); pointer-events: auto; }

.apps-drawer__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 22px 16px; border-bottom: 1px solid var(--stroke);
}
.apps-drawer__title {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-size: 20px; font-weight: 600; color: var(--text);
}
.apps-drawer__title svg { width: 20px; height: 20px; color: var(--acc); }
.apps-drawer__close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--glass-1); border: 1px solid var(--stroke); color: var(--text-2);
  transition: transform .25s var(--spring), border-color .2s, color .2s;
}
.apps-drawer__close:hover { border-color: var(--stroke-lit); color: var(--text); transform: rotate(90deg); }
.apps-drawer__close svg { width: 20px; height: 20px; }

.apps-drawer__body { flex: 1; overflow-y: auto; padding: 18px 22px; display: grid; gap: 24px; scrollbar-width: thin; }

/* catégories */
.apps-cat__title {
  margin: 0 0 12px; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--cat, var(--acc)); display: flex; align-items: center; gap: 8px;
}
.apps-cat__title::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--cat, var(--acc)); box-shadow: 0 0 10px var(--cat, var(--acc));
}
.apps-cat__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }

/* tuiles d'app (pastille lettrée, pas d'émoji) */
.app-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  min-height: 92px; justify-content: center;
  padding: 14px 8px; border-radius: 16px;
  background: var(--glass-1); border: 1px solid var(--stroke);
  color: var(--text); text-decoration: none;
  transition: transform .28s var(--spring), border-color .2s, background .2s;
}
.app-tile__i {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .01em;
  color: var(--cat, var(--acc));
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--stroke-lit);
}
.app-tile__n { font-size: 12px; font-weight: 600; color: var(--text-2); line-height: 1.2; }
.app-tile:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: var(--cat, var(--acc));
  background: var(--glass-2);
}
.app-tile:hover .app-tile__n { color: var(--text); }
.app-tile:active { transform: scale(.95); }

/* pied : utilisateur + déconnexion */
.apps-drawer__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 22px; border-top: 1px solid var(--stroke); flex: 0 0 auto;
}
.apps-drawer__user { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.apps-drawer__avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--grad-acc); color: #fff; font-weight: 700; font-size: 12px;
}
.apps-drawer__user b { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apps-drawer__logout {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  min-height: 40px; padding: 0 15px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--err);
  background: transparent; border: 1px solid rgba(248, 113, 113, .4);
  transition: background .2s, border-color .2s;
}
.apps-drawer__logout:hover { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .6); }
.apps-drawer__logout svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
  .apps-drawer, .apps-overlay, .apps-fab { transition: none; }
  .apps-fab { animation: none; }
}
