/* mod_idealbooking_slots — prochains ateliers (même présentation qu'Ideal Horaires).
   La typographie hérite du template. Couleurs : variables --ib-available / --ib-limited / --ib-full. */

.ib-schedule {
  --ib-available: #16a34a;
  --ib-limited: #f59e0b;
  --ib-full: #dc2626;
  --ib-closed: #9ca3af;
  --ib-line: rgba(0, 0, 0, .12);
  container-type: inline-size;
}

.ib-schedule-empty { opacity: .75; margin: 0; }

/* Semaine (accordéon natif) */
.ib-week > summary { list-style: none; }
.ib-week > summary::-webkit-details-marker { display: none; }

.ib-week-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ib-line);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.ib-week-title:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

.ib-week-label { flex: 1 1 auto; }

.ib-week-title::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin: 0 6px 4px 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .25s ease;
}
.ib-week[open] > .ib-week-title::after { transform: rotate(-135deg); margin-bottom: -4px; }

.ib-week-count {
  flex: none;
  font-size: .75rem;
  font-weight: 600;
  padding: .2em .65em;
  border-radius: 999px;
  color: var(--ib-available);
  background: color-mix(in srgb, var(--ib-available) 12%, transparent);
}
.ib-week-count--full {
  color: var(--ib-full);
  background: color-mix(in srgb, var(--ib-full) 10%, transparent);
}

.ib-week-content { padding: 4px 0 14px; }

/* Jour */
.ib-day {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ib-line);
}
.ib-day:last-child { border-bottom: 0; }
.ib-day-label { flex: 0 0 180px; font-weight: 600; text-transform: capitalize; }
.ib-day-slots { flex: 1 1 260px; display: flex; flex-direction: column; gap: 6px; }

/* Créneau */
.ib-schedule .ib-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.ib-schedule .ib-slot-time { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 7.5em; }
.ib-schedule .ib-slot-note { opacity: .7; font-size: .92em; }
.ib-schedule .ib-slot-button { margin-left: auto; white-space: nowrap; }
.ib-schedule .ib-slot-button--disabled,
.ib-schedule .ib-slot-button--disabled:hover {
  opacity: .45;
  filter: grayscale(1);
  pointer-events: none;
  cursor: not-allowed;
}
.ib-schedule .ib-slot--complet .ib-slot-time { opacity: .55; }

/* Badges */
.ib-badge {
  --c: var(--ib-available);
  display: inline-flex;
  align-items: center;
  gap: .45em;
  padding: .25em .75em;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
  color: #fff;
  background: var(--c);
  border: 1px solid var(--c);
}
.ib-badge::before {
  content: "";
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
}
.ib-badge--limite { --c: var(--ib-limited); color: #1f1300; }
.ib-badge--complet { --c: var(--ib-full); }
.ib-badge--ferme { --c: var(--ib-closed); }

.ib-schedule--outline .ib-badge { color: var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); }
.ib-schedule--text .ib-badge { padding: 0; border: 0; background: none; color: var(--c); font-size: inherit; font-weight: 500; }
.ib-schedule--text .ib-badge::before { display: none; }

/* Liste compacte */
.ib-list { list-style: none; margin: 0; padding: 0; }
.ib-list-item { padding: 10px 0; border-bottom: 1px solid var(--ib-line); }
.ib-list-item:last-child { border-bottom: 0; }
.ib-list-date { display: block; font-size: .85em; font-weight: 600; text-transform: capitalize; margin-bottom: 4px; opacity: .8; }

/* Sections sombres YOOtheme */
.uk-light .ib-schedule { --ib-line: rgba(255, 255, 255, .18); }

/* Module étroit (colonne latérale, mobile) : le libellé du jour passe au-dessus,
   l'heure et l'intitulé sur une ligne, la pastille et le bouton sur la suivante. */
@container (max-width: 520px) {
  .ib-day { gap: 8px; }
  .ib-day-label { flex-basis: 100%; }
  .ib-day-slots { flex-basis: 100%; gap: 14px; }
  .ib-schedule .ib-slot { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; }
  .ib-schedule .ib-slot-time { grid-column: 1; min-width: 0; }
  .ib-schedule .ib-slot-note { grid-column: 2; text-align: right; }
  .ib-badge { grid-column: 1; justify-self: start; }
  .ib-schedule .ib-slot-button { grid-column: 2; margin-left: 0; }
  .ib-week-title { gap: 8px; }
  .ib-week-count { font-size: .7rem; }
}

@media (max-width: 639px) {
  .ib-day-label { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .ib-week-title::after { transition: none; }
}

/* 1.2.2 : une ligne par créneau — heure | intitulé (souple) | pastille + bouton alignés à droite */
.ib-schedule .ib-slot { flex-wrap: nowrap; }
.ib-schedule .ib-slot-note { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ib-schedule .ib-slot-time + .ib-badge { margin-left: auto; }
.ib-schedule .ib-slot-button { margin-left: 0; }
@container (max-width: 520px) {
  .ib-schedule .ib-slot-time + .ib-badge { margin-left: 0; }
  .ib-schedule .ib-slot-note { white-space: normal; }
}
@media (max-width: 479px) {
  .ib-schedule .ib-slot { flex-wrap: wrap; }
}
/* Créneau complet sans bouton : place réservée, invisible, pour garder l'alignement */
.ib-schedule .ib-slot-button--placeholder { visibility: hidden; pointer-events: none; }

/* 1.8.4 : nom du jour aligné sur la ligne du premier créneau (ligne de base commune) */
.ib-day { align-items: baseline; }
.ib-day-label { line-height: inherit; }

/* Titre de la semaine plus visible : plus grand (défaut) ou dans une pastille */
.ib-week-label { font-size: 1.15em; }
.ib-schedule--week-badge .ib-week-label { flex: 0 1 auto; font-size: .95em; padding: .35em .9em; border-radius: 999px; background: color-mix(in srgb, currentColor 8%, transparent); }
.ib-schedule--week-badge .ib-week-title::before { content: ""; flex: 1 1 auto; order: 1; }
.ib-schedule--week-badge .ib-week-count { order: 2; }
.ib-schedule--week-badge .ib-week-title::after { order: 3; }
.ib-schedule--week-text .ib-week-label { font-size: 1em; }
@container (max-width: 520px) {
  .ib-week-label { font-size: 1.05em; }
}

/* 1.8.7 : un intitulé long (intitulé · intervenant) ne fait plus passer le nom du jour sur sa propre ligne */
.ib-day-slots { min-width: 0; }

/* Intitulé long : passe à la ligne au lieu d'être coupé (l'intervenant reste lisible) */
.ib-schedule .ib-slot-note { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
