/* ==========================================================================
   Booking dialog (file/common/book-popup.php, custom/js/book.js)
   Desktop: centred two-column panel, plum brand side + form side.
   Below 768px: a bottom sheet with a compact header, swipe down to close.
   The <dialog> itself is the full-screen scrim; the panel sits inside it.
   No cards: choices are pills and radios, sections split by space and rules.
   Tokens (--pg-*) come from custom/css/nav.css.
   ========================================================================== */

html.pg-book-open, html.pg-book-open body { overflow: hidden; }

.pg-book {
	position: fixed; inset: 0; z-index: 3000;
	width: 100%; height: 100%; max-width: none; max-height: none;
	margin: 0; padding: 24px; border: 0;
	background: rgba(26, 20, 64, 0);
	color: var(--pg-ink); font-family: var(--pg-font);
	overflow: hidden;
	transition: background-color .35s ease, -webkit-backdrop-filter .35s ease, backdrop-filter .35s ease;
}
.pg-book[open] { display: grid; place-items: center; }
.pg-book::backdrop { background: transparent; }
.pg-book.is-open { background: rgba(26, 20, 64, .52); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }

.pg-book *, .pg-book *::before, .pg-book *::after { box-sizing: border-box; }
.pg-book :where(p, ol, ul, fieldset, legend) { margin: 0; padding: 0; }
.pg-book :where(ol, ul) { list-style: none; }
.pg-book fieldset { min-width: 0; border: 0; }

/* Panel ------------------------------------------------------------------- */
.pg-book__panel {
	position: relative;
	display: grid; grid-template-columns: 340px minmax(0, 1fr);
	width: min(980px, 100%); height: min(700px, calc(100dvh - 48px));
	border-radius: 28px; overflow: hidden;
	background: #fff;
	box-shadow: 0 40px 90px -30px rgba(20, 14, 60, .6);
	opacity: 0; transform: translateY(26px) scale(.975);
	transition: opacity .3s ease, transform .5s var(--pg-sheet-ease, cubic-bezier(.32, .72, 0, 1));
}
.pg-book.is-open .pg-book__panel { opacity: 1; transform: none; }

.pg-book__grab { display: none; }
.pg-book__close {
	position: absolute; z-index: 3; top: 16px; right: 16px;
	display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
	border: 0; border-radius: 50%; background: var(--pg-lilac); color: var(--pg-plum); cursor: pointer;
	transition: background-color .2s, color .2s, transform .3s var(--pg-ease);
}
.pg-book__close .pg-i { width: 18px; height: 18px; }
.pg-book__close:hover { background: var(--pg-plum); color: #fff; transform: rotate(90deg); }
.pg-book__close:focus-visible { outline: 3px solid rgba(230, 8, 127, .4); outline-offset: 2px; }

/* Brand side ---------------------------------------------------------------- */
.pg-book__aside {
	position: relative; overflow: auto;
	display: flex; flex-direction: column;
	padding: 40px 32px 30px;
	background:
		radial-gradient(420px 300px at 100% 0%, rgba(230, 8, 127, .34), transparent 70%),
		radial-gradient(380px 300px at 0% 100%, rgba(122, 104, 214, .3), transparent 70%),
		linear-gradient(165deg, #2c2568 0%, #3b3284 60%, #33296f 100%);
	color: rgba(255, 255, 255, .8);
}
.pg-book__eyebrow {
	display: inline-flex; align-items: center; gap: 10px; margin-bottom: 14px !important;
	color: #ff9fd0; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
}
.pg-book__eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; }
.pg-book__title { color: #fff; font: 600 30px/1.12 var(--pg-font); letter-spacing: -.015em; }
.pg-book .pg-book__title span { display: block; color: #ff8cc6 !important; font-weight: 500; }
.pg-book__lede { margin-top: 12px !important; font-size: 15px; line-height: 1.6; }

.pg-book__next { margin-top: 26px !important; border-top: 1px solid rgba(255, 255, 255, .14); }
.pg-book__next li { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 14px; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, .14); }
.pg-book__next span {
	display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
	background: rgba(255, 255, 255, .1); color: #ff9fd0; font-size: 13px; font-weight: 700;
}
.pg-book__next p { font-size: 13.5px; line-height: 1.5; }
.pg-book__next b { display: block; margin-bottom: 1px; color: #fff; font-size: 15px; font-weight: 600; }

.pg-book__call { margin-top: auto !important; padding-top: 22px; font-size: 13.5px; }
.pg-book__call a { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; color: #fff; font-size: 17px; font-weight: 600; }
.pg-book__call a:hover { color: #ff9fd0; }
.pg-book__call .pg-i { width: 18px; height: 18px; color: #ff9fd0; }
.pg-book__private { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px !important; color: rgba(255, 255, 255, .6); font-size: 12.5px; line-height: 1.5; }
.pg-book__private .pg-i { width: 15px; height: 15px; margin-top: 1px; color: #ff9fd0; }

/* Form side ---------------------------------------------------------------- */
.pg-book__form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; margin: 0; }

.pg-book__progress { display: grid; gap: 10px; padding: 30px 72px 0 34px; }
.pg-book__progress-label { color: var(--pg-muted); font-size: 13px; font-weight: 500; }
.pg-book__progress-label b { color: var(--pg-pink); font-weight: 700; }
.pg-book__progress-label em { color: var(--pg-ink); font-style: normal; font-weight: 600; }
.pg-book__progress-bar { position: relative; height: 4px; border-radius: 4px; background: var(--pg-line); overflow: hidden; }
.pg-book__progress-bar i {
	position: absolute; inset: 0; border-radius: inherit;
	background: linear-gradient(90deg, var(--pg-plum), var(--pg-pink));
	transform: scaleX(.5); transform-origin: left; transition: transform .5s var(--pg-ease);
}
.pg-book__form[data-step="2"] .pg-book__progress-bar i { transform: scaleX(1); }

.pg-book__scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 34px 24px; scrollbar-width: thin; }
.pg-book__step { animation: pg-book-step .45s var(--pg-ease); }
.pg-book__form[data-dir="back"] .pg-book__step { animation-name: pg-book-step-back; }
@keyframes pg-book-step { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes pg-book-step-back { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

.pg-book__group + .pg-book__group { margin-top: 24px; }
.pg-book__label {
	display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%;
	margin-bottom: 10px; color: var(--pg-ink); font-size: 15px; font-weight: 600;
}
.pg-book__label small { color: var(--pg-muted); font-size: 12.5px; font-weight: 500; }

/* Shared: radio pills */
.pg-book__day, .pg-book__time, .pg-book__chip { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pg-book__day input, .pg-book__time input, .pg-book__chip input {
	position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
}

/* Day strip */
.pg-book__days {
	display: flex; gap: 8px; margin: 0 -34px; padding: 2px 34px 6px;
	overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: 34px; scrollbar-width: none;
	-webkit-mask: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent);
	mask: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent);
}
.pg-book__days::-webkit-scrollbar { display: none; }
.pg-book__day { flex: none; scroll-snap-align: start; }
.pg-book__day span {
	display: grid; justify-items: center; gap: 2px; width: 70px; padding: 10px 0 11px;
	border: 1.5px solid var(--pg-line); border-radius: 16px; background: #fff;
	color: var(--pg-muted); font-size: 12px; font-weight: 500; line-height: 1.15;
	transition: border-color .2s, background-color .2s, color .2s, transform .25s var(--pg-ease), box-shadow .25s;
}
.pg-book__day b { color: var(--pg-ink); font-size: 22px; font-weight: 600; letter-spacing: -.02em; transition: color .2s; }
.pg-book__day em { color: var(--pg-pink); font-size: 11.5px; font-style: normal; font-weight: 700; }
.pg-book__day:hover span { border-color: rgba(59, 50, 132, .35); }
.pg-book__day input:checked + span {
	border-color: var(--pg-plum); background: var(--pg-plum); color: rgba(255, 255, 255, .78);
	box-shadow: 0 12px 22px -14px rgba(59, 50, 132, .9); transform: translateY(-2px);
}
.pg-book__day input:checked + span b { color: #fff; }
.pg-book__day input:checked + span em { color: #ff9fd0; }

/* Time slots */
.pg-book__times { display: grid; gap: 14px; }
.pg-book__part { display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: start; column-gap: 12px; }
.pg-book__part-name { padding-top: 10px; color: var(--pg-muted); font-size: 12.5px; font-weight: 600; }
.pg-book__slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.pg-book__time span {
	display: grid; place-items: center; height: 40px; border: 1.5px solid var(--pg-line); border-radius: 999px;
	color: var(--pg-ink); font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums;
	transition: border-color .2s, background-color .2s, color .2s;
}
.pg-book__time:hover span { border-color: rgba(230, 8, 127, .45); color: var(--pg-pink); }
.pg-book__time input:checked + span { border-color: var(--pg-pink); background: var(--pg-pink); color: #fff; font-weight: 600; }
.pg-book__none { padding: 14px 16px; border-radius: 14px; background: var(--pg-blush); color: var(--pg-muted); font-size: 14px; }

/* Topic chips */
.pg-book__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-book__chip span {
	display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px;
	border: 1.5px solid var(--pg-line); border-radius: 999px;
	color: var(--pg-ink); font-size: 14px; font-weight: 500; line-height: 1.2;
	transition: border-color .2s, background-color .2s, color .2s;
}
.pg-book__chip:hover span { border-color: rgba(59, 50, 132, .35); }
.pg-book__chip input:checked + span { border-color: var(--pg-plum); background: var(--pg-lilac); color: var(--pg-plum); font-weight: 600; }
.pg-book__chip input:checked + span::before {
	content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pg-pink);
}

/* Keyboard focus on any pill */
.pg-book__day input:focus-visible + span, .pg-book__time input:focus-visible + span, .pg-book__chip input:focus-visible + span {
	outline: 3px solid rgba(230, 8, 127, .35); outline-offset: 2px;
}

/* Step 2 */
.pg-book__summary {
	display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; column-gap: 12px;
	margin-bottom: 22px !important; padding-bottom: 18px; border-bottom: 1px solid var(--pg-line);
}
.pg-book__summary-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--pg-blush); color: var(--pg-pink); }
.pg-book__summary-icon .pg-i { width: 19px; height: 19px; }
.pg-book__summary small { display: block; color: var(--pg-muted); font-size: 12.5px; }
.pg-book__summary b { color: var(--pg-ink); font-size: 16px; font-weight: 600; }
.pg-book__change {
	padding: 6px 2px; border: 0; background: none; cursor: pointer;
	color: var(--pg-pink); font: 600 14px var(--pg-font); text-decoration: underline; text-underline-offset: 3px;
}

.pg-book__field + .pg-book__field { margin-top: 16px; }
.pg-book__field .pg-book__label { margin-bottom: 7px; }
.pg-book__input {
	display: block; width: 100%; min-height: 52px; padding: 13px 16px;
	border: 1.5px solid #e4e0f0; border-radius: 14px; background: #fff;
	color: var(--pg-ink); font: 400 16px/1.4 var(--pg-font);
	transition: border-color .2s, box-shadow .2s;
}
textarea.pg-book__input { min-height: 88px; resize: vertical; }
.pg-book__input::placeholder { color: #aaa6c0; }
.pg-book__input:focus { outline: none; border-color: var(--pg-plum); box-shadow: 0 0 0 4px rgba(59, 50, 132, .1); }
.pg-book__input.is-invalid { border-color: #d6336c; box-shadow: 0 0 0 4px rgba(214, 51, 108, .1); }
.pg-book__hint { display: block; min-height: 18px; margin-top: 5px; color: var(--pg-muted); font-size: 12.5px; }
.pg-book__hint.is-error { color: #d6336c; }

/* Phone widget (intl-tel-input) inside the dialog */
.pg-book .iti { display: block; width: 100%; }
.pg-book .iti__selected-country { border-radius: 14px 0 0 14px; }
.pg-book .iti__selected-country-primary { padding: 0 6px 0 14px; }
.pg-book .iti__selected-dial-code { color: var(--pg-ink); font-size: 15px; }
.pg-book .iti--allow-dropdown .iti__country-container:hover .iti__selected-country-primary { background: var(--pg-lilac); }
.pg-book .iti__dropdown-content { z-index: 5; border: 1px solid var(--pg-line); border-radius: 14px; box-shadow: 0 20px 40px -20px rgba(20, 14, 60, .5); }

.pg-book__consent { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 10px; margin-top: 18px; cursor: pointer; color: var(--pg-muted); font-size: 13px; line-height: 1.5; }
.pg-book__consent input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--pg-pink); cursor: pointer; }
.pg-book__consent a { color: var(--pg-plum); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.pg-book__consent.is-invalid span { color: #d6336c; }

.pg-book__error { margin-top: 14px !important; color: #d6336c; font-size: 14px; font-weight: 500; }
.pg-book__error:empty { display: none; }

/* Actions */
.pg-book__actions {
	display: flex; justify-content: flex-end; gap: 10px;
	padding: 16px 34px calc(18px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--pg-line); background: #fff;
}
.pg-book__btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	min-height: 52px; padding: 0 26px; border: 0; border-radius: 999px; cursor: pointer;
	font: 600 16px/1 var(--pg-font);
	transition: transform .25s var(--pg-ease), box-shadow .25s, background-color .2s, color .2s, opacity .2s;
}
.pg-book__btn[hidden] { display: none; }
.pg-book__btn .pg-i { width: 18px; height: 18px; transition: transform .3s var(--pg-ease); }
.pg-book__btn--main { background: linear-gradient(135deg, var(--pg-pink), var(--pg-pink-deep)); color: #fff; box-shadow: 0 14px 28px -14px rgba(230, 8, 127, .85); }
.pg-book__btn--main:hover { transform: translateY(-1px); }
.pg-book__btn--main:hover .pg-i { transform: translateX(3px); }
.pg-book__btn--ghost { margin-right: auto; padding: 0 18px; background: var(--pg-lilac); color: var(--pg-plum); }
.pg-book__btn--ghost:hover { background: #e6e2f7; }
.pg-book__back-ico { transform: rotate(180deg); }
.pg-book__btn--ghost:hover .pg-book__back-ico { transform: rotate(180deg) translateX(3px); }
.pg-book__btn:active { transform: scale(.97); }
.pg-book__btn:focus-visible { outline: 3px solid rgba(230, 8, 127, .4); outline-offset: 3px; }
.pg-book__btn.is-busy { pointer-events: none; opacity: .85; }
.pg-book__btn.is-busy .pg-i { display: none; }
.pg-book__btn.is-busy::after {
	content: ""; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%;
	animation: pg-book-spin .7s linear infinite;
}
@keyframes pg-book-spin { to { transform: rotate(360deg); } }

/* Tablet ------------------------------------------------------------------ */
@media (max-width: 991.98px) {
	.pg-book__panel { grid-template-columns: 280px minmax(0, 1fr); }
	.pg-book__aside { padding: 34px 24px 26px; }
	.pg-book__title { font-size: 26px; }
	.pg-book__progress { padding: 26px 66px 0 26px; }
	.pg-book__scroll { padding: 20px 26px 22px; }
	.pg-book__days { margin: 0 -26px; padding: 2px 26px 6px; scroll-padding-inline: 26px; }
	.pg-book__actions { padding-left: 26px; padding-right: 26px; }
}

/* Phone: bottom sheet --------------------------------------------------------- */
@media (max-width: 767.98px) {
	.pg-book { padding: 0; }
	.pg-book[open] { place-items: end stretch; }
	.pg-book__panel {
		grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
		width: 100%; height: min(760px, calc(100dvh - 32px));
		border-radius: 24px 24px 0 0;
		opacity: 1; transform: translateY(100%);
		transition: transform .45s var(--pg-sheet-ease, cubic-bezier(.32, .72, 0, 1));
	}
	.pg-book.is-open .pg-book__panel { transform: translateY(var(--pgbk-drag, 0px)); }
	.pg-book.is-dragging .pg-book__panel { transition: none; }

	.pg-book__grab {
		display: block; position: absolute; z-index: 3; top: 0; left: 0; right: 0; height: 26px; cursor: grab; touch-action: none;
	}
	.pg-book__grab::before {
		content: ""; position: absolute; left: 50%; top: 9px; width: 42px; height: 5px; margin-left: -21px;
		border-radius: 5px; background: rgba(255, 255, 255, .5);
	}
	.pg-book__close { top: 14px; right: 12px; width: 36px; height: 36px; background: rgba(255, 255, 255, .14); color: #fff; }

	.pg-book__aside { overflow: visible; padding: 26px 64px 18px 18px; }
	.pg-book__eyebrow { margin-bottom: 6px !important; font-size: 11px; }
	.pg-book__title { font-size: 22px; }
	.pg-book .pg-book__title span { display: inline; }
	.pg-book__lede, .pg-book__next, .pg-book__call, .pg-book__private { display: none; }

	.pg-book__progress { padding: 16px 18px 0; }
	.pg-book__scroll { padding: 16px 18px 20px; }
	.pg-book__days { margin: 0 -18px; padding: 2px 18px 6px; scroll-padding-inline: 18px; }
	.pg-book__day span { width: 62px; }
	.pg-book__day b { font-size: 20px; }
	.pg-book__part { grid-template-columns: minmax(0, 1fr); row-gap: 6px; }
	.pg-book__part-name { padding-top: 0; }
	.pg-book__slots { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
	.pg-book__time span { height: 40px; font-size: 13.5px; }
	.pg-book__actions { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
	.pg-book__btn--main { flex: 1; }
}

@media (max-width: 359.98px) {
	.pg-book__slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
	.pg-book, .pg-book__panel, .pg-book__progress-bar i { transition: none !important; }
	.pg-book__step { animation: none; }
	.pg-book__panel { transform: none !important; }
	.pg-book:not(.is-open) .pg-book__panel { opacity: 0; }
}
