/**
 * Estilos del bloque de novedades en el frontend.
 * Diseño responsive: 3 tarjetas horizontales, botón "Ver más", desplegable y modal.
 */

/* Bloque contenedor */
.novedades-aa-block {
	--novedades-aa-bg: linear-gradient(180deg, #0f1729 0%, #0a0e1a 100%);
	--novedades-aa-card-bg: #fff;
	--novedades-aa-card-footer-bg: #fff;
	--novedades-aa-btn-bg: #2563eb;
	--novedades-aa-btn-color: #fff;
	--novedades-aa-text-dark: #1e293b;
	--novedades-aa-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	--novedades-aa-radius: 12px;
	--novedades-aa-radius-btn: 8px;
	background: var(--novedades-aa-bg);
	padding: 2rem 1rem 3rem;
	min-height: 320px;
}

/* Fila de tarjetas (3 últimas) */
.novedades-aa-cards {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
	max-width: 1200px;
	margin: 0 auto 2rem;
}

@media (max-width: 900px) {
	.novedades-aa-cards {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 560px) {
	.novedades-aa-cards {
		grid-template-columns: 1fr;
	}
}

/* Tarjeta individual */
.novedades-aa-card {
	position: relative;
	border-radius: var(--novedades-aa-radius);
	overflow: hidden;
	box-shadow: var(--novedades-aa-shadow);
	background: var(--novedades-aa-card-bg);
}

.novedades-aa-card-link {
	position: absolute;
	left: -9999px;
	z-index: 0;
}

.novedades-aa-card-link:focus {
	left: 0.5rem;
	top: 0.5rem;
	z-index: 10;
	padding: 0.25rem 0.5rem;
	background: var(--novedades-aa-btn-bg);
	color: var(--novedades-aa-btn-color);
	text-decoration: none;
	border-radius: 4px;
	font-size: 0.875rem;
}

.novedades-aa-card-trigger {
	display: block;
	width: 100%;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
}

.novedades-aa-card-image {
	width: 100%;
	aspect-ratio: 4 / 3;
	background-color: #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.novedades-aa-card-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	display: block;
}

.novedades-aa-card-subtitulo {
	display: block;
	padding: 0.5rem 1rem 0;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--novedades-aa-text-dark);
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.novedades-aa-card-footer {
	padding: 1rem;
	background: var(--novedades-aa-card-footer-bg);
	border-top: 1px solid #f1f5f9;
}

.novedades-aa-card-titulo {
	font-size: 1rem;
	font-weight: 600;
	color: var(--novedades-aa-text-dark);
}

.novedades-aa-card-resumen {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.875rem;
	color: #64748b;
	line-height: 1.4;
}

/* Tarjeta dentro del desplegable (mismo estilo, posible ajuste de ancho) */
.novedades-aa-card-listado {
	max-width: 360px;
}

.novedades-aa-desplegable-inner {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 1.5rem;
	justify-content: center;
}

/* Botón "Ver más" */
.novedades-aa-ver-mas-wrap {
	text-align: center;
	margin-top: 1rem;
}

.novedades-aa-btn-ver-mas {
	display: inline-block;
	padding: 0.75rem 2rem;
	background: var(--novedades-aa-btn-bg);
	color: var(--novedades-aa-btn-color);
	border: none;
	border-radius: var(--novedades-aa-radius-btn);
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.2s, transform 0.15s;
}

.novedades-aa-btn-ver-mas:hover,
.novedades-aa-btn-ver-mas:focus {
	opacity: 0.95;
	transform: translateY(-1px);
	outline: 2px solid rgb(229, 228, 236);
	outline-offset: 2px;
	/* Asegura que el texto NO quede en rojo por estilos externos */
	color: var(--novedades-aa-btn-color) !important;
	background: var(--novedades-aa-btn-bg) !important;
}

/* Desplegable con todas las novedades */
.novedades-aa-desplegable {
	max-width: 1200px;
	margin: 0 auto;
	padding: 2rem 1rem;
}

.novedades-aa-desplegable[hidden] {
	display: none !important;
}

.novedades-aa-desplegable:not([hidden]) {
	display: block;
	animation: novedadesAaFadeIn 0.3s ease;
}

@keyframes novedadesAaFadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* Modal */
.novedades-aa-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	box-sizing: border-box;
}

.novedades-aa-modal[hidden],
.novedades-aa-modal[aria-hidden="true"] {
	display: none !important;
}

.novedades-aa-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	cursor: pointer;
}

.novedades-aa-modal-content {
	position: relative;
	width: 100%;
	max-width: 640px;
	max-height: 90vh;
	background: #fff;
	border-radius: var(--novedades-aa-radius);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.novedades-aa-modal-close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	width: 40px;
	height: 40px;
	border: 1px solid #e2e8f0;
	background: #fff !important;
	border-radius: 50%;
	cursor: pointer;
	font-size: 1.75rem;
	line-height: 1;
	color: #000 !important;
	z-index: 9999;
	transition: border-color 0.2s, box-shadow 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	pointer-events: auto;
}

.novedades-aa-modal-close span {
	line-height: 1;
	font-weight: 300;
	color: inherit;
}

.novedades-aa-modal-close:hover,
.novedades-aa-modal-close:focus,
.novedades-aa-modal-close:active {
	background: #fff !important;
	color: #000 !important;
	border-color: #94a3b8;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4);
	outline: none;
}

.novedades-aa-modal-close:hover span,
.novedades-aa-modal-close:focus span,
.novedades-aa-modal-close:active span {
	color: inherit;
}

.novedades-aa-modal-body {
	padding: 2rem 2rem 0;
	overflow-y: auto;
	flex: 1;
	position: relative;
	z-index: 1;
}

.novedades-aa-modal-title {
	margin: 0 0 0.5rem;
	font-size: 1.5rem;
	color: var(--novedades-aa-text-dark);
}

.novedades-aa-modal-subtitulo {
	margin: 0 0 1rem;
	font-size: 0.9rem;
	color: #64748b;
}

.novedades-aa-modal-cual-es-la-novedad {
	margin: 0 0 1rem;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--novedades-aa-text-dark);
}

.novedades-aa-modal-image {
	margin: 0 0 1rem;
	border-radius: 8px;
	overflow: hidden;
}

.novedades-aa-modal-image img {
	width: 100%;
	height: auto;
	display: block;
}

.novedades-aa-modal-text {
	font-size: 1rem;
	line-height: 1.6;
	color: var(--novedades-aa-text-dark);
}

.novedades-aa-modal-text p:last-child {
	margin-bottom: 0;
}

.novedades-aa-modal-footer {
	padding: 1rem 2rem 2rem;
	border-top: 1px solid #f1f5f9;
}

.novedades-aa-modal-link-page {
	display: inline-block;
	padding: 0.5rem 1rem;
	background: var(--novedades-aa-btn-bg);
	color: var(--novedades-aa-btn-color);
	text-decoration: none;
	border-radius: var(--novedades-aa-radius-btn);
	font-weight: 600;
	transition: opacity 0.2s;
}

.novedades-aa-modal-link-page:hover,
.novedades-aa-modal-link-page:focus {
	opacity: 0.95;
	color: var(--novedades-aa-btn-color);
}

/* Estado de carga del modal */
.novedades-aa-modal-body.is-loading {
	min-height: 120px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #94a3b8;
}
