/*
 * Styles du mode d'affichage "Calendrier" (Assoc Event Manager).
 *
 * Réutilise les mêmes propriétés CSS personnalisées que le mode Cartes
 * (--aem-font-family, --aem-font-size, --aem-card-bg, --aem-title-color,
 * --aem-card-text-color, --aem-btn-color) : elles sont redéfinies ici avec les
 * mêmes valeurs par défaut sur .aem-calendar-wrap, pour que la modale de détail
 * (qui réutilise le template card.php, donc les règles .aem-card/.aem-btn de
 * cards.css) hérite correctement de l'apparence configurée, même si elle n'est
 * pas physiquement un enfant de .aem-cards-wrap.
 */

.aem-calendar-wrap {
	--aem-font-family: inherit;
	--aem-font-size: 16px;
	--aem-card-bg: #ffffff;
	--aem-title-color: inherit;
	--aem-card-text-color: inherit;
	--aem-btn-color: #2271b1;

	box-sizing: border-box;
	font-family: var(--aem-font-family);
	font-size: var(--aem-font-size);
}

.aem-calendar-wrap *,
.aem-calendar-wrap *::before,
.aem-calendar-wrap *::after {
	box-sizing: inherit;
}

.aem-calendar-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin-bottom: 1rem;
}

.aem-calendar-nav__btn {
	border: 1px solid rgba(0, 0, 0, 0.15);
	background: transparent;
	border-radius: 6px;
	padding: 0.35rem 0.75rem;
	cursor: pointer;
	font-size: 1em;
	font-family: var(--aem-font-family);
}

.aem-calendar-nav__btn:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

.aem-calendar-nav__label {
	font-weight: 600;
	font-size: 1.05em;
	min-width: 10em;
	text-align: center;
	text-transform: capitalize;
}

.aem-calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
}

.aem-calendar-grid--header {
	margin-bottom: 4px;
}

.aem-calendar-day-label {
	text-align: center;
	font-size: 0.8em;
	font-weight: 600;
	opacity: 0.6;
	padding: 0.25rem 0;
}

.aem-calendar-cell {
	min-height: 90px;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 6px;
	padding: 0.35rem;
	display: flex;
	flex-direction: column;
	gap: 3px;
	overflow: hidden;
}

.aem-calendar-cell--empty {
	border: none;
	background: transparent;
}

.aem-calendar-cell__day {
	font-size: 0.8em;
	font-weight: 600;
	opacity: 0.6;
}

.aem-calendar-pill {
	display: block;
	width: 100%;
	text-align: left;
	border: none;
	border-radius: 4px;
	padding: 2px 5px;
	font-size: 0.72em;
	line-height: 1.3;
	background: #999999;
	color: #fff;
	cursor: pointer;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	font-family: var(--aem-font-family);
}

/* Mobile : cellules plus compactes, moins de hauteur minimale. */
@media (max-width: 700px) {
	.aem-calendar-cell {
		min-height: 60px;
	}

	.aem-calendar-day-label {
		font-size: 0.7em;
	}
}

.aem-calendar-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
}

.aem-calendar-modal[hidden] {
	display: none;
}

.aem-calendar-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.aem-calendar-modal__content {
	position: relative;
	max-width: 480px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	background: var(--aem-card-bg);
	border-radius: 8px;
	padding: 1.5rem;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.aem-calendar-modal__close {
	position: absolute;
	top: 0.5rem;
	right: 0.75rem;
	border: none;
	background: transparent;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.6;
}

.aem-calendar-modal__close:hover {
	opacity: 1;
}

/* À l'intérieur de la modale, la carte de détail retrouve son apparence normale
   (elle est habituellement masquée via [hidden] dans .aem-calendar-details). */
.aem-calendar-modal__body .aem-card {
	box-shadow: none;
	border: none;
	padding: 0;
}
