/* =========================================================
   YT Playlist Pro — Frontend Styles
   ========================================================= */

.ytpp-container {
	--ytpp-gap: 24px;
	--ytpp-radius: 12px;
	position: relative;
	box-sizing: border-box;
}
.ytpp-container * { box-sizing: border-box; }

/* Header */
.ytpp-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
	flex-wrap: wrap;
}
.ytpp-header-title { margin: 0; font-size: 22px; line-height: 1.3; }
.ytpp-header-count { font-size: 14px; white-space: nowrap; }

/* Placeholder / error state */
.ytpp-placeholder {
	text-align: center;
	padding: 60px 20px;
	background: #f7f7f7;
	border: 2px dashed #ddd;
	border-radius: 10px;
	color: #777;
}
.ytpp-placeholder .dashicons { font-size: 40px; width: 40px; height: 40px; opacity: .5; }
.ytpp-placeholder p { margin: 10px 0 0; }

/* ---------- Card (shared) ---------- */
.ytpp-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: var(--ytpp-radius);
	overflow: hidden;
	transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease;
}

.ytpp-thumb-wrap {
	position: relative;
	width: 100%;
	padding-top: 56.25%; /* 16:9 default */
	background: #111;
	overflow: hidden;
}
.ytpp-thumb {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .4s ease;
}
.ytpp-card:hover .ytpp-thumb { transform: scale(1.06); }

.ytpp-thumb-link { display: block; position: absolute; inset: 0; }

.ytpp-play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(.85);
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: #ff0000;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity .25s ease, transform .25s ease;
	pointer-events: none;
}
.ytpp-card:hover .ytpp-play-icon { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.ytpp-play-icon svg { fill: #fff; }

.ytpp-duration {
	position: absolute;
	bottom: 8px;
	right: 8px;
	background: rgba(0,0,0,.8);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	padding: 2px 6px;
	border-radius: 4px;
	line-height: 1.4;
}

.ytpp-index {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	background: #ff0000;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	min-width: 22px;
	height: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	padding: 0 4px;
}

.ytpp-card-content { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }

.ytpp-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; }
.ytpp-title-link { color: inherit; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ytpp-title-link:hover { text-decoration: none; }

.ytpp-description { margin: 0; font-size: 13px; line-height: 1.5; opacity: .85; }

.ytpp-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; opacity: .8; }
.ytpp-meta span:not(:last-child)::after { content: '•'; margin-left: 10px; opacity: .6; }

/* ---------- Grid ---------- */
.ytpp-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--ytpp-gap);
}

/* ---------- Gallery / Masonry ---------- */
.ytpp-gallery {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--ytpp-gap);
	grid-auto-flow: dense;
}
.ytpp-gallery-item { display: flex; }
.ytpp-gallery-item .ytpp-card { width: 100%; }
.ytpp-gallery-featured {
	grid-column: span 2;
}
.ytpp-gallery-featured .ytpp-thumb-wrap { padding-top: 42%; }

/* ---------- List ---------- */
.ytpp-list { display: flex; flex-direction: column; gap: 16px; }
.ytpp-list-item.ytpp-card {
	flex-direction: row;
	align-items: stretch;
	position: relative;
}
.ytpp-thumb-wrap-list {
	width: 260px;
	flex: 0 0 260px;
	padding-top: 0;
	height: auto;
}
.ytpp-thumb-wrap-list::before { content: ''; display: block; padding-top: 56.25%; }
.ytpp-thumb-wrap-list .ytpp-thumb { position: absolute; }
.ytpp-list-content { flex: 1; justify-content: center; }
.ytpp-play-icon-sm { width: 44px; height: 44px; }
.ytpp-index-list { top: 8px; left: 8px; }

/* ---------- Carousel ---------- */
.ytpp-carousel { position: relative; display: flex; align-items: center; gap: 10px; }
.ytpp-carousel-track-wrap { overflow: hidden; flex: 1; }
.ytpp-carousel-track { display: flex; gap: var(--ytpp-gap); transition: transform .4s ease; will-change: transform; }
.ytpp-carousel-slide { flex: 0 0 calc((100% - (2 * var(--ytpp-gap))) / 3); display: flex; }
.ytpp-carousel-slide .ytpp-card { width: 100%; }
.ytpp-carousel-nav {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid #e2e2e2;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
	z-index: 2;
}
.ytpp-carousel-nav:hover { background: #f2f2f2; }
.ytpp-carousel-nav svg { fill: #333; }
.ytpp-carousel-nav[disabled] { opacity: .35; cursor: default; }
.ytpp-carousel-dots {
	position: absolute;
	bottom: -26px;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	gap: 6px;
}
.ytpp-carousel-dot { width: 8px; height: 8px; border-radius: 50%; background: #ddd; cursor: pointer; transition: background .2s ease, transform .2s ease; }
.ytpp-carousel-dot.is-active { background: #ff0000; transform: scale(1.2); }

/* ---------- Load more ---------- */
.ytpp-load-more-wrap { text-align: center; margin-top: 28px; }
.ytpp-load-more {
	background: #ff0000;
	color: #fff;
	border: none;
	padding: 12px 32px;
	border-radius: 30px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .2s ease, transform .15s ease;
}
.ytpp-load-more:hover { background: #cc0000; }
.ytpp-load-more:active { transform: scale(.97); }
.ytpp-load-more[disabled] { opacity: .6; cursor: default; }
.ytpp-load-more.is-loading::after {
	content: '';
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-left: 8px;
	border: 2px solid rgba(255,255,255,.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ytpp-spin .7s linear infinite;
	vertical-align: middle;
}
@keyframes ytpp-spin { to { transform: rotate(360deg); } }

/* ---------- Sidebar Player Layout ---------- */
.ytpp-sidebar-layout { display: flex; gap: 24px; align-items: flex-start; }
.ytpp-sidebar-pos-left { flex-direction: row-reverse; }
.ytpp-sidebar-pos-below { flex-direction: column; }

.ytpp-sidebar-player { flex: 1; min-width: 0; }
.ytpp-main-player-wrap {
	position: relative;
	width: 100%;
	padding-top: 56.25%;
	background: #000;
	border-radius: var(--ytpp-radius);
	overflow: hidden;
}
.ytpp-main-player-frame, .ytpp-main-player-wrap iframe {
	position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.ytpp-main-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.ytpp-play-icon-main { width: 80px; height: 80px; opacity: 1; cursor: pointer; }

.ytpp-main-title { margin: 16px 0 8px; font-size: 20px; line-height: 1.4; }
.ytpp-main-meta { margin-bottom: 10px; }
.ytpp-main-description { max-width: 68ch; }

.ytpp-sidebar-panel { flex: 0 0 360px; width: 360px; }
.ytpp-sidebar-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
	max-height: 500px;
	overflow-y: auto;
	padding-right: 4px;
}
.ytpp-sidebar-list::-webkit-scrollbar { width: 6px; }
.ytpp-sidebar-list::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 4px; }

.ytpp-sidebar-item {
	display: flex;
	gap: 10px;
	padding: 8px;
	border-radius: 8px;
	border-left: 3px solid transparent;
	cursor: pointer;
	transition: background-color .2s ease;
	position: relative;
}
.ytpp-sidebar-item:hover { background: #f5f5f5; }
.ytpp-sidebar-item.is-active { background: #fff4f4; border-left-color: #ff0000; }

.ytpp-thumb-wrap-sidebar { width: 140px; flex: 0 0 140px; border-radius: 6px; overflow: hidden; padding-top: 0; height: 78px; }
.ytpp-thumb-wrap-sidebar .ytpp-thumb { position: relative; height: 78px; }
.ytpp-index-sidebar { position: static; align-self: center; background: transparent; color: #909090; font-size: 13px; width: 18px; height: auto; }

.ytpp-sidebar-item-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.ytpp-title-sidebar { margin: 0; font-size: 13.5px; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; display: -webkit-box; overflow: hidden; }
.ytpp-sidebar-item .ytpp-meta { font-size: 11.5px; }

/* ---------- Lightbox Modal ---------- */
.ytpp-lightbox-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.9);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease;
	padding: 40px 20px;
}
.ytpp-lightbox-overlay.is-open { opacity: 1; visibility: visible; }
.ytpp-lightbox-inner { position: relative; width: 100%; max-width: 960px; }
.ytpp-lightbox-frame-wrap { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: 8px; overflow: hidden; }
.ytpp-lightbox-frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ytpp-lightbox-close {
	position: absolute;
	top: -44px;
	right: 0;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(255,255,255,.1);
	border: none;
	color: #fff;
	font-size: 20px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.ytpp-lightbox-close:hover { background: rgba(255,255,255,.25); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.ytpp-grid, .ytpp-gallery { grid-template-columns: repeat(2, 1fr); }
	.ytpp-carousel-slide { flex-basis: calc((100% - var(--ytpp-gap)) / 2); }
	.ytpp-sidebar-panel { flex: 0 0 300px; width: 300px; }
}

@media (max-width: 767px) {
	.ytpp-grid, .ytpp-gallery { grid-template-columns: 1fr; }
	.ytpp-gallery-featured { grid-column: span 1; }
	.ytpp-carousel-slide { flex-basis: 100%; }
	.ytpp-sidebar-layout, .ytpp-sidebar-pos-left { flex-direction: column; }
	.ytpp-sidebar-panel { width: 100%; flex-basis: auto; }
	.ytpp-list-item.ytpp-card { flex-direction: column; }
	.ytpp-thumb-wrap-list { width: 100%; flex-basis: auto; }
	.ytpp-thumb-wrap-list .ytpp-thumb { position: absolute; }
}
