/* Eventi e Prenotazioni – frontend. Colori sovrascrivibili dal tema con le variabili. */
.ep-evento, .ep-form-wrap, .ep-lista {
	--ep-accent: #7a1f3d;
	--ep-accent-fg: #fff;
	--ep-border: #d9dce1;
	--ep-muted: #5f6672;
	--ep-bg-soft: #f6f7f9;
	--ep-radius: 8px;
}

/* Evento ----------------------------------------------------------- */
.ep-evento__foto img { width: 100%; height: auto; border-radius: var(--ep-radius); display: block; }
.ep-evento__titolo { margin: 1rem 0 .5rem; }
.ep-meta { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; }
.ep-meta li { margin: 0; }
.ep-meta li > span:not(.ep-badge) { display: block; font-size: .75em; text-transform: uppercase; letter-spacing: .04em; color: var(--ep-muted); }

/* Badge ------------------------------------------------------------ */
.ep-badge { display: inline-block; padding: .2em .65em; border-radius: 999px; font-size: .78em; font-weight: 600; line-height: 1.5; background: #e5e7eb; color: #374151; }
.ep-badge--aperto { background: #dcfce7; color: #166534; }
.ep-badge--completo { background: #fee2e2; color: #991b1b; }
.ep-badge--chiuso { background: #e5e7eb; color: #4b5563; }
.ep-badge--in_attesa { background: #fef3c7; color: #92400e; }

/* Avvisi ----------------------------------------------------------- */
.ep-avviso { padding: .9rem 1.1rem; border-radius: var(--ep-radius); border-left: 4px solid; margin: 0 0 1rem; background: var(--ep-bg-soft); }
.ep-avviso ul { margin: .5rem 0 0 1.2rem; }
.ep-avviso--ok { border-color: #16a34a; background: #f0fdf4; }
.ep-avviso--warn { border-color: #d97706; background: #fffbeb; }
.ep-avviso--stop { border-color: #dc2626; background: #fef2f2; }
.ep-avviso--info { border-color: #2563eb; background: #eff6ff; }

/* Form ------------------------------------------------------------- */
.ep-form-wrap { margin: 2rem 0; }
.ep-form { border: 1px solid var(--ep-border); border-radius: var(--ep-radius); padding: 1.5rem; }
.ep-form__titolo { margin: 0 0 1rem; }
.ep-fs { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
.ep-fs legend { font-weight: 700; margin-bottom: .75rem; padding: 0; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.ep-field { margin: 0 0 .9rem; }
.ep-field label { display: block; font-weight: 600; font-size: .9em; margin-bottom: .3rem; }
.ep-field input[type=text], .ep-field input[type=email], .ep-field input[type=tel], .ep-field select,
.ep-nominativo input { width: 100%; max-width: 100%; box-sizing: border-box; padding: .6rem .75rem; border: 1px solid var(--ep-border); border-radius: 6px; font: inherit; background: #fff; }
.ep-field--posti select { width: auto; min-width: 6rem; }
.ep-field small { display: block; color: var(--ep-muted); margin-top: .3rem; }
.ep-nominativi { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem 1rem; }
.ep-nominativo label { display: block; font-size: .85em; font-weight: 600; margin-bottom: .25rem; }
.ep-nominativo[hidden] { display: none; }
.ep-privacy label { font-weight: 400; display: flex; gap: .5rem; align-items: flex-start; }
.ep-privacy input { margin-top: .25em; flex: none; }
.ep-invalid { border-color: #dc2626 !important; box-shadow: 0 0 0 1px #dc2626; }
.ep-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.ep-btn { display: inline-block; background: var(--ep-accent); color: var(--ep-accent-fg) !important; border: 0; border-radius: 6px; padding: .75rem 1.5rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.ep-btn:hover, .ep-btn:focus { filter: brightness(1.1); }
.ep-btn[disabled] { opacity: .6; cursor: wait; }
.ep-btn--small { padding: .45rem 1rem; font-size: .9em; }

/* Lista eventi ----------------------------------------------------- */
.ep-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin: 1.5rem 0; }
.ep-card { border: 1px solid var(--ep-border); border-radius: var(--ep-radius); overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.ep-card__foto { display: block; aspect-ratio: 16 / 9; background: var(--ep-bg-soft); overflow: hidden; }
.ep-card__foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep-card__body { padding: 1rem 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; align-items: flex-start; }
.ep-card__titolo { margin: .25rem 0 0; font-size: 1.15em; }
.ep-card__titolo a { text-decoration: none; }
.ep-card__data { margin: 0; color: var(--ep-muted); font-size: .9em; }
.ep-card__estratto { margin: 0; font-size: .95em; }
.ep-card__posti { margin: 0; font-size: .85em; font-weight: 600; color: #166534; }
.ep-card .ep-btn { margin-top: auto; }
.ep-card--completo .ep-card__foto, .ep-card--chiuso .ep-card__foto { filter: grayscale(.6); }

@media (max-width: 480px) {
	.ep-form { padding: 1rem; }
}

/* Pulsante "Conferma prenotazione" – selettore specifico + !important per battere gli stili del tema */
.ep-form-wrap .ep-form button.ep-btn,
.ep-form-wrap .ep-form button.ep-btn:visited {
	background: #3bcf93 !important;
	background-color: #3bcf93 !important;
	border: 0 !important;
	color: #fff !important;
	filter: none;
}
.ep-form-wrap .ep-form button.ep-btn:hover,
.ep-form-wrap .ep-form button.ep-btn:focus-visible {
	background: #2fb57f !important;
	background-color: #2fb57f !important;
}
.ep-form-wrap .ep-form button.ep-btn:focus-visible {
	outline: 2px solid #1f8a5f;
	outline-offset: 2px;
}

/* [ep_prenota]: form sopra, descrizione sotto */
.ep-prenota__head .ep-evento__titolo { margin-top: 0; }
.ep-prenota .ep-form-wrap { margin: 1rem 0 2.5rem; }
.ep-prenota__descrizione { border-top: 1px solid var(--ep-border, #d9dce1); padding-top: 2rem; }
.ep-prenota__descrizione .ep-evento__foto { margin-bottom: 1.25rem; }
/* [ep_prenota foto="no"]: form in cima, nessuna intestazione */
.ep-prenota > .ep-form-wrap:first-child { margin-top: 0; }

/* Campo note */
.ep-note textarea { width: 100%; max-width: 100%; box-sizing: border-box; padding: .6rem .75rem; border: 1px solid var(--ep-border, #d9dce1); border-radius: 6px; font: inherit; background: #fff; resize: vertical; min-height: 4.5em; }

/* Testi personalizzati del form (per evento) */
.ep-form__testo { margin: 0 0 1.25rem; }
.ep-form__testo > :first-child { margin-top: 0; }
.ep-form__testo > :last-child { margin-bottom: 0; }
.ep-form__testo--sotto { margin: 1rem 0 0; font-size: .95em; }
