/* ----------------------------------------------------------------------
   dogbar visual system — a dark, streaming-app layout: fixed top bar,
   left category rail, poster grid. All colours, radii and shadows live
   as --bb-* tokens on :root.

   - accent is dogbar blue (#2f7dff): brand mark plus every interactive
     / selected cue. Everything else is greyscale for depth.
   - cards are 2:3 portrait — MacCMS vod_pic art is portrait poster art.
   - body text in Plus Jakarta Sans, brand/headings in Sora, both
     self-hosted (see fonts.css); CJK falls back to the system font.
   ---------------------------------------------------------------------- */

:root {
	--bb-bg: #0f0f0f;          /* neutral near-black -- page, chrome */
	--bb-surface-0: #121212;   /* barely-there fill, e.g. the search bar */
	--bb-surface: #181818;     /* raised panels: cards, info card */
	--bb-surface-2: #272727;   /* hover / active-pill fill */
	--bb-border: #3d3d3d;
	--bb-text: #f1f1f1;
	--bb-muted: #aaaaaa;       /* secondary metadata only */
	--bb-brand: #2f7dff;       /* dogbar blue -- brand + every interactive accent */
	--bb-brand-600: #1f6ae8;   /* pressed / darker */
	--bb-brand-soft: rgba(47, 125, 255, .15);
	--bb-gold: #ffc24b;        /* quality badges */

	--bb-radius: 14px;
	--bb-radius-sm: 9px;
	--bb-shadow: 0 6px 22px rgba(0, 0, 0, .45);
	--bb-shadow-hover: 0 12px 30px rgba(0, 0, 0, .55), 0 0 0 1px var(--bb-brand);

	--topbar-height: 64px;
	--sidebar-width: 240px;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bb-bg);
	color: var(--bb-text);
	font-family: "Plus Jakarta Sans", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
	-webkit-font-smoothing: antialiased;
	letter-spacing: .1px;
}

h1, h2, h3, h4, h5, h6, .brand {
	font-family: "Sora", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
	letter-spacing: -.01em;
}

a { color: inherit; text-decoration: none; }

.icon {
	width: 24px;
	height: 24px;
	fill: currentColor;
	flex-shrink: 0;
}

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }

.topbar {
	position: fixed;
	top: 0; left: 0; right: 0;
	height: var(--topbar-height);
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 16px;
	/* Same fill as the sidebar/content, with a hairline -- the bar reads
	   as part of the page, not a panel floating over it. */
	background: var(--bb-bg);
	border-bottom: 1px solid var(--bb-border);
	z-index: 20;
}

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: none;
	background: transparent;
	color: var(--bb-text);
	cursor: pointer;
}

.icon-btn:hover { background: var(--bb-surface-2); }

.brand {
	display: flex;
	align-items: center;
	gap: .12em;
	margin-right: 8px;
	font-size: 1.35rem;
	font-weight: 800;
	letter-spacing: -.02em;
	white-space: nowrap;
}

.brand .brand-accent { color: var(--bb-brand); }

.searchbar {
	flex: 1;
	max-width: 640px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 16px;
	border: 1px solid var(--bb-border);
	border-radius: 999px;
	background: var(--bb-surface-0);
}

.searchbar:focus-within { border-color: var(--bb-brand); }

.searchbar input {
	flex: 1;
	border: none;
	outline: none;
	background: transparent;
	color: var(--bb-text);
	font-size: .95rem;
	font-family: inherit;
}

.searchbar .icon {
	color: var(--bb-muted);
	width: 18px;
	height: 18px;
}

/* ---------- Sidebar ----------
   Text/icon stay white at every state -- unselected items are as white as
   the selected one; only the pill fill changes. Grey is for metadata, not
   nav. */
.sidebar {
	position: fixed;
	top: var(--topbar-height);
	left: 0;
	bottom: 0;
	width: var(--sidebar-width);
	overflow-y: auto;
	background: var(--bb-bg);
	padding: 12px 8px;
	z-index: 15;
	transition: transform .2s ease;
}

.nav-item {
	display: flex;
	align-items: center;
	gap: 24px;
	height: 40px;
	padding: 0 16px;
	border-radius: 10px;
	color: var(--bb-text);
	font-size: .875rem;
	font-weight: 500;
	white-space: nowrap;
	transition: background .15s ease;
}

.nav-item:hover { background: var(--bb-surface-2); }

/* Plain neutral fill, not a brand wash -- a translucent tint on near-black
   reads muddy, a flat #272727 reads cleanly as "this one". */
.nav-item.active {
	background: var(--bb-surface-2);
	font-weight: 600;
}

.nav-item .icon { width: 24px; height: 24px; }

.nav-divider {
	height: 1px;
	background: var(--bb-border);
	margin: 10px 12px;
}

/* ---------- Content ---------- */
.content {
	margin-top: var(--topbar-height);
	margin-left: var(--sidebar-width);
	padding: 20px 24px 48px;
}

body.sidebar-collapsed .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
body.sidebar-collapsed .content { margin-left: 0; }

@media (max-width: 900px) {
	.sidebar { transform: translateX(-100%); box-shadow: var(--bb-shadow); }
	.nav-item { height: 48px; gap: 20px; }
	.content { margin-left: 0; }
	body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
	body.sidebar-open .sidebar { transform: translateX(0); }
}

/* Narrow phones: the menu button + wordmark + search don't fit on one
   line, so wrap search to its own full-width row and grow the bar to
   match. */
@media (max-width: 560px) {
	.topbar {
		height: 112px;
		flex-wrap: wrap;
		align-content: flex-start;
		padding-top: 10px;
	}
	.searchbar { order: 10; flex-basis: 100%; max-width: none; margin: 0; }
	.content { margin-top: 112px; }
	.sidebar { top: 112px; }
}

/* ---------- Filter bar (dogbar-only surface, kept) ----------
   A <details> element -- collapse/expand for free, no JS. bar/views.py
   decides the initial open/closed state (open when a filter's already
   active), <details> just renders whichever the server sent; toggling
   afterward is native browser behaviour. */
.filter-bar {
	margin-bottom: 20px;
}

.filter-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	border-radius: 999px;
	background: var(--bb-surface);
	border: 1px solid var(--bb-border);
	color: var(--bb-text);
	font-size: .8125rem;
	font-weight: 600;
	cursor: pointer;
	user-select: none;
	list-style: none;
}

.filter-toggle::-webkit-details-marker { display: none; }
.filter-toggle:hover { background: var(--bb-surface-2); }
.filter-toggle .icon { width: 18px; height: 18px; color: var(--bb-muted); }

.filter-toggle-caret { transition: transform .15s ease; }
details[open] > .filter-toggle .filter-toggle-caret { transform: rotate(90deg); }

.filter-bar-body {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 12px;
}

.pill-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 4px;
}

.pill {
	border: none;
	background: transparent;
	color: var(--bb-muted);
	font-family: inherit;
	font-size: .8125rem;
	line-height: 1.4;
	padding: 6px 12px;
	border-radius: 999px;
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s ease, color .15s ease;
}

.pill:hover { color: var(--bb-text); background: var(--bb-surface-2); }

.pill.active {
	background: var(--bb-surface-2);
	color: var(--bb-text);
	font-weight: 600;
}

/* ---------- Video grid / cards ---------- */
.video-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: clamp(.9rem, .6rem + .8vw, 1.4rem) 16px;
}

@media (min-width: 700px) {
	.video-grid { grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); }
}

.video-card { display: block; min-width: 0; }

.video-card .thumb {
	position: relative;
	aspect-ratio: 2 / 3;
	border-radius: var(--bb-radius);
	overflow: hidden;
	background: var(--bb-surface-2);
	box-shadow: var(--bb-shadow);
	transition: transform .18s ease, box-shadow .18s ease;
}

.video-card img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .35s ease, filter .25s ease;
}

.video-card:hover .thumb {
	transform: translateY(-4px);
	box-shadow: var(--bb-shadow-hover);
}

.video-card:hover img { transform: scale(1.05); }

.chip {
	position: absolute;
	font-size: .68rem;
	font-weight: 600;
	padding: 3px 7px;
	border-radius: 6px;
	background: rgba(0, 0, 0, .78);
	color: #fff;
	backdrop-filter: blur(2px);
}

.chip-remarks { bottom: 8px; right: 8px; }

.video-card .meta { padding: 10px 2px 0; }

.video-card .title {
	margin: 0;
	font-size: .85rem;
	font-weight: 500;
	line-height: 1.3;
	overflow-wrap: anywhere;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color .15s ease;
}

.video-card:hover .title { color: var(--bb-brand); }

.video-card .sub {
	margin: 4px 0 0;
	font-size: .75rem;
	color: var(--bb-muted);
}

.empty-state {
	color: var(--bb-muted);
	padding: 48px 0;
	text-align: center;
}

/* ---------- Pagination ---------- */
.pager {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin-top: 32px;
}

.page-btn {
	min-width: 38px;
	height: 38px;
	padding: 0 12px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--bb-radius-sm);
	border: 1px solid var(--bb-border);
	background: var(--bb-surface);
	color: var(--bb-muted);
	font-size: .875rem;
}

.page-btn:hover { color: var(--bb-text); background: var(--bb-surface-2); }

.page-btn.active {
	background: var(--bb-brand-soft);
	border-color: transparent;
	color: #fff;
	font-weight: 600;
}

/* ---------- Watch page ---------- */
.watch-title {
	font-family: "Sora", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
	font-size: 1.4rem;
	font-weight: 700;
	line-height: 1.2;
	margin: 20px 0 8px;
}

.watch-title small { color: var(--bb-muted); font-weight: 400; }

.player-wrap {
	border-radius: var(--bb-radius);
	overflow: hidden;
	background: #000;
	box-shadow: var(--bb-shadow);
}

.player {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: contain;
	background: #000;
}

.player-status {
	margin: 0;
	padding: 8px 16px;
	font-size: .8125rem;
	color: #fff;
	background: var(--bb-brand);
}

.section-label {
	font-size: .8125rem;
	font-weight: 600;
	color: var(--bb-muted);
	margin: 24px 0 10px;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.chip-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.ep-chip {
	padding: 8px 16px;
	border-radius: 999px;
	border: 1px solid var(--bb-border);
	color: var(--bb-text);
	font-size: .8125rem;
	font-family: inherit;
	cursor: pointer;
	background: transparent;
	transition: background .15s ease, border-color .15s ease;
}

.ep-chip:hover { background: var(--bb-surface-2); }

.ep-chip.active {
	background: var(--bb-brand-soft);
	color: #fff;
	border-color: transparent;
	font-weight: 600;
}

.info-card {
	margin-top: 24px;
	padding: 16px;
	border-radius: var(--bb-radius);
	background: var(--bb-surface);
	border: 1px solid var(--bb-border);
}

.info-card p { margin: 0 0 8px; font-size: .875rem; color: var(--bb-muted); line-height: 1.6; }
.info-card p:last-child { margin-bottom: 0; }
.info-card .desc { color: var(--bb-text); white-space: pre-line; }

/* ---------- Footer ---------- */
.site-footer {
	margin-top: 48px;
	padding-top: 16px;
	border-top: 1px solid var(--bb-border);
	color: var(--bb-muted);
	font-size: .75rem;
	line-height: 1.6;
	text-align: center;
}
