/**
 * 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;
}

/* ============================================
   Variables de diseño (carrusel tipo referencia)
   ============================================ */
:root {
	--novedades-purple: #5c2d91;
	--novedades-purple-light: #8b5cf6;
	--novedades-purple-border: 4px;
	/* Fondo del bloque: gris claro / blanco suave */
	--novedades-bg-light: #f7f7f8;
	--novedades-bg-white: #ffffff;
}

/* ============================================
   Contenedor Principal (gris y blanco, bordes redondeados, sin línea violeta)
   ============================================ */

.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 */
	box-sizing: border-box;
	/* Sin línea violeta: fondo gris claro con área interior en blanco */
	background: var(--novedades-bg-light);
	border: none;
	border-radius: 24px; /* Rectángulo con esquinas redondeadas */
	/* Espacio generoso para que las tarjetas no se vean pegadas ni forzadas */
	padding: 3rem 2rem;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* 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)
   ============================================ */

/* Contenedor interior: más aire, como en la foto de ejemplo */
.novedades-carousel-wrapper {
	position: relative;
	padding: 0 3rem; /* Más espacio lateral para las flechas y que no esté forzado */
	max-width: 100%;
}

/* Área blanca interior sobre el gris: las tarjetas no quedan pegadas al borde */
.novedades-carousel-container {
	overflow: hidden;
	width: 100%;
	background: var(--novedades-bg-white);
	border-radius: 16px;
	padding: 2rem 1.5rem;
	box-sizing: border-box;
}

/* Separación clara entre tarjetas, sin que queden pegadas */
.novedades-carousel-track {
	display: flex;
	transition: transform 0.5s ease-in-out;
	gap: 2.5rem;
}

/* Primera tarjeta más ancha; 2.ª y 3.ª más delgadas para diferenciación clara */
.novedad-carousel-item {
	min-width: 0; /* Permite que el contenido se ajuste */
}

.novedad-carousel-item:first-child {
	flex: 0 0 calc((100% - 5rem) * 0.42); /* 42%: tarjeta destacada (gap 2.5rem x2) */
}

.novedad-carousel-item:not(:first-child) {
	flex: 0 0 calc((100% - 5rem) * 0.29); /* 29% cada una: más delgadas */
}

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

/* Flechas del carousel: púrpura claro en área translúcida */
.novedades-carousel-prev,
.novedades-carousel-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 50px;
	height: 50px;
	background: rgba(139, 92, 246, 0.25);
	backdrop-filter: blur(6px);
	color: var(--novedades-purple);
	border: 1px solid rgba(92, 45, 145, 0.3);
	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, color 0.3s ease;
}

.novedades-carousel-prev {
	left: 8px;
}

.novedades-carousel-next {
	right: 8px;
}

.novedades-carousel-prev:hover,
.novedades-carousel-next:hover {
	background: rgba(139, 92, 246, 0.4);
	color: var(--novedades-purple);
	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: 22px;
	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 */
}

/* ============================================
   Tarjeta de Novedad (diseño carrusel referencia)
   ============================================ */

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

.novedad-card-inner {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 320px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	overflow: hidden;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	cursor: pointer;
	text-decoration: none;
	color: inherit;
	position: relative;
}

.novedad-card-inner:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(92, 45, 145, 0.12);
}

.novedad-card-image {
	width: 100%;
	height: 200px;
	overflow: hidden;
	background: linear-gradient(135deg, #e9d5ff 0%, #ddd6fe 100%);
	flex-shrink: 0;
}

.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.25rem 1.5rem 1.5rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.novedad-card-title {
	margin: 0 0 0.5rem 0;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.35;
	color: #fff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.novedad-card-subtitle {
	margin: 0 0 0.5rem 0;
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.95);
	font-weight: 400;
}

.novedad-card-excerpt {
	margin: 0 0 1rem 0;
	font-size: 0.875rem;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.9);
	flex: 1;
}

/* Botón tipo píldora: blanco, borde púrpura, texto púrpura, flecha en círculo. Siempre visible. */
.novedad-card-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-top: auto;
	padding: 0.5rem 1rem 0.5rem 1.25rem;
	background: #fff;
	color: var(--novedades-purple);
	border: 2px solid var(--novedades-purple);
	border-radius: 9999px; /* Píldora */
	font-size: 0.875rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
	align-self: flex-start;
	flex-shrink: 0; /* Nunca colapsar ni ocultar el botón */
	min-height: 44px;
}

.novedad-card-cta-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	background: var(--novedades-purple);
	color: #fff;
	border-radius: 50%;
	font-size: 0.9rem;
	line-height: 1;
	flex-shrink: 0;
}

.novedad-card-inner:hover .novedad-card-link {
	background: var(--novedades-purple);
	color: #fff;
	border-color: var(--novedades-purple);
}

.novedad-card-inner:hover .novedad-card-cta-icon {
	background: #fff;
	color: var(--novedades-purple);
}

/* Tarjetas con imagen: título y texto sobre fondo oscuro para legibilidad */
.novedad-card-inner.novedad-card-has-image .novedad-card-content {
	background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
	margin-top: -80px;
	padding-top: 3rem;
	position: relative;
	z-index: 1;
}

/* Si no hay imagen, mantener texto oscuro */
.novedad-card-inner:not(.novedad-card-has-image) .novedad-card-content {
	background: transparent;
	margin-top: 0;
	padding-top: 1.25rem;
}

.novedad-card-inner:not(.novedad-card-has-image) .novedad-card-title,
.novedad-card-inner:not(.novedad-card-has-image) .novedad-card-subtitle,
.novedad-card-inner:not(.novedad-card-has-image) .novedad-card-excerpt {
	color: #333;
	text-shadow: none;
}

.novedad-card-inner:not(.novedad-card-has-image) .novedad-card-subtitle,
.novedad-card-inner:not(.novedad-card-has-image) .novedad-card-excerpt {
	color: #555;
}

/* ============================================
   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;
	}
}

