/* ─── Layer prenotazioni (.cc-booking) ───────────────────────────────────────────────────
   Box fisso in alto a destra su tutte le pagine (widget CC_Widget_Layer_Prenotazioni,
   stampato da cc_booking_layer() in functions.php). Compare quando l'header esce dallo
   schermo (lì c'è già il bottone "Prenotazioni" del menu): assets/js/booking-layer.js
   toglie [hidden] e gestisce .is-visible / .is-open.
   - Desktop (≥1024px): scheda aperta (prenota, telefono, orari), riducibile a pillola
     "Prenota" con la ×; la scelta resta per la sessione.
   - Mobile/tablet: solo la pillola, che apre la scheda a tendina sotto di sé. */

.cc-booking {
	--cc-booking-top: 16px;
	position: fixed;
	top: var(--cc-booking-top);
	right: clamp(12px, 2vw, 24px);
	z-index: 900;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-family: var(--font-body);
	opacity: 0;
	visibility: hidden; /* anche fuori dalla navigazione da tastiera finché è nascosto */
	transform: translateY(-12px);
	pointer-events: none;
	transition: opacity var(--duration-ui) var(--ease), transform var(--duration-ui) var(--ease), visibility var(--duration-ui);
}

.cc-booking[hidden] {
	display: none;
}

body.admin-bar .cc-booking {
	--cc-booking-top: 48px;
}

.cc-booking.is-visible {
	opacity: 1;
	visibility: visible;
	transform: none;
	pointer-events: auto;
}

/* --- Pillola "Prenota" --- */
.cc-booking__toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 18px 11px 14px;
	border: 0;
	border-radius: var(--radius-pill);
	background: var(--primary);
	color: var(--background);
	font: 600 0.92rem/1 var(--font-body);
	cursor: pointer;
	box-shadow: 0 14px 30px -14px rgba(15, 36, 71, 0.6);
	transition: background-color var(--duration-ui) var(--ease), transform var(--duration-micro) var(--ease);
}

.cc-booking__toggle:hover,
.cc-booking__toggle:focus-visible {
	background: var(--footer);
}

.cc-booking__toggle:active {
	transform: scale(0.97);
}

.cc-booking__icon {
	width: 20px;
	height: 20px;
	flex: none;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.cc-booking.is-open .cc-booking__toggle {
	display: none;
}

/* --- Scheda --- */
.cc-booking__panel {
	position: relative;
	width: min(300px, calc(100vw - 24px));
	padding: 22px 20px 18px;
	border-radius: var(--radius-lg);
	background: var(--background);
	box-shadow: 0 28px 60px -24px rgba(15, 36, 71, 0.45), 0 0 0 1px rgba(15, 36, 71, 0.06);
	transform-origin: top right;
	transition: opacity var(--duration-ui) var(--ease), transform var(--duration-ui) var(--ease), visibility var(--duration-ui);
}

.cc-booking:not(.is-open) .cc-booking__panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px) scale(0.97);
}

/* Filetto accento in cima, come i box della Home */
.cc-booking__panel::before {
	content: '';
	position: absolute;
	top: 0;
	left: 20px;
	width: 44px;
	height: 4px;
	border-radius: 0 0 var(--radius-pill) var(--radius-pill);
	background: var(--accent);
}

.cc-booking__close {
	position: absolute;
	top: 10px;
	right: 10px;
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--muted-foreground);
	cursor: pointer;
	transition: background-color var(--duration-micro) var(--ease), color var(--duration-micro) var(--ease);
}

.cc-booking__close:hover,
.cc-booking__close:focus-visible {
	background: var(--muted);
	color: var(--primary);
}

.cc-booking__close svg {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
}

.cc-booking__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 14px;
	padding: 13px 18px;
	border-radius: var(--radius-pill);
	background: var(--primary);
	color: var(--background);
	font-weight: 600;
	font-size: 0.95rem;
	text-decoration: none;
	transition: background-color var(--duration-ui) var(--ease);
}

.cc-booking__cta span {
	transition: transform var(--duration-ui) var(--ease);
}

.cc-booking__cta:hover,
.cc-booking__cta:focus-visible {
	background: var(--footer);
	color: var(--background);
}

.cc-booking__cta:hover span,
.cc-booking__cta:focus-visible span {
	transform: translateX(4px);
}

/* "oppure chiamaci" tra due righe sottili */
.cc-booking__or {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 14px 0 4px;
	font-size: 0.8rem;
	line-height: 1.2;
	color: var(--muted-foreground);
}

.cc-booking__or::before,
.cc-booking__or::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--border);
}

.cc-booking__phone {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 6px 0;
	font-family: var(--font-heading);
	font-weight: 600;
	font-size: 1.3rem;
	letter-spacing: 0.01em;
	color: var(--primary);
	text-decoration: none;
	white-space: nowrap;
	transition: color var(--duration-micro) var(--ease);
}

.cc-booking__phone .cc-booking__icon {
	color: var(--accent);
}

.cc-booking__phone:hover,
.cc-booking__phone:focus-visible {
	color: var(--accent);
}

.cc-booking__hours {
	margin: 10px 0 0;
	padding: 10px 12px;
	border-radius: var(--radius-md);
	background: var(--muted);
	font-size: 0.8rem;
	line-height: 1.45;
}

.cc-booking__hours-row {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.cc-booking__hours-row + .cc-booking__hours-row {
	margin-top: 3px;
}

.cc-booking__hours dt {
	font-weight: 700;
	color: var(--primary);
	white-space: nowrap;
}

.cc-booking__hours dd {
	margin: 0;
	text-align: right;
	color: var(--muted-foreground);
}

/* --- Variante statica (.cc-booking--static) ---
   Stesso widget inserito fuori dall'area del layer, es. nella colonna "widget-prenotazioni"
   del megamenu (widget CC_Widget_Menu_Prenotazioni): la scheda è sempre aperta, nel flusso,
   senza pillola né × (non stampate dal PHP) e senza JS. visibility: inherit, mai
   "visible": un figlio con visibility: visible resterebbe visibile anche con il megamenu
   chiuso (che nasconde i sottomenu con visibility: hidden). */
.cc-booking.cc-booking--static {
	position: static;
	align-items: stretch;
	opacity: 1;
	visibility: inherit; /* segue il megamenu: nascosto quando il menu è chiuso */
	transform: none;
	pointer-events: auto;
}

.cc-booking.cc-booking--static .cc-booking__panel {
	position: relative;
	top: auto;
	right: auto;
	width: auto;
	max-width: 340px;
	opacity: 1;
	visibility: inherit; /* segue il megamenu: nascosto quando il menu è chiuso */
	transform: none;
	box-shadow: 0 18px 40px -28px rgba(15, 36, 71, 0.45), 0 0 0 1px rgba(15, 36, 71, 0.08);
}

/* Menu mobile (breakpoint Max Mega Menu, 930px): scheda centrata nel contenitore.
   left 50% sposta il bordo sinistro a metà contenitore, translateX(-50%) lo riporta indietro
   di metà della sua larghezza. */
@media (max-width: 930px) {
	.cc-booking.cc-booking--static .cc-booking__panel {
		left: 50%;
		transform: translateX(-50%);
	}
}

/* Nel megamenu i link ereditano le regole del menu di GeneratePress (.main-navigation a,
   .main-navigation .main-nav ul li a: font 15px, interlinea 60px, padding, colore):
   specificità a tre classi per riaffermare l'aspetto del box. Misure un po' ridotte per
   stare nella colonna stretta del menu. */
.cc-booking.cc-booking--static .cc-booking__panel {
	padding: 44px 14px 36px;
	container-type: inline-size; /* per le unità cqi del telefono */
}

.cc-booking.cc-booking--static .cc-booking__cta {
	display: flex;
	margin-top: 8px;
	padding: 13px 5px;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	color: var(--background);
}

.cc-booking.cc-booking--static .cc-booking__cta:hover,
.cc-booking.cc-booking--static .cc-booking__cta:focus-visible {
	color: var(--background);
}

.cc-booking.cc-booking--static .cc-booking__phone {
	display: flex;
	gap: 6px;
	padding: 4px 0;
	/* proporzionale alla larghezza del box (colonne del megamenu da ~200 a ~340px): il
	   numero resta su una riga senza uscire; tra 16 e 21px */
	font-size: clamp(1rem, 9.4cqi, 1.3rem);
	font-weight: 600;
	line-height: 1.3;
	color: var(--primary);
}

.cc-booking.cc-booking--static .cc-booking__phone:hover,
.cc-booking.cc-booking--static .cc-booking__phone:focus-visible {
	color: var(--accent);
}

.cc-booking.cc-booking--static .cc-booking__phone .cc-booking__icon {
	width: 17px;
	height: 17px;
}

/* Testi del box nel megamenu un po' più grandi del layer (qui c'è più spazio verticale) */
.cc-booking.cc-booking--static .cc-booking__or {
	margin: 34px 0 10px;
	font-size: 0.9rem;
}

.cc-booking.cc-booking--static .cc-booking__hours {
	margin-top: 18px;
	padding: 12px 14px;
	font-size: 0.9rem;
	line-height: 1.55;
}

.cc-booking.cc-booking--static .cc-booking__hours-row + .cc-booking__hours-row {
	margin-top: 8px;
}

@media (max-width: 1199px) {
	.cc-booking.cc-booking--static .cc-booking__hours {font-size: 0.7rem;}
}

@media (prefers-reduced-motion: reduce) {
	.cc-booking,
	.cc-booking__panel,
	.cc-booking__toggle,
	.cc-booking__cta span {
		transition: none;
	}
}

@media print {
	.cc-booking {
		display: none;
	}
}
