:root {
  /* Fixed header offset used by main/wrapper height */
  --header-offset: 7rem; /* 70px */
}

/* =========================
   BASE / RESET
   ========================= */

html {
  font-size: 62.5%; /* 1rem = 10px */
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  overflow: hidden;

  font-size: 1.6rem; /* 16px */

  background-image:
    linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)),
    url("./Image/fond-vert.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

h2,
h3,
p {
  color: #fff;
}

/* =========================
   HEADER / NAV
   ========================= */

header {
  position: fixed;
  top: 0;
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 2rem 5rem; /* 20px 50px */
  background-color: rgba(22, 104, 42, 0.7);
  z-index: 1000;
  backdrop-filter: blur(0.6rem); /* 6px */
}

header h1 {
  margin: 0;
  color: #fff;
  font-size: 2.8rem; /* 28px */
}

nav {
  display: flex;
  gap: 2.5rem; /* 25px */
}

nav a {
  color: #fff;
  cursor: pointer;
  font-weight: bold;
  text-decoration: none;
}

header nav a:hover {
  text-decoration: underline;
}

/* =========================
   LAYOUT (slider)
   ========================= */

main {
  padding-top: var(--header-offset);
}

.wrapper {
  display: flex;
  width: 300vw;
  height: calc(100vh - var(--header-offset));
  transition: transform 0.6s ease;
}

section {
  width: 100vw;
  height: 100%;
  padding: 4rem; /* 40px */
  overflow-y: auto;
  overflow-x: hidden;
}

#accueil,
#participants,
#formations {
  color: #fff;
  padding-bottom: 10rem; /* 100px */
}

/* =========================
   HOME
   ========================= */

.welcome {
  background-color: rgba(30, 35, 30,0.7);
  padding: 2rem; /* 20px */
  border-radius: 2rem; /* 20px */
  backdrop-filter: blur(0.3rem); /* 3px */
}

.dashboard {
  display: flex;
  gap: 2rem; /* 20px */
  flex-wrap: wrap;
}

.card {
  background: rgba(22,104,42,0.7);
  padding: 2rem; /* 20px */
  border-radius: 2rem; /* 20px */
  flex: 1;
  backdrop-filter: blur(0.3rem); /* 3px */
  min-width: 22rem; /* 220px */
}

/* =========================
   SECTION HEADER (title + actions)
   ========================= */

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem; /* 20px */

  gap: 1.2rem; /* 12px */
  flex-wrap: wrap;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* 5px */
  flex-wrap: wrap;
}

.search-input {
  width: 0;
  opacity: 0;
  padding: 0;
  border: none;
  border-radius: 0.8rem; /* 8px */
  transition: width 0.25s ease, opacity 0.25s ease, padding 0.25s ease;
  pointer-events: none;
}

.search-input.open {
  width: 26rem; /* 260px */
  opacity: 1;
  padding: 1rem 1.2rem; /* 10px 12px */
  pointer-events: auto;
}

.search-input:focus {
  outline: none;
  box-shadow: 0 0 0 0.3rem rgba(46, 204, 113, 0.25); /* 3px */
}

.add {
  background-color: rgba(22, 104, 42, 0.7);
  width: 4rem; /* 40px */
  height: 4rem; /* 40px */
  border-radius: 0.8rem; /* 8px */
  color: #2ecc71;
  font-size: 2rem; /* 20px */
  cursor: pointer;
  border: none;
}

/* =========================
   TABLES (generic)
   ========================= */

table {
  width: 100%;
  border-collapse: collapse;
  background: black;
  table-layout: fixed;
}

th,
td {
  padding: 1rem; /* 10px */
  border: 0.15rem solid #16682AFF; /* 1.5px */
  overflow-wrap: anywhere;
  word-break: break-word;
}

th {
  background-color: rgba(22, 104, 42, 0.3);
}

/* =========================
   PARTICIPANTS TABLE (desktop layout)
   ========================= */

.cell-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem; /* 12px */
  min-width: 0;
}

.cell-text {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.row-actions {
  display: inline-flex;
  gap: 0.8rem; /* 8px */
  flex: 0 0 auto;
  margin-left: auto;
}

/* Legacy class kept only if you still use it somewhere */
.actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 0.8rem; /* 8px */
}

/* =========================
   FORMATIONS (cards)
   ========================= */

.formations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(26rem, 1fr)); /* 260px */
  gap: 2rem; /* 20px */
  margin-top: 2rem; /* 20px */
}

.formation-card {
  background: rgba(22,104,42,0.45);
  border-radius: 1.6rem; /* 16px */
  padding: 1.8rem; /* 18px */
  cursor: pointer;
  border: 0.1rem solid rgba(46, 204, 113, 0.6); /* 1px */
  backdrop-filter: blur(0.3rem); /* 3px */
}

.formation-card h3 {
  margin-top: 0;
}

.formation-card .desc {
  opacity: 0.9;
}

.formation-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.2rem; /* 12px */
}

.badge {
  padding: 0.6rem 1rem; /* 6px 10px */
  border-radius: 99.9rem; /* 999px */
  background: rgba(46, 204, 113, 0.25);
  border: 0.1rem solid rgba(46, 204, 113, 0.7); /* 1px */
  color: #fff;
  font-size: 1.4rem; /* 14px */
}

/* =========================
   BUTTONS
   ========================= */

button {
  padding: 0.8rem 1.2rem; /* 8px 12px */
  border: none;
  background-color: #3498db;
  color: #fff;
  border-radius: 0.4rem; /* 4px */
  cursor: pointer;
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.3rem rgba(46, 204, 113, 0.25); /* 3px */
}

/* Icon buttons */
.icon-btn {
  width: 4rem; /* 40px */
  height: 4rem; /* 40px */

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 0.8rem; /* 8px */
  cursor: pointer;

  background-color: rgba(22, 104, 42, 0.7);
  color: #fff;
}

.icon-btn.table {
  border-color: rgba(22, 104, 42, 0.25);
  background: rgba(22, 104, 42, 0.08);
}

.icon-btn.table:hover {
  background: rgba(25, 120, 48, 0.18);
}

.icon-btn.danger {
  border-color: rgba(231, 76, 60, 0.25);
  background: rgba(231, 76, 60, 0.08);
}

.icon-btn.danger:hover {
  background: rgba(231, 76, 60, 0.18);
}

/* Smaller action buttons in table */
.row-actions .icon-btn {
  width: 3.4rem; /* 34px */
  height: 3.4rem; /* 34px */
  border-radius: 1rem; /* 10px */
}

.row-actions .icon-btn i {
  font-size: 1.4rem; /* 14px */
}

/* =========================
   MODALS (shared)
   ========================= */

.Formulaire-part,
.Formulaire-form {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;

  justify-content: center;
  align-items: center;

  overflow: auto;
  padding: 1.8rem; /* 18px */
}

.Formulaire-part.open,
.Formulaire-form.open {
  display: flex;
}

.form-content {
  background: #0b1f14;
  padding: 2.5rem; /* 25px */
  border-radius: 1rem; /* 10px */
  width: 32rem; /* 320px */
  color: #fff;
  border: 0.1rem solid #2ecc71; /* 1px */
  max-width: 92vw;
}

.form-group {
  margin-bottom: 1rem; /* 10px */
}

.form-content label {
  display: block;
  margin-bottom: 0.8rem; /* 8px */
  font-weight: bold;
}

.form-content input {
  width: 100%;
  padding: 1rem; /* 10px */
  border-radius: 0.6rem; /* 6px */
  border: none;
}

.form-content textarea {
  width: 100%;
  padding: 1rem; /* 10px */
  border-radius: 0.6rem; /* 6px */
  border: none;
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem; /* 10px */
  margin-top: 2rem; /* 20px */
}

.btn-cancel {
  background: rgba(22, 104, 42, 1);
}

.btn-save {
  background: #2ecc71;
  color: black;
}

.inline-form {
  display: inline;
  margin: 0;
}

/* Error box */
.form-error {
  margin: 1.2rem 0; /* 12px */
  padding: 1rem 1.2rem; /* 10px 12px */
  border-radius: 1rem; /* 10px */
  background: rgba(231, 76, 60, 0.12);
  border: 0.1rem solid rgba(231, 76, 60, 0.35); /* 1px */
  color: #fff;
}

/* Checklist */
.form-label {
  margin: 0 0 0.8rem; /* 8px */
  font-weight: bold;
  color: #fff;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 0.8rem; /* 8px */
  max-height: 16rem; /* 160px */
  overflow: auto;
  padding: 1rem; /* 10px */
  border-radius: 1rem; /* 10px */
  background: rgba(255,255,255,0.04);
  border: 0.1rem solid rgba(46, 204, 113, 0.25); /* 1px */
}

.check-item {
  display: flex;
  gap: 1rem; /* 10px */
  align-items: center;
  cursor: pointer;
  color: #fff;
}

.check-item input {
  width: 1.8rem; /* 18px */
  height: 1.8rem; /* 18px */
}

.hint {
  margin: 0;
  opacity: 0.85;
}

/* =========================
   TRAINING DETAILS MODAL
   ========================= */

.form-content-wide {
  width: min(90rem, 92vw); /* 900px */
  max-height: 85vh;
  overflow: auto;
}

.modal-subtitle {
  margin-top: 1.8rem; /* 18px */
  margin-bottom: 1rem; /* 10px */
  color: #fff;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.6rem; /* 16px */
}

.places-pill {
  white-space: nowrap;
  font-weight: 700;
  padding: 1rem 1.4rem; /* 10px 14px */
  border-radius: 99.9rem; /* 999px */
  background: rgba(255,255,255,0.08);
  border: 0.1rem solid rgba(255,255,255,0.12); /* 1px */
}

.places-pill.full {
  background: rgba(231, 76, 60, 0.18);
  border-color: rgba(231, 76, 60, 0.45);
}

.modal-desc {
  margin-top: 1.2rem; /* 12px */
  margin-bottom: 1.6rem; /* 16px */
  line-height: 1.5;
  white-space: pre-wrap;
}

.formation-subtitle {
  margin-top: 0.6rem; /* 6px */
  margin-bottom: 1.4rem; /* 14px */
  opacity: 0.85;
  font-style: italic;
}

.participants-table-wrap {
  margin-top: 1.2rem; /* 12px */
  overflow: visible;
}

/* Participants table inside modal */
.participants-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.participants-table th,
.participants-table td {
  min-width: 0;
  padding: 1rem 1.2rem; /* 10px 12px */
  text-align: left;
  border-bottom: 0.1rem solid rgba(255,255,255,0.08); /* 1px */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.participants-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0b1f14;
  color: rgb(22, 104, 42);
}

.participants-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

/* Modal overlay + sticky footer layout */
#modal-formation-details {
  overflow: auto;
}

#modal-formation-details .form-content-wide {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

#modal-formation-details .modal-body-scroll {
  overflow: auto;
  padding-right: 0.6rem; /* 6px */
  flex: 1;
}

/* Bottom actions */
.modal-actions-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem; /* 12px */
  margin-top: 1.8rem; /* 18px */
}

.left-actions,
.right-actions {
  display: flex;
  align-items: center;
  gap: 1rem; /* 10px */
}

#modal-formation-details .modal-actions-bottom {
  position: sticky;
  bottom: 0;
  z-index: 5;

  margin-top: 1.2rem; /* 12px */
  padding-top: 1.2rem; /* 12px */

  background: rgba(11, 31, 20, 0.92);
  backdrop-filter: blur(0.6rem); /* 6px */
  border-top: 0.1rem solid rgba(46, 204, 113, 0.18); /* 1px */
}

/* Enrollment form */
.enroll-form {
  margin-top: 1rem; /* 10px */
  padding: 1.2rem; /* 12px */
  border-radius: 1.2rem; /* 12px */
  background: rgba(255,255,255,0.03);
  border: 0.1rem solid rgba(46, 204, 113, 0.22); /* 1px */
}

.enroll-form .form-group {
  margin-bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.2rem; /* 12px */
  align-items: end;
}

.enroll-form label {
  grid-column: 1 / -1;
  margin-bottom: 0.6rem; /* 6px */
  font-weight: 700;
}

.enroll-form select {
  width: 100%;
  height: 4.4rem; /* 44px */
  padding: 1rem 1.2rem; /* 10px 12px */
  border-radius: 1rem; /* 10px */
  background: rgba(255,255,255,0.07);
  border: 0.1rem solid rgba(46, 204, 113, 0.35); /* 1px */
  color: #fff;
  outline: none;
}

.enroll-form option {
  color: #000;
}

.enroll-form select:focus {
  border-color: rgba(46, 204, 113, 0.85);
  box-shadow: 0 0 0 0.3rem rgba(46, 204, 113, 0.18); /* 3px */
}

.enroll-form .enroll-btn,
.enroll-form button[type="submit"] {
  height: 4.4rem; /* 44px */
  padding: 0 1.6rem; /* 16px */
  border-radius: 1rem; /* 10px */
  font-weight: 600;
  font-family: inherit;
  background: #2ecc71;
  color: #0b1f14;
  border: none;
  cursor: pointer;
}

.enroll-form .enroll-btn:hover,
.enroll-form button[type="submit"]:hover {
  filter: brightness(1.05);
}

.enroll-form button:disabled,
.enroll-form select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

.edit-info {
  margin: 0 0 1rem; /* 10px */
  padding: 1rem 1.2rem; /* 10px 12px */
  border-radius: 1rem; /* 10px */
  background: rgba(255,255,255,0.04);
  border: 0.1rem solid rgba(46, 204, 113, 0.25); /* 1px */
  color: #fff;
  font-size: 1.4rem; /* 14px */
}

/* =========================
   RESPONSIVE
   ========================= */

/* Tablet */
@media (max-width: 90rem) { /* 900px */
  :root {
    --header-offset: 8rem; /* 80px */
  }

  header {
    padding: 1.6rem 2rem; /* 16px 20px */
  }

  header h1 {
    font-size: 2.2rem; /* 22px */
  }

  section {
    padding: 2.4rem; /* 24px */
  }

  .search-input.open {
    width: min(26rem, 100%); /* 260px */
  }
}

/* Mobile header wraps */
@media (max-width: 56rem) { /* 560px */
  :root {
    --header-offset: 11.5rem; /* 115px */
  }

  header {
    flex-wrap: wrap;
    gap: 1rem; /* 10px */
  }

  nav {
    gap: 1.2rem; /* 12px */
    flex-wrap: wrap;
  }

  nav a {
    padding: 0.6rem 1rem; /* 6px 10px */
    border-radius: 0.8rem; /* 8px */
    background: rgba(0,0,0,0.12);
  }

  .dashboard {
    gap: 1.2rem; /* 12px */
  }

  section {
    padding: 1.8rem; /* 18px */
  }
}

/* Enrollment form mobile */
@media (max-width: 52rem) { /* 520px */
  .enroll-form .form-group {
    grid-template-columns: 1fr;
  }

  .enroll-form .enroll-btn,
  .enroll-form button[type="submit"] {
    width: 100%;
  }
}

/* Very small screens: tighten buttons */
@media (max-width: 42rem) { /* 420px */
  .row-actions {
    gap: 0.6rem; /* 6px */
  }

  .row-actions .icon-btn {
    width: 3.2rem; /* 32px */
    height: 3.2rem; /* 32px */
  }
}

/* Training details table -> cards (no horizontal scroll) */
@media (max-width: 70rem) { /* 700px */
  .participants-table thead {
    display: none;
  }

  .participants-table,
  .participants-table tbody,
  .participants-table tr,
  .participants-table td {
    display: block;
    width: 100%;
  }

  .participants-table tr {
    border: 0.1rem solid rgba(46, 204, 113, 0.25); /* 1px */
    border-radius: 1.2rem; /* 12px */
    padding: 1rem; /* 10px */
    margin-bottom: 1.2rem; /* 12px */
    background: rgba(255,255,255,0.03);
  }

  .participants-table td {
    border: none;
    padding: 0.6rem 0; /* 6px 0 */
  }

  .participants-table td:last-child {
    text-align: right;
    white-space: normal;
    padding-top: 1rem; /* 10px */
  }
}

/* Participants table -> cards (email readable on narrow screens) */
@media (max-width: 72rem) { /* 720px */
  #participants table thead {
    display: none;
  }

  #participants table,
  #participants tbody,
  #participants tr,
  #participants td {
    display: block;
    width: 100%;
  }

  #participants tr {
    border: 0.1rem solid rgba(46, 204, 113, 0.25); /* 1px */
    border-radius: 1.2rem; /* 12px */
    padding: 1.2rem; /* 12px */
    margin-bottom: 1.2rem; /* 12px */
    background: rgba(255,255,255,0.03);
  }

  #participants td {
    border: none;
    padding: 0.6rem 0; /* 6px 0 */
  }

  /* Prenom + Nom inline */
  #participants tr td:nth-child(1),
  #participants tr td:nth-child(2) {
    display: inline-block;
    width: auto;
    padding-right: 0.8rem; /* 8px */
    font-weight: 700;
  }

  /* Email cell becomes the block that contains email + actions */
  #participants tr td:nth-child(3) {
    padding-top: 0.8rem; /* 8px */
  }

  #participants .cell-flex {
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.2rem; /* 12px */
  }

  #participants .cell-text {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #participants .row-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
  }
}

/* Extra small: buttons move below but stay right */
@media (max-width: 42rem) { /* 420px */
  #participants .cell-flex {
    flex-direction: column;
  }

  #participants .row-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
