.disp-cal-wrapper,
.disp-cal-wrapper *,
.disp-cal-wrapper *::before,
.disp-cal-wrapper *::after {
	box-sizing: border-box;
}

.disp-cal-wrapper {
	--disp-green: #2e9e5b;
	--disp-green-bg: #e6f4ea;
	--disp-amber: #b9770e;
	--disp-amber-bg: #fff4e0;
	--disp-red: #b3261e;
	--disp-red-bg: #fbe4e4;

	font-family: inherit;
	background: #fff;
	border: 1px solid #e2e2e2;
	border-radius: 12px;
	padding: 16px;
	margin: 0 auto;
	width: fit-content;
	max-width: 100%;
	/* Evita que contenedores flex del constructor de páginas (p.ej. Spectra)
	   estiren el calendario al 100% de su ancho por defecto. */
	align-self: center;
	flex-shrink: 0;
}

.disp-cal-wrapper--no-border {
	border: none;
	background: transparent;
	padding: 0;
}

.disp-cal-title {
	margin: 0 0 12px;
	font-size: 1.1em;
}

.disp-cal-months-wrap {
	position: relative;
	padding: 0 40px;
}

.disp-cal-months {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 24px;
	width: 100%;
}

.disp-cal-nav__btn {
	position: absolute;
	top: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	border-radius: 50%;
	width: 30px;
	height: 30px;
	padding: 0;
	cursor: pointer;
	color: #555;
}

.disp-cal-nav__btn--prev {
	left: 0;
}

.disp-cal-nav__btn--next {
	right: 0;
}

.disp-cal-nav__btn:hover:not(:disabled) {
	background: rgba(0, 0, 0, 0.06);
	color: #222;
}

.disp-cal-nav__btn:disabled {
	opacity: 0.25;
	cursor: not-allowed;
}

/* El ancho final lo fija el estilo inline en .disp-cal-months (automático
   según nº de meses, o el valor personalizado del bloque). El wrapper se
   ajusta a ese contenido con `width: fit-content`, así que activar o
   desactivar el borde nunca le resta espacio a la rejilla de días. */

.disp-cal-month {
	padding: 0;
}

.disp-cal-month-slot--divider .disp-cal-month {
	border-left: 1px solid #eee;
	padding-left: 16px;
}

.disp-cal-month__header {
	text-align: center;
	margin-bottom: 10px;
}

.disp-cal-month__label {
	font-weight: 600;
	text-transform: capitalize;
	letter-spacing: 0.02em;
}

.disp-cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 6px;
}

.disp-cal-grid--headers {
	margin-bottom: 4px;
}

.disp-cal-grid__dow {
	text-align: center;
	font-size: 0.75em;
	font-weight: 600;
	color: #767676;
	padding-bottom: 2px;
}

.disp-day {
	position: relative;
	aspect-ratio: 1 / 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	font-size: 0.8em;
	line-height: 1.15;
	opacity: 0;
	transform: translateY(6px) scale(0.94);
	animation: disp-day-in 0.35s ease forwards;
	animation-delay: calc(var(--disp-delay, 0) * 12ms);
}

.disp-day__badge {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 15px;
	height: 15px;
	padding: 0 3px;
	border-radius: 999px;
	background: #444;
	color: #fff;
	font-size: 0.55em;
	line-height: 15px;
	text-align: center;
	font-weight: 600;
}

/* Tooltip flotante: lo posiciona y muestra el JS (ver frontend-calendar.js), siguiendo al cursor. */
.disp-cal-floating-tooltip {
	position: fixed;
	display: none;
	background: #2b2822;
	color: #fff;
	padding: 6px 10px;
	border-radius: 6px;
	font-size: 12px;
	line-height: 1.4;
	white-space: pre-line;
	max-width: 240px;
	pointer-events: none;
	z-index: 9999;
}

.disp-day__time {
	font-size: 0.62em;
	opacity: 0.85;
	margin-top: 1px;
}

.disp-day--empty {
	visibility: hidden;
	animation: none;
}

.disp-day--unset {
	background: transparent;
	color: #767676;
}

.disp-day--available {
	background: var(--disp-green-bg);
	color: var(--disp-green);
}

.disp-day--limited {
	background: var(--disp-amber-bg);
	color: var(--disp-amber);
}

.disp-day--unavailable {
	background: var(--disp-red-bg);
	color: var(--disp-red);
}

.disp-day--today {
	box-shadow: 0 0 0 2px currentColor inset;
}

.disp-day:hover {
	filter: brightness(0.97);
}

.disp-cal-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: 16px;
}

.disp-cal-legend__item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 0.85em;
	color: #444;
}

.disp-cal-legend__dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	display: inline-block;
}

.disp-cal-error {
	padding: 12px;
	background: #fbe4e4;
	border-radius: 6px;
	color: #7a1c1c;
}

/* Móvil: los meses múltiples siempre se apilan en una sola columna, y el
   número de día se agranda ligeramente para que sea fácil de leer. El ancho
   general ya se adapta solo gracias a `width: fit-content` + `max-width: 100%`
   en el wrapper. */
@media (max-width: 480px) {
	.disp-cal-months {
		grid-template-columns: 1fr;
	}

	.disp-day {
		font-size: 0.85em;
	}
}

@keyframes disp-day-in {
	from {
		opacity: 0;
		transform: translateY(6px) scale(0.94);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Respeta la preferencia del usuario de reducir animaciones */
@media (prefers-reduced-motion: reduce) {
	.disp-day {
		animation: none;
		opacity: 1;
		transform: none;
	}
}
