/* ===========================================
   YT Gallery - Grid Layout
   =========================================== */

.ytpg-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	width: 100%;
}

/* ===========================================
   Grid Item
   =========================================== */

.ytpg-item {
	cursor: pointer;
	position: relative;
}

/* ===========================================
   Thumbnail Wrapper - Aspect Ratios
   =========================================== */

.ytpg-item-thumb-wrapper {
	position: relative;
	overflow: hidden;
	width: 100%;
}

.ytpg-aspect-16-9 { aspect-ratio: 16 / 9; }
.ytpg-aspect-4-3  { aspect-ratio: 4 / 3; }
.ytpg-aspect-3-2  { aspect-ratio: 3 / 2; }
.ytpg-aspect-1-1  { aspect-ratio: 1 / 1; }
.ytpg-aspect-2-3  { aspect-ratio: 2 / 3; }
.ytpg-aspect-9-16 { aspect-ratio: 9 / 16; }

.ytpg-item-thumb-wrapper > img.ytpg-item-thumb {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	object-fit: cover;
}

/* ===========================================
   Play Icon Overlay
   =========================================== */

.ytpg-play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	pointer-events: none;
	opacity: 0.85;
	transition: opacity 0.3s ease;
	z-index: 1;
}

/* ===========================================
   Duration Badge
   =========================================== */

.ytpg-duration {
	position: absolute;
	bottom: 8px;
	right: 8px;
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	padding: 2px 6px;
	border-radius: 3px;
	line-height: 1.4;
	pointer-events: none;
	z-index: 1;
}

/* ===========================================
   Video Title
   =========================================== */

.ytpg-item-title {
	margin: 8px 0 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.4;
	font-weight: 500;
}

/* ===========================================
   Lightbox Overlay
   =========================================== */

.ytpg-lightbox-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.92);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ytpg-lightbox-overlay.ytpg-active {
	opacity: 1;
	visibility: visible;
}

.ytpg-lightbox-content {
	position: relative;
	width: 90%;
	max-width: 960px;
	aspect-ratio: 16 / 9;
}

.ytpg-lightbox-content iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

/* ===========================================
   Lightbox Controls
   =========================================== */

.ytpg-lightbox-close {
	position: absolute;
	top: 20px;
	right: 20px;
	color: #fff;
	font-size: 36px;
	cursor: pointer;
	background: none;
	border: none;
	padding: 4px 12px;
	line-height: 1;
	opacity: 0.8;
	transition: opacity 0.2s ease;
	z-index: 2;
}

.ytpg-lightbox-close:hover {
	opacity: 1;
}

.ytpg-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	color: #fff;
	font-size: 28px;
	cursor: pointer;
	background: rgba(255, 255, 255, 0.1);
	border: none;
	padding: 16px 14px;
	border-radius: 4px;
	z-index: 2;
	opacity: 0.7;
	transition: opacity 0.2s ease, background 0.2s ease;
}

.ytpg-lightbox-nav:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.2);
}

.ytpg-lightbox-prev {
	left: 20px;
}

.ytpg-lightbox-next {
	right: 20px;
}

/* ===========================================
   Inline Player
   =========================================== */

.ytpg-inline-player {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 2;
}

.ytpg-inline-player iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

/* ===========================================
   Editor Placeholder & Error States
   =========================================== */

.ytpg-editor-placeholder,
.ytpg-error,
.ytpg-empty {
	padding: 40px 20px;
	text-align: center;
	background: #f5f5f5;
	border: 2px dashed #ccc;
	border-radius: 4px;
	color: #666;
	font-size: 14px;
}

.ytpg-error {
	border-color: #e74c3c;
	color: #e74c3c;
}
