/* HelloAsso Events Display — frontend
   Toutes les couleurs « marque » dérivent des variables posées par PHP :
   --hed-accent, --hed-cal-header, --hed-radius, --hed-font-size,
   --hed-title-color, --hed-text-color
*/

.hed-app {
	--hed-accent: #2563eb;
	--hed-cal-header: #1e293b;
	--hed-radius: 12px;
	--hed-font-size: 16px;
	--hed-title-color: #0f172a;
	--hed-text-color: #475569;
	--hed-border: #e5e7eb;
	--hed-surface: #ffffff;
	--hed-muted: #f8fafc;
	--hed-card-bg: #ffffff;
	--hed-card-border: #e5e7eb;
	--hed-card-bw: 1px;
	--hed-card-shadow: 0 1px 2px rgba(15, 23, 42, .05);
	--hed-card-shadow-hover: 0 10px 24px rgba(15, 23, 42, .10);
	--hed-card-hover-y: -3px;
	--hed-btn-text: #ffffff;
	--hed-btn-radius: 8px;
	font-size: var(--hed-font-size);
	color: var(--hed-text-color);
	line-height: 1.5;
	box-sizing: border-box;
}
.hed-app *,
.hed-app *::before,
.hed-app *::after { box-sizing: border-box; }

.hed-app img { max-width: 100%; height: auto; display: block; }

/* ---------- Toolbar ---------- */
.hed-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
}
.hed-search { flex: 1 1 220px; min-width: 200px; }
.hed-search__input {
	width: 100%;
	padding: 9px 14px;
	border: 1px solid var(--hed-border);
	border-radius: var(--hed-btn-radius);
	font-size: 0.95em;
	background: var(--hed-surface);
}
.hed-search__input:focus {
	outline: none;
	border-color: var(--hed-accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--hed-accent) 20%, transparent);
}

.hed-filters, .hed-switch { display: flex; flex-wrap: wrap; gap: 8px; }

.hed-filter {
	--hed-tag-bg: #f1f5f9;
	--hed-tag-text: #334155;
	border: 1px solid transparent;
	background: var(--hed-tag-bg);
	color: var(--hed-tag-text);
	padding: 6px 14px;
	border-radius: var(--hed-btn-radius);
	font-size: 0.85em;
	cursor: pointer;
	transition: transform .12s ease, box-shadow .12s ease;
}
.hed-filter:hover { transform: translateY(-1px); }
.hed-filter.is-active {
	box-shadow: 0 0 0 2px var(--hed-card-bg, #fff), 0 0 0 4px var(--hed-accent);
	font-weight: 700;
	transform: translateY(-1px) scale(1.04);
}
.hed-filter.is-active::before {
	content: "✓";
	font-weight: 700;
	margin-right: 5px;
}
/* Quand un tag est sélectionné, on estompe les autres pour faire ressortir l'actif. */
.hed-filters--filtering .hed-filter:not(.is-active) { opacity: .55; }
.hed-filters--filtering .hed-filter:not(.is-active):hover { opacity: .85; }

/* Menu déroulant de filtre par type. */
.hed-filter-select {
	border: 1px solid var(--hed-border);
	background: var(--hed-surface);
	color: var(--hed-text-color);
	padding: 7px 34px 7px 14px;
	border-radius: var(--hed-btn-radius);
	font-size: 0.85em;
	font-weight: 600;
	cursor: pointer;
	max-width: 100%;
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23667085' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}
.hed-filter-select:focus-visible { outline: 2px solid var(--hed-accent); outline-offset: 1px; }

.hed-switch__btn {
	border: 1px solid var(--hed-border);
	background: var(--hed-surface);
	color: var(--hed-text-color);
	padding: 7px 14px;
	border-radius: var(--hed-btn-radius);
	font-size: 0.85em;
	cursor: pointer;
}
.hed-switch__btn.is-active {
	background: var(--hed-accent);
	border-color: var(--hed-accent);
	color: #fff;
}

/* Sélecteur temporel (à venir / passés / tous) — contrôle segmenté. */
.hed-timefilter {
	display: inline-flex;
	border: 1px solid var(--hed-border);
	border-radius: var(--hed-btn-radius);
	overflow: hidden;
	background: var(--hed-surface);
}
.hed-timefilter__btn {
	border: none;
	background: transparent;
	color: var(--hed-text-color);
	padding: 7px 16px;
	font-size: 0.85em;
	font-weight: 600;
	cursor: pointer;
	transition: background .12s ease, color .12s ease;
}
.hed-timefilter__btn + .hed-timefilter__btn { border-left: 1px solid var(--hed-border); }
.hed-timefilter__btn:hover { background: color-mix(in srgb, var(--hed-accent) 10%, transparent); }
.hed-timefilter__btn.is-active {
	background: var(--hed-accent);
	color: #fff;
}

/* ---------- Boutons / CTA ---------- */
.hed-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	gap: 6px;
	background: var(--hed-accent);
	color: var(--hed-btn-text);
	text-decoration: none;
	padding: 9px 16px 8px;
	border-radius: var(--hed-btn-radius);
	font-size: 0.9em;
	font-weight: 600;
	transition: filter .12s ease;
}
.hed-btn:hover { filter: brightness(0.93); color: var(--hed-btn-text); }
.hed-btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ---------- Tags ---------- */
.hed-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.hed-tag-badge {
	display: inline-flex;
	align-items: center;
	line-height: 1;
	font-size: 0.66em;
	font-weight: normal;
	padding: 5px 9px 4px;
	border-radius: min(var(--hed-radius, 12px), 12px);
	background: #eef2ff;
	color: #3730a3;
	letter-spacing: .02em;
}
.hed-tag-badge.is-clickable {
	border: none;
	cursor: pointer;
	transition: transform .12s ease, filter .12s ease;
}
.hed-tag-badge.is-clickable:hover { filter: brightness(.95); transform: translateY(-1px); }

/* Image cliquable (liste/cartes). */
.hed-media-link { display: block; width: 100%; height: 100%; }
.hed-media-link img { display: block; }

/* ---------- État vide ---------- */
.hed-empty {
	text-align: center;
	padding: 40px 16px;
	color: var(--hed-text-color);
	background: var(--hed-muted);
	border-radius: var(--hed-radius);
}

/* ---------- Vue CARTES ---------- */
.hed-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 22px;
}
/* Nombre de colonnes imposé via l'attribut columns (vues cartes et liste). */
.hed-app[data-cols="1"] .hed-cards,
.hed-app[data-cols="1"] .hed-list { grid-template-columns: 1fr; }
.hed-app[data-cols="2"] .hed-cards,
.hed-app[data-cols="2"] .hed-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hed-app[data-cols="3"] .hed-cards,
.hed-app[data-cols="3"] .hed-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hed-app[data-cols="4"] .hed-cards,
.hed-app[data-cols="4"] .hed-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* La liste devient une grille seulement si un nombre de colonnes est imposé. */
.hed-app[data-cols] .hed-list { display: grid; }
.hed-card {
	display: flex;
	flex-direction: column;
	background: var(--hed-card-bg);
	border: var(--hed-card-bw) solid var(--hed-card-border);
	border-radius: var(--hed-radius);
	box-shadow: var(--hed-card-shadow);
	overflow: hidden;
	transition: transform .15s ease, box-shadow .15s ease;
}
.hed-card.is-clickable { cursor: pointer; }
.hed-card:hover {
	transform: translateY(var(--hed-card-hover-y));
	box-shadow: var(--hed-card-shadow-hover);
}
.hed-card__media { aspect-ratio: 16 / 9; background: var(--hed-muted); position: relative; }
.hed-card__media img { width: 100%; height: 100%; object-fit: cover; }
.hed-card__media--empty {
	background: linear-gradient(135deg, color-mix(in srgb, var(--hed-accent) 14%, #fff), var(--hed-muted));
}
.hed-card__body { padding: 16px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.hed-card__title { margin: 0; font-size: 1.05em; color: var(--hed-title-color); line-height: 1.3; font-weight: 600; font-family: inherit; }
.hed-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.hed-card__meta .hed-card__date + .hed-card__loc::before { content: "·"; margin-right: 10px; opacity: .5; }
.hed-card__date { margin: 0; font-size: 0.85em; font-weight: 600; color: var(--hed-accent); line-height: 1.3; }
.hed-card__loc, .hed-card__desc { margin: 0; font-size: 0.85em; }
.hed-card__loc { line-height: 1.3; }
.hed-card__desc { color: var(--hed-text-color); line-height: 1.4; margin-top: 9px; white-space: pre-line; }

/* Tag : superposition en bas à droite de l'image (cartes). */
.hed-card__tags { margin: 0; }
.hed-card__tags--overlay {
	position: absolute;
	right: 8px;
	bottom: 8px;
	justify-content: flex-end;
	max-width: calc(100% - 16px);
}
.hed-card__tags--overlay .hed-tag-badge { box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.hed-card__tags--inline { justify-content: flex-end; }

/* Tag aligné à droite (liste). */
.hed-list__tags { align-self: flex-end; margin: 0; }
.hed-card__footer {
	margin-top: auto;
	padding-top: 6px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}
.hed-card__price { font-weight: 700; color: var(--hed-title-color); font-size: 1.1em; }

/* ---------- Vue LISTE ---------- */
.hed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.hed-list__item {
	display: flex;
	gap: 0;
	background: var(--hed-card-bg);
	border: var(--hed-card-bw) solid var(--hed-card-border);
	border-radius: var(--hed-radius);
	overflow: hidden;
	box-shadow: var(--hed-card-shadow);
	transition: box-shadow .15s ease;
}
.hed-list__item.is-clickable { cursor: pointer; }
.hed-list__item:hover { box-shadow: var(--hed-card-shadow-hover); }
.hed-list__media { flex: 0 0 170px; overflow: hidden; background: var(--hed-muted); }
.hed-list__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hed-list__body { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 14px 16px; }
.hed-list__title { margin: 0; font-size: 1.1em; color: var(--hed-title-color); font-weight: 600; font-family: inherit; }
.hed-list__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.hed-list__meta .hed-list__date + .hed-list__loc::before { content: "·"; margin-right: 10px; opacity: .5; }
.hed-list__date { margin: 0; font-size: 0.9em; font-weight: 600; color: var(--hed-accent); }
.hed-list__loc { margin: 0; font-size: 0.85em; opacity: .85; }
.hed-list__desc { margin: 9px 0 0; font-size: 0.88em; line-height: 1.4; white-space: pre-line; }
.hed-list__footer { display: flex; align-items: center; gap: 14px; margin-top: auto; padding-top: 4px; }
.hed-list__price { font-weight: 700; color: var(--hed-title-color); font-size: 1.1em; }
.hed-list__cta { margin-left: auto; }

/* ---------- Calendrier mensuel ---------- */
.hed-cal { border: var(--hed-card-bw) solid var(--hed-card-border); border-radius: var(--hed-radius); overflow: hidden; background: var(--hed-card-bg); }
.hed-cal__head, .hed-year .hed-cal__head {
	position: relative;
	display: flex; align-items: center; justify-content: center;
	background: var(--hed-cal-header);
	color: #fff;
	padding: 12px 16px;
}
.hed-cal__title { font-weight: 700; font-size: 1.1em; text-transform: capitalize; text-align: center; }
.hed-cal__actions { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 8px; }
.hed-cal__today { display: inline-flex; align-items: center; justify-content: center; }
.hed-cal__today svg { display: block; }
.hed-cal__today.is-current { opacity: .45; cursor: default; }
.hed-cal__nav {
	background: rgba(255, 255, 255, .15);
	border: none; color: #fff;
	width: 34px; height: 34px;
	border-radius: var(--hed-btn-radius); cursor: pointer;
	font-size: 1.2em; line-height: 1;
}
.hed-cal__nav:hover { background: rgba(255, 255, 255, .28); }
.hed-cal__dow {
	display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
	background: var(--hed-muted);
	font-size: 0.78em; font-weight: 600; text-align: center;
	border-bottom: 1px solid var(--hed-card-border);
}
.hed-cal__dow span { padding: 8px 0; }
.hed-cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.hed-cal__cell {
	min-height: 92px;
	min-width: 0;
	padding: 6px;
	position: relative;
	text-align: center;
}
.hed-cal__cell--empty { background: var(--hed-muted); }
.hed-cal__day { font-size: 0.82em; font-weight: 600; color: var(--hed-text-color); }
.hed-cal__cell.is-today .hed-cal__day {
	background: var(--hed-accent); color: #fff;
	border-radius: 50%; width: 24px; height: 24px;
	display: inline-flex; align-items: center; justify-content: center;
}
.hed-cal__events { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; min-width: 0; }
.hed-cal__chip {
	border: none; text-align: left; cursor: pointer;
	font-size: 0.72em; padding: 2px 6px; border-radius: min(var(--hed-radius, 12px), 8px);
	background: color-mix(in srgb, var(--hed-accent) 15%, #fff);
	color: var(--hed-title-color);
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	max-width: 100%;
}

/* ---------- Calendrier annuel ---------- */
.hed-year { border: var(--hed-card-bw) solid var(--hed-card-border); border-radius: var(--hed-radius); overflow: hidden; background: var(--hed-card-bg); }
.hed-year__months {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 18px;
	padding: 18px;
}
.hed-year__month-name { font-weight: 700; color: var(--hed-title-color); margin-bottom: 6px; text-transform: capitalize; font-size: 0.95em; }
.hed-year__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.hed-year__day {
	aspect-ratio: 1;
	display: flex; flex-direction: column;
	align-items: center; justify-content: center;
	font-size: 0.7em; color: var(--hed-text-color);
	border-radius: 6px; position: relative;
}
.hed-year__day--empty { visibility: hidden; }
.hed-year__day.is-today { outline: 2px solid var(--hed-accent); outline-offset: -2px; }
.hed-year__day.has-events { cursor: pointer; font-weight: 600; color: var(--hed-title-color); }
.hed-year__day.has-events:hover { background: var(--hed-muted); }
.hed-year__dots { display: flex; gap: 2px; margin-top: 1px; }
.hed-year__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--hed-accent); }

/* ---------- Tooltip ---------- */
.hed-tooltip {
	position: absolute;
	z-index: 9999;
	max-width: 280px;
	background: var(--hed-card-bg);
	border: var(--hed-card-bw) solid var(--hed-card-border);
	border-radius: var(--hed-radius);
	box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
	padding: 12px 14px;
	display: flex; flex-direction: column; gap: 6px;
	font-size: 13px; color: var(--hed-text-color);
	pointer-events: auto;
}
.hed-tooltip__title { color: var(--hed-title-color); font-size: 14px; font-weight: 600; }
.hed-tooltip__date { font-weight: 600; color: var(--hed-accent); }
.hed-tooltip__price { font-weight: 700; color: var(--hed-title-color); font-size: 1.1em; }
.hed-tooltip__loc { color: var(--hed-text-color); }
.hed-tooltip__rowprice { font-weight: 700; font-size: 1.1em; color: var(--hed-title-color); }
.hed-tooltip__cta { margin-top: 6px; align-self: flex-start; }
.hed-tooltip--day { gap: 4px; }
.hed-tooltip__dayhead { font-weight: 700; color: var(--hed-title-color); font-size: 13px; margin-bottom: 2px; }
.hed-tooltip__row { display: flex; align-items: flex-start; gap: 8px; padding: 5px 4px; border-radius: 8px; text-decoration: none; }
.hed-tooltip__row:hover { background: var(--hed-muted); }
.hed-tooltip__dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; margin-top: 5px; }
.hed-tooltip__thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; }
.hed-tooltip__rowtext { display: flex; flex-direction: column; }
.hed-tooltip__event { color: var(--hed-title-color); font-weight: 600; font-size: 13px; }
.hed-tooltip__rowmeta { color: var(--hed-accent); font-size: 12px; font-weight: 600; }
.hed-tooltip__row:hover .hed-tooltip__event { text-decoration: underline; }

/* Popup « carte » du mode mois : miniature en fond + contenu cliquable. */
.hed-tooltip--card { padding: 0; max-width: 300px; overflow: hidden; }
.hed-tooltip--card.is-clickable { cursor: pointer; }
.hed-tooltip__media {
	height: 120px;
	background-size: cover;
	background-position: center;
	position: relative;
}
.hed-tooltip__inner { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; }
.hed-tooltip__tag {
	align-self: flex-start;
	display: inline-flex; align-items: center; line-height: 1;
	font-size: 0.7em; font-weight: normal; padding: 4px 9px 3px; border-radius: min(var(--hed-radius, 12px), 12px);
	background: #eef2ff; color: #3730a3;
}
.hed-tooltip__tag--overlay {
	position: absolute;
	right: 8px;
	bottom: 8px;
	align-self: auto;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.hed-tooltip__tag--inline { align-self: flex-end; }
.hed-tooltip--card .hed-tooltip__title { font-size: 15px; font-weight: 600; }

/* ---------- Repli (no-JS / SEO) ---------- */
.hed-app .hed-fallback { list-style: none; margin: 0; padding: 0; }
.hed-fallback__item { padding: 6px 0; border-bottom: 1px solid var(--hed-border); }
.hed-noscript-note { font-style: italic; }

/* ---------- Focus accessibilité ---------- */
.hed-app a:focus-visible,
.hed-app button:focus-visible,
.hed-app [tabindex]:focus-visible {
	outline: 2px solid var(--hed-accent);
	outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
	/* Sur tablette, 3 ou 4 colonnes retombent à 2 pour rester lisibles. */
	.hed-app[data-cols="3"] .hed-cards,
	.hed-app[data-cols="4"] .hed-cards,
	.hed-app[data-cols="3"] .hed-list,
	.hed-app[data-cols="4"] .hed-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.hed-list__item { flex-direction: column; }
	.hed-list__media { flex-basis: auto; height: 180px; }
	.hed-cal__cell { min-height: 64px; }
	.hed-cal__chip { font-size: 0.65em; }
	.hed-toolbar { flex-direction: column; align-items: stretch; }
	/* En colonne, flex-basis deviendrait une hauteur : on neutralise. */
	.hed-search { flex: 0 0 auto; min-width: 0; width: 100%; }
	.hed-timefilter, .hed-switch, .hed-filters { flex: 0 0 auto; }
	/* Téléphone : toujours une seule colonne, quel que soit columns. */
	.hed-app[data-cols] .hed-cards,
	.hed-app[data-cols] .hed-list { grid-template-columns: 1fr; }
	/* Vue mois : titre aligné à gauche et actions en flux, pour éviter que les
	   longs mois (« Septembre 2026 ») ne chevauchent les boutons de droite. */
	.hed-cal .hed-cal__head { justify-content: flex-start; }
	.hed-cal .hed-cal__title { text-align: left; }
	.hed-cal .hed-cal__actions { position: static; transform: none; margin-left: auto; }
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
	.hed-app * { transition: none !important; animation: none !important; }
}
