/* Certificate Gallery Pro v2 - Frontend Styles */

/* ---------- GRID (front-end, plain images only) ---------- */

.cgp-gallery-wrap {
	margin: 30px 0;
}

.cgp-gallery {
	display: grid;
	gap: 20px;
	grid-template-columns: repeat(4, 1fr);
}

.cgp-columns-1 { grid-template-columns: repeat(1, 1fr); }
.cgp-columns-2 { grid-template-columns: repeat(2, 1fr); }
.cgp-columns-3 { grid-template-columns: repeat(3, 1fr); }
.cgp-columns-4 { grid-template-columns: repeat(4, 1fr); }
.cgp-columns-5 { grid-template-columns: repeat(5, 1fr); }
.cgp-columns-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 992px) {
	.cgp-gallery { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 700px) {
	.cgp-gallery { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 460px) {
	.cgp-gallery { grid-template-columns: repeat(1, 1fr) !important; }
}

.cgp-grid-item {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 12px;
	overflow: hidden;
	background: #f2f2f2;
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
	cursor: pointer;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.cgp-grid-item:hover,
.cgp-grid-item:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
	outline: none;
}

.cgp-grid-img {
	width: 100%;
	height: auto;
	object-fit: contain;
	display: block;
	transition: transform 0.4s ease;
}

.cgp-grid-item:hover .cgp-grid-img {
	transform: scale(1.04);
}

.cgp-no-certificates {
	text-align: center;
	padding: 30px;
	font-style: italic;
	color: #777;
}

/* ---------- MODAL ---------- */

.cgp-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 110px 24px 30px;
	box-sizing: border-box;
}

.cgp-modal.cgp-open {
	display: flex;
}

.cgp-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 15, 20, 0.82);
	backdrop-filter: blur(2px);
}

.cgp-modal-dialog {
	position: relative;
	z-index: 1;
	background: #fff;
	width: 100%;
	max-width: 1280px;
	max-height: 82vh;
	border-radius: 16px;
	overflow: hidden;
	display: grid;
	grid-template-columns: minmax(0, auto) minmax(360px, 1.3fr);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
	animation: cgp-pop-in 0.25s ease;
}

@keyframes cgp-pop-in {
	from { opacity: 0; transform: scale(0.96); }
	to   { opacity: 1; transform: scale(1); }
}

.cgp-modal-image-side {
	background: #111;
	display: flex;
	align-items: center;
	justify-content: center;
	max-height: 82vh;
	max-width: 60vw;
	overflow: hidden;
}

.cgp-modal-img {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 82vh;
	object-fit: contain;
	display: block;
}

.cgp-modal-text-side {
	padding: 34px 32px;
	overflow-y: auto;
	max-height: 82vh;
	min-width: 360px;
	display: flex;
	flex-direction: column;
}

.cgp-modal-title {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: #1a1a1a;
}

.cgp-modal-text {
	font-size: 13px;
	line-height: 1.6;
	color: #333;
	white-space: pre-line;
	word-wrap: break-word;
}

.cgp-modal-counter {
	margin-top: auto;
	padding-top: 18px;
	font-size: 13px;
	color: #999;
}

.cgp-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	width: 38px;
	height: 38px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	color: #111;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, transform 0.2s ease;
}
.cgp-modal-close:hover {
	background: #fff;
	transform: scale(1.08);
}

.cgp-modal-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 42px;
	height: 42px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	color: #111;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, transform 0.2s ease;
}
.cgp-modal-nav:hover {
	background: #fff;
	transform: translateY(-50%) scale(1.08);
}
.cgp-modal-prev { left: 14px; }
.cgp-modal-next { right: 14px; }

@media (max-width: 900px) {
	.cgp-modal-dialog {
		grid-template-columns: 1fr;
		max-height: 92vh;
		overflow-y: auto;
	}
	.cgp-modal-image-side,
	.cgp-modal-img {
		max-height: 42vh;
		max-width: 100%;
	}
	.cgp-modal-text-side {
		max-height: none;
		min-width: 0;
	}
	.cgp-modal-prev,
	.cgp-modal-next {
		left: 10px;
		right: 10px;
	}
	.cgp-modal-prev { right: auto; }
	.cgp-modal-next { left: auto; }
	.cgp-modal-nav {
		top: auto;
		bottom: 10px;
		transform: none;
	}
	.cgp-modal-nav:hover {
		transform: scale(1.08);
	}
}

/* Custom thin scrollbar for the readable text panel */
.cgp-modal-text-side::-webkit-scrollbar {
	width: 6px;
}
.cgp-modal-text-side::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.2);
	border-radius: 4px;
}