/**
 * Branded date picker — assets/js/date-picker.js (OFF-CATALOG).
 * Used on „Моят профил“ and in the waitlist form of the booking modal.
 */

.zd-date {
	position: relative;
}

.zd-date__toggle {
	position: absolute;
	top: 0;
	right: 0;
	display: grid;
	place-items: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	border: 0;
	border-radius: 0.625rem;
	background: none;
	color: var(--wp--preset--color--third);
	cursor: pointer;
}

.zd-date__toggle:hover,
.zd-date__toggle[aria-expanded="true"] {
	color: var(--wp--preset--color--primary);
}

.zd-date__toggle svg {
	width: 1.25rem;
	height: 1.25rem;
}

.zd-date__pop {
	position: absolute;
	z-index: 40;
	top: calc(100% + 0.5rem);
	left: 0;
	width: 20.5rem;
	max-width: calc(100vw - 2rem);
	padding: 1rem;
	border: 1px solid var(--wp--preset--color--bg-color-light);
	border-radius: 1rem;
	background: var(--wp--preset--color--white);
	box-shadow: var(--wp--preset--shadow--raised);
}

.zd-date__pop[hidden] {
	display: none;
}

.zd-date__pop.is-end {
	left: auto;
	right: 0;
}

@media (max-width: 767px) {
	/* As wide as the field: never past the screen edge. */
	.zd-date__pop,
	.zd-date__pop.is-end {
		left: 0;
		right: 0;
		width: auto;
		max-width: 22rem;
	}
}

.zd-date__head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.875rem;
}

.zd-date__nav {
	flex: none;
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--wp--preset--color--bg-color-light);
	color: var(--wp--preset--color--primary);
	cursor: pointer;
}

.zd-date__nav svg {
	width: 1.125rem;
	height: 1.125rem;
}

.zd-date__nav:hover:not(:disabled) {
	background: var(--wp--preset--color--secondary-light);
}

.zd-date__nav:disabled {
	opacity: 0.35;
	cursor: default;
}

.zd-date__selects {
	flex: 1;
	display: flex;
	gap: 0.375rem;
	min-width: 0;
}

/* Month + year dropdowns (the birthdate fields; compact mode shows a title instead). */
.zd-date .zd-date__select {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
	min-height: 2.25rem;
	padding: 0 1.75rem 0 0.75rem;
	border: 1px solid var(--wp--preset--color--footer-border-light);
	border-radius: 999px;
	background: var(--wp--preset--color--white) url("../icons/search/chevron-down.svg") no-repeat right 0.5rem center / 1rem;
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--wp--preset--color--primary);
	appearance: none;
	cursor: pointer;
}

.zd-date .zd-date__select--year {
	flex: 0 0 5.5rem;
}

.zd-date .zd-date__select:hover {
	border-color: var(--wp--preset--color--footer-border-color);
}

@media (max-width: 767px) {
	/* Phone: leave the month name room („Септември“) next to the year. */
	.zd-date .zd-date__pop {
		padding: 0.875rem 0.75rem;
	}

	.zd-date .zd-date__head {
		gap: 0.375rem;
	}

	.zd-date .zd-date__nav {
		width: 2rem;
		height: 2rem;
	}

	.zd-date .zd-date__select {
		padding: 0 1.375rem 0 0.625rem;
		background-position: right 0.375rem center;
		font-size: 0.875rem;
	}

	.zd-date .zd-date__select--year {
		flex-basis: 4.25rem;
	}
}

.zd-date__week,
.zd-date__grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 0.125rem;
}

.zd-date__week {
	margin-bottom: 0.25rem;
}

.zd-date__week span {
	padding: 0.25rem 0;
	font-size: 0.75rem;
	font-weight: 700;
	text-align: center;
	color: var(--wp--preset--color--base-dark);
}

.zd-date__week .is-weekend,
.zd-date__day.is-weekend {
	color: var(--wp--preset--color--third);
}

.zd-date__day {
	aspect-ratio: 1;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 50%;
	background: none;
	font: inherit;
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
	color: var(--wp--preset--color--primary);
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.zd-date__day:hover:not(:disabled) {
	background: var(--wp--preset--color--bg-color-light);
}

.zd-date__day.is-today {
	border-color: var(--wp--preset--color--secondary);
	font-weight: 700;
}

.zd-date__day[aria-pressed="true"],
.zd-date__day[aria-pressed="true"]:hover {
	border-color: var(--wp--preset--color--secondary);
	background: var(--wp--preset--color--secondary);
	font-weight: 700;
	color: var(--wp--preset--color--primary);
}

.zd-date__day:focus-visible,
.zd-date__nav:focus-visible,
.zd-date__toggle:focus-visible,
.zd-date__link:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 1px;
}

.zd-date__day:disabled {
	color: var(--wp--preset--color--footer-border-light);
	cursor: default;
}

.zd-date__foot {
	display: flex;
	justify-content: space-between;
	margin-top: 0.75rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--wp--preset--color--bg-color-light);
}

.zd-date__foot:empty,
.zd-date__foot:has(> span:only-child) {
	display: none;
}

.zd-date__link {
	padding: 0.25rem 0;
	border: 0;
	background: none;
	font: inherit;
	font-size: 0.875rem;
	font-weight: 700;
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
	text-underline-offset: 0.2em;
	cursor: pointer;
}

.zd-date__link:hover {
	color: var(--wp--preset--color--third);
}

/* [data-zd-date-compact]: month + year as text between the arrows. */
.zd-date__title {
	flex: 1;
	font-size: 0.9375rem;
	font-weight: 700;
	text-align: center;
	color: var(--wp--preset--color--primary);
}

/* The calendar's own Today button is disabled when today is out of range. */
.zd-date__link:disabled {
	opacity: 0.35;
	cursor: default;
	text-decoration: none;
}
