/**
 * Nexgen Services Grid / Products Grid - frontend styles
 * Fully self-contained: every rule is scoped under .nxg-sg-wrapper using
 * plugin-specific class names only, so it never inherits or collides with
 * the active theme's own CSS (grid systems, hover states, etc.).
 *
 * Card style: full-bleed image with the title overlaid at the bottom on a
 * dark gradient, matching the native Nexgen portfolio grid look.
 */

.nxg-sg-wrapper {
	width: 100%;
	box-sizing: border-box;
}

.nxg-sg-wrapper *,
.nxg-sg-wrapper *::before,
.nxg-sg-wrapper *::after {
	box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Filter buttons                                                      */
/* ------------------------------------------------------------------ */
.nxg-sg-wrapper .nxg-sg-filters {
	list-style: none;
	margin: 0 0 25px;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.nxg-sg-wrapper .nxg-sg-filter-btn {
	cursor: pointer;
	padding: 8px 20px;
	border: 1px solid #e2e2e2;
	border-radius: 30px;
	font-size: 14px;
	line-height: 1.4;
	transition: all 0.25s ease;
	user-select: none;
	background: transparent;
}

.nxg-sg-wrapper .nxg-sg-filter-btn:hover,
.nxg-sg-wrapper .nxg-sg-filter-btn.nxg-sg-active {
	background-color: #000;
	border-color: #000;
	color: #fff;
}

/* ------------------------------------------------------------------ */
/* Grid / row                                                          */
/* ------------------------------------------------------------------ */
.nxg-sg-wrapper .nxg-sg-items {
	display: flex;
	flex-wrap: wrap;
	margin-left: -12px;
	margin-right: -12px;
}

.nxg-sg-wrapper .nxg-sg-item {
	padding: 12px;
}

/* Column widths - fully custom, no dependency on Bootstrap or theme grid */
.nxg-sg-wrapper .nxg-sg-col-1 { flex: 0 0 100%;      max-width: 100%; }
.nxg-sg-wrapper .nxg-sg-col-2 { flex: 0 0 50%;        max-width: 50%; }
.nxg-sg-wrapper .nxg-sg-col-3 { flex: 0 0 33.3333%;   max-width: 33.3333%; }
.nxg-sg-wrapper .nxg-sg-col-4 { flex: 0 0 25%;        max-width: 25%; }
.nxg-sg-wrapper .nxg-sg-col-5 { flex: 0 0 20%;        max-width: 20%; }
.nxg-sg-wrapper .nxg-sg-col-6 { flex: 0 0 16.6667%;   max-width: 16.6667%; }

@media (max-width: 991px) {
	.nxg-sg-wrapper .nxg-sg-col-4,
	.nxg-sg-wrapper .nxg-sg-col-5,
	.nxg-sg-wrapper .nxg-sg-col-6 {
		flex: 0 0 33.3333%;
		max-width: 33.3333%;
	}
	.nxg-sg-wrapper .nxg-sg-col-3 {
		flex: 0 0 50%;
		max-width: 50%;
	}
}

@media (max-width: 767px) {
	.nxg-sg-wrapper .nxg-sg-col-2,
	.nxg-sg-wrapper .nxg-sg-col-3,
	.nxg-sg-wrapper .nxg-sg-col-4,
	.nxg-sg-wrapper .nxg-sg-col-5,
	.nxg-sg-wrapper .nxg-sg-col-6 {
		flex: 0 0 50%;
		max-width: 50%;
	}
}

@media (max-width: 480px) {
	.nxg-sg-wrapper [class*="nxg-sg-col-"] {
		flex: 0 0 100%;
		max-width: 100%;
	}
}

/* ------------------------------------------------------------------ */
/* Card - full-bleed image with overlaid title (Nexgen-style)          */
/* ------------------------------------------------------------------ */
.nxg-sg-wrapper .nxg-sg-card {
	width: 100%;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.nxg-sg-wrapper .nxg-sg-card:hover {
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
	transform: translateY(-3px);
}

/* Fixed-ratio image area: keeps every card the exact same height even
   when the uploaded images have different original dimensions. */
.nxg-sg-wrapper .nxg-sg-thumb {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #d9d9d9;
	text-decoration: none;
}

/* Fallback for older browsers without aspect-ratio support */
@supports not (aspect-ratio: 1 / 1) {
	.nxg-sg-wrapper .nxg-sg-thumb {
		height: 0;
		padding-top: 100%;
	}
}

.nxg-sg-wrapper .nxg-sg-thumb img,
.nxg-sg-wrapper .nxg-sg-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	margin: 0;
	transition: transform 0.4s ease;
}

.nxg-sg-wrapper .nxg-sg-card:hover .nxg-sg-img {
	transform: scale(1.08);
}

.nxg-sg-wrapper .nxg-sg-noimage {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
	font-size: 13px;
	background: #d9d9d9;
}

/* Dark gradient behind the title so white text stays readable on any image */
.nxg-sg-wrapper .nxg-sg-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		180deg,
		rgba(0, 0, 0, 0) 45%,
		rgba(0, 0, 0, 0.35) 70%,
		rgba(0, 0, 0, 0.72) 100%
	);
	pointer-events: none;
}

/* Caption overlaid at the bottom of the image */
.nxg-sg-wrapper .nxg-sg-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 18px 16px 20px;
}

.nxg-sg-wrapper .nxg-sg-title {
	display: block;
	color: #fff;
	font-size: 19px;
	font-weight: 700;
	line-height: 1.35;
	margin: 0;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.nxg-sg-wrapper .nxg-sg-price {
	display: block;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	margin-top: 6px;
	opacity: 0.95;
}

.nxg-sg-wrapper .nxg-sg-excerpt {
	display: block;
	color: rgba(255, 255, 255, 0.85);
	font-size: 13px;
	line-height: 1.5;
	margin-top: 6px;
}

/* ------------------------------------------------------------------ */
/* Empty state / notices                                               */
/* ------------------------------------------------------------------ */
.nxg-sg-wrapper .nxg-sg-empty,
.nxg-sg-wrapper .nxg-sg-notice {
	width: 100%;
	text-align: center;
	padding: 30px 10px;
	color: #888;
}

/* ------------------------------------------------------------------ */
/* Pagination                                                          */
/* ------------------------------------------------------------------ */
.nxg-sg-wrapper .nxg-sg-pagination {
	margin-top: 25px;
	text-align: center;
}

.nxg-sg-wrapper .nxg-sg-pagination .page-numbers {
	display: inline-block;
	margin: 0 3px;
	padding: 6px 14px;
	border: 1px solid #e2e2e2;
	border-radius: 4px;
	text-decoration: none;
	color: inherit;
}

.nxg-sg-wrapper .nxg-sg-pagination .page-numbers.current {
	background-color: #000;
	border-color: #000;
	color: #fff;
}
