/**
 * Estilos Frontend del Plugin Novedades
 *
 * Estilos para las tarjetas de novedades, modal y página individual.
 * Diseñado para no interferir con el tema activo.
 *
 * @package NovedadesPlugin
 * @since 1.0.0
 */

/* ============================================
   Sticky Footer Fix (v1.2.0)
   ============================================ */

/* Asegurar que el body y html tengan altura completa */
body.novedades-archive-page,
body.single-novedad,
body.page-template-archive-novedad {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

/* El contenido principal debe crecer para empujar el footer */
body.novedades-archive-page #main,
body.novedades-archive-page .site-main,
body.novedades-archive-page main,
body.single-novedad #main,
body.single-novedad .site-main,
body.single-novedad main {
	flex: 1 0 auto;
}

/* El footer debe quedarse al final */
body.novedades-archive-page footer,
body.novedades-archive-page .site-footer,
body.novedades-archive-page #footer,
body.novedades-archive-page [role="contentinfo"],
body.single-novedad footer,
body.single-novedad .site-footer,
body.single-novedad #footer,
body.single-novedad [role="contentinfo"] {
	flex-shrink: 0;
	margin-top: auto;
}

/* Solución alternativa más agresiva usando JavaScript si es necesario */
.novedades-footer-fix {
	min-height: calc(100vh - 200px); /* Altura de viewport menos header/footer estimado */
	padding-bottom: 2rem;
}

/* ============================================
   Contenedor Principal
   ============================================ */

.novedades-container,
.novedades-archive-container {
	width: 100%;
	margin: 2rem 0;
	margin-bottom: 4rem; /* Espacio adicional antes del footer */
	min-height: 400px; /* Altura mínima para el contenido */
}

/* Asegurar que el contenedor del archivo tenga espacio suficiente */
.novedades-archive-container {
	padding-bottom: 3rem; /* Espacio adicional al final */
	position: relative;
}

/* ============================================
   Carousel de Novedades (v1.2.0)
   ============================================ */

.novedades-carousel-wrapper {
	position: relative;
	padding: 0 50px; /* Espacio para las flechas */
}

.novedades-carousel-container {
	overflow: hidden;
	width: 100%;
}

.novedades-carousel-track {
	display: flex;
	transition: transform 0.5s ease-in-out;
	gap: 2rem;
}

.novedad-carousel-item {
	flex: 0 0 calc(33.333% - 1.33rem); /* 3 columnas con gap */
	min-width: 0; /* Permite que el contenido se ajuste */
}

/* Mostrar solo 3 visibles */
.novedades-carousel-container {
	width: 100%;
}

/* Flechas del carousel */
.novedades-carousel-prev,
.novedades-carousel-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 50px;
	height: 50px;
	background: #0073aa;
	color: #fff;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	transition: background 0.3s ease, transform 0.3s ease;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.novedades-carousel-prev {
	left: 0;
}

.novedades-carousel-next {
	right: 0;
}

.novedades-carousel-prev:hover,
.novedades-carousel-next:hover {
	background: #005a87;
	transform: translateY(-50%) scale(1.1);
}

.novedades-carousel-prev:active,
.novedades-carousel-next:active {
	transform: translateY(-50%) scale(0.95);
}

.novedades-carousel-arrow {
	font-size: 24px;
	line-height: 1;
	font-weight: bold;
}

/* Deshabilitar flechas cuando no hay más contenido */
.novedades-carousel-prev.disabled,
.novedades-carousel-next.disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* Responsive: en móviles mostrar 1, en tablets 2 */
@media (max-width: 768px) {
	.novedades-carousel-wrapper {
		padding: 0 40px;
	}
	
	.novedad-carousel-item {
		flex: 0 0 calc(100% - 1rem); /* 1 columna en móvil */
	}
	
	.novedades-carousel-prev,
	.novedades-carousel-next {
		width: 40px;
		height: 40px;
	}
	
	.novedades-carousel-arrow {
		font-size: 20px;
	}
}

@media (min-width: 769px) and (max-width: 1024px) {
	.novedad-carousel-item {
		flex: 0 0 calc(50% - 1rem); /* 2 columnas en tablet */
	}
}

/* ============================================
   Página de Archivo
   ============================================ */

/* Asegurar que el main tenga altura mínima y empuje el footer */
.site-main {
	min-height: 60vh;
}

.page-header {
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 2px solid #e0e0e0;
}

.page-title {
	margin: 0 0 1rem 0;
	font-size: 2.5rem;
	font-weight: 700;
	line-height: 1.2;
	color: #333;
}

.archive-description {
	font-size: 1.1rem;
	line-height: 1.6;
	color: #666;
}

.novedades-no-posts {
	padding: 3rem 2rem;
	text-align: center;
	background: #f9f9f9;
	border-radius: 8px;
}

.novedades-no-posts p {
	margin: 0;
	font-size: 1.1rem;
	color: #666;
}

/* Asegurar que el contenedor del archivo tenga espacio suficiente */
.novedades-archive-container {
	padding-bottom: 3rem; /* Espacio adicional al final */
}

/* Asegurar que el carousel wrapper en el archivo no afecte el layout */
.novedades-archive-container.novedades-carousel-wrapper {
	position: relative;
	overflow: visible; /* Permitir que el contenido fluya normalmente */
}

/* ============================================
   Grid de Novedades (para cuando no hay carousel)
   ============================================ */

.novedades-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 2rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.novedades-grid-1 {
	grid-template-columns: 1fr;
}

.novedades-grid-2 {
	grid-template-columns: repeat(2, 1fr);
}

.novedades-grid-3 {
	grid-template-columns: repeat(3, 1fr);
}

.novedades-grid-4 {
	grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
	.novedades-grid {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}
}

/* Cuando no hay carousel (3 o menos items), usar grid normal */
.novedades-no-carousel .novedades-carousel-track {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 2rem;
	transform: none !important;
}

.novedades-no-carousel .novedad-carousel-item {
	flex: none;
}

.novedades-no-carousel {
	padding: 0 !important; /* Sin padding para las flechas */
}

@media (max-width: 768px) {
	.novedades-no-carousel .novedades-carousel-track {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}
}

@media (min-width: 769px) and (max-width: 1024px) {
	.novedades-no-carousel .novedades-carousel-track {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ============================================
   Tarjeta de Novedad
   ============================================ */

.novedad-card {
	margin: 0;
	padding: 0;
}

.novedad-card-inner {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	cursor: pointer;
	text-decoration: none;
	color: inherit;
}

.novedad-card-inner:hover {
	transform: translateY(-4px);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.novedad-card-image {
	width: 100%;
	height: 200px;
	overflow: hidden;
	background: #f0f0f0;
}

.novedad-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.novedad-card-inner:hover .novedad-card-image img {
	transform: scale(1.05);
}

.novedad-card-content {
	padding: 1.5rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.novedad-card-title {
	margin: 0 0 0.5rem 0;
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.4;
	color: #333;
}

.novedad-card-subtitle {
	margin: 0 0 1rem 0;
	font-size: 0.95rem;
	color: #666;
	font-weight: 400;
}

.novedad-card-excerpt {
	margin: 0 0 1rem 0;
	font-size: 0.9rem;
	line-height: 1.6;
	color: #555;
	flex: 1;
}

.novedad-card-link {
	display: inline-block;
	margin-top: auto;
	padding: 0.5rem 1rem;
	background: #0073aa;
	color: #fff;
	border-radius: 4px;
	font-size: 0.9rem;
	font-weight: 500;
	text-align: center;
	transition: background 0.3s ease;
}

.novedad-card-inner:hover .novedad-card-link {
	background: #005a87;
}

/* ============================================
   Modal de Vista Previa
   ============================================ */

.novedades-modal {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.novedades-modal.active {
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 1;
}

.novedades-modal-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(4px);
}

.novedades-modal-content {
	position: relative;
	width: 90%;
	max-width: 800px;
	max-height: 90vh;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	overflow: hidden;
	z-index: 1;
	transform: scale(0.9);
	transition: transform 0.3s ease;
}

.novedades-modal.active .novedades-modal-content {
	transform: scale(1);
}

.novedades-modal-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.9);
	border: none;
	border-radius: 50%;
	cursor: pointer;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.3s ease;
}

.novedades-modal-close:hover {
	background: #fff;
}

.novedades-modal-close-icon {
	font-size: 24px;
	line-height: 1;
	color: #333;
	font-weight: bold;
}

.novedades-modal-body {
	overflow-y: auto;
	max-height: 90vh;
}

.novedades-modal-image {
	width: 100%;
	height: 300px;
	overflow: hidden;
	background: #f0f0f0;
}

.novedades-modal-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.novedades-modal-text {
	padding: 2rem;
}

.novedades-modal-title {
	margin: 0 0 0.5rem 0;
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1.3;
	color: #333;
}

.novedades-modal-subtitle {
	margin: 0 0 1rem 0;
	font-size: 1.1rem;
	color: #666;
	font-weight: 400;
}

.novedades-modal-excerpt {
	margin: 0 0 1.5rem 0;
	font-size: 1rem;
	line-height: 1.7;
	color: #555;
}

.novedades-modal-button {
	display: inline-block;
	padding: 0.75rem 2rem;
	background: #0073aa;
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
	font-size: 1rem;
	font-weight: 500;
	transition: background 0.3s ease;
}

.novedades-modal-button:hover {
	background: #005a87;
}

/* ============================================
   Página Individual de Novedad
   ============================================ */

.novedad-single {
	max-width: 900px;
	margin: 2rem auto;
	padding: 2rem;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.novedad-single-header {
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 2px solid #e0e0e0;
}

.novedad-single-title {
	margin: 0 0 0.5rem 0;
	font-size: 2.5rem;
	font-weight: 700;
	line-height: 1.2;
	color: #333;
}

.novedad-single-subtitle {
	margin: 0 0 1rem 0;
	font-size: 1.25rem;
	color: #666;
	font-weight: 400;
}

.novedad-single-meta {
	font-size: 0.9rem;
	color: #999;
}

.novedad-single-content {
	margin-bottom: 2rem;
}

.novedad-single-image {
	margin: 2rem 0;
	border-radius: 8px;
	overflow: hidden;
}

.novedad-single-image img {
	width: 100%;
	height: auto;
	display: block;
}

.novedad-single-text {
	font-size: 1.1rem;
	line-height: 1.8;
	color: #333;
}

.novedad-single-text p {
	margin-bottom: 1.5rem;
}

.novedad-single-footer {
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 2px solid #e0e0e0;
}

.novedad-single-back {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	background: #0073aa;
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
	font-size: 1rem;
	transition: background 0.3s ease;
}

.novedad-single-back:hover {
	background: #005a87;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
	.novedades-modal-content {
		width: 95%;
		max-height: 95vh;
	}

	.novedades-modal-text {
		padding: 1.5rem;
	}

	.novedades-modal-title {
		font-size: 1.5rem;
	}

	.novedad-single {
		margin: 1rem;
		padding: 1.5rem;
	}

	.novedad-single-title {
		font-size: 2rem;
	}
}

