/**
 * Estilos CSS para Post Banners
 * 
 * Estilos para o frontend e para o editor Gutenberg
 */

/* ==========================================================================
   Estilos do Carrossel de Banners
   ========================================================================== */

.post-banners-carousel {
	position: relative;
	width: 100%;
	max-width: 100%;
	margin: 20px auto;
	overflow: hidden;
}

.post-banner-item {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	opacity: 0;
	transition: opacity 0.6s ease-in-out;
	pointer-events: none;
}

.post-banner-item.active {
	position: relative;
	opacity: 1;
	pointer-events: auto;
	text-align: center;
}

.post-banner-link {
	display: inline-block;
	text-decoration: none;
	outline: none;
	line-height: 0;
	font-size: 0;
}

.post-banner-link:hover {
	opacity: 0.9;
	transition: opacity 0.3s ease;
}

.post-banner-link picture {
	display: inline-block;
	line-height: 0;
	font-size: 0;
}

/* Imagem se ajusta ao container mas nunca expande além do tamanho original */
.post-banner-image {
	display: block;
	max-width: 100%;
	width: auto;
	height: auto;
}

/* ==========================================================================
   Responsividade
   ========================================================================== */

@media screen and (max-width: 768px) {
	.post-banners-carousel {
		margin: 15px auto;
	}
}

/* ==========================================================================
   Estilos do Editor Gutenberg
   ========================================================================== */

.post-banner-editor-preview {
	padding: 20px;
	text-align: center;
	border: 2px dashed #ccc;
	border-radius: 4px;
	background-color: #f9f9f9;
	color: #555;
	min-height: 150px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.post-banner-placeholder {
	padding: 40px 20px;
	text-align: center;
	background-color: #f0f0f0;
	border: 2px dashed #ddd;
	border-radius: 4px;
	color: #666;
	font-size: 14px;
}

/* ==========================================================================
   Animações e Transições
   ========================================================================== */

.post-banner-item {
	animation-duration: 0.6s;
	animation-fill-mode: both;
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes fadeOut {
	from {
		opacity: 1;
	}
	to {
		opacity: 0;
	}
}

/* ==========================================================================
   Estados de Carregamento
   ========================================================================== */

.post-banner-item img {
	opacity: 1;
	transition: opacity 0.3s ease;
}

.post-banner-item img:not([src]) {
	opacity: 0;
}

/* ==========================================================================
   Acessibilidade
   ========================================================================== */

.post-banner-link:focus {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* Remove outline para mouse, mantém para teclado */
.post-banner-link:focus:not(:focus-visible) {
	outline: none;
}

.post-banner-link:focus-visible {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
}

/* ==========================================================================
   Compatibilidade com Temas
   ========================================================================== */

/* Remove margens/paddings que alguns temas possam adicionar */
.post-banners-carousel p,
.post-banners-carousel figure {
	margin: 0;
	padding: 0;
}

/* Garante que links não tenham underline */
.post-banner-link:hover,
.post-banner-link:visited,
.post-banner-link:active {
	text-decoration: none;
}

/* Reset de estilos que temas podem aplicar */
.post-banner-image {
	max-width: 100% !important;
	width: auto !important;
	height: auto !important;
}

/* Para picture tag */
.post-banner-link picture {
	display: block;
	line-height: 0;
}

.post-banner-link picture img {
	max-width: 100%;
	width: auto;
	height: auto;
}

/* ==========================================================================
   Estilos de Print (opcional)
   ========================================================================== */

@media print {
	.post-banners-carousel {
		page-break-inside: avoid;
	}
	
	/* Mostra apenas o primeiro banner ao imprimir */
	.post-banner-item:not(.active) {
		display: none;
	}
}

/* ==========================================================================
   Lazy Loading (opcional)
   ========================================================================== */

.post-banner-image[loading="lazy"] {
	min-height: 200px;
	background: #f0f0f0;
}

/* ==========================================================================
   Dark Mode Support (opcional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
	.post-banner-placeholder {
		background-color: #2d2d2d;
		border-color: #555;
		color: #ccc;
	}
	
	.post-banner-editor-preview {
		background-color: #2d2d2d;
		border-color: #555;
		color: #ccc;
	}
}
