/*
 * Hébergement Calendar — feuille de style par défaut.
 *
 * Pensée pour s'intégrer dans n'importe quel thème :
 *   - aucune police déclarée (héritage)
 *   - tailles en em/rem (scale avec le contexte)
 *   - palette pastel saturée, contraste AA
 *   - currentColor pour les accents (suit le thème)
 *
 * Toutes les classes commencent par `hebcal-`.
 *
 * Structure :
 *   .hebcal-calendar
 *     .hebcal-nav (révélée par .hebcal-js)
 *       .hebcal-nav-btn[.hebcal-nav-prev|-today|-next]
 *     .hebcal-months
 *       .hebcal-month
 *         .hebcal-month-header
 *         .hebcal-weekdays > .hebcal-weekday
 *         .hebcal-days     > .hebcal-day [.hebcal-empty | .hebcal-available
 *                                         | .hebcal-booked | .hebcal-past
 *                                         | .hebcal-today]
 *     .hebcal-legend
 *       .hebcal-legend-item > .hebcal-swatch[-available|-booked]
 */

.hebcal-calendar {
	box-sizing: border-box;
	max-width: 100%;
	line-height: 1.4;
	color: inherit;
}

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

/* --- Barre de navigation (masquée par défaut, révélée par JS) --- */
.hebcal-nav {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
}

.hebcal-calendar.hebcal-js .hebcal-nav {
	display: flex;
}

.hebcal-nav-btn {
	appearance: none;
	-webkit-appearance: none;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 4px;
	padding: 0.25em 0.7em;
	font: inherit;
	color: inherit;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.15s ease, background-color 0.15s ease;
}

.hebcal-nav-btn:hover,
.hebcal-nav-btn:focus-visible {
	opacity: 1;
	background: rgba(0, 0, 0, 0.05);
}

.hebcal-nav-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.hebcal-nav-prev,
.hebcal-nav-next {
	font-size: 1.1em;
	line-height: 1;
	min-width: 2em;
}

.hebcal-loading .hebcal-months {
	opacity: 0.5;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

/* --- Layout des mois --- */
.hebcal-months {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
}

.hebcal-month {
	flex: 1 1 280px;
	min-width: 0;
}

.hebcal-month-header {
	text-align: center;
	font-weight: 600;
	margin: 0 0 0.5rem;
	text-transform: capitalize;
}

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

.hebcal-weekday {
	text-align: center;
	font-size: 0.75em;
	font-weight: 600;
	padding: 4px 0;
	opacity: 0.6;
}

/* --- Cellules jour --- */
.hebcal-day {
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.875em;
	border-radius: 4px;
	background: #f1f3f4;
}

.hebcal-day.hebcal-empty {
	background: transparent;
}

/* Disponible — vert pastel saturé. Contraste : #0d4017 sur #a5d6a7 ≈ 6.5:1 (AA). */
.hebcal-day.hebcal-available {
	background: #a5d6a7;
	color: #0d4017;
}

/* Réservé — rouge/saumon pastel saturé. Contraste : #5c1011 sur #ef9a9a ≈ 7.1:1 (AAA). */
.hebcal-day.hebcal-booked {
	background: #ef9a9a;
	color: #5c1011;
}

/* Passé — gris neutre, prend le pas grâce à l'ordre des règles. */
.hebcal-day.hebcal-past {
	background: #e8eaed;
	color: #80868b;
}

/* Aujourd'hui — contour interne de la couleur de texte du thème. */
.hebcal-day.hebcal-today {
	outline: 2px solid currentColor;
	outline-offset: -2px;
	font-weight: 700;
}

.hebcal-day-num {
	display: inline-block;
}

/* --- Légende --- */
.hebcal-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	margin-top: 1rem;
	font-size: 0.85em;
	opacity: 0.85;
}

.hebcal-legend-item {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.hebcal-swatch {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 3px;
}

.hebcal-swatch-available { background: #a5d6a7; }
.hebcal-swatch-booked    { background: #ef9a9a; }

/* --- Erreur (admin only) --- */
.hebcal-error {
	padding: 0.75em 1em;
	background: #fff8e1;
	border-left: 3px solid #f0a000;
	color: inherit;
}

/* --- Mobile : un seul mois affiché. Seuil aligné sur Elementor (767px). --- */
@media (max-width: 767px) {
	.hebcal-month:nth-child(n+2) {
		display: none;
	}

	.hebcal-months {
		gap: 0;
	}
}
