/* Swepac Grid Gallery – filtry, siatka, paginacja */

.swepac-gallery-wrap {
	width: 100%;
}

/* Przyciski filtrów – pill style */
.swepac-gallery-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 24px;
}

.swepac-gallery-filter-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 140px;
	height: 44px;
	min-height: 44px;
	padding: 0 20px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	border: 2px solid #E5E7EB;
	border-radius: 999px;
	background: #fff !important;
	color: #333 !important;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
	box-sizing: border-box;
}

.swepac-gallery-filter-btn:hover:not(.is-active) {
	background: #f9fafb !important;
	border-color: #d1d5db;
	color: #333 !important;
}

/* Tylko aktywny filtr – czerwone tło */
.swepac-gallery-filter-btn.is-active {
	background: #E13639 !important;
	border-color: #E13639 !important;
	color: #fff !important;
}

/* Siatka – fixed height 500px (2×250px), element 1 wyznacza wysokość */
.swepac-gallery-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: 250px;
	gap: 16px;
	align-items: stretch;
}

.swepac-gallery-item {
	position: relative;
	overflow: hidden;
}

.swepac-gallery-item-link {
	display: block;
	width: 100%;
	height: 100%;
}

.swepac-gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	transition: transform 0.3s;
}

.swepac-gallery-item-link:hover img {
	transform: scale(1.03);
}

/* Dwa szablony na przemian – klasy tpl-0..6 ustawiane przez JS (indeks wśród widocznych) */

/* Szablon A: | tpl-0 (2kol 2r) | tpl-1 |
             |                  | tpl-2 | */
.swepac-gallery-item.tpl-0 {
	grid-column: 1 / 3;
	grid-row: span 2;
}
.swepac-gallery-item.tpl-1 {
	grid-column: 3;
	grid-row: span 1;
}
.swepac-gallery-item.tpl-2 {
	grid-column: 3;
	grid-row: span 1;
}

/* Szablon B: | tpl-3     | tpl-4 (2 kol) |
             | tpl-3     | tpl-5 | tpl-6  | */
.swepac-gallery-item.tpl-3 {
	grid-column: 1;
	grid-row: span 2;
}
.swepac-gallery-item.tpl-4 {
	grid-column: 2 / 4;
	grid-row: span 1;
}
.swepac-gallery-item.tpl-5 {
	grid-column: 2;
	grid-row: span 1;
}
.swepac-gallery-item.tpl-6 {
	grid-column: 3;
	grid-row: span 1;
}

/* Ukryte (filtrowanie) */
.swepac-gallery-item.is-hidden {
	display: none !important;
}

/* Paginacja */
.swepac-gallery-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 32px;
	margin-bottom: 32px;
}

.swepac-gallery-pagination.is-hidden {
	display: none;
}

.swepac-gallery-pagination-numbers {
	display: flex;
	align-items: center;
	gap: 4px;
}

.swepac-gallery-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	font-size: 15px;
	font-weight: 500;
	border: 2px solid #E5E7EB;
	border-radius: 8px;
	background: #fff;
	color: #333;
	text-decoration: none;
	transition: all 0.2s;
}

.swepac-gallery-pagination .page-numbers:hover:not(.current):not(.disabled) {
	border-color: #d1d5db;
	background: #f9fafb;
}

.swepac-gallery-pagination .page-numbers.current {
	background: #E13639;
	border-color: #E13639;
	color: #fff;
	cursor: default;
}

.swepac-gallery-pagination .page-numbers.disabled,
.swepac-gallery-pagination .swepac-gallery-prev.disabled,
.swepac-gallery-pagination .swepac-gallery-next.disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* Unikalne klasy prev/next – brak konfliktu z motywem/Elementorem (.page-numbers.prev/.next) */
.swepac-gallery-pagination .swepac-gallery-prev,
.swepac-gallery-pagination .swepac-gallery-next {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 2px solid #E5E7EB;
	border-radius: 8px;
	background: #fff;
	color: #333;
	text-decoration: none;
	min-width: 40px;
	height: 40px;
}

.swepac-gallery-pagination .swepac-gallery-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
}

.swepac-gallery-pagination .swepac-gallery-icon svg,
.swepac-gallery-pagination .swepac-gallery-prev svg,
.swepac-gallery-pagination .swepac-gallery-next svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
	flex-shrink: 0;
	display: block;
}

/* Responsywność */
@media (max-width: 1024px) {
	.swepac-gallery-grid {
		grid-template-columns: repeat(2, 1fr);
		grid-auto-rows: 250px;
	}
	.swepac-gallery-item.tpl-0 {
		grid-column: span 2;
		grid-row: span 2;
	}
	.swepac-gallery-item.tpl-1,
	.swepac-gallery-item.tpl-2,
	.swepac-gallery-item.tpl-3,
	.swepac-gallery-item.tpl-4,
	.swepac-gallery-item.tpl-5,
	.swepac-gallery-item.tpl-6 {
		grid-column: span 1;
		grid-row: span 1;
	}
}

@media (max-width: 767px) {
	.swepac-gallery-filters {
		gap: 6px;
		margin-bottom: 16px;
	}
	.swepac-gallery-filter-btn {
		min-width: 120px;
		height: 40px;
		padding: 0 14px;
		font-size: 13px;
	}
	.swepac-gallery-grid {
		display: flex;
		flex-direction: column;
		gap: 16px;
	}
	.swepac-gallery-item.tpl-0,
	.swepac-gallery-item.tpl-1,
	.swepac-gallery-item.tpl-2,
	.swepac-gallery-item.tpl-3,
	.swepac-gallery-item.tpl-4,
	.swepac-gallery-item.tpl-5,
	.swepac-gallery-item.tpl-6 {
		grid-column: unset;
		grid-row: unset;
	}
	.swepac-gallery-item .swepac-gallery-item-link {
		display: block;
		aspect-ratio: 4/3;
		min-height: unset;
	}
	.swepac-gallery-item img {
		width: 100%;
		height: 100%;
		min-height: unset;
		object-fit: cover;
	}
	.swepac-gallery-pagination .page-numbers,
	.swepac-gallery-pagination .swepac-gallery-prev,
	.swepac-gallery-pagination .swepac-gallery-next {
		min-width: 36px;
		height: 36px;
		font-size: 14px;
	}
}
