:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --text: #1c2434;
  --muted: #58627a;
  --primary: #2f5cff;
  --primary-dark: #2148d8;
  --border: #d9e1f0;
  --success: #1f8f5f;
  --danger: #c13a3a;
  --radius: 14px;
  --shadow: 0 14px 30px rgba(19, 34, 78, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: radial-gradient(circle at top, #eaf0ff 0%, var(--bg) 35%, var(--bg) 100%);
}

main {
  width: min(980px, calc(100% - 32px));
  margin: 32px auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.3rem);
  line-height: 1.2;
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem);
}

p {
  margin: 0 0 14px;
}

section {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

form {
  display: grid;
  gap: 12px;
}

form > div {
  display: grid;
  gap: 7px;
}

label {
  font-weight: 600;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(47, 92, 255, 0.25);
  outline-offset: 1px;
  border-color: var(--primary);
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

a.button-link:hover {
  background: var(--primary-dark);
  text-decoration: none;
}

ul,
ol {
  margin: 8px 0 0;
  padding-left: 22px;
}

li {
  margin: 8px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}

th,
td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
}

th {
  background: #eef3ff;
  font-weight: 700;
}

p[id$="feedback"] {
  margin-top: 8px;
  font-weight: 600;
  color: var(--muted);
}

#participants-list li,
#participants-summary-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#participants-list button {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 0.92rem;
}

#unavailability-picker {
  max-height: 290px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
}

#unavailability-picker label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  margin: 6px 0;
}

#unavailability-picker input[type="checkbox"] {
  width: auto;
}

@media (max-width: 780px) {
  body.page-participant,
  body.page-syncer,
  body.page-result {
    overflow-x: hidden;
  }

  main {
    width: calc(100% - 16px);
    margin: 8px auto 16px;
    padding: 14px;
  }

  section {
    margin-top: 14px;
    padding: 12px;
  }

  input[type="text"],
  input[type="date"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px;
    min-height: 44px;
  }

  body.page-participant main form button[type="submit"],
  body.page-participant main #clear-unavailabilities-button,
  body.page-participant main #change-profile-button,
  body.page-syncer main form button[type="submit"],
  body.page-syncer main #save-exception-dates-button,
  body.page-syncer main #share-link-button,
  body.page-result main #reset-calendar-view-button,
  body.page-result main .result-toggle-detail-button,
  body.page-result main .show-participant-calendar-button {
    width: 100%;
    min-height: 44px;
  }

  #participants-list li {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #participants-list button {
    width: 100%;
    min-height: 44px;
  }

  /* FullCalendar utilise des tableaux HTML : ne jamais les passer en display:block */
  .page-participant .fc table,
  .page-syncer .fc table,
  .page-result .fc table {
    display: table;
    width: 100%;
    border-collapse: collapse;
  }

  .page-participant .fc thead,
  .page-syncer .fc thead,
  .page-result .fc thead {
    display: table-header-group;
  }

  .page-participant .fc tbody,
  .page-syncer .fc tbody,
  .page-result .fc tbody {
    display: table-row-group;
  }

  .page-participant .fc tr,
  .page-syncer .fc tr,
  .page-result .fc tr {
    display: table-row;
  }

  .page-participant .fc th,
  .page-participant .fc td,
  .page-syncer .fc th,
  .page-syncer .fc td,
  .page-result .fc th,
  .page-result .fc td {
    display: table-cell;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
  }

  /* FullCalendar — styles communs mobile (participant, syncer, résultats) */
  .page-participant .fc,
  .page-syncer .fc,
  .page-result .fc {
    max-width: 100%;
    font-size: 0.92rem;
  }

  .page-participant .fc .fc-toolbar.fc-header-toolbar,
  .page-syncer .fc .fc-toolbar.fc-header-toolbar,
  .page-result .fc .fc-toolbar.fc-header-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 0.75rem;
  }

  .page-participant .fc .fc-toolbar-chunk,
  .page-syncer .fc .fc-toolbar-chunk,
  .page-result .fc .fc-toolbar-chunk {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .page-participant .fc .fc-toolbar-title,
  .page-syncer .fc .fc-toolbar-title,
  .page-result .fc .fc-toolbar-title {
    font-size: 1rem;
    line-height: 1.3;
    text-align: center;
    white-space: normal;
  }

  .page-participant .fc .fc-button,
  .page-syncer .fc .fc-button,
  .page-result .fc .fc-button {
    min-height: 44px;
    min-width: 44px;
    padding: 8px 14px;
    font-size: 0.9rem;
  }

  .page-participant .fc .fc-daygrid-day-frame,
  .page-syncer .fc .fc-daygrid-day-frame,
  .page-result .fc .fc-daygrid-day-frame {
    min-height: 44px;
  }

  .page-participant .fc .fc-daygrid-day-number,
  .page-syncer .fc .fc-daygrid-day-number,
  .page-result .fc .fc-daygrid-day-number {
    font-size: 0.95rem;
    padding: 4px;
  }

  .page-participant .fc .fc-col-header-cell-cushion,
  .page-syncer .fc .fc-col-header-cell-cushion,
  .page-result .fc .fc-col-header-cell-cushion {
    font-size: 0.78rem;
    padding: 4px 2px;
  }

}
