/* Padel Manager – frontend
   Palette: blu campo (primario), giallo pallina (accento), inchiostro, vetro. */
:root {
	--pm-primary: #1d5fa8;
	--pm-accent: #dce85a;
	--pm-ink: #14243a;
	--pm-muted: #5d6b7d;
	--pm-glass: #eef3f8;
	--pm-surface: #ffffff;
	--pm-line: #d5dee8;
	--pm-bg: #ffffff;
	--pm-ok: #1f7a4d;
	--pm-err: #b42318;
	--pm-radius: 10px;
	--pm-display: "Barlow Condensed", "Arial Narrow", sans-serif;
	--pm-text: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.pm { font-family: var(--pm-text); color: var(--pm-ink); line-height: 1.55; }
.pm *, .pm *::before, .pm *::after { box-sizing: border-box; }
html { overflow-x: clip; }
.pm h2, .pm h3, .pm-hero h1 { font-family: var(--pm-display); letter-spacing: .01em; line-height: 1.1; color: var(--pm-ink); }
.pm h3 { font-size: 1.45rem; margin: 0 0 .25rem; font-weight: 700; }
.pm-muted { color: var(--pm-muted); }
.pm-small { font-size: .85rem; color: var(--pm-muted); margin-top: .75rem; }
.pm-link { color: var(--pm-primary); font-weight: 600; text-underline-offset: 3px; }
.pm img { max-width: 100%; height: auto; display: block; }

.pm :focus-visible { outline: 3px solid var(--pm-primary); outline-offset: 2px; }

/* Bottoni */
.pm-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
	min-height: 46px; padding: .6rem 1.3rem; border: 2px solid var(--pm-primary); border-radius: 999px;
	background: var(--pm-primary); color: #fff; font: 600 1rem var(--pm-text); text-decoration: none; cursor: pointer;
}
.pm-btn:hover { filter: brightness(1.08); color: #fff; }
.pm-btn[disabled] { opacity: .6; cursor: wait; }
.pm-btn-ghost { background: transparent; color: var(--pm-primary); }
.pm-btn-ghost:hover { background: var(--pm-glass); color: var(--pm-primary); }
.pm-btn-small { min-height: 38px; padding: .35rem 1rem; font-size: .92rem; }

/* Messaggi */
.pm-ok, .pm-err { padding: .75rem 1rem; border-radius: var(--pm-radius); font-weight: 500; }
.pm-ok { background: #e7f5ee; color: var(--pm-ok); }
.pm-err { background: #fdecea; color: var(--pm-err); }

/* ---------- Prenotazione ---------- */
.pm-booking { display: grid; gap: 1.25rem; }

.pm-days { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .4rem; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.pm-days button {
	flex: 0 0 auto; width: 4.4rem; scroll-snap-align: start;
	display: grid; justify-items: center; gap: 0; padding: .55rem .25rem;
	border: 1px solid var(--pm-line); border-radius: var(--pm-radius); background: var(--pm-bg); color: var(--pm-ink);
	font: 500 .8rem var(--pm-text); cursor: pointer; text-transform: capitalize;
}
.pm-days button strong { font: 700 1.6rem/1.05 var(--pm-display); }
.pm-days button small { color: var(--pm-muted); }
.pm-days button[aria-selected="true"] { background: var(--pm-primary); border-color: var(--pm-primary); color: #fff; }
.pm-days button[aria-selected="true"] small { color: rgba(255,255,255,.8); }

.pm-durations { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pm-label { font-weight: 600; margin-right: .25rem; }
.pm-durations button {
	min-height: 40px; padding: .3rem 1rem; border-radius: 999px; border: 1px solid var(--pm-line);
	background: var(--pm-bg); color: var(--pm-ink); font: 600 .95rem var(--pm-text); cursor: pointer;
}
.pm-durations button[aria-checked="true"] { background: var(--pm-ink); border-color: var(--pm-ink); color: #fff; }

.pm-courts { display: grid; gap: 1rem; }
/* Ogni campo: bordo sinistro blu con linea bianca interna, come il vetro e la riga del campo */
.pm-court-row {
	position: relative; padding: 1rem 1rem 1rem 1.4rem; background: var(--pm-surface);
	border-radius: var(--pm-radius); overflow: hidden;
}
.pm-court-row::before {
	content: ""; position: absolute; inset: 0 auto 0 0; width: 8px;
	background: linear-gradient(90deg, var(--pm-primary) 0 5px, #fff 5px 6px, var(--pm-primary) 6px);
}
.pm-court-row header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; margin-bottom: .75rem; }
.pm-court-row h3 { margin: 0; }
.pm-court-type { font-size: .85rem; color: var(--pm-muted); text-transform: capitalize; }
.pm-from { margin-left: auto; font-weight: 600; }

.pm-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: .45rem; }
.pm-slot {
	min-height: 44px; border-radius: 8px; border: 1.5px solid var(--pm-primary); background: #fff;
	color: var(--pm-primary); font: 700 1.05rem var(--pm-display); letter-spacing: .02em; cursor: pointer;
}
.pm-slot:hover:not([disabled]) { background: var(--pm-accent); border-color: var(--pm-ink); color: var(--pm-ink); }
.pm-slot[disabled] { border-color: transparent; background: transparent; color: #a3afbd; text-decoration: line-through; cursor: not-allowed; }

/* Pannello conferma: bottom sheet su mobile, finestra su desktop */
.pm-sheet { position: fixed; inset: 0; z-index: 99999; background: rgba(20, 36, 58, .55); display: flex; align-items: flex-end; justify-content: center; }
.pm-sheet[hidden] { display: none; }
.pm-sheet-inner {
	position: relative; width: 100%; max-width: 30rem; max-height: 90vh; overflow: auto;
	background: #fff; border-radius: 18px 18px 0 0; padding: 1.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
	animation: pm-up .22s ease-out;
}
@media (min-width: 640px) {
	.pm-sheet { align-items: center; }
	.pm-sheet-inner { border-radius: 18px; }
}
@keyframes pm-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pm-sheet-inner { animation: none; } }
.pm-sheet-close { position: absolute; top: .5rem; right: .75rem; width: 40px; height: 40px; border: 0; background: none; font-size: 1.8rem; color: var(--pm-muted); cursor: pointer; }
.pm-sheet h3 { font-size: 1.6rem; }
.pm-sheet-summary { margin: .25rem 0; }
.pm-sheet-summary::first-letter { text-transform: uppercase; }
.pm-sheet-price { font: 800 2.4rem/1 var(--pm-display); margin: .5rem 0 1rem; }
.pm-sheet-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.pm-sheet-error { color: var(--pm-err); font-weight: 500; }
.pm-field { display: grid; gap: .3rem; font-weight: 600; margin-bottom: 1rem; }
.pm-pay { border: 0; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.pm-pay legend { font-weight: 600; margin-bottom: .3rem; }
.pm-pay label { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border: 1px solid var(--pm-line); border-radius: 8px; cursor: pointer; }
.pm-pay label:has(input:checked) { border-color: var(--pm-primary); background: var(--pm-glass); }
.pm-confirm { width: 100%; background: var(--pm-accent); border-color: var(--pm-accent); color: var(--pm-ink); font-size: 1.05rem; }
.pm-confirm:hover { color: var(--pm-ink); }

body.pm-lock { overflow: hidden; }

/* ---------- Form ---------- */
.pm input[type="text"], .pm input[type="email"], .pm input[type="tel"], .pm input[type="password"], .pm textarea, .pm-sheet input[type="tel"] {
	width: 100%; min-height: 46px; padding: .6rem .8rem; border: 1px solid var(--pm-line); border-radius: 8px;
	font: 400 1rem var(--pm-text); color: var(--pm-ink); background: #fff;
}
.pm-form { display: grid; gap: 1rem; }
.pm-form label { display: grid; gap: .3rem; font-weight: 600; }
.pm-form .pm-check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; }
.pm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.pm-hp { position: absolute; left: -9999px; }
@media (max-width: 520px) { .pm-row { grid-template-columns: 1fr; } }

/* ---------- Campi ---------- */
.pm-court-list { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.pm-court-card { background: var(--pm-surface); border-radius: var(--pm-radius); overflow: hidden; }
.pm-court-card img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.pm-court-body { padding: 1rem 1.25rem 1.25rem; }
.pm-court-meta { color: var(--pm-muted); font-weight: 500; margin: 0 0 .5rem; }

/* ---------- Formazione ---------- */
.pm-courses { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.pm-course { background: var(--pm-surface); padding: 1.25rem; border: 1px solid var(--pm-line); border-radius: var(--pm-radius); border-top: 5px solid var(--pm-primary); }
.pm-level-avanzato { border-top-color: var(--pm-ink); }
.pm-level-bambini { border-top-color: var(--pm-accent); }
.pm-level { margin: 0 0 .25rem; font-weight: 600; color: var(--pm-primary); font-size: .9rem; }
.pm-course dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .75rem; margin: 1rem 0; }
.pm-course dt { color: var(--pm-muted); }
.pm-course dd { margin: 0; font-weight: 500; }

/* ---------- Eventi ---------- */
.pm-events { display: grid; gap: 1rem; }
.pm-event { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; align-items: start; padding-bottom: 1rem; border-bottom: 1px solid var(--pm-line); }
.pm-event-date { display: grid; justify-items: center; padding: .5rem 0; background: var(--pm-ink); color: #fff; border-radius: var(--pm-radius); font: 600 .9rem var(--pm-text); text-transform: capitalize; }
.pm-event-date span { font: 800 2rem/1 var(--pm-display); color: var(--pm-accent); }
.pm-event h3 a { color: inherit; text-decoration: none; }
.pm-event p { margin: .2rem 0 .6rem; }

/* ---------- Galleria ---------- */
.pm-gallery { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
.pm-gallery-item { display: block; border-radius: 6px; overflow: hidden; }
.pm-gallery-item img { aspect-ratio: 1; object-fit: cover; width: 100%; transition: transform .3s; }
.pm-gallery-item:hover img { transform: scale(1.04); }
.pm-lightbox { position: fixed; inset: 0; z-index: 99999; background: rgba(10, 18, 30, .94); display: flex; align-items: center; justify-content: center; }
.pm-lightbox[hidden] { display: none; }
.pm-lightbox figure { margin: 0; max-width: 92vw; }
.pm-lightbox img { max-height: 82vh; max-width: 92vw; object-fit: contain; }
.pm-lightbox figcaption { color: #fff; text-align: center; margin-top: .5rem; font-family: var(--pm-text); }
.pm-lightbox button { position: absolute; border: 0; background: rgba(255,255,255,.12); color: #fff; width: 48px; height: 48px; border-radius: 50%; font-size: 1.8rem; cursor: pointer; }
.pm-lb-close { top: 1rem; right: 1rem; }
.pm-lb-prev { left: 1rem; }
.pm-lb-next { right: 1rem; }

/* ---------- Contatti ---------- */
.pm-contacts { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.pm-contact-info p { margin: 0 0 1.25rem; }
.pm-contact-info .pm-btn { margin: 0 .4rem .5rem 0; }
.pm-map { width: 100%; aspect-ratio: 4 / 3; border: 0; border-radius: var(--pm-radius); }

/* ---------- Area personale ---------- */
.pm-tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--pm-line); margin-bottom: 1.5rem; }
.pm-tabs button { border: 0; background: none; padding: .75rem 1rem; font: 600 1rem var(--pm-text); color: var(--pm-muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.pm-tabs button[aria-selected="true"] { color: var(--pm-ink); border-bottom-color: var(--pm-primary); }
.pm-account #loginform { display: grid; gap: .75rem; }
.pm-account #loginform p { margin: 0; }
.pm-account #loginform label { display: block; font-weight: 600; margin-bottom: .3rem; }
.pm-account #loginform input[type="submit"] { min-height: 46px; padding: .6rem 1.5rem; border-radius: 999px; border: 0; background: var(--pm-primary); color: #fff; font: 600 1rem var(--pm-text); cursor: pointer; }
.pm-account-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.pm-account-head h2 { margin: 0; font-size: 2.2rem; }
.pm-my-bookings { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .75rem; }
.pm-my-bookings li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; padding: 1rem; background: var(--pm-surface); border-radius: var(--pm-radius); }
.pm-my-bookings li > div:first-child { display: grid; gap: .15rem; }
.pm-my-bookings li strong { font: 700 1.25rem var(--pm-display); text-transform: capitalize; }
.pm-my-bookings.pm-past li { padding: .6rem 1rem; background: none; border-bottom: 1px solid var(--pm-line); border-radius: 0; }
.pm-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.pm-cancelled { opacity: .55; }
.pm-badge { display: inline-block; justify-self: start; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.pm-st-confirmed { background: #e7f5ee; color: var(--pm-ok); }
.pm-st-pending { background: #fff4d6; color: #8a5a00; }
.pm-st-cancelled { background: #eceff3; color: var(--pm-muted); }
.pm-history { margin: 1rem 0; }
.pm-history summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }

/* ---------- Home ---------- */
.pm-hero {
	/* Foto a tutta larghezza, anche dentro il contenitore del tema */
	position: relative; width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw);
	display: flex; justify-content: center; text-align: center;
	padding: 1.75rem 1.25rem 2rem; color: #fff; border-radius: 0;
	overflow: hidden; isolation: isolate;
	background: linear-gradient(135deg, var(--pm-primary), var(--pm-ink));
}
.pm .pm-hero-bg {
	position: absolute; inset: 0; z-index: -2;
	width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center;
}
.pm-hero.has-photo::before {
	content: ""; position: absolute; inset: 0; z-index: -1;
	background: linear-gradient(180deg, rgba(11,41,79,.55), rgba(11,41,79,.82));
}
.pm-hero-inner { position: relative; max-width: 40rem; display: flex; flex-direction: column; align-items: center; }
.pm-hero-logo { width: clamp(120px, 34vw, 200px); height: auto; margin: 0 0 .9rem; filter: drop-shadow(0 6px 16px rgba(0,0,0,.35)); }
.pm-hero h1 { font-size: clamp(1.9rem, 8vw, 3.6rem); font-weight: 800; margin: 0; color: #fff; text-transform: uppercase; line-height: 1; letter-spacing: .02em; }
.pm-hero p { font-size: .95rem; letter-spacing: .06em; margin: .45rem 0 1.1rem; opacity: .9; }
.pm-hero .pm-btn { background: var(--pm-accent); border-color: var(--pm-accent); color: var(--pm-ink); }
.pm-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }

/* Pulsanti social */
.pm-social { display: flex; gap: .5rem; }
.pm-social a {
	display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
	background: var(--pm-surface); color: var(--pm-primary); border: 1px solid var(--pm-line); text-decoration: none;
}
.pm-social svg { width: 22px; height: 22px; }
.pm-social a:hover { background: var(--pm-primary); color: #fff; border-color: var(--pm-primary); }
.pm-social-top { justify-content: flex-end; margin: 0 0 .75rem; }
.pm-social-top a { width: 40px; height: 40px; }
.pm-social-top svg { width: 20px; height: 20px; }
.pm-contact-info .pm-social { margin-bottom: 1.25rem; }

.pm-section { margin: 3.5rem 0; }
.pm-section > h2 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0 0 1.25rem; }
.pm-section > .pm-link { display: inline-block; margin-top: 1rem; }

/* ---------- Barra app in basso (solo smartphone) ---------- */
.pm-bottomnav { display: none; }
@media (max-width: 781px) {
	.pm-bottomnav {
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 9999;
		display: grid; grid-template-columns: repeat(5, 1fr);
		background: #fff; border-top: 1px solid var(--pm-line);
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
	.pm-bottomnav a { display: grid; justify-items: center; gap: 2px; padding: .35rem 0 .3rem; color: var(--pm-muted); text-decoration: none; font: 600 .66rem/1.2 var(--pm-text); }
	.pm-bottomnav svg { width: 21px; height: 21px; }
	.pm-bottomnav a[aria-current="page"] { color: var(--pm-primary); }
	body { padding-bottom: calc(54px + env(safe-area-inset-bottom, 0px)); }
}
