/* Styles du widget « Événements à venir ». Tokens repris localement du skill abby-design
   (~/.claude/skills/abby-design/colors_and_type.css) : couleurs, typo, radii, spacing, shadows.
   Fontes Inter auto-hébergées depuis ./fonts/ (jamais Google Fonts/CDN). */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/Inter-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./fonts/Inter-SemiBold.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./fonts/Inter-Bold.ttf") format("truetype");
}

:root {
  /* Palette (sous-ensemble abby-design : navy + electric blue) */
  --color-background: #FEFEFF;
  --color-card: #FFFFFF;
  --color-foreground: #25385E;
  --color-muted-foreground: #5A7294;
  /* blue-600/700 (pas blue-500) : blue-500 sur blanc ne passe pas le AA texte 4.5:1 (4.43:1 mesuré) */
  --color-primary: #0068D4;
  --color-primary-hover: #005CBD;
  --color-primary-foreground: #FFFFFF;
  --color-border: #E7E7E7;
  --color-ring: #0075EB;
  --color-secondary: #F6F7FD;

  /* Typo */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --type-heading-sm-size: 18px;
  --type-heading-sm-lh: 24px;
  --type-body-md-size: 16px;
  --type-body-md-lh: 24px;
  --type-body-sm-size: 14px;
  --type-body-sm-lh: 20px;
  --type-label-sm-size: 12px;
  --type-label-sm-lh: 16px;

  /* Spacing / radii / shadow */
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.07);
  --motion-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 600px;
  overflow-y: auto; /* variante iframe pure (sans embed.js) : scroll interne garanti */
  font-family: var(--font-sans);
  color: var(--color-foreground);
  background: var(--color-background);
  -webkit-font-smoothing: antialiased;
}

#webinaire-widget {
  padding: var(--space-5);
  width: 100%;
}

a {
  color: inherit;
}

/* -- Focus visible (a11y) -- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-lg);
}

/* -- Squelette de chargement -- */
.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.skeleton-card {
  height: 96px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  background: linear-gradient(90deg, var(--color-secondary) 25%, #EDEEF8 37%, var(--color-secondary) 63%);
  background-size: 400% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-card { animation: none; }
}

/* -- Liste d'événements -- */
.event-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.event-card {
  min-width: 0; /* évite l'overflow horizontal des flex items (titres longs) à 320px */
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  background: var(--color-card);
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.event-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Mobile : le bouton passe après les autres dates (ordre visuel), la grille ≥640px reprend la main */
.event-action {
  order: 3;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.event-title {
  font-size: var(--type-heading-sm-size);
  line-height: var(--type-heading-sm-lh);
  font-weight: 600;
  margin: 0;
}

.event-when {
  font-size: var(--type-body-md-size);
  line-height: var(--type-body-md-lh);
  font-weight: 600;
  color: var(--color-primary);
  margin: 0;
}

.event-duration,
.event-other-dates-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--type-body-sm-size);
  line-height: var(--type-body-sm-lh);
  color: var(--color-muted-foreground);
  margin: 0;
}

.event-duration svg,
.event-other-dates-label svg {
  flex-shrink: 0;
}

/* Mobile : label « Autres dates » au-dessus des chips ; ≥640px : tout sur une même ligne */
.event-other-dates {
  order: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.event-other-dates-label {
  flex-shrink: 0;
}

.date-chips {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.date-chips li {
  display: contents; /* le lien lui-même est l'item flex */
}

.date-chip {
  display: inline-block;
  background: var(--color-secondary);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: var(--type-label-sm-size);
  line-height: var(--type-label-sm-lh);
  color: var(--color-foreground);
  white-space: nowrap;
  text-decoration: none;
  transition: border-color var(--motion-fast), color var(--motion-fast);
}

a.date-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

a.date-chip:focus-visible {
  border-radius: 999px; /* conserve la pilule (la règle focus générique pose un radius 8px) */
}

/* « Plus de dates… » : même pilule mais texte primaire semi-gras — signale une action
   (voir toutes les dates) plutôt qu'une date. #0068D4 sur --color-secondary : 4.9:1, AA ok. */
a.date-chip-more {
  color: var(--color-primary);
  font-weight: 600;
}
a.date-chip-more:hover {
  color: var(--color-primary-hover);
}

.btn-register {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  font-size: var(--type-body-sm-size);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--motion-fast);
}
.btn-register:hover {
  background: var(--color-primary-hover);
}

/* -- État vide / erreur (rendu identique, jamais d'écran cassé) -- */
.state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  color: var(--color-muted-foreground);
}
.state-empty svg {
  color: var(--color-muted-foreground);
}
.state-empty p {
  margin: 0;
  width: 100%; /* sans ça : flex item non stretché (align-items:center) => pas de wrap, overflow */
  font-size: var(--type-body-md-size);
  line-height: var(--type-body-md-lh);
}
.link-replays {
  font-size: var(--type-body-sm-size);
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: underline;
}

/* -- Responsive 320 -> 1200+ : layout fluide, aucune largeur fixe -- */
/* ≥640px : grille qui étale la carte sur la largeur — titre+date à gauche, CTA à droite,
   et la rangée de chips sur TOUTE la largeur de la carte (blocs plats, pas de colonne épaisse) */
@media (min-width: 640px) {
  #webinaire-widget {
    padding: var(--space-6);
  }
  .event-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: var(--space-6);
    row-gap: var(--space-3);
  }
  .event-main {
    grid-column: 1;
    grid-row: 1;
  }
  .event-action {
    grid-column: 2;
    grid-row: 1;
  }
  .event-other-dates {
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
  }
}
