* {
  box-sizing: border-box;
}

:root {
  --bg: #f7f4ec;
  --bg-soft: #fcfaf5;
  --card: rgba(255, 255, 255, 0.95);

  --text: #24211a;
  --muted: #716a5d;

  --border: #e7dfcf;
  --border-strong: #d9cfbb;

  --accent: #99874e;
  --accent-dark: #7f703f;
  --accent-soft: #f3eee0;

  --success: #667a67;
  --warning: #b87945;
  --danger: #a65757;
  --neutral: #6f6758;

  --shadow: 0 10px 28px rgba(40, 33, 20, 0.06);
  --shadow-hover: 0 18px 38px rgba(40, 33, 20, 0.10);

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 999px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Poppins", Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(153, 135, 78, 0.08), transparent 28%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  width: min(1260px, calc(100% - 40px));
  margin: 0 auto;
}

.is-hidden {
  display: none !important;
}

/* HEADER */

.site-header {
  padding: 22px 0 18px;
}

.hero {
  position: relative;
  min-height: 205px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(231, 223, 207, 0.98);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero-logo-wrap {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
}

.hero-logo {
  display: block;
  width: 200px;
  max-width: 100%;
  height: auto;
}

.hero-actions {
  position: absolute;
  top: 16px;
  right: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.hero-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  min-height: 26px;
  border-radius: var(--radius-pill);
  border: 1px solid #dccfae;
  background: #f7f1e4;
  color: #6f6032;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.hero-button:hover {
  transform: translateY(-1px);
  background: #efe6d1;
  border-color: #ccb98a;
}

.hero-content {
  width: 100%;
  max-width: 820px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1e1b16;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

/* FILTERS */

.filters-panel {
  position: relative;
  z-index: 100;
  margin: 24px 0 22px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(231, 223, 207, 0.98);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.public-block {
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid #e2d7bd;
  background: linear-gradient(180deg, #fffdf8 0%, #faf7ef 100%);
}

.block-head {
  margin-bottom: 14px;
}

.block-head h2 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
  color: #2b261d;
}

.block-head p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.public-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.public-pill,
.reset-button {
  appearance: none;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-pill);
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.public-pill {
  border: 1px solid #dccfae;
  background: #ffffff;
  color: #6f6032;
  padding: 11px 15px;
  font-size: 13px;
  font-weight: 700;
}

.public-pill:hover {
  transform: translateY(-1px);
  background: #fcf8ee;
  border-color: #c8b17a;
}

/* État actif par défaut */

.public-pill.is-active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 5px 12px rgba(153, 135, 78, 0.08);
}

/* Bouton Tous actif : doré Graad */

.public-pill.is-active[data-public-value=""] {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 5px 12px rgba(153, 135, 78, 0.08);
}

/* Publics actifs : rappel des couleurs des badges */

.public-pill.is-active[data-public-value="medecins"] {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
  box-shadow: 0 5px 12px rgba(29, 78, 216, 0.08);
}

.public-pill.is-active[data-public-value="infirmiers"] {
  background: #ecfeff;
  color: #0f766e;
  border-color: #67e8f9;
  box-shadow: 0 5px 12px rgba(15, 118, 110, 0.08);
}

.public-pill.is-active[data-public-value="pharmaciens"] {
  background: #f0fdf4;
  color: #15803d;
  border-color: #86efac;
  box-shadow: 0 5px 12px rgba(21, 128, 61, 0.08);
}

.public-pill.is-active[data-public-value="sages-femmes"] {
  background: #fdf2f8;
  color: #be185d;
  border-color: #f9a8d4;
  box-shadow: 0 5px 12px rgba(190, 24, 93, 0.08);
}

.public-pill.is-active[data-public-value="kines"] {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fdba74;
  box-shadow: 0 5px 12px rgba(194, 65, 12, 0.08);
}

.public-pill.is-active[data-public-value="dentistes"] {
  background: #eef2ff;
  color: #4338ca;
  border-color: #a5b4fc;
  box-shadow: 0 5px 12px rgba(67, 56, 202, 0.08);
}

.advanced-filters {
  position: relative;
  z-index: 110;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid #eee7dc;
  background: linear-gradient(180deg, #fffefd 0%, #fbfaf7 100%);
}

.filters-grid {
  display: grid;
  grid-template-columns:
    minmax(190px, 1fr)
    minmax(155px, 0.75fr)
    minmax(190px, 1fr)
    minmax(155px, 0.75fr)
    minmax(260px, 1.25fr);
  gap: 16px;
  align-items: start;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
  position: relative;
}

.filter-group label {
  padding-left: 2px;
  color: #645d50;
  font-size: 13px;
  font-weight: 700;
}

.filter-group input,
.filter-group select {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  outline: none;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(40, 33, 20, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.filter-group input::placeholder {
  color: #a39b8d;
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: rgba(153, 135, 78, 0.7);
  box-shadow: 0 0 0 4px rgba(153, 135, 78, 0.14);
}

.filter-group select:disabled {
  background: #f5f2ea;
  color: #9a9286;
  cursor: not-allowed;
  border-color: #ddd4c5;
}

/* SINGLE FILTER + MULTISELECT FILTERS */

.single-filter,
.multi-filter {
  position: relative;
  width: 100%;
  z-index: 120;
}

.single-filter-button,
.multi-filter-button {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  outline: none;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(40, 33, 20, 0.03);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.single-filter-button:hover,
.multi-filter-button:hover {
  border-color: #cbbb9d;
  background: #ffffff;
}

.single-filter-button:focus,
.single-filter-button[aria-expanded="true"],
.multi-filter-button:focus,
.multi-filter-button[aria-expanded="true"] {
  border-color: rgba(153, 135, 78, 0.7);
  box-shadow: 0 0 0 4px rgba(153, 135, 78, 0.14);
}

.single-filter-button:disabled {
  background: #f5f2ea;
  color: #9a9286;
  cursor: not-allowed;
  border-color: #ddd4c5;
  box-shadow: none;
}

.single-filter-label,
.multi-filter-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.single-filter-arrow,
.multi-filter-arrow {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f4efdf;
  color: var(--accent-dark);
  font-size: 14px;
  transition: transform 0.2s ease;
}

.single-filter-button:disabled .single-filter-arrow {
  background: #ece7dc;
  color: #aaa294;
}

.single-filter-button[aria-expanded="true"] .single-filter-arrow,
.multi-filter-button[aria-expanded="true"] .multi-filter-arrow {
  transform: rotate(180deg);
}

.single-filter-menu,
.multi-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 9999;
  min-width: 280px;
  width: 320px;
  max-width: calc(100vw - 48px);
  padding: 8px;
  border: 1px solid #e7dfd1;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(40, 33, 20, 0.14);
  overflow-x: hidden;
}

.single-filter-menu[hidden],
.multi-filter-menu[hidden] {
  display: none;
}

.single-filter-options,
.multi-filter-options {
  display: grid;
  gap: 3px;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px;
}

.single-filter-option,
.multi-filter-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 11px;
  color: #2b261d;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.single-filter-option {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.single-filter-option:hover,
.multi-filter-option:hover {
  background: #fbf7ef;
}

.single-filter-option.is-selected {
  background: #f4efdf;
  color: var(--accent-dark);
  font-weight: 700;
}

.single-filter-option::after {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-left: auto;
}

.single-filter-option.is-selected::after {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.multi-filter-option input[type="checkbox"] {
  appearance: none;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  max-width: 16px;
  max-height: 16px;
  padding: 0 !important;
  margin: 0;
  border: 1px solid #ddd2bd;
  border-radius: 5px;
  background: #fffdf8;
  cursor: pointer;
  position: relative;
  box-shadow: 0 1px 2px rgba(40, 33, 20, 0.04);
  flex: 0 0 16px;
}

.multi-filter-option input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.multi-filter-option input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.multi-filter-option input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(153, 135, 78, 0.14);
}

.multi-filter-option span {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #2b261d;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
}

/* Largeurs spécifiques */

.single-filter-menu {
  width: 340px;
}

.multi-filter-format .multi-filter-menu {
  width: 280px;
}

.multi-filter-type-action .multi-filter-menu {
  width: 360px;
}

.multi-filter-financement .multi-filter-menu {
  width: 260px;
}

/* SEARCH */

.search-wrap {
  position: relative;
}

.search-wrap span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #a18e5a;
  pointer-events: none;
}

.search-wrap input {
  padding-left: 40px;
}

/* FILTERS FOOTER + ACTIVE FILTERS */

.filters-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 220px;
}

.active-filter-badge {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 260px;
  padding: 8px 10px 8px 12px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.active-filter-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(40, 33, 20, 0.08);
  opacity: 0.92;
}

.active-filter-badge span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-filter-remove {
  width: 17px;
  height: 17px;
  min-width: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  color: #ffffff;
  font-size: 14px;
  font-weight: 300;
  line-height: 1;
}

/* Couleur de la pastille selon la couleur du texte du badge clair */

.badge-public-medecins .active-filter-remove {
  background: rgba(29, 78, 216, 0.62);
}

.badge-public-infirmiers .active-filter-remove {
  background: rgba(15, 118, 110, 0.62);
}

.badge-public-pharmaciens .active-filter-remove {
  background: rgba(21, 128, 61, 0.62);
}

.badge-public-sages-femmes .active-filter-remove {
  background: rgba(190, 24, 93, 0.62);
}

.badge-public-kines .active-filter-remove {
  background: rgba(194, 65, 12, 0.62);
}

.badge-public-dentistes .active-filter-remove {
  background: rgba(67, 56, 202, 0.62);
}

.badge-public-mixte .active-filter-remove {
  background: rgba(109, 40, 217, 0.62);
}

.badge-public-empty .active-filter-remove {
  background: rgba(107, 114, 128, 0.62);
}

.badge-type-epp .active-filter-remove {
  background: rgba(185, 28, 28, 0.62);
}

.badge-type-fc .active-filter-remove {
  background: rgba(3, 105, 161, 0.62);
}

.badge-type-pi .active-filter-remove {
  background: rgba(162, 28, 175, 0.62);
}

.badge-type-default .active-filter-remove {
  background: rgba(82, 82, 91, 0.62);
}

.badge-financement-dpc .active-filter-remove {
  background: rgba(4, 120, 87, 0.62);
}

.badge-financement-fifpl .active-filter-remove {
  background: rgba(180, 83, 9, 0.62);
}

.badge-financement-default .active-filter-remove {
  background: rgba(82, 82, 91, 0.62);
}

/* Formats foncés : pastille blanche transparente + croix blanche */

.badge-format .active-filter-remove,
.badge-format-classe-virtuelle .active-filter-remove,
.badge-format-elearning .active-filter-remove,
.badge-format-presentiel .active-filter-remove,
.badge-format-mixte-presentiel .active-filter-remove,
.badge-format-mixte-classe-virtuelle .active-filter-remove {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.reset-button {
  border: 1px solid #dccfae;
  background: #f7f1e4;
  color: #6f6032;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.reset-button:hover {
  transform: translateY(-1px);
  background: #efe6d1;
  border-color: #ccb98a;
}

/* TOPBAR */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 22px;
}

#results-count {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

/* FORMATION CARDS */

.cards {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  padding-bottom: 54px;
}

.formation-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid rgba(231, 223, 207, 0.98);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.formation-card:hover {
  transform: translateY(-2px);
  border-color: #d5cab6;
  box-shadow: var(--shadow-hover);
}

.formation-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, #99874e, #c1b07a);
}

/* Liseré gauche basé uniquement sur le public */

.formation-card.card-public-empty::before {
  background: linear-gradient(180deg, #9ca3af, #d1d5db);
}

.formation-card.card-public-mixte::before {
  background: linear-gradient(180deg, #6d28d9, #c4b5fd);
}

.formation-card.card-public-medecins::before {
  background: linear-gradient(180deg, #1d4ed8, #93c5fd);
}

.formation-card.card-public-infirmiers::before {
  background: linear-gradient(180deg, #0f766e, #67e8f9);
}

.formation-card.card-public-pharmaciens::before {
  background: linear-gradient(180deg, #15803d, #86efac);
}

.formation-card.card-public-sages-femmes::before {
  background: linear-gradient(180deg, #be185d, #f9a8d4);
}

.formation-card.card-public-kines::before {
  background: linear-gradient(180deg, #c2410c, #fdba74);
}

.formation-card.card-public-dentistes::before {
  background: linear-gradient(180deg, #4338ca, #a5b4fc);
}

.formation-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 22px 24px;
  cursor: pointer;
}

.formation-title {
  margin: 0 0 11px;
  color: #1e1b16;
  font-size: 21px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

/* BADGES PUBLICS */

.badge-public {
  background: #f4efdf;
  color: #7f703f;
  border-color: #e6dcc0;
}

.badge-public-empty {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d1d5db;
}

.badge-public-mixte {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.badge-public-medecins {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.badge-public-infirmiers {
  background: #ecfeff;
  color: #0f766e;
  border-color: #a5f3fc;
}

.badge-public-pharmaciens {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.badge-public-sages-femmes {
  background: #fdf2f8;
  color: #be185d;
  border-color: #fbcfe8;
}

.badge-public-kines {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fdba74;
}

.badge-public-dentistes {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

/* BADGES FORMAT / TYPE / FINANCEMENT / SESSION */

.badge-format {
  background: #6f6758;
  color: #ffffff;
  border-color: #6f6758;
}

.badge-format-classe-virtuelle {
  background: #667a67;
  color: #ffffff;
  border-color: #667a67;
}

.badge-format-elearning {
  background: #99874e;
  color: #ffffff;
  border-color: #99874e;
}

.badge-format-mixte-presentiel,
.badge-format-presentiel {
  background: #b87945;
  color: #ffffff;
  border-color: #b87945;
}

.badge-format-mixte-classe-virtuelle {
  background: #7f6a57;
  color: #ffffff;
  border-color: #7f6a57;
}

.badge-type-action {
  letter-spacing: 0.02em;
}

.badge-type-epp {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.badge-type-fc {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}

.badge-type-pi {
  background: #fdf4ff;
  color: #a21caf;
  border-color: #f5d0fe;
}

.badge-type-default {
  background: #f4f4f5;
  color: #52525b;
  border-color: #d4d4d8;
}

.badge-financement {
  letter-spacing: 0.02em;
}

.badge-financement-dpc {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.badge-financement-fifpl {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.badge-financement-default {
  background: #f4f4f5;
  color: #52525b;
  border-color: #d4d4d8;
}

.badge-session-count {
  background: #f8f4ec;
  color: #8a6c45;
  border-color: #e9dcc6;
}

.badge-status-open {
  background: #eaf4ea;
  color: #3f6f42;
  border-color: #cce3cc;
}

.badge-status-full {
  background: #fff3e8;
  color: #a65f21;
  border-color: #f0cfad;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  user-select: none;
}

.toggle-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid #e6dcc0;
  background: #f4efdf;
  transition: transform 0.25s ease;
}

.formation-card.is-open .toggle-icon {
  transform: rotate(180deg);
}

.formation-details {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  height: 0;
  overflow: hidden;
  margin: 0;
  transition:
    grid-template-rows 0.28s ease,
    opacity 0.28s ease,
    height 0.28s ease;
}

.formation-card.is-open .formation-details {
  grid-template-rows: 1fr;
  opacity: 1;
  height: auto;
}

.formation-details-inner {
  min-height: 0;
  overflow: hidden;
  padding: 0 24px 24px;
}

.formation-card:not(.is-open) .formation-details-inner {
  padding-top: 0;
  padding-bottom: 0;
}

/* MISE EN PAGE DÉTAIL CARTE */

.formation-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
}

.formation-main {
  min-width: 0;
}

.formation-sidebar {
  min-width: 0;
}

.formation-sidebar .info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.formation-sidebar .info-block {
  padding: 12px;
  gap: 9px;
}

.formation-sidebar .info-icon {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 10px;
}

.formation-sidebar .info-icon svg {
  width: 15px;
  height: 15px;
}

.formation-sidebar .info-label {
  font-size: 9.5px;
  line-height: 1.25;
}

.formation-sidebar .info-value {
  font-size: 12.5px;
  line-height: 1.45;
}

/* INFOS */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.info-block {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px 16px;
  border-radius: 18px;
  border: 1px solid #eee7dc;
  background: linear-gradient(180deg, #fffefd 0%, #fbfaf7 100%);
}

.info-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 12px;
  background: #f4efdf;
  border: 1px solid #e6dcc0;
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.info-icon svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

.info-content {
  flex: 1;
  min-width: 0;
}

.info-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.info-value {
  color: #1e1b16;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

/* ENCART FICHE MÉMO */

.info-block-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.info-block-link:hover {
  transform: translateY(-1px);
  border-color: #d4c5a7;
  background: linear-gradient(180deg, #fffaf0 0%, #f8f1e3 100%);
  box-shadow: 0 8px 18px rgba(40, 33, 20, 0.06);
}

.memo-info-block {
  border-color: rgba(153, 135, 78, 0.35);
}

.memo-info-block .info-icon {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.memo-info-block .info-value {
  color: var(--accent-dark);
}

.memo-info-block .info-icon svg {
  stroke: currentColor;
}

.public-specialite-list {
  display: inline;
}

.public-specialite-extra[hidden] {
  display: none;
}

.inline-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
}

.inline-toggle:hover {
  text-decoration: underline;
}

.section-block {
  margin-top: 18px;
  border-radius: 20px;
  border: 1px solid #eee7dc;
  background: linear-gradient(180deg, #fffefd 0%, #fbfaf7 100%);
  overflow: hidden;
}

.formation-main .section-block:first-child {
  margin-top: 0;
}

.section-inner {
  padding: 18px;
}

.section-title {
  display: block;
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 800;
}

.context-text {
  margin: 0;
  color: #2e2a24;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-line;
}

/* SESSION CARDS */

.sessions-list {
  display: grid;
  gap: 12px;
}

.session-card {
  border-radius: 18px;
  border: 1px solid #e6dccb;
  background: #fffdf8;
  padding: 15px;
}

.session-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.session-name {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  font-weight: 800;
  color: #1e1b16;
}

.session-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.session-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid #e9dcc6;
  background: #f8f4ec;
  color: #8a6c45;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.session-meta-badge span {
  color: #9b8a69;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.session-meta-badge strong {
  color: #6f6032;
  font-size: 12px;
  font-weight: 800;
}

.session-date-badge {
  background: #fffaf0;
  color: #7f703f;
  border-color: #eadfc8;
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.session-field {
  padding: 10px 11px;
  border-radius: 14px;
  background: #faf6ec;
  border: 1px solid #eee4d2;
}

.session-field span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.session-field strong {
  color: #1e1b16;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 650;
}

/* EMPTY / ERROR */

.empty-state {
  padding: 34px;
  border-radius: 24px;
  border: 1px dashed #d9cfbf;
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted);
  text-align: center;
  box-shadow: var(--shadow);
}

/* RESPONSIVE */

@media (max-width: 1180px) {
  .filters-grid {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
  }

  .filter-search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .formation-layout {
    grid-template-columns: 1fr;
  }

  .formation-sidebar {
    order: -1;
  }

  .formation-sidebar .info-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
}

@media (max-width: 980px) {
  .hero {
    min-height: auto;
    flex-direction: column;
    padding: 18px;
  }

  .hero-logo-wrap,
  .hero-actions {
    position: static;
    transform: none;
  }

  .hero-logo-wrap {
    margin-bottom: 10px;
  }

  .hero-logo {
    width: 160px;
  }

  .hero-actions {
    justify-content: center;
    margin-bottom: 12px;
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .filter-search {
    grid-column: 1 / -1;
  }

  .formation-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .toggle {
    justify-self: start;
  }

  .session-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .session-meta-row {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(100%, calc(100% - 20px));
  }

  h1 {
    font-size: 28px;
  }

  .filters-panel,
  .public-block,
  .advanced-filters {
    padding: 14px;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .filter-search {
    grid-column: auto;
  }

  .filters-footer {
    align-items: stretch;
  }

  .active-filters {
    width: 100%;
    min-width: 0;
  }

  .active-filter-badge {
    max-width: 100%;
  }

  .reset-button {
    width: 100%;
  }

  .single-filter-menu,
  .multi-filter-menu {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-top: 8px;
    box-shadow: 0 10px 24px rgba(40, 33, 20, 0.08);
  }

  .formation-header {
    padding: 20px 18px;
  }

  .formation-details-inner {
    padding: 0 18px 20px;
  }

  .formation-card:not(.is-open) .formation-details-inner {
    padding-top: 0;
    padding-bottom: 0;
  }

  .formation-title {
    font-size: 19px;
  }

  .formation-sidebar .info-grid {
    grid-template-columns: 1fr;
  }

  .formation-sidebar .info-block {
    padding: 13px;
  }

  .formation-sidebar .info-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .formation-sidebar .info-icon svg {
    width: 16px;
    height: 16px;
  }

  .formation-sidebar .info-label {
    font-size: 10px;
  }

  .formation-sidebar .info-value {
    font-size: 13px;
  }

  .session-card-header {
    flex-direction: column;
  }

  .session-meta-row {
    width: 100%;
    justify-content: flex-start;
  }

  .session-meta-badge,
  .session-meta-row .badge {
    white-space: normal;
  }
}
