/**
 * Youtube VideoList Gallery 3.3
 * Copyright (C) 2011 - 2026 JoomlaX
 */

.jx-ytg {
	--jx-ytg-accent: #ff0000;
	--jx-ytg-bg: #fff;
	--jx-ytg-surface: #f2f2f2;
	--jx-ytg-text: #0f0f0f;
	--jx-ytg-muted: #606060;
	--jx-ytg-border: rgba(0, 0, 0, 0.1);
	--jx-ytg-hover: rgba(0, 0, 0, 0.05);
	--jx-ytg-radius: 12px;
	--jx-ytg-gap: 12px;
	--jx-ytg-list-w: 360px;
	--jx-ytg-thumb-w: 112px;

	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	color: var(--jx-ytg-text);
	background: var(--jx-ytg-bg);
	border-radius: var(--jx-ytg-radius);
	font-family: Roboto, "Segoe UI", Helvetica, Arial, sans-serif;
	line-height: 1.4;
	overflow: hidden;
}

.jx-ytg *,
.jx-ytg *::before,
.jx-ytg *::after {
	box-sizing: border-box;
}

/* Themes */
.jx-ytg--theme-youtube {
	--jx-ytg-bg: #0f0f0f;
	--jx-ytg-surface: #121212;
	--jx-ytg-text: #f1f1f1;
	--jx-ytg-muted: #aaaaaa;
	--jx-ytg-border: rgba(255, 255, 255, 0.12);
	--jx-ytg-hover: #272727;
	--jx-ytg-accent: #ff0000;
}

.jx-ytg--theme-light {
	--jx-ytg-bg: #ffffff;
	--jx-ytg-surface: #f8f8f8;
	--jx-ytg-text: #0f0f0f;
	--jx-ytg-muted: #606060;
	--jx-ytg-border: #e5e5e5;
	--jx-ytg-hover: #f2f2f2;
}

.jx-ytg--theme-soft {
	--jx-ytg-bg: #f8fafc;
	--jx-ytg-surface: #ffffff;
	--jx-ytg-text: #0f172a;
	--jx-ytg-muted: #64748b;
	--jx-ytg-border: #e2e8f0;
	--jx-ytg-hover: #f1f5f9;
	--jx-ytg-accent: #0d9488;
}

.jx-ytg--theme-dark {
	--jx-ytg-bg: #0b1220;
	--jx-ytg-surface: #111827;
	--jx-ytg-text: #f3f4f6;
	--jx-ytg-muted: #9ca3af;
	--jx-ytg-border: rgba(255, 255, 255, 0.1);
	--jx-ytg-hover: #1f2937;
}

/* Shell */
.jx-ytg__shell {
	display: grid;
	gap: var(--jx-ytg-gap);
	padding: var(--jx-ytg-gap);
	align-items: start;
}

/* —— YouTube layout: flat watch-page style —— */
.jx-ytg--youtube .jx-ytg__shell {
	grid-template-columns: minmax(0, 1fr) min(var(--jx-ytg-list-w), 34%);
}

.jx-ytg--youtube .jx-ytg__stage {
	border-radius: 8px;
}

.jx-ytg--youtube .jx-ytg__list {
	padding-top: 2px;
}

.jx-ytg--youtube .jx-ytg__item {
	border-radius: 10px;
}

/* —— Cinema layout: widescreen theater —— */
.jx-ytg--cinema {
	background: linear-gradient(165deg, #030308 0%, var(--jx-ytg-bg) 42%, #020206 100%);
}

.jx-ytg--cinema .jx-ytg__shell {
	grid-template-columns: minmax(0, 1fr) min(var(--jx-ytg-list-w), 30%);
	padding: calc(var(--jx-ytg-gap) * 1.35);
	border: 1px solid rgba(255, 255, 255, 0.07);
	border-radius: calc(var(--jx-ytg-radius) + 6px);
	background: rgba(0, 0, 0, 0.42);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.05),
		0 24px 48px rgba(0, 0, 0, 0.55);
}

.jx-ytg--cinema .jx-ytg__stage {
	aspect-ratio: 21 / 9;
	border-radius: 4px;
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.1),
		0 16px 48px rgba(0, 0, 0, 0.7);
}

.jx-ytg--cinema .jx-ytg__list {
	padding-left: calc(var(--jx-ytg-gap) * 0.75);
	border-left: 1px solid var(--jx-ytg-border);
	--jx-ytg-thumb-w: 96px;
}

.jx-ytg--cinema .jx-ytg__item {
	padding: 3px 4px !important;
	border-radius: 6px;
}

.jx-ytg--cinema .jx-ytg__item.is-active {
	box-shadow: inset 2px 0 0 var(--jx-ytg-accent);
}

.jx-ytg--cinema .jx-ytg__play-btn {
	width: 72px;
	height: 72px;
	border-radius: 50% !important;
}

.jx-ytg--cinema .jx-ytg__play-btn::after {
	border-width: 12px 0 12px 20px;
}

/* Sidebar shares column split only */
.jx-ytg--sidebar .jx-ytg__shell {
	grid-template-columns: minmax(0, 1fr) min(var(--jx-ytg-list-w), 36%);
}

.jx-ytg--sidebar-left .jx-ytg__shell {
	grid-template-columns: min(var(--jx-ytg-list-w), 36%) minmax(0, 1fr);
}

.jx-ytg--sidebar-left .jx-ytg__player { order: 2; }
.jx-ytg--sidebar-left .jx-ytg__list { order: 1; }

.jx-ytg--stacked .jx-ytg__shell,
.jx-ytg--grid .jx-ytg__shell {
	grid-template-columns: 1fr;
}

/* Player — video only, no extra chrome below */
.jx-ytg__player {
	min-width: 0;
	display: block;
	line-height: 0;
	font-size: 0;
}

.jx-ytg__stage {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: var(--jx-ytg-radius);
	overflow: hidden;
	display: block;
	vertical-align: top;
}

.jx-ytg__stage iframe,
.jx-ytg__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.jx-ytg__poster {
	object-fit: cover;
}

.jx-ytg__play-btn {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 68px;
	height: 48px;
	border: 0;
	border-radius: 14px;
	background: var(--jx-ytg-accent);
	cursor: pointer;
	display: grid;
	place-items: center;
	z-index: 2;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
	transition: transform 160ms ease, filter 160ms ease;
}

.jx-ytg__play-btn:hover {
	transform: scale(1.05);
	filter: brightness(1.08);
}

.jx-ytg__play-btn::after {
	content: "";
	width: 0;
	height: 0;
	margin-left: 3px;
	border-style: solid;
	border-width: 10px 0 10px 16px;
	border-color: transparent transparent transparent #fff;
}

/* List */
.jx-ytg__list {
	min-width: 0;
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow: hidden;
}

.jx-ytg--grid .jx-ytg__list,
.jx-ytg--stacked .jx-ytg__list {
	max-height: none;
	overflow: visible;
}

.jx-ytg__search {
	position: relative;
	flex-shrink: 0;
}

.jx-ytg .jx-ytg__search-input,
.jx-ytg input.jx-ytg__search-input[type="search"],
.jx-ytg input[type="search"].jx-ytg__search-input {
	width: 100% !important;
	max-width: 100% !important;
	height: 36px !important;
	margin: 0 !important;
	border: 1px solid var(--jx-ytg-border) !important;
	background-color: var(--jx-ytg-surface) !important;
	background-image: none !important;
	color: var(--jx-ytg-text) !important;
	border-radius: 18px !important;
	padding: 0 12px 0 36px !important;
	font-size: 13px !important;
	line-height: 36px !important;
	box-shadow: none !important;
	outline: none !important;
	caret-color: var(--jx-ytg-text) !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.jx-ytg .jx-ytg__search-input::placeholder {
	color: var(--jx-ytg-muted) !important;
	opacity: 1;
}

.jx-ytg .jx-ytg__search-input:focus {
	border-color: var(--jx-ytg-accent) !important;
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--jx-ytg-accent) 25%, transparent) !important;
}

.jx-ytg__search-icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	width: 15px;
	height: 15px;
	color: var(--jx-ytg-muted);
	pointer-events: none;
	z-index: 1;
}

.jx-ytg__items {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: auto;
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1 1 auto;
	min-height: 0;
	scrollbar-width: thin;
	scrollbar-color: var(--jx-ytg-border) transparent;
}

.jx-ytg--grid .jx-ytg__items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 16px;
	overflow: visible;
	flex: none;
}

.jx-ytg__item {
	display: grid !important;
	grid-template-columns: var(--jx-ytg-thumb-w) minmax(0, 1fr) !important;
	gap: 8px !important;
	align-items: center;
	width: 100%;
	margin: 0 !important;
	padding: 4px 6px !important;
	border-radius: 8px;
	cursor: pointer;
	border: 0;
	background: transparent;
	transition: background 120ms ease;
}

.jx-ytg--grid .jx-ytg__item {
	grid-template-columns: 1fr !important;
	padding: 0 !important;
	align-items: start;
}

.jx-ytg__item:hover,
.jx-ytg__item:focus-visible {
	background: var(--jx-ytg-hover);
	outline: none;
}

.jx-ytg__item.is-active {
	background: var(--jx-ytg-hover);
}

.jx-ytg--theme-youtube .jx-ytg__item.is-active,
.jx-ytg--theme-dark .jx-ytg__item.is-active {
	box-shadow: inset 3px 0 0 var(--jx-ytg-accent);
}

.jx-ytg__thumb-wrap {
	position: relative;
	width: var(--jx-ytg-thumb-w);
	max-width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: 6px;
	overflow: hidden;
	background: #222;
	flex-shrink: 0;
}

.jx-ytg--grid .jx-ytg__thumb-wrap {
	width: 100%;
}

.jx-ytg__thumb {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block !important;
	max-width: none !important;
}

.jx-ytg__now-badge {
	position: absolute;
	left: 4px;
	bottom: 4px;
	padding: 1px 4px;
	border-radius: 2px;
	background: var(--jx-ytg-accent);
	color: #fff;
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	display: none;
	line-height: 1.4;
}

.jx-ytg__item.is-active .jx-ytg__now-badge {
	display: inline-block;
}

.jx-ytg__meta {
	min-width: 0;
	line-height: 1.35;
}

.jx-ytg__title {
	margin: 0 !important;
	padding: 0 !important;
	color: var(--jx-ytg-text) !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	line-height: 1.35 !important;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	word-break: break-word;
	white-space: normal !important;
}

.jx-ytg__item.is-active .jx-ytg__title {
	font-weight: 600 !important;
}

.jx-ytg__loader {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: rgba(0, 0, 0, 0.45);
	z-index: 3;
}

.jx-ytg__spinner {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	animation: jx-ytg-spin 0.7s linear infinite;
}

@keyframes jx-ytg-spin {
	to { transform: rotate(360deg); }
}

@media (max-width: 992px) {
	.jx-ytg--youtube .jx-ytg__shell,
	.jx-ytg--sidebar .jx-ytg__shell,
	.jx-ytg--cinema .jx-ytg__shell,
	.jx-ytg--sidebar-left .jx-ytg__shell {
		grid-template-columns: 1fr;
	}

	.jx-ytg--sidebar-left .jx-ytg__player,
	.jx-ytg--sidebar-left .jx-ytg__list {
		order: initial;
	}

	.jx-ytg__list {
		max-height: 320px !important;
	}

	.jx-ytg {
		--jx-ytg-thumb-w: 128px;
	}
}

@media (max-width: 560px) {
	.jx-ytg {
		--jx-ytg-thumb-w: 108px;
		--jx-ytg-gap: 10px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.jx-ytg__item,
	.jx-ytg__play-btn,
	.jx-ytg__spinner {
		transition: none !important;
		animation: none !important;
	}
}
