/* YouTube TV — Player styles */

/* ─── Reset dans le scope du widget ─── */
.ytv-app, .ytv-app * { box-sizing: border-box; margin: 0; padding: 0; }

.ytv-app {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	position: relative;
	background: #0a0a0a;
	border-radius: 8px;
	overflow: hidden;
	max-width: 1100px;
	margin: 0 auto;
	aspect-ratio: 16 / 9;
	min-height: 420px;
}

/* ═══════════════════════════════════════
   ÉCRAN D'ACCUEIL
═══════════════════════════════════════ */

.ytv-home {
	position: absolute;
	inset: 0;
	background: linear-gradient(160deg, #0f0f0f 0%, #1a1a2e 60%, #16213e 100%);
	overflow-y: auto;
	transition: opacity .4s, visibility .4s;
}

.ytv-home.ytv-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.ytv-home-inner {
	max-width: 1100px;
	margin: 0 auto;
	padding: 40px 24px 60px;
}

.ytv-home-header {
	text-align: center;
	margin-bottom: 32px;
	padding-top: 8px;
}

.ytv-home-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	background: rgba(255,0,0,.9);
	color: #fff;
	border-radius: 50%;
	font-size: 12px;
	padding-left: 2px;
	margin-bottom: 12px;
}

.ytv-home-sub {
	color: #e0e0e0;
	font-size: 1.05rem;
	font-weight: 500;
	letter-spacing: .01em;
}

.ytv-play-all-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 18px;
	padding: 10px 22px;
	background: #ff0000;
	color: #fff;
	border: none;
	border-radius: 24px;
	font-size: .9rem;
	font-weight: 700;
	cursor: pointer;
	transition: background .15s, transform .15s;
}

.ytv-play-all-btn:hover,
.ytv-play-all-btn:focus-visible {
	background: #e60000;
	transform: translateY(-1px);
	outline: none;
}

/* Grille de vignettes */
.ytv-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 16px;
}

.ytv-grid-item {
	cursor: pointer;
	border-radius: 8px;
	overflow: hidden;
	background: #1c1c1c;
	border: 2px solid transparent;
	transition: transform .2s, border-color .2s, box-shadow .2s;
	list-style: none;
}

.ytv-grid-item:hover,
.ytv-grid-item:focus-visible {
	transform: translateY(-4px);
	border-color: #ff0000;
	box-shadow: 0 8px 24px rgba(255,0,0,.25);
	outline: none;
}

.ytv-grid-thumb {
	position: relative;
	width: 100%;
	padding-bottom: 56.25%;
	overflow: hidden;
}

.ytv-grid-thumb img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .3s;
}

.ytv-grid-item:hover .ytv-grid-thumb img { transform: scale(1.06); }

.ytv-grid-play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0,0,0,.3);
	opacity: 0;
	transition: opacity .2s;
}

.ytv-grid-item:hover .ytv-grid-play { opacity: 1; }

.ytv-grid-play-icon {
	width: 44px;
	height: 44px;
	background: rgba(255,0,0,.9);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 16px;
	padding-left: 4px;
}

.ytv-grid-info {
	padding: 10px 12px;
}

.ytv-grid-title {
	font-size: .85rem;
	color: #e0e0e0;
	font-weight: 600;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ytv-grid-index {
	font-size: .75rem;
	color: #555;
	margin-top: 4px;
}

/* ═══════════════════════════════════════
   MODE THÉÂTRE
═══════════════════════════════════════ */

.ytv-theater {
	position: absolute;
	inset: 0;
	display: flex;
	background: #000;
	opacity: 0;
	visibility: hidden;
	transition: opacity .4s, visibility .4s;
}

.ytv-theater.ytv-visible {
	opacity: 1;
	visibility: visible;
}

/* Sidebar playlist */
.ytv-sidebar {
	width: 260px;
	flex-shrink: 0;
	background: #111;
	display: flex;
	flex-direction: column;
	border-right: 1px solid #222;
	overflow: hidden;
	transition: transform .3s;
}

.ytv-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid #222;
	gap: 8px;
}

.ytv-back-btn {
	background: none;
	border: 1px solid #333;
	color: #aaa;
	padding: 6px 12px;
	border-radius: 4px;
	cursor: pointer;
	font-size: .8rem;
	transition: color .15s, border-color .15s;
}
.ytv-back-btn:hover { color: #fff; border-color: #666; }

.ytv-playlist-label {
	font-size: .75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: #555;
}

.ytv-playlist {
	flex: 1;
	overflow-y: auto;
	list-style: none;
	padding: 8px 0;
	scrollbar-width: thin;
	scrollbar-color: #333 transparent;
}

.ytv-playlist::-webkit-scrollbar { width: 4px; }
.ytv-playlist::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.ytv-pl-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	cursor: pointer;
	transition: background .15s;
	border-left: 3px solid transparent;
}

.ytv-pl-item:hover { background: #1c1c1c; }

.ytv-pl-item.ytv-pl-active {
	background: #1a1a1a;
	border-left-color: #ff0000;
}

.ytv-pl-thumb {
	flex-shrink: 0;
	width: 64px;
	height: 36px;
	object-fit: cover;
	border-radius: 3px;
}

.ytv-pl-title {
	font-size: .78rem;
	color: #ccc;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ytv-pl-item.ytv-pl-active .ytv-pl-title { color: #fff; font-weight: 600; }

.ytv-pl-num {
	flex-shrink: 0;
	width: 18px;
	font-size: .7rem;
	color: #444;
	text-align: right;
}

.ytv-pl-item.ytv-pl-active .ytv-pl-num { color: #ff0000; }

/* Zone principale */
.ytv-main {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
	position: relative;
}

/* Iframe */
.ytv-iframe-wrap {
	flex: 1;
	position: relative;
	background: #000;
	min-height: 0;
}

.ytv-iframe-inner {
	position: absolute;
	inset: 0;
}

.ytv-iframe-inner iframe {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

/* Contrôles */
.ytv-controls {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	background: #111;
	border-top: 1px solid #1c1c1c;
	min-height: 70px;
}

.ytv-nav-btn {
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid #333;
	background: #1c1c1c;
	color: #ccc;
	font-size: 1.1rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s, color .15s, border-color .15s, transform .1s;
}

.ytv-nav-btn:hover:not(:disabled) {
	background: #ff0000;
	color: #fff;
	border-color: #ff0000;
	transform: scale(1.08);
}

.ytv-nav-btn:disabled { opacity: .3; cursor: default; }

.ytv-info { flex: 1; min-width: 0; }

.ytv-info-title {
	font-size: clamp(.85rem, 2vw, 1.1rem);
	color: #fff;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ytv-info-desc {
	font-size: .78rem;
	color: #666;
	margin-top: 3px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Dots */
.ytv-dots {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 8px 20px 12px;
	background: #111;
	flex-wrap: wrap;
}

.ytv-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #333;
	border: none;
	cursor: pointer;
	padding: 0;
	transition: background .2s, transform .2s;
}

.ytv-dot:hover { background: #666; transform: scale(1.3); }
.ytv-dot.ytv-dot-active { background: #ff0000; transform: scale(1.4); }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */

@media (max-width: 700px) {
	.ytv-app { aspect-ratio: auto; min-height: 520px; }

	.ytv-theater { flex-direction: column; }

	.ytv-sidebar {
		width: 100%;
		height: 160px;
		border-right: none;
		border-bottom: 1px solid #222;
		flex-direction: row;
	}

	.ytv-sidebar-header {
		flex-direction: column;
		justify-content: center;
		width: 90px;
		border-bottom: none;
		border-right: 1px solid #222;
		padding: 10px;
	}

	.ytv-playlist { flex-direction: row; display: flex; }

	.ytv-pl-item { flex-direction: column; padding: 8px; width: 90px; flex-shrink: 0; }
	.ytv-pl-thumb { width: 74px; height: 42px; }
	.ytv-pl-num { display: none; }

	.ytv-controls { padding: 10px 14px; }

	.ytv-info-desc { display: none; }
}

@media (max-width: 480px) {
	.ytv-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
	.ytv-home-inner { padding: 24px 14px 40px; }
}

/* ─── Transition slide home → theater ─── */
.ytv-home { transition: opacity .35s ease, visibility .35s; }
.ytv-theater { transition: opacity .35s ease, visibility .35s; }
