/* =====================================================
   MN Repeater Items Widget
   ===================================================== */

/* ── Grid layout ────────────────────────────────── */
.mn-ri-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}

/* Equal column height — grid mode */
.mn-ri--equal-height .mn-ri-grid {
	align-items: stretch;
}

.mn-ri--equal-height .mn-ri-grid .mn-ri-item {
	height: 100%;
	display: flex;
	flex-direction: column;
}

/* Equal column height — centered/flex mode */
.mn-ri--equal-height.mn-ri--centered .mn-ri-grid {
	align-items: stretch;
}

.mn-ri--equal-height.mn-ri--centered .mn-ri-grid .mn-ri-item {
	height: 100%;
	display: flex;
	flex-direction: column;
}

/*
 * Centered grid: switch to flexbox so the last (partial) row
 * is centred. Card width is driven by --mn-ri-cols (set inline)
 * so all cards stay the same size regardless of row position.
 */
.mn-ri--centered .mn-ri-grid {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

.mn-ri--centered .mn-ri-grid .mn-ri-item {
	/* fallback: 3 cols */
	width: calc( ( 100% - ( var(--mn-ri-cols, 3) - 1 ) * var(--mn-ri-gap, 20px) ) / var(--mn-ri-cols, 3) );
	flex: 0 0 auto;
}

/* ── List layout ────────────────────────────────── */
.mn-ri-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* ── Item card ──────────────────────────────────── */
.mn-ri-item {
	overflow: hidden;
	background: #fff;
	border-radius: 4px;
}

/* JS pagination visibility */
.mn-ri-item.mn-ri-page-hidden {
	display: none !important;
}

/* ── Field wrapper ──────────────────────────────── */
.mn-ri-field {
	margin-bottom: 8px;
}

.mn-ri-field:last-child {
	margin-bottom: 0;
}

/* ── Image field ────────────────────────────────── */
.mn-ri-field-image {
	margin-bottom: 12px;
}

.mn-ri-field-image img {
	display: block;
	width: 100%;
	height: 180px;
	object-fit: cover;
}

/* ── Label ──────────────────────────────────────── */
.mn-ri-field-label {
	font-size: 0.75em;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #888;
	margin-bottom: 2px;
}

/* Inline label: label + value on same line */
.mn-ri-field--inline .mn-ri-field-label {
	display: inline;
}

.mn-ri-field--inline .mn-ri-field-value {
	display: inline;
}

/* ── Value ──────────────────────────────────────── */
.mn-ri-field-value {
	color: inherit;
	word-break: break-word;
}

.mn-ri-field-value a {
	color: inherit;
	text-decoration: underline;
}

/* ── Badge / tag ────────────────────────────────── */
.mn-ri-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 0.8em;
	font-weight: 600;
	background: #e9ecef;
	color: #333;
	margin: 2px 2px 2px 0;
}
.mn-ri-badge--yes {
	background: #d4edda;
	color: #155724;
}
.mn-ri-badge--no {
	background: #f8d7da;
	color: #721c24;
}

/* ── Table layout ───────────────────────────────── */
.mn-ri-table-wrapper {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.mn-ri-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95em;
}

.mn-ri-table thead th {
	padding: 10px 14px;
	text-align: left;
	font-weight: 600;
	background: #f1f3f5;
	color: #333;
	white-space: nowrap;
	border-bottom: 2px solid #dee2e6;
}

.mn-ri-table tbody td {
	padding: 9px 14px;
	border-bottom: 1px solid #dee2e6;
	vertical-align: middle;
	word-break: break-word;
}

.mn-ri-table tbody tr:last-child td {
	border-bottom: none;
}

.mn-ri-table img {
	max-width: 80px;
	height: auto;
	border-radius: 4px;
	display: block;
}

/* ── Empty / notice ─────────────────────────────── */
.mn-ri-empty,
.mn-ri-notice {
	padding: 16px;
	background: #f8f9fa;
	border: 1px dashed #ccc;
	border-radius: 6px;
	font-size: 0.9em;
	color: #666;
	text-align: center;
}

/* ── Wrapper ────────────────────────────────────── */
.mn-ri-wrapper {
	position: relative;
}

/* ── Pagination container ───────────────────────── */
.mn-ri-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 24px;
}

/* Dots */
.mn-ri-pagination-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #ccc;
	cursor: pointer;
	transition: background 0.2s, transform 0.2s;
}

.mn-ri-pagination-dot--active {
	background: #333;
	transform: scale(1.3);
}

/* Numbers / prev / next */
.mn-ri-pagination-number,
.mn-ri-pagination-prev,
.mn-ri-pagination-next {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	border-radius: 4px;
	border: 1px solid #ddd;
	background: #fff;
	color: #333;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
	user-select: none;
}

.mn-ri-pagination-number:hover,
.mn-ri-pagination-prev:hover,
.mn-ri-pagination-next:hover {
	background: #f5f5f5;
	border-color: #bbb;
}

.mn-ri-pagination-number.mn-ri-pagination-current {
	background: #333;
	color: #fff;
	border-color: #333;
	font-weight: 600;
	cursor: default;
}

.mn-ri-pagination-dots {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	color: #999;
	font-size: 14px;
	letter-spacing: 2px;
}

/* Mobile-only pagination */
.mn-ri--pagination-mobile-only .mn-ri-pagination {
	display: none;
}

@media (max-width: 480px) {
	.mn-ri--pagination-mobile-only .mn-ri-pagination {
		display: flex;
	}
}

/* ── Responsive fallback ────────────────────────── */
@media (max-width: 767px) {
	.mn-ri-grid {
		grid-template-columns: 1fr;
	}
}
