/* Rooster Gym — responsive, mobile first.
   app.css reste la maquette mobile validée : RIEN ici ne s'applique sous 768 px (hors le logo de la barre latérale, caché).
   Chargé après app.css, connexion.css et web.css, sur le site comme dans l'app MAUI (tablette, téléphone à l'horizontale).

   ≥ 768 px  tablette : barre d'onglets → rail vertical à gauche, contenu centré, grilles plus larges, fenêtres du bas → boîtes au centre.
   ≥ 1100 px ordinateur : rail → barre latérale avec libellés, colonne de contenu plus large.

   Gouttière : --gut centre une colonne de --col px dans la largeur disponible ; l'élément qui défile garde toute la largeur
   (la molette marche partout, la barre de défilement reste au bord). */

/* logo de la barre latérale : seulement sur grand écran */
.nav-logo{display:none}

@media (min-width:768px){
  :root{--rail:calc(96px + env(safe-area-inset-left,0px))}

  /* ——— le cadre : plein écran, plus de téléphone au centre ——— */
  .tel{max-width:none;--col:720px}
  .tel,.ecran,.fiche,.live,.bilan{--gut:max(24px, calc((100% - var(--col)) / 2))}
  .ecran{padding-left:var(--gut);padding-right:var(--gut)}

  /* colonnes de lecture plus étroites : formulaires, fiches, séance en direct, profil, calendrier, documents */
  .fiche,.live,#v-amis,#v-cal,.tel:not(:has(> .nav)) > .ecran{--col:760px}

  /* ——— agencement : rail à gauche, l'écran à droite, la barre « Reprendre » sous l'écran ——— */
  .tel:has(> .nav){display:grid;grid-template-columns:var(--rail) minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto}
  .tel:has(> .nav) > *{grid-column:2}
  .tel:has(> .nav) > .ecran{grid-row:1;min-height:0}
  .tel:has(> .nav) > .reprise{grid-row:2}
  /* les surcouches (fiche, séance, bilan) et le message court couvrent l'écran, pas le rail */
  .tel:has(> .nav) > :is(.fiche,.live,.bilan,.toast){grid-row:1 / -1}
  /* les fenêtres couvrent tout */
  .tel:has(> .nav) > .fenetre{grid-column:1 / -1;grid-row:1 / -1}

  /* ——— rail de navigation ——— */
  .tel:has(> .nav) > .nav{grid-column:1;grid-row:1 / -1;display:flex;flex-direction:column;gap:4px;padding:16px 8px calc(16px + env(safe-area-inset-bottom,0px)) calc(8px + env(safe-area-inset-left,0px));border-top:0;border-right:1px solid var(--line);overflow-y:auto;scrollbar-width:none}
  .nav a,.nav button{min-height:64px;padding:6px 4px;font-size:11.5px;line-height:1.2;text-align:center}
  .nav a[aria-current="page"],.nav button[aria-current="page"]{background:var(--surf-2)}
  .nav-logo{display:grid;place-items:center;min-height:56px;margin-bottom:12px}
  .nav-logo img{width:44px;height:44px;border-radius:12px;display:block}
  .nav-logo .marque{display:none}

  /* ——— barre « Reprendre » : centrée sous le contenu ——— */
  .tel > .reprise{justify-self:center;width:min(calc(100% - 48px), 640px);margin:0 0 12px}

  /* ——— fenêtres du bas → boîtes de dialogue au centre ——— */
  .fenetre{align-items:center;justify-content:center;padding:24px}
  .fenetre-in{max-width:520px;max-height:min(85%, 820px);border-radius:20px;padding-bottom:18px;box-shadow:0 24px 60px rgba(0,0,0,.55);animation:rg-dialogue .18s ease-out}
  .fenetre-in.fixe{height:min(86%, 760px);max-height:min(86%, 760px)}
  .fenetre-in.fixe>.fenetre-b{bottom:-18px;padding-bottom:18px;margin-bottom:-18px}
  .fenetre.centre .fenetre-in{box-shadow:none}
  @keyframes rg-dialogue{from{opacity:0;transform:translateY(8px) scale(.98)}to{opacity:1;transform:none}}

  /* ——— en-têtes des surcouches alignés sur la colonne ——— */
  .fiche > .tete{margin-left:max(0px, calc(var(--gut) - 12px));margin-right:max(0px, calc(var(--gut) - 12px))}
  .pied-fixe{padding-left:var(--gut);padding-right:var(--gut)}

  /* ——— séance en direct ——— */
  .live-h{margin-left:max(0px, calc(var(--gut) - 12px));margin-right:max(0px, calc(var(--gut) - 12px))}
  .live-c,.prog-bar{margin-left:var(--gut);margin-right:var(--gut)}
  .coop-bande,.duo,.live-pied{padding-left:var(--gut);padding-right:var(--gut)}
  .live .repos{left:50%;right:auto;width:min(520px, calc(100% - 20px));transform:translate(-50%,130%)}
  .live .repos.ouvert{transform:translateX(-50%)}
  /* lignes de séries : plus de place pour la charge et les reps */
  .ls{grid-template-columns:48px minmax(0,1fr) 96px 84px 48px}
  .ls.rpe-on{grid-template-columns:48px minmax(0,1fr) 96px 84px 64px 48px;gap:4px}

  /* ——— bilan (cartes à faire glisser) : cartes à taille fixe, la première centrée ——— */
  .bilan{--col:480px}
  .bilan > :not(.cartes){margin-left:max(0px, calc((100% - var(--col)) / 2));margin-right:max(0px, calc((100% - var(--col)) / 2))}
  .cs{width:min(440px, calc(100% - 16px))}
  .cartes{padding-left:max(20px, calc(50% - 220px));padding-right:max(20px, calc(50% - 220px))}

  /* ——— éléments qui n'ont pas à s'étirer sur toute la largeur ——— */
  .ecran > .seg{max-width:560px}
  .flt{max-width:560px}
  #p-cmp{max-width:560px}

  /* ——— grilles : autant de colonnes que la largeur le permet ——— */
  .grille{grid-template-columns:repeat(auto-fill,minmax(160px,1fr))}
  .cats.grille{grid-template-columns:repeat(auto-fill,minmax(200px,1fr))}
  .grille-sc{grid-template-columns:repeat(auto-fill,minmax(220px,1fr))}
  .cats.ligne{grid-template-columns:repeat(auto-fill,minmax(340px,1fr))}
  .badges{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}

  /* fil de l'accueil : cartes côte à côte, le jour sur toute la largeur */
  #fil-zone > .liste{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:10px 12px}
  #fil-zone > .liste > :is(.jour-t,.vide-g){grid-column:1 / -1}
  #fil-zone > .liste > .jour-t{margin:12px 0 0}
  #fil-zone > .liste > .jour-t:first-child{margin-top:20px}

  /* Explorer : programmes publiés en cartes */
  #x-liste{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px;align-items:start}
  #x-liste > .vide-g{grid-column:1 / -1}

  /* Profil : contacts sur deux colonnes */
  #liste-contacts{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:8px;align-items:start}
  #liste-contacts > .vide-g{grid-column:1 / -1}
}

@media (min-width:1100px){
  :root{--rail:calc(248px + env(safe-area-inset-left,0px))}
  .tel{--col:1040px}

  /* ——— barre latérale avec libellés ——— */
  .tel:has(> .nav) > .nav{padding:20px 14px calc(20px + env(safe-area-inset-bottom,0px)) calc(14px + env(safe-area-inset-left,0px))}
  .nav a,.nav button{flex-direction:row;justify-content:flex-start;gap:14px;min-height:48px;padding:0 14px;font-size:15px;text-align:left}
  .nav-logo{display:flex;align-items:center;justify-content:flex-start;gap:12px;min-height:56px;padding:0 6px;margin-bottom:20px}
  .nav-logo img{width:40px;height:40px;border-radius:11px}
  .nav-logo .marque{display:block;font-size:22px;white-space:nowrap}
  .bulle-nav{left:30px;top:6px}

  /* séances en lignes : deux colonnes */
  #seances.liste:not(.grille-sc){display:grid;grid-template-columns:repeat(auto-fill,minmax(420px,1fr));gap:8px;align-items:start}
  #seances.liste > .vide-g{grid-column:1 / -1}

  /* Progrès : lignes sur deux colonnes ; une séance dépliée grandit dans sa colonne */
  .pg-liste{display:grid;grid-template-columns:repeat(auto-fill,minmax(400px,1fr));align-items:start}
  .pg-liste > :not(.pg-l):not(.pg-it){grid-column:1 / -1}
}

/* ——— souris : retours au survol et barre de défilement fine (jamais sur écran tactile) ——— */
@media (hover:hover) and (pointer:fine){
  .wide,.exo-h{cursor:pointer}
  .wide:hover,.tuile:hover,.cat-carte:hover,.sc-carre:hover,.sc2:hover,.pub:hover,.contact-l:hover,.fil-l:hover,.ex-l:hover,.dr-carte:hover,.g-choix:hover,.rc:hover,.streak:hover,.pf-obj:hover,.pe-badges:hover,.crn:not(.crn-raid):hover{border-color:#3A3F48}
  .pg-l:hover,.g-l:hover,.im-r:hover,.rg-l:hover,.chiffres .ch-b:hover,button.ch-l:hover{background:var(--surf-2)}
  .menu-l:hover,.rg-choix button:hover,.types button:hover,.recomp button:hover{background:#2A2F37}
  .ic:not(:disabled):hover{background:var(--surf-2);color:var(--fg)}
  .btn-p:not(:disabled):hover{background:#F04A38}
  .btn-s:not(:disabled):hover{background:#2A2F37}
  .puce:hover,.seg button:not([aria-pressed="true"]):hover,.seg a:not([aria-current="page"]):hover{color:var(--fg)}
  .ajout:hover{border-color:var(--fg-3);color:var(--fg)}
  .nav a:not([aria-current="page"]):hover,.nav button:not([aria-current="page"]):hover{color:var(--fg-2);background:rgba(255,255,255,.04)}
  .sc2-play:hover,.imp:not(.ok):not(.moi):not(:disabled):hover{filter:brightness(1.1)}
}
@media (hover:hover) and (pointer:fine) and (min-width:768px){
  .ecran,.fenetre-in,.ch-liste,#g-liste,.flt-menu{scrollbar-width:thin;scrollbar-color:var(--line) transparent}
  .ecran::-webkit-scrollbar{display:block;width:8px}
  .ecran::-webkit-scrollbar-thumb{background:var(--line);border-radius:8px}
}
