/* Styles pour la gamification */

/* Barre XP en haut */
.barre-xp { position: fixed; top: 0; left: 0; right: 0; background: var(--carte); border-bottom: 1px solid var(--bord); padding: 8px 16px; z-index: 50; cursor: pointer; transition: background .2s; }
.barre-xp:hover { background: var(--survol); }
.barre-xp-contenu { display: flex; align-items: center; gap: 16px; max-width: 1400px; margin: 0 auto; }
.barre-xp-niveau { font: 600 13px var(--mono); letter-spacing: 0.5px; text-transform: uppercase; color: var(--texte); white-space: nowrap; }
.barre-xp-jauge { flex: 1; height: 20px; background: var(--fond); border: 1px solid var(--bord); border-radius: 10px; overflow: hidden; position: relative; }
.barre-xp-rempli { height: 100%; background: linear-gradient(90deg, #8a8a8a, #f2f2f2); border-radius: 10px; transition: width .5s cubic-bezier(0.23,1,0.32,1); }
.barre-xp-texte { font-size: 12px; color: var(--doux); white-space: nowrap; }

/* Notifications gamification */
.notif-gamif { position: fixed; top: 70px; right: 20px; background: var(--carte); border: 1px solid var(--bord); border-radius: 10px; padding: 12px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.4); z-index: 60; min-width: 260px; opacity: 0; transform: translateX(20px); transition: opacity .3s, transform .3s; }
.notif-gamif.visible { opacity: 1; transform: translateX(0); }
.notif-titre { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.notif-texte { font-size: 13px; color: var(--doux); }
.notif-xp .notif-titre { color: #f2f2f2; }
.notif-succes .notif-titre { color: #9cd89f; }
.notif-badge .notif-titre { color: #f2f2f2; }
.notif-badge { border-color: #f2f2f2; }

/* Modal profil */
.modale-gamif { position: fixed; inset: 0; background: rgba(10,10,10,.75); display: grid; place-items: center; z-index: 100; }
.modale-gamif .modale-contenu { width: min(700px, 95%); max-height: 90vh; overflow: auto; background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.6); }

/* Section niveau */
.profil-niveau { text-align: center; padding: 24px 20px; border-bottom: 1px solid var(--bord); background: var(--fond); }
.profil-niveau-grand { font-size: 48px; font-weight: 700; color: var(--texte); }
.profil-niveau-titre { font-size: 20px; color: var(--doux); margin: 8px 0; }
.profil-xp { font-size: 14px; color: var(--discret); margin-bottom: 16px; }
.profil-barre { height: 12px; background: var(--carte); border: 1px solid var(--bord); border-radius: 6px; overflow: hidden; margin: 0 auto; max-width: 400px; }
.profil-barre-rempli { height: 100%; background: linear-gradient(90deg, #8a8a8a, #f2f2f2); border-radius: 6px; transition: width .5s; }
.profil-xp-suivant { font-size: 13px; color: var(--doux); margin-top: 8px; }
.profil-max { font-size: 18px; margin-top: 12px; }

/* Section badges */
.profil-badges { padding: 20px; border-bottom: 1px solid var(--bord); }
.profil-badges h4 { font-size: 16px; margin: 0 0 16px; }
.badges-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 1px solid var(--bord); border-radius: 10px; background: var(--fond); transition: transform .2s, box-shadow .2s; }
.badge:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.badge.verrouille { opacity: .4; filter: grayscale(1); }
.badge-icone { font-size: 32px; }
.badge-nom { font-size: 11px; text-align: center; line-height: 1.3; color: var(--doux); }

/* Section stats */
.profil-stats { padding: 20px; }
.profil-stats h4 { font-size: 16px; margin: 0 0 16px; }
.stats-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px; border: 1px solid var(--bord); border-radius: 8px; background: var(--fond); }
.stat-valeur { font-size: 28px; font-weight: 700; color: var(--texte); }
.stat-label { font-size: 11px; color: var(--doux); text-align: center; line-height: 1.3; }

/* Ajustement du contenu principal pour la barre XP */
/* La place de la barre : sa hauteur RÉELLE (--xp, mesurée par adaptation.js — elle passe sur deux lignes sur un
   téléphone), et non 46 px fixes. Sur l'écran de connexion, personne n'est encore entré : pas de barre. */
body { padding-top: var(--xp, 0px); }
body:has(#app.cache) .barre-xp { display: none; }

/* Responsive */
@media (max-width: 768px) {
  .barre-xp-contenu { flex-wrap: wrap; gap: 8px; }
  .barre-xp-jauge { order: 3; flex-basis: 100%; }
  .badges-grille { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .badge-icone { font-size: 24px; }
  .stats-grille { grid-template-columns: repeat(2, 1fr); }
}
