/* SK Media — Metro/Windows Phone 8 inspired theme */
@import url('/ui/sk-classless.css');

/* ── Custom properties ── */
:root {
	--tile-size: 160px;
	--appbar-h: 64px;
}

/* ── View transitions ── */
.view-enter {
	transform: translateX(40px);
	opacity: 0;
}

.view-visible {
	transform: translateX(0);
	opacity: 1;
	transition: transform 220ms cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 220ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Section headings ── */
.section-heading {
	display: flex;
	align-items: center;
	padding: 0 0 4px 0;
	margin-bottom: 10px;
	border-bottom: 1px solid var(--color-accent);

	& span {
		font-size: 0.7rem;
		font-weight: 700;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		color: var(--color-accent);
	}
}

/* ── Media tile ── */
.media-tile {
	display: inline-flex;
	flex-direction: column;
	width: var(--tile-size);
	min-width: var(--tile-size);
	cursor: pointer;
	text-decoration: none;
	color: var(--color-text);
	flex-shrink: 0;
	outline: none;

	&:focus-visible {
		outline: 2px solid var(--color-accent);
		outline-offset: 2px;
	}

	&:active { opacity: 0.75; }
}

.tile-img {
	width: var(--tile-size);
	height: var(--tile-size);
	object-fit: cover;
	display: block;
	background: var(--color-surface);
}

.tile-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-accent);
	color: var(--color-accent-text);
	font-size: 3rem;
	font-weight: 100;
}

.tile-label {
	padding: 6px 0 0 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.tile-title {
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: -0.01em;
}

.tile-sub {
	font-size: 0.75rem;
	color: var(--color-text-muted);
}

/* ─────────────────────────────────────────────
   LOGIN VIEW
───────────────────────────────────────────── */
.login-screen {
	display: flex;
	height: 100%;
	width: 100%;
	position: relative;
	flex-direction: row;

	&::before {
		content: '';
		width: 8px;
		background: var(--color-accent);
		flex-shrink: 0;
	}

	& > div {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		padding: 48px 48px 48px 40px;
		max-width: 440px;
	}
}

.login-title {
	font-size: 3.5rem;
	font-weight: 100;
	letter-spacing: -0.03em;
	line-height: 1;
	color: var(--color-text);
	margin: 0 0 4px 0;
}

.login-subtitle {
	font-size: 0.875rem;
	color: var(--color-text-muted);
	letter-spacing: 0.04em;
	text-transform: lowercase;
}

.login-form {
	display: flex;
	flex-direction: column;

	& > div { margin-bottom: 24px; }
}

.login-error {
	color: var(--color-error);
	font-size: 0.825rem;
	margin-bottom: 16px;
}

.login-btn {
	margin-top: 8px;
	font-size: 0.875rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 14px 32px;
	align-self: flex-start;
}

/* ─────────────────────────────────────────────
   MAIN VIEW
───────────────────────────────────────────── */
main-view {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
}

/* ── Hero section ── */
.hero-section {
	padding: 0 16px;
	margin-bottom: 32px;
}

.hero-tile {
	display: block;
	position: relative;
	width: 100%;
	aspect-ratio: 16/9;
	max-height: 320px;
	overflow: hidden;
	text-decoration: none;
	background: var(--color-surface);
}

.hero-art {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.hero-art--empty {
	width: 100%;
	height: 100%;
	background: var(--color-accent);
	opacity: 0.15;
}

.hero-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 16px 20px;
	background: linear-gradient(transparent, rgba(0,0,0,0.72));
}

.hero-info { display: flex; flex-direction: column; gap: 2px; }

.hero-title {
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: #fff;
	text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.hero-title--empty {
	color: var(--color-text-muted);
	font-weight: 300;
}

.hero-artist {
	font-size: 0.875rem;
	color: rgba(255,255,255,0.8);
}

.library-links {
	display: flex;
	gap: 2px;
	margin-top: 2px;
}

.lib-link {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px 8px;
	background: var(--color-surface);
	color: var(--color-text);
	text-decoration: none;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: lowercase;
	transition: background var(--transition-fast);

	&:hover, &:focus-visible {
		background: var(--color-accent);
		color: var(--color-accent-text);
		outline: none;
	}
}

/* ─────────────────────────────────────────────
   BROWSE VIEW
───────────────────────────────────────────── */
browse-view {
	& > main {
		display: flex;
		flex-direction: column;
		overflow: hidden;



		& > div:has(figure) {
			flex: 1;
			min-height: 0;
			overflow-y: auto;
			overflow-x: hidden;
			scrollbar-width: thin;
			align-content: start;
			display: flex;
			flex-direction: row;
			flex-wrap: wrap;
			gap: var(--space-md);

			&::-webkit-scrollbar { width: 4px; }
			&::-webkit-scrollbar-thumb { background: var(--color-surface); }

			& > a {
				--size: 14rem;
				display: block;
				max-width: var(--size);
				
				& > * {
					margin: 0;
					padding: 0;
				}

				& > figure {
					display: flex;
					flex-direction: column;
					
					& > img {
						display: block;
						width: var(--size);
						height: var(--size);
						max-width: var(--size);
						max-height: var(--size);
					}
					& > figcaption {
						display: block;
						text-wrap: nowrap;
						overflow: hidden;
					}
				}
			}
		}

		
	}



	& section.home {
		display: flex;
		flex-direction: column;
		height: 100%;
		padding: 24px;

		& > h2 {
			font-size: 2rem;
			font-weight: 300;
			text-transform: lowercase;
			letter-spacing: -0.02em;
			margin-bottom: 24px;
		}

		& .grid {
			display: grid;
			grid-template-columns: repeat(2, 1fr);
			gap: 16px;
			align-content: start;

			& > a {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				gap: 12px;
				padding: 32px 24px;
				background: var(--color-surface);
				text-decoration: none;
				color: var(--color-text);
				transition: transform var(--transition-fast), background var(--transition-fast);

				&:hover {
					transform: translateY(-2px);
					background: var(--color-surface-hover);
				}

				& > span:first-child { font-size: 2.5rem; line-height: 1; }
				& > span:last-child { font-size: 1rem; text-transform: lowercase; letter-spacing: 0.02em; }
			}
		}
	}
}

@media (min-width: 768px) {
	browse-view > .browse-main > nav.subtabs { display: none; }
}

/* Photo lightbox */
.photo-lightbox {
	position: fixed;
	inset: 0;
	z-index: 1000;
	background: rgba(0,0,0,0.92);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.photo-lightbox-img {
	max-width: 95vw;
	max-height: 92vh;
	object-fit: contain;
	display: block;
	cursor: default;
}

.photo-lightbox-close {
	position: absolute;
	top: 16px;
	right: 16px;
	background: none;
	border: none;
	color: #fff;
	font-size: 1.5rem;
	cursor: pointer;
	padding: 8px;
	line-height: 1;
	opacity: 0.7;

	&:hover { opacity: 1; }
}

/* Track list */
.track-list {
	display: flex;
	flex-direction: column;
}

.track-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	text-decoration: none;
	color: var(--color-text);
	border-bottom: 1px solid var(--color-surface);
	transition: background var(--transition-fast);

	&:hover, &:focus-visible {
		background: var(--color-surface);
		outline: none;
	}

	& .tile-img {
		width: 48px;
		height: 48px;
		object-fit: cover;
		flex-shrink: 0;
		border-radius: 2px;
	}

	&.track-row--playing {
		border-left: 3px solid var(--color-accent);
		padding-left: 8px;

		& .track-num {
			color: var(--color-accent);
			font-weight: 700;
		}
	}
}

.track-row-link,
a.track-row {
	cursor: pointer;
}
.track-row-link {
	display: contents;
	text-decoration: none;
	color: inherit;
}

.track-num {
	font-size: 0.8rem;
	color: var(--color-text-muted);
	width: 24px;
	text-align: center;
	flex-shrink: 0;
}

.track-cover-placeholder {
	width: 48px;
	height: 48px;
	flex-shrink: 0;
	background: var(--color-surface);
	border-radius: 2px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.2rem;
	color: var(--color-text-muted);
}

.track-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.track-title {
	font-size: 0.9rem;
	font-weight: 600;
}

.track-artist {
	font-size: 0.78rem;
	color: var(--color-text-muted);
}

.track-dur {
	font-size: 0.78rem;
	color: var(--color-text-muted);
	flex-shrink: 0;
	font-variant-numeric: tabular-nums;
}

.track-rating {
	font-size: 0.72rem;
	color: var(--color-accent);
	flex-shrink: 0;
	letter-spacing: 1px;
}

/* Search list items */
.result-title {
	font-size: 0.9rem;
	font-weight: 600;
	display: block;
}

.result-sub {
	font-size: 0.78rem;
	color: var(--color-text-muted);
	display: block;
}

p.empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	padding: 0 16px;
	color: var(--color-text-muted);
	font-size: 0.875rem;
	letter-spacing: 0.06em;
	margin: 0;
}

.browse-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--tile-size), 1fr));
	gap: 16px;
	padding: 16px;

	& .media-tile {
		width: 100%;
		min-width: unset;
	}

	& .tile-img {
		width: 100%;
		height: auto;
		aspect-ratio: 1;
	}
}

/* ─────────────────────────────────────────────
   NOW PLAYING VIEW
───────────────────────────────────────────── */
now-playing-view {
	& > sk-topbar {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 10;
	}

	& > figure {
		grid-column: 1 / -1;
		grid-row: 2;
		overflow: hidden;
		background: #000;
		min-height: 0;
		margin: 0;
	}

	& > #controls {
		grid-column: 1 / -1;
		grid-row: 3;
		background: var(--color-bg);
		padding: 12px 20px 8px;
		display: flex;
		flex-direction: column;
		gap: 12px;
		border-top: 1px solid var(--color-surface);

		& > nav {
			align-items: center;
			justify-content: center;
		}

		& .scrubber {
			display: flex;
			align-items: center;

			& span {
				font-size: 0.75rem;
				color: var(--color-text-muted);
				font-variant-numeric: tabular-nums;
				width: 4rem;
				flex-shrink: 0;
				text-align: left;

				&:last-child { text-align: right; }
			}
		}

		& > div:last-child {
			display: grid;
			grid-template-columns: 1fr auto 1fr;
			align-items: center;
			gap: 16px;

			& > div:first-child {
				display: block flex;
				align-items: center;
				gap: 12px;
				min-width: 0;

				& > img {
					width: 48px;
					height: 48px;
					object-fit: cover;
					border-radius: 4px;
					flex-shrink: 0;
				}

				& > div {
					display: flex;
					flex-direction: column;
					gap: 2px;
					min-width: 0;
				}

				& > span {
					font-size: 0.875rem;
					color: var(--color-accent);
					display: block;
				}
			}

			& > div:last-child.np-end-controls {
				display: flex;
				align-items: center;
				gap: 8px;
				width: auto;
				justify-self: end;
			}
		}
	}

	& strong {
		font-size: 1rem;
		font-weight: 600;
		display: block;
	}

	& small {
		font-size: 0.75rem;
		color: var(--color-text-muted);
		display: block;
	}

	&.fullscreen {
		background: #000;

		& figure {
			cursor: pointer;
			position: absolute;
			inset: 0;
			z-index: 0;
		}

		& > #controls {
			position: absolute;
			bottom: 0;
			left: 0;
			right: 0;
			z-index: 10;
			background: linear-gradient(transparent, rgba(0,0,0,0.85));
			border-top: none;
			padding: 32px 20px 12px;
			transition: opacity 0.5s ease;
			--color-text: #eee;
			--color-text-muted: #aaa;
			--color-bg: transparent;
			--color-accent: var(--color-accent, #4fc3f7);
			--color-surface: rgba(255,255,255,0.12);

			& > nav {
				border-bottom-color: rgba(255,255,255,0.15);

				& a { color: rgba(255,255,255,0.6); }
			}
		}

		&.ui-hidden {
			& sk-topbar,
			& #controls {
				opacity: 0;
				pointer-events: none;
			}
		}
	}	
}
.np-cover-wrap {
	width: 100%;
	height: 100%;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;

	& > img {
		width: auto;
		height: auto;
		max-width: 90%;
		max-height: 90%;
		object-fit: contain;
		display: block;
		position: relative;
		z-index: 1;
		border-radius: 4px;
		box-shadow: 0 8px 32px rgba(0,0,0,0.5);
	}
}

.np-cover-blur {
	position: absolute;
	inset: -20px;
	background-size: cover;
	background-position: center;
	filter: blur(40px) brightness(0.6);
	transform: scale(1.1);
	z-index: 0;
}



.np-video {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
	background: #000;
}

.np-picture-wrap {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;

	& img {
		width: 100%;
		height: 100%;
		object-fit: contain;
		display: block;
	}
}

.np-canvas {
	width: 100%;
	height: 100%;
	display: block;
}

/* Scrubber */






/* Responsive: stack on small screens */
@media (max-width: 640px) {
	
}

/* ─────────────────────────────────────────────
   SEARCH VIEW
───────────────────────────────────────────── */
.search-view {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
}

.search-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border-bottom: 1px solid var(--color-surface);
	flex-shrink: 0;
}

.search-input {
	flex: 1;
	font-size: 1.1rem;
	border: none;
	border-bottom: 2px solid var(--color-accent);
	background: transparent;
	color: var(--color-text);
	padding: 6px 4px;
	outline: none;

	&::placeholder { color: var(--color-text-muted); }
}

.search-clear {
	background: transparent;
	border: none;
	color: var(--color-text-muted);
	font-size: 1rem;
	cursor: pointer;
	padding: 4px;
}

.back-btn {
	background: transparent;
	border: none;
	color: var(--color-text);
	font-size: 1.2rem;
	cursor: pointer;
	padding: 4px;
}

.search-body {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 16px;
	scrollbar-width: thin;

	&::-webkit-scrollbar { width: 4px; }
	&::-webkit-scrollbar-thumb { background: var(--color-surface); }
}

.search-results { display: flex; flex-direction: column; gap: 24px; }

.result-group { display: flex; flex-direction: column; }

.result-row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 4px;
	text-decoration: none;
	color: var(--color-text);
	border-bottom: 1px solid var(--color-surface);
	cursor: pointer;
	transition: background var(--transition-fast);

	&:hover, &:focus-visible {
		background: var(--color-surface);
		outline: none;
	}
}

.result-thumb {
	width: 48px;
	height: 48px;
	object-fit: cover;
	flex-shrink: 0;
	display: block;
	background: var(--color-surface);
}

.result-thumb--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-accent);
	color: var(--color-accent-text);
	font-size: 1.4rem;
}

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

.search-hint, .search-empty, .search-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 160px;
	color: var(--color-text-muted);
	font-size: 0.875rem;
	letter-spacing: 0.06em;
}

.search-recent { display: flex; flex-direction: column; gap: 12px; }

.recent-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.chip {
	background: var(--color-surface);
	border: none;
	color: var(--color-text);
	font-size: 0.8rem;
	padding: 8px 16px;
	cursor: pointer;
	letter-spacing: 0.02em;
	transition: background var(--transition-fast), color var(--transition-fast);

	&:hover {
		background: var(--color-accent);
		color: var(--color-accent-text);
	}
}

/* ── Loading dots (3-dot pulse) ── */
.loading-dots {
	display: flex;
	gap: 8px;
	align-items: center;

	& span {
		width: 8px;
		height: 8px;
		background: var(--color-accent);
		border-radius: 50%;
		animation: dot-pulse 1.2s ease-in-out infinite;

		&:nth-child(2) { animation-delay: 0.2s; }
		&:nth-child(3) { animation-delay: 0.4s; }
	}
}

@keyframes dot-pulse {
	0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
	40% { transform: scale(1); opacity: 1; }
}

/* ─────────────────────────────────────────────
   TV / D-PAD FOCUS STYLES
───────────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
	:focus-visible {
		outline: 3px solid var(--color-accent) !important;
		outline-offset: 3px !important;
	}
}

@media (min-width: 960px) {
	:root {
		--tile-size: 200px;
		--appbar-h: 72px;
	}

	.hero-section { padding: 0 24px; }

	.browse-grid {
		grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	}
}

@media (min-width: 1440px) {
	.login-screen > div { max-width: 520px; }
}

.playlist-popover {
	position: absolute;
	z-index: 100;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 6px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.3);
	padding: 8px 0;
	min-width: 200px;
	max-height: 300px;
	overflow-y: auto;
	margin-top: 4px;
}
.playlist-popover-title {
	padding: 4px 12px;
	font-size: 0.8em;
	opacity: 0.6;
	margin: 0;
}
.playlist-popover-list a {
	display: block;
	padding: 6px 12px;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.playlist-popover-list a:hover {
	background: var(--color-hover);
}

.track-add-btn, .result-add-btn {
	margin-left: auto;
	padding: 2px 8px;
	font-size: 1.1em;
	font-weight: bold;
	line-height: 1;
	border: 1px solid var(--color-border);
	border-radius: 4px;
	background: transparent;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s;
}
.track-row:hover .track-add-btn,
.result-row:hover .result-add-btn {
	opacity: 1;
}
.track-add-btn:hover, .result-add-btn:hover {
	background: var(--color-hover);
}

.np-add-to-pl-btn {
	margin: 4px 0;
	padding: 4px 10px;
	font-size: 1em;
	font-weight: bold;
	border: 1px solid var(--color-border);
	border-radius: 4px;
	background: transparent;
	cursor: pointer;
}

.detail-actions {
	display: flex;
	gap: 4px;
	margin-top: 6px;
	flex-wrap: wrap;
}
.detail-actions button {
	font-size: 0.8em;
	padding: 4px 8px;
}
