/* HouTV app layout — header, sidebar, video grid, cards, buttons, forms. */

/* ============ Buttons ============ */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: none;
	border-radius: 999px;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	background: var(--bg-chip);
	color: var(--text);
	transition: background 0.15s, transform 0.05s, opacity 0.15s;
	white-space: nowrap;
	font-family: inherit;
}
.btn:hover {
	background: var(--bg-hover);
}
.btn:active {
	transform: scale(0.97);
}
.btn-primary {
	background: var(--primary);
	color: var(--primary-contrast);
}
.btn-primary:hover {
	background: var(--primary-dark);
}
.btn-outline {
	background: transparent;
	border: 1px solid var(--border);
	color: var(--primary);
}
.btn-outline:hover {
	background: var(--primary-soft);
}
.btn-ghost {
	background: transparent;
}
.btn-ghost:hover {
	background: var(--bg-hover);
}
.btn-block {
	width: 100%;
}
.btn-lg {
	padding: 12px 24px;
	font-size: 15px;
}
.btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}
.icon-btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	color: var(--text);
	cursor: pointer;
}
.icon-btn:hover {
	background: var(--bg-hover);
}
.icon-btn svg {
	width: 22px;
	height: 22px;
}

/* ============ Header ============ */
.header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: var(--header-h);
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 16px;
	background: var(--bg);
	z-index: 100;
}
.header-left {
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 170px;
}
.brand {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 20px;
	font-weight: 800;
	letter-spacing: -0.5px;
}
.brand .logo-mark {
	width: 30px;
	height: 22px;
	background: var(--primary);
	border-radius: 7px;
	position: relative;
	flex-shrink: 0;
}
.brand .logo-mark::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 52%;
	transform: translate(-50%, -50%);
	border-left: 9px solid #fff;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
}
.brand .logo-text b {
	color: var(--primary);
}

.header-center {
	flex: 1;
	display: flex;
	justify-content: center;
	max-width: 720px;
	margin: 0 auto;
}
.search {
	display: flex;
	width: 100%;
	max-width: 600px;
}
.search input {
	flex: 1;
	height: 40px;
	border: 1px solid var(--border);
	border-right: none;
	border-radius: 999px 0 0 999px;
	padding: 0 16px;
	font-size: 15px;
	background: var(--bg-secondary);
	color: var(--text);
	outline: none;
	font-family: inherit;
}
.search input:focus {
	border-color: var(--primary);
}
.search button {
	width: 64px;
	border: 1px solid var(--border);
	border-radius: 0 999px 999px 0;
	background: var(--bg-secondary);
	cursor: pointer;
	color: var(--text-secondary);
	display: flex;
	align-items: center;
	justify-content: center;
}
.search button:hover {
	background: var(--bg-hover);
}
.search svg {
	width: 20px;
	height: 20px;
}

.header-right {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 170px;
	justify-content: flex-end;
}
.avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--primary);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 15px;
	cursor: pointer;
	object-fit: cover;
}

/* dropdown menu */
.menu {
	position: absolute;
	top: 52px;
	right: 16px;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: 12px;
	box-shadow: var(--shadow);
	min-width: 240px;
	padding: 8px;
	z-index: 200;
	display: none;
}
.menu.open {
	display: block;
}
.menu a,
.menu button {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 10px 12px;
	border-radius: 8px;
	background: none;
	border: none;
	color: var(--text);
	font-size: 14px;
	cursor: pointer;
	font-family: inherit;
	text-align: left;
}
.menu a:hover,
.menu button:hover {
	background: var(--bg-hover);
}
.menu svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}
.menu-divider {
	height: 1px;
	background: var(--border);
	margin: 6px 0;
}

/* ============ Sidebar ============ */
.sidebar {
	position: fixed;
	top: var(--header-h);
	left: 0;
	width: var(--sidebar-w);
	height: calc(100vh - var(--header-h));
	overflow-y: auto;
	padding: 12px;
	background: var(--bg);
	z-index: 90;
}
.nav-item {
	display: flex;
	align-items: center;
	gap: 24px;
	padding: 10px 12px;
	border-radius: 10px;
	font-size: 14px;
	color: var(--text);
	cursor: pointer;
}
.nav-item:hover {
	background: var(--bg-hover);
}
.nav-item.active {
	background: var(--bg-hover);
	font-weight: 600;
}
.nav-item svg {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}
.nav-section-title {
	padding: 12px 12px 6px;
	font-size: 13px;
	color: var(--text-muted);
	font-weight: 600;
}
.sidebar hr {
	border: none;
	border-top: 1px solid var(--border);
	margin: 12px 4px;
}

/* ============ Main ============ */
.main {
	margin-left: var(--sidebar-w);
	margin-top: var(--header-h);
	padding: 24px;
	min-height: calc(100vh - var(--header-h));
}
body.no-sidebar .main {
	margin-left: 0;
}

/* category chips */
.chips {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	padding-bottom: 16px;
	scrollbar-width: none;
}
.chips::-webkit-scrollbar {
	display: none;
}
.chip {
	background: var(--bg-chip);
	border: none;
	border-radius: 8px;
	padding: 8px 12px;
	font-size: 14px;
	white-space: nowrap;
	cursor: pointer;
	color: var(--text);
	font-family: inherit;
}
.chip.active {
	background: var(--bg-chip-active);
	color: var(--bg-chip-active-text);
}

/* ============ Video grid ============ */
.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 16px 16px;
}
.card {
	cursor: pointer;
	display: flex;
	flex-direction: column;
}
.thumb {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--bg-secondary);
}
.thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.thumb .duration {
	position: absolute;
	bottom: 8px;
	right: 8px;
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	padding: 2px 5px;
	border-radius: 4px;
}
.badge-members {
	position: absolute;
	top: 8px;
	left: 8px;
	background: var(--primary);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 999px;
	display: flex;
	align-items: center;
	gap: 4px;
}
.card-body {
	display: flex;
	gap: 12px;
	margin-top: 12px;
}
.card-info {
	min-width: 0;
	flex: 1;
}
.card-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--primary);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	flex-shrink: 0;
	font-size: 14px;
}
.card-title {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--text);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.card-meta {
	font-size: 13px;
	color: var(--text-secondary);
	margin-top: 4px;
}
.card-meta a:hover {
	color: var(--text);
}

/* ============ Empty / states ============ */
.empty-state {
	text-align: center;
	padding: 80px 20px;
	color: var(--text-secondary);
}
.empty-state svg {
	width: 64px;
	height: 64px;
	color: var(--text-muted);
	margin-bottom: 16px;
}
.empty-state h2 {
	color: var(--text);
	font-size: 20px;
	margin-bottom: 8px;
}
.skeleton {
	background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
	background-size: 200% 100%;
	animation: shimmer 1.4s infinite;
	border-radius: var(--radius);
}
@keyframes shimmer {
	to {
		background-position: -200% 0;
	}
}

/* ============ Toast ============ */
.toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	background: var(--text);
	color: var(--bg);
	padding: 12px 20px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 500;
	opacity: 0;
	pointer-events: none;
	transition: all 0.25s;
	z-index: 500;
}
.toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ============ Auth pages ============ */
.auth-wrap {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: var(--bg-secondary);
}
.auth-card {
	width: 100%;
	max-width: 400px;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 36px 32px;
	box-shadow: var(--shadow);
}
.auth-card .brand {
	justify-content: center;
	margin-bottom: 8px;
	font-size: 26px;
}
.auth-card h1 {
	text-align: center;
	font-size: 22px;
	margin-bottom: 24px;
}
.field {
	margin-bottom: 16px;
}
.field label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-secondary);
	margin-bottom: 6px;
}
.field input,
.field textarea,
.field select {
	width: 100%;
	padding: 11px 14px;
	border: 1px solid var(--border);
	border-radius: 10px;
	font-size: 15px;
	background: var(--bg);
	color: var(--text);
	outline: none;
	font-family: inherit;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-soft);
}
.auth-alt {
	text-align: center;
	margin-top: 18px;
	font-size: 14px;
	color: var(--text-secondary);
}
.auth-alt a {
	color: var(--primary);
	font-weight: 600;
}
.form-error {
	background: #fde8e8;
	color: #b91c1c;
	border-radius: 8px;
	padding: 10px 12px;
	font-size: 13px;
	margin-bottom: 16px;
	display: none;
}
.form-error.show {
	display: block;
}

/* ============ Responsive ============ */
@media (max-width: 1000px) {
	.sidebar {
		transform: translateX(-100%);
		transition: transform 0.2s;
		box-shadow: var(--shadow);
	}
	body.sidebar-open .sidebar {
		transform: translateX(0);
	}
	.main {
		margin-left: 0;
	}
}
@media (max-width: 640px) {
	.header-center {
		display: none;
	}
	.brand .logo-text {
		display: none;
	}
}
