.epg-gallery {
	display: flex;
	width: 100%;
	height: 620px;
	gap: 20px;
	box-sizing: border-box;
}

.epg-gallery.epg-dir-reverse {
	flex-direction: row-reverse;
}

.epg-gallery * {
	box-sizing: border-box;
}

/* ---------- LIST COLUMN ---------- */
.epg-list-col {
	flex: 0 0 32%;
	max-width: 32%;
	height: 100%;
	overflow-y: auto;
	padding-right: 4px;
}

.epg-list-col::-webkit-scrollbar {
	width: 6px;
}
.epg-list-col::-webkit-scrollbar-thumb {
	background: rgba(0,0,0,0.2);
	border-radius: 10px;
}

.epg-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.epg-item {
	display: flex;
	gap: 10px;
	padding: 8px;
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.2s ease;
	background-color: transparent;
	outline: none;
}

.epg-item:focus-visible {
	box-shadow: 0 0 0 2px #065fd4;
}

.epg-item.is-active {
	background-color: #e5f1ff;
}

.epg-item-thumb {
	position: relative;
	width: 120px;
	min-width: 120px;
	aspect-ratio: 4 / 3;
	border-radius: 8px;
	overflow: hidden;
	background: #ddd;
	flex-shrink: 0;
}

.epg-item-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.epg-item-badge {
	position: absolute;
	bottom: 4px;
	right: 4px;
	background: rgba(0,0,0,0.75);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.5px;
	padding: 2px 5px;
	border-radius: 3px;
	line-height: 1;
}

.epg-item-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
}

.epg-item-title {
	font-size: 14px;
	font-weight: 600;
	color: #0f0f0f;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.epg-item-meta {
	font-size: 12px;
	color: #606060;
}

.epg-item-desc {
	font-size: 12px;
	color: #606060;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ---------- PREVIEW COLUMN ---------- */
.epg-preview-col {
	flex: 1;
	min-width: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
	background: #f8f9fa;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid #e2e2e2;
}

.epg-preview-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 14px;
	border-bottom: 1px solid #e2e2e2;
	background: #fff;
}

.epg-preview-current-title {
	font-size: 14px;
	font-weight: 600;
	color: #0f0f0f;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.epg-download-btn {
	flex-shrink: 0;
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	background-color: #065fd4;
	padding: 6px 14px;
	border-radius: 18px;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.epg-download-btn:hover {
	background-color: #0b4faa;
	color: #fff;
}

.epg-preview-frame-wrap {
	position: relative;
	flex: 1;
	min-height: 0;
}

.epg-preview-iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.epg-preview-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: #8a8a8a;
	text-align: center;
	padding: 20px;
}

.epg-icon-pdf-large {
	font-style: normal;
	font-weight: 800;
	font-size: 13px;
	letter-spacing: 1px;
	color: #fff;
	background: #d33b2c;
	padding: 14px 18px;
	border-radius: 10px;
}

.epg-icon-pdf {
	font-style: normal;
}

.epg-preview-placeholder p {
	margin: 0;
	font-size: 14px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 767px) {
	.epg-gallery,
	.epg-gallery.epg-dir-reverse {
		flex-direction: column;
		height: auto !important;
	}

	.epg-list-col {
		max-width: 100%;
		flex: 1 1 auto;
		max-height: 320px;
	}

	.epg-preview-col {
		flex: 0 0 420px;
		height: 420px;
	}
}

/* =====================================================
   GRID LAYOUT (cards)
   ===================================================== */
.epg-grid-wrap,
.epg-grid-wrap * {
	box-sizing: border-box;
}

.epg-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
	align-items: stretch;
}

.epg-card {
	display: flex;
	flex-direction: column;
	background-color: #f7f7f7;
	padding: 20px;
	border-radius: 8px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
	text-align: center;
	min-width: 0;
}

.epg-card-thumb {
	width: 100%;
	height: 250px;
	overflow: hidden;
	border-radius: 6px;
	background: #ddd;
	flex-shrink: 0;
}

.epg-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 6px;
}

.epg-card-title {
	margin: 24px 0 14px;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	color: #e01e23;
}

.epg-card-meta {
	font-size: 13px;
	color: #222;
	margin-bottom: 8px;
}

.epg-card-desc {
	margin: 0 0 24px;
	font-size: 15px;
	line-height: 1.5;
	color: #222;
	flex-grow: 1; /* pushes the button to the bottom so all buttons line up */
}

.epg-card-action {
	margin-top: auto;
	padding-top: 4px;
}

.epg-card-btn,
.epg-view-all-btn {
	display: inline-block;
	text-decoration: none;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.epg-card-btn {
	color: #fff;
	background-color: #e01e23;
	padding: 12px 24px;
	border-radius: 0;
}

.epg-card-btn:hover,
.epg-card-btn:focus {
	color: #fff;
	background-color: #b9161b;
}

.epg-view-all {
	text-align: center;
	margin-top: 28px;
}

.epg-view-all-btn {
	color: #000;
	background-color: #f9cb02;
	padding: 12px 24px;
	border-radius: 0;
}

.epg-view-all-btn:hover,
.epg-view-all-btn:focus {
	color: #000;
	background-color: #e0b602;
}

/* ---------- POPUP PREVIEW (used by grid "popup" action) ---------- */
.epg-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.7);
	padding: 24px;
}

.epg-modal.is-open {
	display: flex;
}

.epg-modal-dialog {
	display: flex;
	flex-direction: column;
	width: min(1100px, 100%);
	height: min(88vh, 900px);
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.epg-modal-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 14px;
	border-bottom: 1px solid #e2e2e2;
	background: #fff;
}

.epg-modal-title {
	font-size: 15px;
	font-weight: 600;
	color: #0f0f0f;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.epg-modal-tools {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-shrink: 0;
}

.epg-modal-download {
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	background: #065fd4;
	padding: 6px 14px;
	border-radius: 18px;
	text-decoration: none;
}

.epg-modal-download:hover {
	color: #fff;
	background: #0b4faa;
}

.epg-modal-close {
	border: 0;
	background: #eee;
	color: #111;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}

.epg-modal-close:hover {
	background: #ddd;
}

.epg-modal-iframe {
	flex: 1;
	width: 100%;
	border: 0;
}

/* ---------- GRID RESPONSIVE FALLBACK ----------
   (Columns are normally controlled from Elementor's Columns control,
   these just keep the default sane if no responsive value is saved.) */
@media (max-width: 1024px) {
	.epg-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (max-width: 767px) {
	.epg-grid {
		grid-template-columns: 1fr;
	}
	.epg-modal {
		padding: 0;
	}
	.epg-modal-dialog {
		height: 100vh;
		border-radius: 0;
	}
}
