/**
 * Styles Bad'Nantes Calendar — charte du club appliquée aux classes FullCalendar (.fc-).
 *
 * Toutes les couleurs sont centralisées dans :root pour une édition facile.
 */

:root {
	--bn-vert-fonce: #0d3b32;   /* vert foncé principal */
	--bn-vert-clair: #14554a;   /* vert clair (hover, alternance) */
	--bn-citron: #c8f24a;       /* jaune-vert citron (texte événements, accents) */
	--bn-fond-case: #f4f7f2;    /* fond des cases de jour */
	--bn-citron-clair: #eefbc9; /* surlignage discret du jour courant */
	--bn-texte-clair: #ffffff;  /* texte sur fond foncé */
	--bn-radius: 5px;
}

/* Conteneur */
.bn-calendar-wrapper {
	margin: 1rem 0;
}

.bn-calendar {
	font-family: inherit;
}

/* Avertissement affiché au-dessus du calendrier quand le flux ICS est injoignable. */
.bn-calendar-error {
	margin: 0 0 0.75rem;
	padding: 0.6rem 0.9rem;
	border-left: 4px solid var(--bn-citron);
	border-radius: var(--bn-radius);
	background-color: var(--bn-vert-fonce);
	color: var(--bn-texte-clair);
	font-size: 0.9em;
}

/* En-têtes de colonnes (jours de la semaine / dates) */
.bn-calendar .fc-col-header-cell {
	background-color: var(--bn-vert-fonce);
}

.bn-calendar .fc-col-header-cell-cushion {
	color: var(--bn-texte-clair);
	text-transform: uppercase;
	font-weight: 700;
	letter-spacing: 0.03em;
	padding: 8px 4px;
	text-decoration: none;
}

/* Cases de jour */
.bn-calendar .fc-daygrid-day {
	background-color: var(--bn-fond-case);
}

.bn-calendar .fc-timegrid-slot,
.bn-calendar .fc-timegrid-col {
	background-color: var(--bn-fond-case);
}

/* Numéro du jour */
.bn-calendar .fc-daygrid-day-number {
	color: var(--bn-vert-fonce);
	font-weight: 600;
	text-decoration: none;
}

/* Jour courant surligné en vert citron très clair */
.bn-calendar .fc-day-today {
	background-color: var(--wp--preset--color--accent-1, var(--bn-vert-fonce)) !important;
	color: var(--wp--preset--color--base, var(--bn-texte-clair));
}

.bn-calendar .fc-day-today .fc-daygrid-day-number {
	color: var(--wp--preset--color--base, var(--bn-vert-fonce));
}

/* En-tête de colonne du jour courant : couleur base (les autres en-têtes restent clairs). */
.bn-calendar th.fc-day-today .fc-col-header-cell-cushion {
	color: var(--wp--preset--color--base, var(--bn-texte-clair));
}

/* Événements */
.bn-calendar .fc-event,
.bn-calendar .fc-event .fc-event-main {
	background-color: var(--bn-vert-fonce);
	border-color: var(--bn-vert-fonce);
	color: var(--bn-citron);
	border-radius: 0;
}

.bn-calendar .fc-event-title,
.bn-calendar .fc-event-time {
	color: var(--bn-citron);
}

/* Alternance de teinte pour aérer visuellement (un événement sur deux) */
.bn-calendar .fc-event:nth-of-type(even),
.bn-calendar .fc-event:nth-of-type(even) .fc-event-main {
	background-color: var(--bn-vert-clair);
	border-color: var(--bn-vert-clair);
}

/* Événements daygrid (mois/semaine) : pas de marge autour. !important requis pour
   battre les défauts FullCalendar (.fc-direction-ltr .fc-daygrid-event.fc-event-start,
   spécificité plus forte + injectés au runtime). */
.bn-calendar .fc-daygrid-event {
	margin: 0 !important;
}

/* Contenu personnalisé des pastilles (heure début–fin, titre, bloc lieu) */
.bn-calendar .bn-event {
	padding: 2px 4px;
	line-height: 1.25;
	/* Autorise le retour à la ligne (FullCalendar force nowrap sur certaines vues). */
	white-space: normal;
	/* Fond = couleur accent-1 du thème (fallback vert club si le preset est absent). */
	background-color: var(--wp--preset--color--accent-1, var(--bn-vert-fonce));
	/* Texte = couleur base du thème (fallback texte clair). */
	color: var(--wp--preset--color--base, var(--bn-texte-clair));
}

.bn-calendar .bn-event-time {
	font-weight: 700;
	font-size: 0.85em;
}

.bn-calendar .bn-event-title {
	font-weight: 600;
}

.bn-calendar .bn-event-location {
	margin-top: 2px;
	font-size: 0.85em;
	opacity: 0.95;
}

/* Bloc lieu — le gabarit par défaut n'utilise QUE des classes .bn-loc* : aucune règle de
   layout du thème/Gutenberg ne le cible, donc rien à neutraliser et aucun !important.
   Si tu colles un gabarit Gutenberg à la place, ces règles ne s'appliqueront plus. */
.bn-calendar .bn-loc {
	display: flex;
	align-items: center;
}

/* Icône Maps : couleurs inversées par rapport à la pastille.
   Sélecteur volontairement à 3 classes (0-3-0) : FullCalendar injecte au runtime
   « .fc .fc-list-event-title a { color: inherit } » (0-2-1), qui attrape ce lien en vue
   liste. Ne pas raccourcir en « .bn-calendar .bn-loc-icon » : l'icône perdrait sa couleur. */
.bn-calendar .bn-event-location .bn-loc-icon {
	display: flex;
	padding: 10px;
	background-color: var(--wp--preset--color--base, var(--bn-texte-clair));
	color: var(--wp--preset--color--accent-1, var(--bn-vert-fonce));
	text-decoration: none;
}

.bn-calendar .bn-loc-icon svg {
	display: block;
	width: 1em;
	height: 1.2em;
}

/* Nom + adresse empilés. min-width:0 autorise le rétrécissement sous la largeur du
   contenu ; sans coupure en plein mot (le retour à la ligne se fait entre les mots). */
.bn-calendar .bn-loc-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding-left: 4px;
}

.bn-calendar .bn-loc-name {
	font-weight: 600;
}

.bn-calendar .bn-loc-address {
	color: var(--wp--preset--color--accent-4, var(--bn-citron));
}

.bn-calendar .bn-event-location img {
	max-width: 100%;
	height: auto;
	border-radius: 3px;
}

/* En vue liste, le fond est clair : on repasse en vert foncé pour la lisibilité */
.bn-calendar .fc-list-event .bn-event-time,
.bn-calendar .fc-list-event .bn-event-title,
.bn-calendar .fc-list-event .bn-event-location {
	color: var(--bn-vert-fonce);
}

/* Pastille de couleur des événements en vue liste : masquée */
.bn-calendar .fc-list-event-dot {
	display: none;
}

/* Titre du calendrier */
.bn-calendar .fc-toolbar-title {
	color: var(--bn-vert-fonce);
	font-weight: 700;
}

/* Boutons de navigation */
.bn-calendar .fc-button,
.bn-calendar .fc-button-primary {
	background-color: var(--bn-vert-fonce);
	border-color: var(--bn-vert-fonce);
	color: var(--bn-texte-clair);
	text-transform: none;
	box-shadow: none;
}

.bn-calendar .fc-button-primary:hover:not(:disabled),
.bn-calendar .fc-button-primary:focus {
	background-color: var(--bn-vert-clair);
	border-color: var(--bn-vert-clair);
	color: var(--bn-texte-clair);
}

/* Bouton de la vue active */
.bn-calendar .fc-button-primary:not(:disabled).fc-button-active {
	background-color: var(--bn-citron);
	border-color: var(--bn-citron);
	color: var(--bn-vert-fonce);
}

.bn-calendar .fc-button-primary:disabled {
	background-color: var(--bn-vert-clair);
	border-color: var(--bn-vert-clair);
	opacity: 0.6;
}

/* Vue liste (mobile) : rester lisible */
.bn-calendar .fc-list {
	border-radius: var(--bn-radius);
	overflow: hidden;
}

.bn-calendar .fc-list-day-cushion {
	background-color: var(--bn-vert-fonce);
	color: var(--bn-texte-clair);
	text-transform: uppercase;
}

/* Libellé de la date dans l'en-tête de jour (vue liste) : couleur accent-1 du thème. */
.bn-calendar .fc-list-day-text {
	color: var(--wp--preset--color--accent-1, var(--bn-citron));
}

.bn-calendar .fc-list-event:hover td {
	background-color: var(--bn-citron-clair);
}

/* Lien de titre de FullCalendar (vue liste). Enfant direct uniquement : un sélecteur
   descendant attraperait aussi le lien de l'icône du bloc lieu et écraserait sa couleur. */
.bn-calendar .fc-list-event-title > a {
	color: var(--bn-vert-fonce);
	font-weight: 600;
}

.bn-calendar .fc-list-event-dot {
	border-color: var(--bn-vert-fonce);
}

/* Responsive : barre d'outils empilée sur petit écran */
@media (max-width: 600px) {
	.bn-calendar .fc-toolbar.fc-header-toolbar {
		flex-direction: column;
		gap: 0.5rem;
	}

	.bn-calendar .fc-toolbar-title {
		font-size: 1.2rem;
	}
}

/* Créneaux rendus par PHP.
   Ce bloc n'est visible que le temps du chargement de FullCalendar, qui vide le
   conteneur au démarrage. Il reste affiché si le JS échoue : il doit donc être
   lisible tel quel, et non un simple entrefilet technique. */
.bn-slots {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.bn-slot {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 10px 12px;
	border-radius: var(--bn-radius);
	background: var(--bn-vert-fonce);
	color: var(--bn-texte-clair);
}

.bn-slot:nth-of-type(even) {
	background: var(--bn-vert-clair);
}

.bn-slot-time {
	font-weight: 700;
	text-transform: capitalize;
}

.bn-slot-title {
	color: var(--wp--preset--color--accent-4, var(--bn-citron));
	font-weight: 600;
}

.bn-slot-location {
	font-size: 0.9em;
	opacity: 0.95;
}
