/* 484 Media Cam Grid - Frontend */

/* ── Grid columns ────────────────────────────────────────────────────────────── */
.cgm-grid {
	grid-template-columns: repeat(3, 1fr) !important;
}
@media (max-width: 639px) {
	.cgm-grid { grid-template-columns: 1fr !important; }
	.cgm-grid > *:first-child { grid-column: auto !important; }
}

/* ── Live embed wrapper in grid ──────────────────────────────────────────────── */
/*
 * Each card shows a live 16:9 embed. The .cgm-embed-wrap creates the
 * aspect-ratio box; everything inside fills it absolutely.
 * A transparent .cgm-card-overlay sits on top to capture clicks.
 */
.cgm-embed-wrap {
	position: relative;
	width: 100%;
	padding-top: 56.25%;   /* 16:9 */
	overflow: hidden;
	background: #040e17;
}

/* Every direct child of the embed wrap fills the box */
.cgm-embed-wrap > * {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

/* All iframes inside the grid embed fill their container */
.cgm-embed-wrap iframe {
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	border: none !important;
	display: block !important;
}

/* TikiLive plugin wrapper overrides */
.cgm-embed-wrap .tlc-embed-wrapper {
	margin-bottom: 0 !important;
	height: 100%;
}
.cgm-embed-wrap .tlc-embed-frame {
	height: 100%;
	border-radius: 0 !important;
}

/* Generic: any wrapper div a plugin adds */
.cgm-embed-wrap > div {
	position: absolute;
	inset: 0;
	height: 100%;
}

/* ── Click overlay ───────────────────────────────────────────────────────────── */
.cgm-card-overlay {
	position: absolute;
	inset: 0;
	z-index: 10;           /* sits above the iframe */
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	transition: background .22s;
	cursor: pointer;
}
.cgm-cam-card:hover .cgm-card-overlay {
	background: rgba(7, 25, 38, 0.38);
}

.cgm-expand-icon {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: rgba(240, 160, 0, 0);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 1.1rem;
	opacity: 0;
	transform: scale(0.8);
	transition: opacity .22s, background .22s, transform .22s;
	box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
.cgm-cam-card:hover .cgm-expand-icon {
	opacity: 1;
	background: rgba(240, 160, 0, 0.92);
	transform: scale(1);
}

/* Card keyboard focus ring */
.cgm-cam-card:focus-visible {
	outline: 2px solid rgba(126, 201, 228, .8);
	outline-offset: 2px;
}

/* ── Pagination ──────────────────────────────────────────────────────────────── */
.cgm-pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
	margin: 1.6rem 0 1rem;
	flex-wrap: wrap;
}
.cgm-page-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 10px;
	border-radius: 8px;
	border: 1px solid rgba(126, 201, 228, 0.3);
	background: rgba(10, 61, 92, 0.35);
	color: rgba(232, 246, 251, 0.8);
	font-size: 0.85rem;
	font-weight: 500;
	text-decoration: none;
	transition: background .18s, border-color .18s, transform .15s;
}
.cgm-page-btn:hover {
	background: rgba(18, 120, 160, 0.55);
	border-color: rgba(126, 201, 228, 0.6);
	color: #e8f6fb;
	transform: translateY(-2px);
	opacity: 1;
}
.cgm-page-btn.cgm-page-current {
	background: rgba(18, 120, 160, 0.7);
	border-color: rgba(126, 201, 228, 0.8);
	color: #e8f6fb;
	font-weight: 700;
	pointer-events: none;
}

/* ── Lightbox ────────────────────────────────────────────────────────────────── */
body.cgm-lb-open { overflow: hidden; }

.cgm-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}
.cgm-lightbox[hidden] { display: none; }

.cgm-lb-overlay {
	position: absolute;
	inset: 0;
	background: rgba(4, 14, 23, 0.88);
	backdrop-filter: blur(5px);
	-webkit-backdrop-filter: blur(5px);
}

.cgm-lb-box {
	position: relative;
	width: 100%;
	max-width: 940px;
	margin: 1rem;
	background: #071926;
	border: 1px solid rgba(126, 201, 228, 0.2);
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75);
	display: flex;
	flex-direction: column;
}

.cgm-lb-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: .6rem 1rem;
	background: rgba(10, 61, 92, 0.55);
	border-bottom: 1px solid rgba(126, 201, 228, 0.15);
	flex-shrink: 0;
}
.cgm-lb-title {
	font-size: .88rem;
	font-weight: 600;
	color: #e8f6fb;
	letter-spacing: .02em;
}
.cgm-lb-close {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 1px solid rgba(126, 201, 228, 0.35);
	background: rgba(18, 120, 160, 0.3);
	color: #e8f6fb;
	font-size: 1.15rem;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background .18s;
	flex-shrink: 0;
}
.cgm-lb-close:hover { background: rgba(18, 120, 160, 0.7); }

/* 16:9 content area */
.cgm-lb-content {
	position: relative;
	width: 100%;
	padding-top: 56.25%;
	background: #040e17;
}

.cgm-preroll,
.cgm-lb-embed {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.cgm-preroll[hidden],
.cgm-lb-embed[hidden] { display: none; }

/* Pre-roll layout */
.cgm-preroll {
	display: flex;
	flex-direction: column;
	background: #040e17;
}
.cgm-ad-slot {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	padding: .5rem;
}
.cgm-ad-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: .42rem .85rem;
	background: rgba(7, 25, 38, 0.92);
	border-top: 1px solid rgba(126, 201, 228, 0.12);
	flex-shrink: 0;
}
.cgm-ad-label {
	font-size: .62rem;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: rgba(126, 201, 228, 0.45);
}
.cgm-ad-controls { display: flex; align-items: center; gap: .65rem; }
.cgm-countdown-wrap { font-size: .7rem; color: rgba(232, 246, 251, 0.5); }

.cgm-skip-btn {
	padding: .28rem .85rem;
	border-radius: 999px;
	border: 1px solid rgba(126, 201, 228, 0.4);
	background: rgba(18, 120, 160, 0.3);
	color: rgba(232, 246, 251, 0.85);
	font-size: .68rem;
	font-weight: 500;
	letter-spacing: .05em;
	cursor: pointer;
	transition: background .18s, border-color .18s, color .18s;
}
.cgm-skip-btn:not(:disabled):hover {
	background: rgba(18, 120, 160, 0.65);
	border-color: rgba(126, 201, 228, 0.7);
	color: #e8f6fb;
}
.cgm-skip-btn:disabled { opacity: .4; cursor: default; }

/* Lightbox embed — force all plugin iframes to fill */
.cgm-lb-embed > * {
	width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
}
.cgm-lb-embed iframe {
	width: 100% !important;
	height: 100% !important;
	border: none !important;
	display: block !important;
}
.cgm-lb-embed .tlc-embed-wrapper { margin-bottom: 0 !important; }
.cgm-lb-embed .tlc-embed-frame { padding-top: 0 !important; height: 100%; }
.cgm-lb-embed .tlc-embed-frame iframe { position: static !important; }

/* Footer */
.cgm-lb-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: .48rem 1rem;
	background: rgba(7, 25, 38, 0.8);
	border-top: 1px solid rgba(126, 201, 228, 0.1);
	flex-shrink: 0;
}
.cgm-lb-loc {
	font-size: .7rem;
	font-weight: 300;
	color: rgba(126, 201, 228, 0.65);
	letter-spacing: .03em;
}

/* Mobile — lightbox slides up from bottom */
@media (max-width: 639px) {
	.cgm-lightbox { align-items: flex-end; }
	.cgm-lb-box { margin: 0; border-radius: 12px 12px 0 0; max-width: 100%; }
}
