/**
 * PlayFlix app shell: collapsible sidebar, hero slider, right rail.
 *
 * @package PlayFlix
 */

/* ============ App layout ============ */
.pf-app {
	display: flex;
	align-items: stretch;
	min-height: 100vh;
	background: var(--pf-bg, #0a0a10);
}

.pf-app-main {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.pf-main {
	flex: 1 1 auto;
	min-width: 0;
	/* The old fixed header is gone with the app shell — remove its offset
	 * so the hero artwork starts at the very top edge. */
	padding-top: 0;
}

/* Inner pages clear the fixed top cluster (desktop) / floating topbar
 * (mobile) so content never slides underneath the logo. The homepage
 * keeps its edge-to-edge hero. */
body:not(.home) .pf-main {
	padding-top: 76px;
}

@media (max-width: 1024px) {
	body:not(.home) .pf-main {
		padding-top: 64px;
	}
}

/* ============ Sidebar ============ */
.pf-side {
	position: sticky;
	top: 4.25rem;
	height: calc(100vh - 4.25rem);
	height: calc(100dvh - 4.25rem);
	width: 248px;
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	background: var(--pf-bg-soft, #101018);
	border-right: 1px solid var(--pf-border, rgba(255, 255, 255, 0.09));
	padding: 0.9rem 0.8rem 1rem;
	overflow-y: auto;
	overflow-x: hidden;
	transition: margin-left var(--pf-speed, 240ms) var(--pf-ease, ease);
	z-index: 60;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.pf-side::-webkit-scrollbar {
	display: none;
}

/* Fixed top-left cluster: hamburger + logo, never moves (MovieBox-style). */
.pf-topcluster {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 80;
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.85rem 1rem;
	transition: transform 280ms var(--pf-ease, ease), opacity 280ms var(--pf-ease, ease);
}

/* Auto-hide on scroll down; returns on scroll up. */
body.pf-cluster-hidden .pf-topcluster {
	transform: translateY(-110%);
	opacity: 0;
	pointer-events: none;
}

.pf-topcluster .pf-logo {
	font-size: 1.25rem;
	white-space: nowrap;
	text-shadow: 0 2px 14px rgba(0, 0, 0, 0.65);
}

.pf-cluster-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	flex: 0 0 auto;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(12, 12, 18, 0.55);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	color: #fff;
	font-size: 1.2rem;
	cursor: pointer;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
	transition: background var(--pf-speed, 240ms), border-color var(--pf-speed, 240ms);
}

.pf-cluster-toggle:hover {
	background: var(--pf-accent, #f3123f);
	border-color: var(--pf-accent, #f3123f);
}

/* Hidden state: sidebar slides away completely, content goes full width. */
body.pf-side-hidden .pf-side {
	margin-left: -248px;
}

.pf-side-nav {
	margin-bottom: 0.4rem;
}

.pf-side-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.pf-side-menu a,
.pf-side-search {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 0.7rem;
	border-radius: var(--pf-radius, 10px);
	color: var(--pf-text-dim, #b9b9c6);
	text-decoration: none;
	font-size: 0.95rem;
	font-weight: 600;
	white-space: nowrap;
	border: 0;
	background: transparent;
	width: 100%;
	cursor: pointer;
	text-align: left;
	transition: background var(--pf-speed, 240ms), color var(--pf-speed, 240ms);
}

.pf-side-menu a:hover,
.pf-side-search:hover {
	background: var(--pf-surface-hover, #242433);
	color: var(--pf-text, #f4f4f7);
}

.pf-side-menu .current-menu-item > a,
.pf-side-menu .current_page_item > a {
	background: linear-gradient(135deg, rgba(243, 18, 63, 0.28), rgba(243, 18, 63, 0.12));
	color: #fff;
	box-shadow: inset 2px 0 0 var(--pf-accent, #f3123f);
}

.pf-side-ico {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.4rem;
	flex: 0 0 auto;
	font-size: 1.05rem;
}

.pf-side-heading {
	margin: 1rem 0.7rem 0.4rem;
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--pf-text-faint, #71717f);
	white-space: nowrap;
}

.pf-side-bottom {
	margin-top: auto;
	padding-top: 0.8rem;
	border-top: 1px solid var(--pf-border, rgba(255, 255, 255, 0.09));
}

.pf-side-backdrop {
	display: none;
}

/* Drawer-only chrome (hidden on desktop). */
.pf-drawer-head,
.pf-drawer-promo {
	display: none;
}

/* ============ Mobile topbar (<=1024px) ============ */
.pf-mtopbar {
	display: none;
}

/* ============ Hero slider ============ */
.pf-hero {
	position: relative;
	overflow: hidden;
	min-height: clamp(380px, 44vw, 560px);
	background: var(--pf-bg-soft, #101018);
	cursor: grab;
}

.pf-hero.is-dragging {
	cursor: grabbing;
}

.pf-hero.is-dragging a,
.pf-hero.is-dragging button {
	pointer-events: none;
}

.pf-hero-track {
	position: absolute;
	inset: 0;
}

.pf-hero-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 800ms ease, visibility 800ms;
}

.pf-hero-slide.is-active {
	opacity: 1;
	visibility: visible;
	z-index: 1;
}

.pf-hero-bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center 20%;
	transform: scale(1.04);
}

.pf-hero-slide.is-active .pf-hero-bg {
	animation: pf-hero-zoom 7s ease-out forwards;
}

@keyframes pf-hero-zoom {
	from { transform: scale(1.08); }
	to { transform: scale(1.0); }
}

.pf-hero-shade {
	position: absolute;
	inset: 0;
	/* Whisper-light at the top so the artwork is fully visible behind the
	 * floating search; stronger at the bottom for text readability. */
	background:
		linear-gradient(180deg, rgba(10, 10, 16, 0.22) 0%, rgba(10, 10, 16, 0) 20%, rgba(10, 10, 16, 0) 55%, rgba(10, 10, 16, 0.92) 100%),
		linear-gradient(90deg, rgba(10, 10, 16, 0.85) 0%, rgba(10, 10, 16, 0.25) 55%, rgba(10, 10, 16, 0) 100%);
}

.pf-hero-content {
	position: absolute;
	z-index: 2;
	left: clamp(1.25rem, 4vw, 3.5rem);
	right: clamp(1.25rem, 4vw, 3.5rem);
	bottom: clamp(2.5rem, 6vw, 4rem);
	max-width: 640px;
}

.pf-hero-kicker {
	margin: 0 0 0.5rem;
	font-size: 0.75rem;
	font-weight: 800;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--pf-accent, #f3123f);
}

.pf-hero-title {
	margin: 0 0 0.6rem;
	font-size: clamp(1.9rem, 4.5vw, 3.4rem);
	line-height: 1.05;
	font-weight: 800;
	color: #fff;
	text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}

.pf-hero-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
	margin: 0 0 0.8rem;
	color: var(--pf-text-dim, #b9b9c6);
	font-size: 0.95rem;
	font-weight: 600;
}

.pf-hero-rating {
	color: var(--pf-gold, #ffb020);
}

.pf-hero-type {
	padding: 0.15rem 0.6rem;
	border-radius: var(--pf-radius-pill, 999px);
	background: rgba(243, 18, 63, 0.18);
	border: 1px solid rgba(243, 18, 63, 0.45);
	color: #ffb3c2;
	font-size: 0.75rem;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.pf-hero-overview {
	margin: 0 0 1.2rem;
	color: #d7d7e0;
	font-size: 0.98rem;
	line-height: 1.55;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	max-width: 560px;
}

.pf-hero-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.7rem;
}

.pf-hero-arrow {
	position: absolute;
	z-index: 3;
	top: 50%;
	transform: translateY(-50%);
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(10, 10, 16, 0.45);
	backdrop-filter: blur(6px);
	color: #fff;
	font-size: 1rem;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity var(--pf-speed, 240ms), background var(--pf-speed, 240ms);
}

.pf-hero:hover .pf-hero-arrow {
	opacity: 1;
}

.pf-hero-arrow:hover {
	background: var(--pf-accent, #f3123f);
	border-color: var(--pf-accent, #f3123f);
}

.pf-hero-prev { left: 1rem; }
.pf-hero-next { right: 1rem; }

/* Floating search over the hero — no opaque top bar. */
.pf-hero-search {
	position: absolute;
	z-index: 4;
	top: clamp(0.9rem, 2.5vw, 1.6rem);
	left: 50%;
	transform: translateX(-50%);
	width: min(560px, calc(100% - 2.5rem));
}

.pf-hero-search .pf-search-form {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	background: rgba(12, 12, 18, 0.55);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: var(--pf-radius-pill, 999px);
	padding: 0.35rem 0.35rem 0.35rem 1.1rem;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.pf-hero-search .pf-field {
	flex: 1 1 auto;
	min-width: 0;
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 0.95rem;
	padding: 0.55rem 0;
	outline: none;
}

.pf-hero-search .pf-field::placeholder {
	color: rgba(255, 255, 255, 0.6);
}

.pf-hero-search .pf-btn {
	flex: 0 0 auto;
}

.pf-hero-suggest {
	position: absolute;
	top: calc(100% + 0.5rem);
	left: 0;
	right: 0;
}

/* ============ Homepage layout: full-width rows (no right rail) ============ */
.pf-home-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: clamp(1rem, 2.5vw, 2rem);
	padding: clamp(1rem, 2.5vw, 2rem) clamp(1rem, 3vw, 2.5rem);
	align-items: start;
}

.pf-home-main {
	min-width: 0;
}

.pf-home-full {
	padding: clamp(0.5rem, 2vw, 1.5rem) clamp(1rem, 3vw, 2.5rem) 3rem;
}

.pf-home-full .pf-row {
	margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.pf-home-full .pf-row .pf-container {
	max-width: none;
	padding-left: 0;
	padding-right: 0;
}



/* ============ Right rail ============ */
.pf-rail {
	position: sticky;
	top: 1rem;
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	min-width: 0;
}

.pf-rail-block {
	background: var(--pf-surface, #16161f);
	border: 1px solid var(--pf-border, rgba(255, 255, 255, 0.09));
	border-radius: var(--pf-radius-lg, 16px);
	padding: 1.1rem 1.1rem 0.9rem;
}

.pf-rail-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0 0 0.9rem;
	font-size: 1.02rem;
	font-weight: 800;
	color: var(--pf-text, #f4f4f7);
}

.pf-rail-fire {
	font-size: 1.1rem;
}

.pf-rail-top {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.pf-rail-top li + li {
	border-top: 1px solid var(--pf-border, rgba(255, 255, 255, 0.09));
}

.pf-rail-top a,
.pf-rail-coming a {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem 0.2rem;
	text-decoration: none;
	border-radius: var(--pf-radius-sm, 6px);
	transition: background var(--pf-speed, 240ms);
}

.pf-rail-top a:hover,
.pf-rail-coming a:hover {
	background: var(--pf-surface-hover, #242433);
}

.pf-rail-rank {
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--pf-accent, #f3123f);
	min-width: 1.6rem;
	text-align: center;
	line-height: 1;
	text-shadow: 0 0 18px var(--pf-accent-glow, rgba(243, 18, 63, 0.35));
}

.pf-rail-top img {
	width: 40px;
	height: 60px;
	object-fit: cover;
	border-radius: 6px;
	flex: 0 0 auto;
	background: var(--pf-surface-2, #1d1d28);
}

.pf-rail-meta {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
}

.pf-rail-name {
	color: var(--pf-text, #f4f4f7);
	font-weight: 700;
	font-size: 0.9rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pf-rail-sub {
	color: var(--pf-text-faint, #71717f);
	font-size: 0.78rem;
}

.pf-rail-coming {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.pf-rail-coming li + li {
	border-top: 1px solid var(--pf-border, rgba(255, 255, 255, 0.09));
}

.pf-rail-cal {
	font-size: 1.3rem;
	flex: 0 0 auto;
}

.pf-rail-ad {
	padding: 0;
	border-style: dashed;
	overflow: hidden;
	text-align: center;
}

/* ============ Card hover lift ============ */
.pf-yt-grid .pf-card,
.pf-row-track .pf-card {
	transition: transform var(--pf-speed, 240ms) var(--pf-ease, ease), box-shadow var(--pf-speed, 240ms);
}

.pf-yt-grid .pf-card:hover,
.pf-row-track .pf-card:hover {
	transform: translateY(-6px) scale(1.02);
	box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(243, 18, 63, 0.35);
	z-index: 2;
}

/* ============ Footer in shell ============ */
.pf-footer-inner {
	padding: 2.5rem clamp(1rem, 3vw, 2.5rem) 1.5rem;
}

/* ============ Responsive ============ */
@media (max-width: 1280px) {
	.pf-home-layout {
		grid-template-columns: minmax(0, 1fr) 260px;
	}
}

@media (max-width: 1024px) {
	/* Sidebar becomes a slimmer rounded off-canvas drawer, hidden by default. */
	.pf-side {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		width: min(280px, 78vw);
		border-radius: 0 22px 22px 0;
		border-right: 0;
		transform: translateX(-104%);
		transition: transform 320ms cubic-bezier(0.32, 0.72, 0.35, 1);
		box-shadow: none;
	}

	body.pf-side-open .pf-side {
		transform: translateX(0);
		box-shadow: 24px 0 64px rgba(0, 0, 0, 0.6);
	}

	body.pf-side-open .pf-side-backdrop {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 55;
		background: rgba(0, 0, 0, 0.45);
		backdrop-filter: blur(3px);
		-webkit-backdrop-filter: blur(3px);
	}

	/* Drawer header: logo + close button. */
	.pf-drawer-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.6rem;
		padding: 0.35rem 0.2rem 0.9rem;
	}

	.pf-drawer-head .pf-logo {
		font-size: 1.2rem;
		white-space: nowrap;
	}

	.pf-drawer-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 2.4rem;
		height: 2.4rem;
		flex: 0 0 auto;
		border-radius: 50%;
		border: 1px solid var(--pf-border, rgba(255, 255, 255, 0.12));
		background: rgba(255, 255, 255, 0.06);
		color: var(--pf-text, #f4f4f7);
		font-size: 1.4rem;
		line-height: 1;
		cursor: pointer;
		transition: background var(--pf-speed, 240ms), transform var(--pf-speed, 240ms);
	}

	.pf-drawer-close:hover {
		background: var(--pf-accent, #f3123f);
		border-color: var(--pf-accent, #f3123f);
		transform: rotate(90deg);
	}

	/* Promo card pinned to the drawer bottom. */
	.pf-drawer-promo {
		display: block;
		margin-top: auto;
		background: linear-gradient(135deg, rgba(243, 18, 63, 0.22), rgba(123, 44, 191, 0.22));
		border: 1px solid rgba(243, 18, 63, 0.3);
		border-radius: 16px;
		padding: 0.9rem 1rem;
	}

	.pf-drawer-promo p {
		margin: 0;
		font-size: 0.82rem;
		color: var(--pf-text-dim, #b9b9c6);
	}

	.pf-drawer-promo-title {
		font-weight: 800;
		color: var(--pf-text, #f4f4f7) !important;
		font-size: 0.95rem !important;
		margin-bottom: 0.25rem !important;
	}

	body.pf-side-open {
		overflow: hidden;
	}

	/* Hidden state never applies on mobile (drawer is used instead). */
	body.pf-side-hidden .pf-side {
		margin-left: 0;
	}

	/* Top cluster hidden on mobile — the topbar hamburger opens the drawer. */
	.pf-topcluster {
		display: none;
	}

	/* Transparent floating topbar (like desktop) — no black box. */
	.pf-mtopbar {
		display: flex;
		align-items: center;
		gap: 0.7rem;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: 50;
		padding: 0.6rem 1rem;
		background: transparent;
		border-bottom: 0;
		transition: transform 280ms var(--pf-ease, ease), opacity 280ms var(--pf-ease, ease);
	}

	body.pf-cluster-hidden .pf-mtopbar {
		transform: translateY(-110%);
		opacity: 0;
		pointer-events: none;
	}

	.pf-mtopbar-logo {
		font-size: 1.15rem;
		margin-right: auto;
		text-shadow: 0 2px 14px rgba(0, 0, 0, 0.65);
	}

	/* Hero search sits below the floating topbar. */
	.pf-hero-search {
		top: 4.4rem;
	}

	/* Rail stacks below content. */
	.pf-home-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.pf-rail {
		position: static;
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
		align-items: start;
	}

	.pf-hero {
		min-height: 340px;
	}

	.pf-hero-content {
		bottom: 2.2rem;
	}

	.pf-hero-overview {
		display: none;
	}

	.pf-hero-arrow {
		display: none;
	}
}

@media (max-width: 640px) {
	.pf-hero {
		min-height: 300px;
	}

	/* Phones: hero search pill hides (it covered the artwork/title);
	   the topbar search icon opens the full search overlay instead. */
	.pf-hero-search {
		display: none;
	}

	.pf-hero-search .pf-btn {
		display: none;
	}

	.pf-home-layout {
		padding: 1rem 0.8rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.pf-hero-slide,
	.pf-side,
	.pf-hero-slide.is-active .pf-hero-bg {
		transition: none;
		animation: none;
	}
}

/* Empty hero (no backdrops yet): just the floating search on a soft band. */
.pf-hero-empty {
	min-height: 0;
	padding: 6.5rem 0 3rem;
	background: radial-gradient(60% 120% at 50% 0%, rgba(243, 18, 63, 0.12), transparent 70%), var(--pf-bg-soft, #101018);
}

.pf-hero-empty .pf-hero-search {
	position: relative;
	top: auto;
	left: auto;
	transform: none;
	margin: 0 auto;
}

/* Logged-in admin bar offset. */
body.admin-bar .pf-topcluster {
	top: 32px;
}

body.admin-bar .pf-side {
	top: calc(32px + 4.25rem);
	height: calc(100vh - 32px - 4.25rem);
	height: calc(100dvh - 32px - 4.25rem);
}

@media (max-width: 782px) {
	body.admin-bar .pf-topcluster {
		top: 46px;
	}

	body.admin-bar .pf-side {
		top: calc(46px + 4.25rem);
		height: calc(100vh - 46px - 4.25rem);
		height: calc(100dvh - 46px - 4.25rem);
	}
}
