/**
 * WoP - Salas de Provas
 *
 * Namespace "spv" (Salas de Provas) para nao colidir com nenhum outro
 * widget do WEM. Base do Swiper (posicionamento minimo de .swiper/
 * .swiper-wrapper/.swiper-slide) escrita aqui de proposito, tal como no
 * WoP-Slider Galeria (wem-gallery-slider) - o Elementor nao garante que o
 * CSS base do Swiper esteja sempre presente so por o script 'swiper' ser
 * uma dependencia.
 */

.spv {
	--spv-font: Soho, Arial, sans-serif;
}

/* ------------------------------------------------------------------ *
 * Cabecalho: titulo + link opcional "Ver todas"
 * ------------------------------------------------------------------ */

.spv__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px 24px;
	margin-bottom: 24px;
}

.spv__title {
	margin: 0;
	font-family: var(--spv-font);
	font-size: 28px;
	font-weight: 700;
}

.spv__link-todas {
	white-space: nowrap;
}

/* ------------------------------------------------------------------ *
 * Barra: abas de sala + Vista Mensal
 * ------------------------------------------------------------------ */

.spv__bar {
	display: flex;
	/* flex-end (nao "center"): garante que a borda inferior da aba ativa
	   (.spv__tab.is-active, desenhada no fundo da propria caixa do botao)
	   fica exatamente à mesma altura da linha cinza deste container (0px
	   de espaco entre elas, sobrepondo-se), em vez de a aba ficar
	   centrada verticalmente e a borda ficar acima da linha. */
	align-items: flex-end;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px 24px;
	border-bottom: 1px solid #e2e2e2;
	margin-bottom: 32px;
}

.spv__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0 28px;
}

.spv__tab {
	appearance: none;
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	cursor: pointer;
	padding: 0 0 14px;
	font-family: var(--spv-font);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: #4a4a4a;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.spv__tab:hover,
.spv__tab:focus-visible {
	color: #1a1a1a;
}

.spv__tab.is-active {
	color: #ba2229;
	border-bottom-color: #ba2229;
}

/* ------------------------------------------------------------------ *
 * Vista Mensal: botao + popup (ano + grelha de meses)
 * ------------------------------------------------------------------ */

.spv__mensal {
	position: relative;
}

/* Mesma tipografia e "caixa" das abas (.spv__tab: padding "0 0 14px" +
   borda inferior de 2px transparente) de proposito - com .spv__bar em
   align-items:flex-end (ver acima), isto garante que o botao "Vista
   Mensal" fica exatamente na mesma linha de base das abas, sem precisar
   de nenhum ajuste de posicionamento a parte. */
.spv__mensal-btn {
	appearance: none;
	background: var(--spv-mensal-header-fundo, none);
	border: none;
	border-bottom: 2px solid transparent;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0 0 14px;
	font-family: var(--spv-font);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: var(--spv-mensal-header-cor, #4a4a4a);
	transition: color 0.15s ease;
}

.spv__mensal-btn:hover,
.spv__mensal-btn:focus-visible {
	color: var(--spv-mensal-header-cor-hover, #1a1a1a);
}

.spv__mensal-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.spv__mensal-btn__label {
	white-space: nowrap;
}

.spv__mensal-btn__clear {
	appearance: none;
	flex: none;
	width: 18px;
	height: 18px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.08);
	color: inherit;
	font-size: 11px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.spv__mensal-btn__clear:hover,
.spv__mensal-btn__clear:focus-visible {
	background: rgba(0, 0, 0, 0.16);
}

.spv__mensal-btn__clear[hidden] {
	display: none;
}

/* O icone escolhido no separador Conteudo (ver Icons_Manager::render_icon()
   em widget.php) pode ser uma tag de fonte de icones (<i>) ou um <svg> em
   linha, consoante a biblioteca - ambos herdam o tamanho/cor definidos nos
   controlos de Estilo em vez de teres de escolher consoante o tipo. */
.spv__mensal-btn__clear i,
.spv__mensal-btn__clear svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.spv__mensal-btn__clear i {
	font-size: inherit;
	line-height: 1;
	width: auto;
	height: auto;
}

.spv__mensal-btn__chevron {
	flex: none;
	transition: transform 0.15s ease;
}

.spv__mensal[data-open="1"] .spv__mensal-btn__chevron {
	transform: rotate(180deg);
}

/* O popup e um cartao flutuante independente (nao "colado" ao botao -
   este agora e do tamanho do proprio texto, tal como uma aba, por isso
   nao faria sentido o popup herdar a sua largura). Ancorado a direita do
   botao. */
.spv__mensal-popup {
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 20;
	width: 300px;
	max-width: 90vw;
	margin-top: 10px;
	padding: 0 8px 12px;
	background: var(--spv-mensal-popup-fundo, #fff);
	border-radius: 8px;
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
}

.spv__mensal-popup[hidden] {
	display: none;
}

.spv__mensal-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 6px 12px;
	margin-bottom: 4px;
	border-bottom: 1px solid #ececec;
	font-family: var(--spv-font);
	font-size: 15px;
	font-weight: 700;
	color: #1a1a1a;
}

.spv__mensal-prev,
.spv__mensal-next {
	appearance: none;
	background: none;
	border: none;
	width: 28px;
	height: 28px;
	cursor: pointer;
	line-height: 1;
	font-size: 16px;
	color: #9a9a9a;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.spv__mensal-prev:hover,
.spv__mensal-next:hover,
.spv__mensal-prev:focus-visible,
.spv__mensal-next:focus-visible {
	color: #1a1a1a;
}

.spv__mensal-months {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 2px;
	margin-bottom: 6px;
}

.spv__mensal-month {
	appearance: none;
	background: none;
	border: none;
	border-radius: 4px;
	padding: 13px 10px;
	font-family: var(--spv-font);
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	color: var(--spv-mensal-mes-cor, #1a1a1a);
	transition: color 0.15s ease, background-color 0.15s ease;
}

.spv__mensal-month:hover,
.spv__mensal-month:focus-visible {
	background: #f5f5f5;
}

.spv__mensal-month.is-active {
	background: var(--spv-mensal-mes-ativo-fundo, #ba2229);
	color: var(--spv-mensal-mes-ativo-cor, #fff);
}

.spv__mensal-month.is-active:hover {
	background: var(--spv-mensal-mes-ativo-fundo, #ba2229);
}

/* Aparencia (cor, tipografia, borda, raio, padding) vem inteiramente das
   classes wem-botao/wem-botao--primario (ver widget.php e
   includes/class-wem-botao-settings.php) - aqui so o LAYOUT deste botao
   dentro do popup (largura total, separador acima, espacamento). */
.spv__mensal-reset.wem-botao {
	display: block;
	width: 100%;
	text-align: center;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid #ececec;
}

.spv__mensal-reset[hidden] {
	display: none;
}

/* ------------------------------------------------------------------ *
 * Resultados: carrossel (Swiper) + setas + estado vazio
 * ------------------------------------------------------------------ */

.spv__results {
	position: relative;
	/* Reserva espaco para as setas fora da area do carrossel (ver
	   .spv__nav abaixo) para que nunca sobreponham o primeiro/ultimo
	   cartao visivel. Removida via .spv__results--sem-setas quando as
	   setas estao desativadas (ver register_content_carrossel_section()
	   em widget.php). */
	padding: 0 52px;
}

.spv__results.spv__results--sem-setas {
	padding: 0;
}

.spv__viewport.swiper {
	position: relative;
	overflow: hidden;
	margin: 0;
}

.spv__wrapper.swiper-wrapper {
	position: relative;
	z-index: 1;
	display: flex;
	box-sizing: content-box;
}

.spv__slide.swiper-slide {
	flex-shrink: 0;
	position: relative;
	height: auto;
}

/* Sobreposto ao .spv__viewport (que ja e position:relative, ver acima) -
   nao ao .spv__results inteiro, para nao cobrir as setas/estado vazio.
   Escondido por omissao (display:none): so aparece quando o JS liga
   ".is-loading" em .spv__results durante um pedido AJAX (abas/Vista
   Mensal) - ver fetchResults() em assets/js/widget.js. Os cartoes
   anteriores ficam visiveis por baixo, so esbatidos (opacity), para nao
   haver um "salto" vazio enquanto a pesquisa esta em curso. */
.spv__loading {
	display: none;
	position: absolute;
	inset: 0;
	z-index: 6;
	align-items: center;
	justify-content: center;
}

.spv__results.is-loading .spv__loading {
	display: flex;
}

.spv__results.is-loading .spv__viewport {
	opacity: 0.35;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.spv__spinner {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 3px solid var(--spv-spinner-fundo, rgba(26, 26, 26, 0.15));
	border-top-color: var(--spv-spinner-cor, #ba2229);
	animation: spv-spin 0.7s linear infinite;
}

@keyframes spv-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.spv__spinner {
		animation-duration: 1.6s;
	}
}

.spv__nav {
	position: absolute;
	top: 40%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid #1a1a1a;
	background: #fff;
	color: #1a1a1a;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	line-height: 1;
	transition: color 0.15s ease, border-color 0.15s ease;
	z-index: 5;
}

.spv__nav--prev {
	left: 0;
}

.spv__nav--next {
	right: 0;
}

.spv__nav.swiper-button-disabled {
	opacity: 0.35;
	cursor: default;
}

.spv__empty {
	text-align: center;
	padding: 60px 20px;
}

.spv__empty[hidden] {
	display: none;
}

.spv__empty-title {
	margin: 0 0 8px;
	font-family: var(--spv-font);
	font-size: 20px;
	font-weight: 700;
}

.spv__empty-desc {
	margin: 0;
	color: #6a6a6a;
}

/* ------------------------------------------------------------------ *
 * Cartao embutido (usado quando nenhum Loop Item e escolhido)
 * ------------------------------------------------------------------ */

.spv-card {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	background: #f7f7f7;
	border-radius: 6px;
	overflow: hidden;
	height: 100%;
}

.spv-card__img {
	display: block;
	width: 100%;
	padding-top: 62%;
	background-size: cover;
	background-position: center;
	background-color: #1a1a1a;
}

.spv-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px;
}

.spv-card__tag {
	align-self: flex-start;
	padding: 3px 10px;
	border-radius: 3px;
	font-family: var(--spv-font);
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #fff;
	background: #ba2229;
}

.spv-card__date {
	font-family: var(--spv-font);
	font-size: 12px;
	color: #6a6a6a;
}

.spv-card__title {
	font-family: var(--spv-font);
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	color: #1a1a1a;
}

.spv-card__desc {
	font-size: 13px;
	line-height: 1.5;
	color: #4a4a4a;
}

/* ------------------------------------------------------------------ *
 * Responsivo
 * ------------------------------------------------------------------ */

@media (max-width: 767px) {
	.spv__results {
		padding: 0 40px;
	}

	.spv__nav {
		width: 32px;
		height: 32px;
		font-size: 15px;
	}
}
