/* Mandoria — arrival date picker (modal calendar on single product page).
   Adapted from parcdupetitprince tickets_system, without the REST availability
   layer: dates are gated purely by min/max. Server-side validation stays the
   source of truth. */

.tsdp-trigger-wrap { margin: 0 0 16px; }

/* Add-to-cart gate: hidden until a date is picked (form gets .tsdp-has-date).
   Scoped to .tsdp-gated so only date-bound products are affected, and applied
   by JS so it fails open when the script doesn't run. */
form.cart.tsdp-gated:not(.tsdp-has-date) .single_add_to_cart_button,
form.cart.tsdp-gated:not(.tsdp-has-date) .add_to_cart_button {
	display: none !important;
}

.tsdp-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	font-weight: 600;
	font-size: 1em;
	cursor: pointer;
}

.tsdp-trigger__icon { font-size: 1.1em; line-height: 1; }

.tsdp-status {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	margin: 10px 0 0;
	padding: 8px 12px;
	background: #f3f4f6;
	border-left: 3px solid #10b981;
	font-size: 0.95em;
}

/* [hidden] attr must win over the display:flex above (it doesn't by default). */
.tsdp-status[hidden] { display: none; }

.tsdp-status__prefix { color: #4b5563; }
.tsdp-status__date { color: #111827; width: 100%; }
.tsdp-status .price { font-weight: 600; color: #111827; }

.tsdp-status__change {
	margin-left: auto;
	background: none;
	border: 0;
	color: #2563eb;
	cursor: pointer;
	font-size: 0.9em;
	text-decoration: underline;
	padding: 0;
}

/* Modal */

.tsdp-modal[hidden] { display: none !important; }

.tsdp-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.tsdp-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(17, 24, 39, 0.55);
	backdrop-filter: blur(2px);
}

.tsdp-modal__panel {
	position: relative;
	background: #ffffff;
	color: #111827;
	border-radius: 12px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
	max-width: 420px;
	width: 100%;
	max-height: calc(100vh - 40px);
	overflow: auto;
	padding: 22px 22px 18px;
	font-family: inherit;
}

.tsdp-modal__close {
	position: absolute;
	top: 8px;
	right: 12px;
	background: transparent;
	border: 0;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #6b7280;
	padding: 4px 10px;
	border-radius: 6px;
}

.tsdp-modal__close:hover { background: #f3f4f6; color: #111827; }

.tsdp-modal__title { margin: 0 0 6px; font-size: 1.25em; font-weight: 600; }
.tsdp-modal__hint { margin: 0 0 16px; color: #6b7280; font-size: 0.92em; }

.tsdp-modal__nav {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.tsdp-modal__label {
	flex: 1;
	text-align: center;
	font-weight: 600;
	font-size: 1.05em;
	text-transform: capitalize;
}

.tsdp-modal__prev,
.tsdp-modal__next {
	background: #fff;
	border: 1px solid #e5e7eb;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	font-size: 18px;
	cursor: pointer;
	color: #111827;
	line-height: 1;
}

.tsdp-modal__prev:hover,
.tsdp-modal__next:hover { background: #f9fafb; }

.tsdp-modal__prev:disabled,
.tsdp-modal__next:disabled { opacity: 0.4; cursor: not-allowed; }

.tsdp-modal__months { min-height: 230px; position: relative; }

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

.tsdp-cal__weekdays { margin-bottom: 4px; }

.tsdp-cal__weekday {
	text-align: center;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	color: #6b7280;
	padding: 4px 0;
}

.tsdp-day {
	aspect-ratio: 1 / 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1.1;
	font-size: 14px;
	border-radius: 6px;
	background: #f3f4f6;
	color: #1f2937;
	cursor: pointer;
	transition: background-color 0.12s ease, transform 0.12s ease;
}

.tsdp-day__price {
	font-size: 10px;
	font-weight: 600;
	color: #2563eb;
	margin-top: 2px;
	white-space: nowrap;
}

.tsdp-day:hover:not(.is-disabled) .tsdp-day__price { color: #fff; }

.tsdp-day__sub {
	font-size: 9px;
	text-transform: uppercase;
	margin-top: 2px;
	letter-spacing: 0.02em;
}

.tsdp-day:hover:not(.is-disabled) {
	background: #2563eb;
	color: #fff;
	transform: translateY(-1px);
}

.tsdp-day:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.tsdp-day--blank { background: transparent; cursor: default; pointer-events: none; }

.tsdp-day.is-disabled {
	background: transparent;
	color: #d1d5db;
	cursor: not-allowed;
	pointer-events: none;
}

.tsdp-day.is-picked { background: #10b981; color: #fff; font-weight: 600; }

.tsdp-day.is-soldout {
	background: #fef2f2;
	color: #b91c1c;
}
.tsdp-day.is-soldout .tsdp-day__num { text-decoration: line-through; }

.tsdp-modal__calwrap { position: relative; }

/* Loader overlays the calendar and blocks day clicks while a month loads. */
.tsdp-modal__loading {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	background: rgba(255, 255, 255, 0.85);
	backdrop-filter: blur(1px);
	color: #4b5563;
	font-size: 0.9em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.tsdp-modal__loading[hidden] { display: none; }

.tsdp-modal__spinner {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: 3px solid rgba(0, 0, 0, 0.12);
	border-top-color: #2563eb;
	animation: tsdp-spin 0.7s linear infinite;
}

@keyframes tsdp-spin { to { transform: rotate(360deg); } }

.tsdp-modal__empty {
	margin-top: 12px;
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 0.92em;
	background: #fffbeb;
	color: #92400e;
	border: 1px solid #fde68a;
	text-align: center;
}

body.tsdp-modal-open { overflow: hidden; }

@media (max-width: 480px) {
	.tsdp-modal__panel { padding: 16px 14px; }
	.tsdp-day { font-size: 13px; }
}
