/*
 * HBcast — Viewer & Archive Styles
 *
 * Two independent scopes in one file:
 *   1. .hbcast-app  — standalone dark viewer page (single recording)
 *   2. .hbcast-archive / .hbcast-card  — archive page (inside WP theme)
 */

/* ================================================================== */
/* VIEWER: Design tokens                                               */
/* ================================================================== */

:root {
	/* Viewer palette — always dark */
	--v-bg:           #0f0f0f;
	--v-surface:      #141414;
	--v-surface-2:    #1c1c1c;
	--v-border:       #2a2a2a;
	--v-text-1:       #f0f0f0;
	--v-text-2:       #888888;
	--v-text-3:       #444444;
	--v-accent:       #E0FD60;
	--v-accent-hover: #D7F25F;

	/* Spacing (4px grid) */
	--sp-1: 4px;
	--sp-2: 8px;
	--sp-3: 12px;
	--sp-4: 16px;
	--sp-5: 20px;
	--sp-6: 24px;
	--sp-8: 32px;

	/* Radii */
	--r-sm: 4px;
	--r-md: 8px;
	--r-lg: 12px;

	/* Layout */
	--topbar-h:    52px;
	--player-max:  860px;

	/* Archive palette (light/dark via media query below) */
	--hbcast-accent:       #e8b84b;
	--hbcast-accent-hover: #d4a43a;
	--hbcast-border:       #2e2e2e;
	--hbcast-text-primary: #1a1a1a;
	--hbcast-text-secondary: #6a6a6a;
	--hbcast-viewer-bg:    #ffffff;
	--hbcast-btn-bg:       transparent;
	--hbcast-btn-border:   #cccccc;
	--hbcast-btn-color:    #1a1a1a;
}

@media (prefers-color-scheme: dark) {
	:root {
		--hbcast-text-primary:   #f0f0f0;
		--hbcast-text-secondary: #8a8a8a;
		--hbcast-viewer-bg:      #1a1a1a;
		--hbcast-btn-border:     #3e3e3e;
		--hbcast-btn-color:      #f0f0f0;
	}
}

/* ================================================================== */
/* VIEWER: Reset / base                                                */
/* ================================================================== */

.hbcast-app *,
.hbcast-app *::before,
.hbcast-app *::after {
	box-sizing: border-box;
}

.hbcast-app {
	margin: 0;
	padding: 0;
	background: var(--v-bg);
	color: var(--v-text-1);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
}

/* Material Symbols: outline, 300 weight, 20px optical size */
.hbcast-app .material-symbols-outlined {
	font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
	font-size: 18px;
	line-height: 1;
	vertical-align: middle;
	user-select: none;
}

/* ================================================================== */
/* VIEWER: Topbar                                                      */
/* ================================================================== */

.hb-topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	height: var(--topbar-h);
	display: flex;
	align-items: center;
	gap: var(--sp-3);
	padding: 0 var(--sp-5);
	background: var(--v-surface);
	border-bottom: 1px solid var(--v-border);
}

/* Brand mark */
.hb-brand {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	text-decoration: none;
	flex-shrink: 0;
}

.hb-brand__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	background: var(--v-accent);
	border-radius: var(--r-sm);
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.02em;
	color: #000;
	line-height: 1;
	flex-shrink: 0;
}

.hb-brand__name {
	font-size: 13px;
	font-weight: 700;
	color: var(--v-text-1);
	letter-spacing: 0.02em;
}

/* Separator */
.hb-topbar__sep {
	width: 1px;
	height: 20px;
	background: var(--v-border);
	flex-shrink: 0;
}

/* Recording title in topbar */
.hb-topbar__title {
	flex: 1;
	font-size: 13px;
	font-weight: 500;
	color: var(--v-text-2);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
	/* Reset WP/theme heading styles */
	margin: 0;
	padding: 0;
	line-height: var(--topbar-h);
	display: flex;
	align-items: center;
	gap: 6px;
}

.hb-topbar__breadcrumb {
	color: var(--v-text-3);
	text-decoration: none;
	flex-shrink: 0;
}

.hb-topbar__breadcrumb:hover {
	color: var(--v-text-1);
}

.hb-topbar__breadcrumb-sep {
	color: var(--v-text-3);
	flex-shrink: 0;
}

/* Actions cluster */
.hb-topbar__actions {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	flex-shrink: 0;
}

/* ================================================================== */
/* VIEWER: Buttons                                                     */
/* ================================================================== */

.hb-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-1);
	padding: 7px 13px;
	font-size: 12px;
	font-family: inherit;
	font-weight: 600;
	border-radius: var(--r-md);
	cursor: pointer;
	text-decoration: none;
	border: 1px solid transparent;
	transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
	white-space: nowrap;
	line-height: 1;
}

.hb-btn .material-symbols-outlined {
	font-size: 15px;
}

.hb-btn--ghost {
	background: transparent;
	color: var(--v-text-2);
	border-color: var(--v-border);
}

.hb-btn--ghost:hover {
	border-color: var(--v-text-3);
	color: var(--v-text-1);
}

.hb-btn--ghost:focus-visible {
	outline: 2px solid var(--v-accent);
	outline-offset: 2px;
}

.hb-btn--accent {
	background: var(--v-accent);
	color: #000;
	border-color: var(--v-accent);
}

.hb-btn--accent:hover {
	background: var(--v-accent-hover);
	border-color: var(--v-accent-hover);
}

.hb-btn--accent:focus-visible {
	outline: 2px solid var(--v-accent);
	outline-offset: 3px;
}

/* ================================================================== */
/* VIEWER: Main content area                                           */
/* ================================================================== */

.hb-main {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: var(--sp-8) var(--sp-4) 80px;
}

/* ================================================================== */
/* VIEWER: Video player                                                */
/* ================================================================== */

.hb-player-wrap {
	width: 100%;
	max-width: var(--player-max);
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: var(--r-lg);
	overflow: hidden;
}

.hb-video {
	width: 100%;
	height: 100%;
	display: block;
}

/* No-video placeholder */
.hb-no-video {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--sp-3);
	height: 100%;
	color: var(--v-text-3);
	font-size: 13px;
}

.hb-no-video__icon {
	font-size: 40px !important;
}

/* ================================================================== */
/* VIEWER: Info row (author + metadata)                                */
/* ================================================================== */

.hb-info {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--sp-4);
	width: 100%;
	max-width: var(--player-max);
	margin-top: var(--sp-5);
}

.hb-info__left {
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	min-width: 0;
}

.hb-info__right {
	flex-shrink: 0;
	padding-top: 3px;
}

/* Author row */
.hb-author {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
}

.hb-author__avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--v-accent);
	color: #000;
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.02em;
	flex-shrink: 0;
	line-height: 1;
}

.hb-author__name {
	font-size: 13px;
	font-weight: 600;
	color: var(--v-text-1);
}

/* Meta row */
.hb-meta {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	flex-wrap: wrap;
}

.hb-meta__item {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	font-size: 12px;
	color: var(--v-text-2);
}

.hb-meta__icon {
	font-size: 14px !important;
	opacity: 0.6;
}

.hb-meta__dot {
	color: var(--v-text-3);
	font-size: 12px;
	line-height: 1;
}

/* File size badge */
.hb-badge {
	display: inline-flex;
	align-items: center;
	padding: 3px 8px;
	background: var(--v-surface-2);
	border: 1px solid var(--v-border);
	border-radius: var(--r-sm);
	font-size: 11px;
	color: var(--v-text-2);
	font-family: ui-monospace, 'SF Mono', 'Fira Code', monospace;
	letter-spacing: 0.03em;
}

/* ================================================================== */
/* VIEWER: Access denied / password                                    */
/* ================================================================== */

/* Lean topbar variant — brand only, no actions */
.hb-topbar--lean {
	justify-content: flex-start;
}

.hb-denied {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--sp-4);
	min-height: calc(100vh - var(--topbar-h));
	padding: var(--sp-8) var(--sp-5);
	text-align: center;
}

/* Icon ring */
.hb-denied__glyph {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	border: 1px solid var(--v-border);
	background: var(--v-surface);
	margin-bottom: var(--sp-2);
	flex-shrink: 0;
}

.hb-denied__glyph .material-symbols-outlined {
	font-size: 36px !important;
	color: var(--v-text-3);
	font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 40;
}

.hb-denied__heading {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	color: var(--v-text-1);
	letter-spacing: -0.01em;
	line-height: 1.2;
}

.hb-denied__msg {
	margin: 0;
	font-size: 14px;
	color: var(--v-text-2);
	max-width: 320px;
	line-height: 1.6;
}

.hb-denied__hint {
	margin: 0;
	font-size: 12px;
	color: var(--v-text-3);
	max-width: 300px;
	line-height: 1.6;
}

/* Legacy: icon-only variant (password form) */
.hb-denied__icon {
	font-size: 48px !important;
	color: var(--v-text-3);
}

/* ================================================================== */
/* VIEWER: Toast notification                                          */
/* ================================================================== */

.hb-toast {
	position: fixed;
	bottom: 28px;
	left: 50%;
	transform: translateX(-50%) translateY(6px);
	background: var(--v-text-1);
	color: var(--v-bg);
	padding: 10px 18px;
	border-radius: var(--r-md);
	font-size: 13px;
	font-weight: 600;
	opacity: 0;
	pointer-events: none;
	transition: opacity 180ms ease, transform 180ms ease;
	white-space: nowrap;
	z-index: 1000;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.hb-toast--visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ================================================================== */
/* VIEWER: Responsive                                                  */
/* ================================================================== */

@media (max-width: 600px) {
	.hb-topbar {
		padding: 0 var(--sp-3);
		gap: var(--sp-2);
	}

	/* Hide brand name + separator on very small screens */
	.hb-brand__name,
	.hb-topbar__sep {
		display: none;
	}

	/* Icon-only buttons */
	.hb-btn__label {
		display: none;
	}

	.hb-btn {
		padding: 7px 10px;
	}

	.hb-main {
		padding: var(--sp-5) var(--sp-3) 56px;
	}

	.hb-player-wrap {
		border-radius: var(--r-md);
	}

	.hb-info {
		flex-direction: column;
		gap: var(--sp-3);
	}
}

/* ================================================================== */
/* VIEWER: Reduced motion                                              */
/* ================================================================== */

@media (prefers-reduced-motion: reduce) {
	.hbcast-app *,
	.hb-toast {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}

/* ================================================================== */
/* ARCHIVE: main layout wrapper                                        */
/* ================================================================== */

.hb-archive-main {
	max-width: 1180px;
	margin: 0 auto;
	width: 100%;
	padding: var(--sp-8) var(--sp-5) 80px;
}

/* ================================================================== */
/* ARCHIVE: card grid                                                  */
/* ================================================================== */

.hbcast-archive__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}

@media (max-width: 960px) {
	.hbcast-archive__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 560px) {
	.hbcast-archive__grid {
		grid-template-columns: 1fr;
	}
}

/* ================================================================== */
/* ARCHIVE: card                                                       */
/* ================================================================== */

.hbcast-card {
	border-radius: var(--r-lg);
	/* overflow: hidden lives on __thumb only so tooltips can escape the card */
	border: 1px solid var(--v-border);
	background: var(--v-surface);
	transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.hbcast-card:hover {
	border-color: var(--v-accent);
	transform: translateY(-2px);
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.hbcast-card__thumb-link {
	display: block;
	text-decoration: none;
}

.hbcast-card__thumb {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	border-radius: var(--r-lg) var(--r-lg) 0 0;
}

/* Video preview frame */
.hbcast-card__preview {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Hover overlay */
.hbcast-card__thumb::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 150ms ease;
	pointer-events: none;
}

.hbcast-card:hover .hbcast-card__thumb::after {
	opacity: 1;
}

/* Play icon — Material Symbol */
.hbcast-card__play-icon {
	position: relative;
	z-index: 1;
	font-size: 48px !important;
	color: rgba(255, 255, 255, 0.25);
	transition: color 150ms ease, transform 150ms ease;
	font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 48;
}

.hbcast-card:hover .hbcast-card__play-icon {
	color: #fff;
	transform: scale(1.08);
}

/* Duration badge — bottom right */
.hbcast-card__duration {
	position: absolute;
	bottom: var(--sp-2);
	right: var(--sp-2);
	font-size: 11px;
	font-weight: 600;
	color: #fff;
	background: rgba(0, 0, 0, 0.7);
	padding: 2px 7px;
	border-radius: var(--r-sm);
	letter-spacing: 0.03em;
	font-family: ui-monospace, 'SF Mono', monospace;
}

/* Private badge — top left */
.hbcast-card__badge {
	position: absolute;
	top: var(--sp-2);
	left: var(--sp-2);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	background: rgba(0, 0, 0, 0.6);
	border-radius: var(--r-sm);
}

.hbcast-card__badge .material-symbols-outlined {
	font-size: 14px !important;
	color: var(--v-text-2);
}

/* Card body */
.hbcast-card__body {
	padding: var(--sp-3) var(--sp-4) var(--sp-4);
}

.hbcast-card__title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	margin: 0 0 var(--sp-2);
}

.hbcast-card__title a {
	color: var(--v-text-1);
	text-decoration: none;
	transition: color 120ms ease;
}

.hbcast-card__title a:hover {
	color: var(--v-accent);
}

/* Meta row: avatar + author + date + views */
.hbcast-card__meta {
	display: flex;
	align-items: center;
	gap: var(--sp-1);
	flex-wrap: wrap;
	font-size: 12px;
	color: var(--v-text-2);
}

.hbcast-card__avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--v-accent);
	color: #000;
	font-size: 9px;
	font-weight: 800;
	letter-spacing: 0.02em;
	flex-shrink: 0;
	line-height: 1;
	margin-right: 2px;
}

.hbcast-card__author {
	font-weight: 500;
	color: var(--v-text-1);
}

.hbcast-card__meta-sep {
	color: var(--v-text-3);
}

.hbcast-card__views {
	display: inline-flex;
	align-items: center;
	gap: 2px;
}

.hbcast-card__meta-icon {
	font-size: 13px !important;
	opacity: 0.6;
}

/* ================================================================== */
/* ARCHIVE: empty state                                                */
/* ================================================================== */

.hbcast-archive__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--sp-4);
	padding: 80px var(--sp-8);
	text-align: center;
	color: var(--v-text-3);
	font-size: 14px;
}

.hbcast-archive__empty-icon {
	font-size: 48px !important;
}

/* ================================================================== */
/* ARCHIVE: pagination                                                 */
/* ================================================================== */

.hbcast-archive__pagination {
	margin-top: var(--sp-8);
}

.hbcast-archive__pagination .nav-links {
	display: flex;
	gap: var(--sp-2);
	flex-wrap: wrap;
	align-items: center;
}

.hbcast-archive__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 10px;
	border-radius: var(--r-md);
	border: 1px solid var(--v-border);
	color: var(--v-text-2);
	text-decoration: none;
	font-size: 13px;
	transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
	background: transparent;
}

.hbcast-archive__pagination .page-numbers:hover {
	border-color: var(--v-text-3);
	color: var(--v-text-1);
}

.hbcast-archive__pagination .page-numbers.current {
	border-color: var(--v-accent);
	color: var(--v-accent);
	background: rgba(232, 184, 75, 0.08);
}

.hbcast-archive__pagination .page-numbers .material-symbols-outlined {
	font-size: 16px !important;
}

/* ================================================================== */
/* ARCHIVE: admin card actions (injected by archive.js)               */
/* ================================================================== */

.hbcast-card__actions {
	display: flex;
	gap: var(--sp-1);
	margin-top: var(--sp-3);
}

/* Icon button base */
.hbcast-card__action {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border-radius: var(--r-md);
	border: 1px solid transparent;
	background: transparent;
	color: var(--v-text-3);
	cursor: pointer;
	transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
	flex-shrink: 0;
}

.hbcast-card__action .material-symbols-outlined {
	font-size: 16px !important;
	pointer-events: none;
}

/* Tooltip via CSS */
.hbcast-card__action[data-tooltip]::before {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 7px);
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	background: var(--v-surface-2);
	color: var(--v-text-1);
	border: 1px solid var(--v-border);
	font-size: 11px;
	font-weight: 500;
	white-space: nowrap;
	padding: 4px 9px;
	border-radius: var(--r-sm);
	pointer-events: none;
	opacity: 0;
	transition: opacity 150ms ease, transform 150ms ease;
	z-index: 20;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.hbcast-card__action[data-tooltip]:hover::before,
.hbcast-card__action[data-tooltip]:focus-visible::before {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* Rename button */
.hbcast-card__action--rename:hover:not(:disabled),
.hbcast-card__action--rename:focus-visible {
	color: var(--v-accent);
	background: rgba(232, 184, 75, 0.08);
	border-color: rgba(232, 184, 75, 0.3);
}

/* Delete button */
.hbcast-card__action--delete:hover:not(:disabled),
.hbcast-card__action--delete:focus-visible {
	color: #e84b4b;
	background: rgba(232, 75, 75, 0.08);
	border-color: rgba(232, 75, 75, 0.3);
}

/* Save button (confirm rename) */
.hbcast-card__action--save:hover:not(:disabled),
.hbcast-card__action--save:focus-visible {
	color: #4be87a;
	background: rgba(75, 232, 122, 0.08);
	border-color: rgba(75, 232, 122, 0.3);
}

/* Cancel button */
.hbcast-card__action--cancel:hover:not(:disabled),
.hbcast-card__action--cancel:focus-visible {
	color: var(--v-text-1);
	background: var(--v-surface-2);
	border-color: var(--v-border);
}

.hbcast-card__action:disabled {
	opacity: 0.3;
	cursor: not-allowed;
}

/* Rename input row */
.hbcast-card__rename-row {
	display: flex;
	align-items: center;
	gap: var(--sp-1);
}

.hbcast-card__rename-input {
	flex: 1;
	min-width: 0;
	padding: 5px 8px;
	font-size: 13px;
	font-family: inherit;
	font-weight: 600;
	border: 1px solid var(--v-accent);
	border-radius: var(--r-sm);
	background: var(--v-surface-2);
	color: var(--v-text-1);
	box-sizing: border-box;
}

.hbcast-card__rename-input:focus {
	outline: 2px solid var(--v-accent);
	outline-offset: 1px;
}

/* ================================================================== */
/* ARCHIVE: responsive                                                 */
/* ================================================================== */

@media (max-width: 600px) {
	.hb-archive-main {
		padding: var(--sp-5) var(--sp-3) 56px;
	}
}
