/* ✅ Page login (index.html) uniquement */
body:not(.dashboard) {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0b0b;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #ffffff;
}

/* ✅ Page dashboard uniquement */
body.dashboard {
  margin: 0;
  background: #171717;
  color: #ffffff;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto;
  display: block;
  min-height: auto;
}

.container-logo_db {
  text-align: center;
}

.logo {
  width: 50px;
  height: 50px;
  position: absolute;
  top: 10px;
  right: 10px;
}

.logo_db {
  width: 170px;
  height: 100px;
  border-radius: 10px;
}

.logo-wa {
  width: 30px;
  height: 30px;
  display: block;
  position: absolute;
  right: 20px;
  bottom: 20px;
}

.card {
  width: 100%;
  max-width: 420px;
  padding: 28px;
  padding-top: 60px;
  padding-bottom: 20px;
  border-radius: 16px;
  background: #171717;
  border: 1px solid #2a2a2a;
  text-align: center;
  position: relative;
}

h1 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.8rem;
}

p {
  opacity: 0.85;
  font-size: 0.95rem;
}

.wa {
  text-align: center;
}

button {
  width: 100%;
  margin-top: 20px;
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: #ffffff;
  color: #000000;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.msg {
  margin-top: 16px;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.exercise-img {
  width: 100%;
  max-width: 300px;
  border-radius: 10px;
  margin: 8px 0;
}

.video-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: #fff;
  color: #000;
  font-size: 13px;
  text-decoration: none;
  font-weight: 600;
}
.video-btn:hover {
  opacity: 0.85;
}

.container {
  max-width: 900px;
  margin: 40px auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;
  margin-top: 20px;
  width: 100%;
}

.user {
  display: flex;
  width: 100vh;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  opacity: 0.9;
}

#logoutBtn {
  margin-top: 0;
  width: 200px;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: #1a1a1a;
  border: 1px solid #333;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
}

h2 {
  margin-top: 30px;
  font-size: 1.2rem;
}

.programs {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.program {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #2a2a2a;
  background: #141414;
  cursor: pointer;
  transition:
    border-color 0.2s,
    transform 0.1s;
}

.program:hover {
  border-color: #555;
  transform: translateY(-1px);
}

.muted {
  opacity: 0.7;
  font-size: 0.9rem;
  margin-top: 4px;
}

.sessions {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.session {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #2a2a2a;
  background: #101010;
}

button {
  background: #ffffff;
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: #e5e5e5;
}

.msg {
  margin-top: 12px;
  font-size: 0.9rem;
  opacity: 0.8;
}

.session {
  cursor: pointer;
}
.session:hover {
  border-color: #555;
  transform: translateY(-1px);
}

.exerciseMeta {
  opacity: 0.75;
  font-size: 0.92rem;
  margin-top: 2px;
}

.lastPerf {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}
.lastPerfLabel {
  font-weight: 800;
  letter-spacing: 0.2px;
  opacity: 0.9;
}
.lastPerfValue {
  opacity: 0.85;
  font-size: 0.92rem;
}

.setPill {
  justify-self: start;
  padding: 6px 10px;
  border-radius: 999px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 800;
  font-size: 0.85rem;
  opacity: 0.95;
}

.inputSmall {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 120px;
  transition:
    border-color 0.15s,
    background 0.15s,
    transform 0.05s;
}
.inputSmall::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
.inputSmall:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}
.inputSmall:active {
  transform: translateY(1px);
}

/* petite différenciation reps vs kg */
.repsInput {
  border-left: 4px solid rgba(255, 255, 255, 0.22);
}
.weightInput {
  border-left: 4px solid rgba(255, 255, 255, 0.35);
}

.btnSecondary {
  background: #ffffff;
  color: #000;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}
.btnSecondary:hover {
  background: #e5e5e5;
}

body.dashboard {
  display: block;
  align-items: initial;
  justify-content: initial;
  min-height: auto;
}

/* Mobile */
@media (max-width: 420px) {
  .setRow {
    grid-template-columns: 0.7fr 1.15fr 1.15fr;
  }

  .inputSmall {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
}

/* =========================
   Chrono responsive
========================= */

.chronoBox {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.chronoDisplay {
  font-weight: 800;
  min-width: 72px;
  text-align: center;
}

.chronoBar {
  margin-top: 12px;
}
.chronoBtns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chronoBtn {
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 800;
}
.chronoRow {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chronoPill {
  padding: 10px 14px;
  border-radius: 14px;
  font-weight: 800;
  margin-left: auto;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  margin-top: 20px;
  margin-right: 10px;
}
.chronoTime {
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 900;
}

/* même logique visuelle que tes inputs (compact + propre) */
.btnAction {
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
  white-space: nowrap;
}

/* Mobile : on passe en 2 lignes */
@media (max-width: 420px) {
  .chronoBox {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .chronoDisplay {
    grid-column: 1 / -1; /* le temps passe en dessous */
    justify-self: end; /* aligné à droite */
  }

  /* boutons un peu plus compacts */
  .btnAction {
    padding: 10px 10px;
    font-size: 0.95rem;
  }
}

/* petit écran */
@media (max-width: 420px) {
  .chronoRow {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
  }
  .chronoPill {
    margin-left: 0;
    justify-self: end;
  }
}

/* ✅ Fix responsive cards */
.exercise-card,
.exercise {
  width: 100%;
  max-width: 100%;
}

.exercise .exercise-content,
.exercise-card .exercise-content {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.exercise input,
.exercise-card input {
  min-width: 0;
}

/* ✅ Le container des champs doit pouvoir wrap */
.exercise .inputs,
.exercise-card .inputs,
.exercise .data-block,
.exercise-card .data-block {
  width: 100%;
  max-width: 100%;
}

/* ✅ Empêche les grilles d'exploser sur mobile */
.data-grid {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

/* Sur petit écran : 2 colonnes max */
@media (max-width: 700px) {
  .data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Sur grand écran : 3 ou 4 colonnes */
@media (min-width: 701px) {
  .data-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ✅ Les blocs dataType ne doivent jamais se chevaucher */
.data-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* ✅ Chaque ligne (S1, S2…) doit pousser vers le bas */
.data-row {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 10px;
  align-items: start;
  width: 100%;
}

/* ✅ Interval : une grille qui ne dépasse jamais */
.interval-grid {
  display: grid;
  gap: 8px;
  width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
}

@media (max-width: 420px) {
  .interval-grid {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  }
}

.interval-grid input {
  width: 100%;
}

/* ✅ Set rows: responsive no-overlap */
.setRow {
  display: grid;
  grid-template-columns: 64px repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  align-items: center;
  width: 100%;
}

@media (max-width: 700px) {
  .setRow {
    grid-template-columns: 56px repeat(auto-fit, minmax(110px, 1fr));
  }
}

.inputSmall {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

/* =========================
   DASHBOARD – OVERRIDES (force responsive)
   ========================= */

/* évite les surprises de flex global */
body.dashboard {
  display: block !important;
  align-items: initial !important;
  justify-content: initial !important;
  min-height: auto !important;
}

/* container toujours “dans l’écran” */
body.dashboard .container {
  width: min(900px, calc(100% - 40px)) !important;
  margin: 24px auto !important;
  padding: 20px !important;
}

/* tout doit pouvoir shrink (sinon overflow) */
body.dashboard *,
body.dashboard *::before,
body.dashboard *::after {
  box-sizing: border-box;
  min-width: 0;
}

/* tes cards ne doivent jamais dépasser */
body.dashboard .session,
body.dashboard .program,
body.dashboard .exercise,
body.dashboard .exercise-card {
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

/* ---------- FIX PRINCIPAL : lignes séries ---------- */
/* ton JS force display:flex en inline => on le tue */
body.dashboard .setRow {
  display: grid !important;
  grid-template-columns: 64px minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 10px !important;
  align-items: center !important;
  width: 100% !important;
}

/* inputs : doivent pouvoir rétrécir sinon ça pousse tout */
body.dashboard .inputSmall,
body.dashboard input.inputSmall,
body.dashboard input {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* ---------- unilat : souvent 4 champs (G reps/kg + D reps/kg) ---------- */
/* si tu as une ligne “unilat” qui met 4 inputs, on la met en grille auto */
body.dashboard .unilatRow,
body.dashboard .unilat-row,
body.dashboard [data-type="unilat"] .setRow {
  grid-template-columns: 64px repeat(4, minmax(0, 1fr)) !important;
}

/* ---------- interval : plein de petits champs ---------- */
/* si ton JS ne met pas .interval-grid, on force sur un wrapper générique */
body.dashboard .interval-grid,
body.dashboard .intervalGrid,
body.dashboard .intervalRow,
body.dashboard .interval-row {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* éviter chevauchement : chaque bloc data doit s’empiler */
body.dashboard .data-block,
body.dashboard .dataBlock,
body.dashboard .inputs,
body.dashboard .dataTypeBlock {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  width: 100% !important;
}

/* responsive : en dessous de 700px, on réduit les colonnes */
@media (max-width: 700px) {
  body.dashboard .setRow {
    grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr) !important;
  }

  /* si unilat à 4 champs, on passe sur 2 lignes */
  body.dashboard .unilatRow,
  body.dashboard .unilat-row,
  body.dashboard [data-type="unilat"] .setRow {
    grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr) !important;
    grid-auto-rows: auto;
  }
}

/* Wrapper scroll horizontal si la grille déborde */
.hscroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

/* La grille doit pouvoir dépasser si besoin */
.hscroll > .data-grid {
  width: max-content; /* ✅ autorise la grille à être plus large que le parent */
  min-width: 100%; /* ✅ mais si ça tient, elle remplit normalement */
}

/* Taille mini des champs, pour éviter des chips trop petites */
.data-grid input,
.data-grid .inputSmall {
  min-width: 72px; /* ajuste si tu veux */
}

.lastPerfValue {
  overflow-x: auto;
  white-space: nowrap;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 420px) {
  .chronoRow {
    grid-template-columns: 1fr 1fr 1fr; /* Start Stop Reset */
  }

  .chronoPill,
  .chronoDisplay {
    grid-column: 1 / -1; /* prend toute la ligne */
    width: 100%;
    justify-self: center;
    margin-top: 0;
    margin-left: 10px;
  }
}

.hscroll {
  scrollbar-width: none;
}
.hscroll::-webkit-scrollbar {
  display: none;
}
