/* Teamazo · État de synchro, endurance, contraintes, petit menu commun, barre « Nouvelle version disponible ». */

/* --- État de synchro, endurance et contraintes (9 octobre 2026) : TOUTES leurs règles sont ici. ---
   Synchro : une pastille de taille fixe (✓ à jour, ↻ qui tourne quelques tours, point orange hors ligne,
   ⚠ erreur) ; le texte est en infobulle et pour les lecteurs d’écran. */
.sync-status {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--lime);
  cursor: help;
}
.sync-status .sync-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
}
.sync-status .icon {
  width: 16px;
  height: 16px;
  color: inherit;
}
.sync-status[data-sync='sync'] .icon {
  animation: sync-spin 0.9s linear 12;
}
.sync-status[data-sync='error'] {
  border-color: #f59e0b80;
  color: #f59e0b;
}
.sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 4px #f59e0b1f;
}
@keyframes sync-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Rapport : un poste à 0 d’un côté ressort en rouge ; ligne d’endurance ; contraintes pas respectées. */
.role-duel.missing {
  border-color: #ff6d75;
  background: #ff6d751a;
}
.role-duel b.zero {
  color: #ff6d75 !important;
}
html[data-theme='light'] .role-duel.missing {
  border-color: #c9353f;
}
html[data-theme='light'] .role-duel b.zero {
  color: #c9353f !important;
}
.report-stamina {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.report-stamina .icon {
  width: 15px;
  height: 15px;
}
.report-stamina b {
  font: 800 italic 16px/1 var(--display);
}
.report-stamina .rs-a {
  color: var(--team-a-ui);
}
.report-stamina .rs-b {
  color: var(--team-b-ui);
}
.report-stamina i {
  font-style: normal;
}
.report-pair-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.report-pair-note .icon {
  flex: none;
  width: 13px;
  height: 13px;
  margin-top: 2px;
  color: var(--gold);
}
body:not(.field-expanded) .report-stamina,
body:not(.field-expanded) .report-pair-note {
  font-size: 13px;
}

/* Options d’équilibrage : les 2 modes sur une ligne, puis l’interrupteur « Endurance » (s’ajoute au mode) et
   « Contraintes » sur la ligne d’en dessous. */
.report-break {
  flex-basis: 100%;
  height: 0;
}
.stamina-mix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  padding: 4px 10px 4px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font: 700 11px var(--font);
  cursor: pointer;
}
.stamina-mix .icon {
  width: 14px;
  height: 14px;
}
.stamina-mix input {
  position: relative;
  flex: none;
  width: 26px;
  height: 15px;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  appearance: none;
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}
.stamina-mix input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--white);
  transition: transform 0.15s var(--ease-snap);
}
.stamina-mix input:checked {
  background: var(--lime);
}
.stamina-mix input:checked::after {
  background: var(--accent-ink, #15200e);
  transform: translateX(11px);
}
.stamina-mix input:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}
.stamina-mix:has(input:checked) {
  border-color: var(--lime);
  color: var(--white);
}
.stamina-mix:has(input:checked) .icon {
  color: var(--lime);
}
body:not(.field-expanded) .stamina-mix {
  font-size: 13px;
}
.stamina-mix[hidden],
.pairs-count[hidden],
.stamina-switch[hidden] {
  display: none;
}
.pairs-open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font: 700 11px var(--font);
  cursor: pointer;
}
.pairs-open .icon {
  width: 13px;
  height: 13px;
}
.pairs-open:hover,
.pairs-open.has-pairs {
  border-color: var(--lime);
  color: var(--white);
}
.pairs-count {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--accent-ink, #15200e);
  font: 800 italic 11px/1 var(--display);
}
body:not(.field-expanded) .pairs-open {
  font-size: 13px;
}

/* Fenêtre « Contraintes ». */
.pairs-dialog {
  width: min(460px, calc(100vw - 24px));
}
.pair-top2 {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 4px 0 14px;
}
.pair-new {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--raised);
}
.pair-kinds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pair-kinds button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font: 800 italic 15px/1 var(--display);
  text-transform: uppercase;
}
.pair-kinds button[aria-pressed='true'] {
  border-color: var(--lime);
  background: var(--lime);
  color: var(--accent-ink, #15200e);
}
.pair-kinds .icon {
  width: 15px;
  height: 15px;
}
.pair-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.pair-pick select {
  min-width: 0;
  height: 40px;
}
.pairs-list {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.pair-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--lime);
  border-radius: 8px;
  background: var(--panel);
  font-size: 14px;
  font-weight: 600;
}
.pair-item.pair-apart {
  border-left-color: var(--gold);
}
.pair-item > .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.pair-item.off {
  opacity: 0.5;
}
.pair-tag {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--raised);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.pair-remove {
  width: 30px;
  height: 30px;
}
.pairs-empty {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.pairs-limit {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

/* Vestiaire : réglage « Endurance des joueurs » et pile de chaque joueur (faible, moyenne, forte). */
.locker-bottom {
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}
.stamina-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.stamina-switch input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--lime);
}
.stamina-switch .icon {
  width: 15px;
  height: 15px;
}
.stamina-switch:has(input:checked) {
  color: var(--white);
} /* « Vider le vestiaire » : petit bouton à contour fin, rouge au survol, à droite de l’interrupteur (ou dessous). */
.stamina-switch {
  min-height: 30px;
}
.locker-clear {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  height: 30px;
  margin-left: auto;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 600 12px var(--font);
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}
.locker-clear[hidden] {
  display: none;
}
/* Colonne étroite (ordinateur) : le bouton passe sous l’interrupteur, calé à gauche comme lui. */
.locker-bottom {
  container-type: inline-size;
}
@container (max-width: 330px) {
  .locker-clear {
    margin-left: 0;
  }
}
.locker-clear .icon {
  width: 14px;
  height: 14px;
}
.locker-clear:hover:not(:disabled),
.locker-clear:focus-visible {
  border-color: #ff6d75;
  background: #ff6d7514;
  color: #ff6d75;
}
html[data-theme='light'] .locker-clear:hover:not(:disabled),
html[data-theme='light'] .locker-clear:focus-visible {
  border-color: #c9353f;
  background: #c9353f12;
  color: #c9353f;
}
.players-list.with-stamina .squad-row {
  grid-template-columns: 18px 22px minmax(0, 1fr) 44px 28px 28px;
}
.stamina-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.stamina-btn .icon {
  width: 19px;
  height: 19px;
}
.stamina-btn:hover {
  background: var(--raised);
}
.stamina-1 {
  color: #ff6d75;
}
.stamina-2 {
  color: var(--gold);
}
.stamina-3 {
  color: var(--lime);
}
html[data-theme='light'] .stamina-1 {
  color: #c9353f;
}
.pc-stamina {
  grid-template-columns: repeat(3, 1fr);
}
.pc-stamina button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 14px;
  text-transform: uppercase;
}
.pc-stamina .icon {
  width: 17px;
  height: 17px;
}
@media (min-width: 1100px) {
  body:not(.field-expanded) .players-list.with-stamina .squad-row {
    grid-template-columns: 22px minmax(0, 1fr) 40px 26px;
  }
  body:not(.field-expanded) .stamina-btn {
    width: 26px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sync-status[data-sync='sync'] .icon {
    animation: none;
  }
  .stamina-mix input,
  .stamina-mix input::after {
    transition: none;
  }
}

/* ---- Petit menu commun (langue, ⋯ de la compo) et barre « Nouvelle version disponible » (9 octobre 2026) ---- */
.pop-menu {
  position: fixed;
  z-index: 120;
  min-width: 180px;
  max-width: calc(100vw - 16px);
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 14px 40px #0008;
  transform-origin: top right;
  animation: pop-menu-in 0.14s var(--ease-out) both;
}
.pop-menu.above {
  transform-origin: bottom right;
}
.pop-menu[hidden] {
  display: none;
}
.pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--white);
  font: 600 14px var(--font);
  text-align: left;
}
.pop-item span {
  flex: 1;
}
.pop-item .icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.pop-item:hover:not(:disabled),
.pop-item:focus-visible {
  outline: none;
  background: var(--raised);
}
.pop-item:focus-visible {
  box-shadow: inset 0 0 0 2px var(--lime);
}
.pop-item[aria-checked='true'],
.pop-item .pop-check {
  color: var(--lime);
}
.pop-item.danger,
.pop-item.danger .icon {
  color: #ff6d75;
}
html[data-theme='light'] .pop-item.danger,
html[data-theme='light'] .pop-item.danger .icon {
  color: #c9353f;
}
.pop-item:disabled {
  opacity: 0.4;
  cursor: default;
}
@keyframes pop-menu-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
}
.update-bar {
  position: fixed;
  z-index: 95;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--lime);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 10px 30px #0007;
  color: var(--white);
  font: 600 13px var(--font);
  transform: translateX(-50%);
  animation: update-in 0.3s var(--ease-out) both;
}
.update-bar[hidden] {
  display: none;
}
.update-bar > .icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--lime);
}
.update-bar > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.update-apply {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--lime);
  color: var(--accent-ink, #15200e);
  font: 800 italic 14px/1 var(--display);
  text-transform: uppercase;
}
.update-apply:disabled {
  opacity: 0.6;
}
.update-later {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}
.update-later:hover {
  background: var(--raised);
  color: var(--white);
}
.update-later .icon {
  width: 16px;
  height: 16px;
}
@keyframes update-in {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
}
@media (max-width: 400px) {
  .update-bar {
    gap: 8px;
    padding-left: 12px;
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pop-menu,
  .update-bar {
    animation: none;
  }
}
