/*
Theme Name: Chill Time
Author: Chill Time
Description: Chill Time — a private, members-only travel video website in a YouTube-style dark layout. Every travel video in the Media Library (already uploaded and every new upload) is shown automatically to all approved subscribers, newest first. Includes left sidebar, category chips, video grid with views and badges, watch page with "Up next", a "Request access" form (Gmail, User ID, Password) and an admin Approve / Reject screen. Settings: Appearance → Chill Time Settings. Categories: Media → Video Categories.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: chill-time
*/

:root {
	--bg: #0f0f0f;
	--surface: #181818;
	--surface-2: #272727;
	--hover: #3a3a3a;
	--line: #303030;
	--text: #f1f1f1;
	--muted: #aaaaaa;
	--accent: #f2b544;
	--accent-ink: #1a1406;
	--danger: #ff4e45;
	--radius: 12px;
	--top: 56px;
	--sb: 240px;
	--gutter: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 14px/1.45 Roboto, system-ui, -apple-system, "Segoe UI", "Noto Sans", Arial, sans-serif;
	min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex: none; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	height: 36px; padding: 0 16px; border-radius: 18px; border: 1px solid transparent;
	background: var(--surface-2); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn-ghost { background: var(--surface-2); }
.btn-outline { background: transparent; border-color: var(--line); color: #3ea6ff; }
.btn-outline:hover { background: rgba(62,166,255,.12); border-color: transparent; }
.btn-accent { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-accent:hover { background: var(--accent); filter: brightness(1.07); }
.btn-block { width: 100%; height: 44px; }
.icon-btn {
	position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
	display: inline-grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.badge {
	display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
	border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
}
.bell .badge { position: absolute; top: 2px; right: 0; }
.ava {
	display: inline-grid; place-items: center; flex: none; border-radius: 50%;
	color: #fff; font-weight: 600; font-size: 14px; line-height: 1;
}

/* ---------- Top bar ---------- */
.topbar {
	position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: var(--top);
	display: flex; align-items: center; gap: 12px; padding: 0 16px;
	background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; letter-spacing: -.2px; white-space: nowrap; }
.brand-mark {
	width: 30px; height: 22px; border-radius: 6px;
	background: var(--accent); color: var(--accent-ink);
	display: grid; place-items: center; font-size: 11px; font-weight: 800;
}
.brand img { max-height: 30px; width: auto; }
.search { flex: 0 1 640px; margin: 0 auto; display: flex; height: 40px; }
.search input {
	flex: 1; min-width: 0; background: #121212; border: 1px solid var(--line); border-right: 0;
	border-radius: 20px 0 0 20px; padding: 0 16px; outline: none; font-size: 16px;
}
.search input:focus { border-color: #1c62b9; }
.search button {
	width: 64px; border: 1px solid var(--line); background: var(--surface-2);
	border-radius: 0 20px 20px 0; cursor: pointer; display: grid; place-items: center;
}
.nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.me { display: inline-flex; }

/* ---------- Shell ---------- */
.layout { padding-top: var(--top); }
.sidebar {
	position: fixed; top: var(--top); bottom: 0; left: 0; width: var(--sb); z-index: 40;
	overflow-y: auto; padding: 12px 12px 24px; background: var(--bg);
	scrollbar-width: thin; scrollbar-color: #444 transparent;
}
.main { margin-left: var(--sb); min-width: 0; }
.sb-closed .sidebar { display: none; }
.sb-closed .main { margin-left: 0; }
.sb-group { padding: 0 0 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.sb-title { font-size: 16px; font-weight: 600; margin: 6px 12px 6px; }
.sb-item {
	display: flex; align-items: center; gap: 22px; height: 40px; padding: 0 12px;
	border-radius: 10px; font-size: 14px;
}
.sb-item span:not(.badge) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-item:hover { background: var(--surface-2); }
.sb-item.is-active { background: var(--surface-2); font-weight: 600; }
.sb-muted { color: var(--muted); }
.sb-foot { color: #717171; font-size: 12px; padding: 0 12px; }
.sb-scrim { position: fixed; inset: var(--top) 0 0 0; background: rgba(0,0,0,.5); z-index: 39; }

/* ---------- Chips ---------- */
.chips-bar {
	position: sticky; top: var(--top); z-index: 30; background: var(--bg);
	display: flex; align-items: center; gap: 12px; padding: 12px 24px;
}
.chips { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
	flex: none; height: 32px; padding: 0 12px; border-radius: 8px; background: var(--surface-2);
	display: inline-flex; align-items: center; font-weight: 500; white-space: nowrap;
}
.chip:hover { background: var(--hover); }
.chip.is-active { background: var(--text); color: var(--bg); }
.chip-sep { flex: none; width: 1px; background: var(--line); margin: 4px 0; }
.sort select { height: 32px; background: var(--surface-2); border: 0; border-radius: 8px; padding: 0 10px; cursor: pointer; }

/* ---------- Content ---------- */
.content { padding: 12px 24px 48px; }
.page-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 20px; }
.page-head h1 { font-size: 22px; margin: 0; }
.count { color: var(--muted); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 40px 16px; }
.card { position: relative; min-width: 0; }
.card-link { position: absolute; inset: 0; z-index: 2; border-radius: var(--radius); }
.thumb {
	position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
	background: linear-gradient(135deg, #222, #161616);
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.card:hover .thumb { border-radius: 0; transition: border-radius .2s; }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #555; }
.badges { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; }
.badges span { padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.8); font-size: 12px; font-weight: 500; line-height: 18px; }
.badges .q { background: rgba(0,0,0,.8); color: var(--accent); font-weight: 700; }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.3); display: none; }
.prog i { display: block; height: 100%; background: var(--danger); }
.card-body { display: flex; gap: 12px; padding-top: 12px; }
.card-text { min-width: 0; }
.card-text h3 {
	margin: 0 0 4px; font-size: 16px; font-weight: 500; line-height: 22px;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-text p { margin: 0; color: var(--muted); font-size: 14px; line-height: 20px; }

.more-wrap { display: flex; justify-content: center; margin-top: 40px; }
.btn-more { min-width: 200px; }
.btn-more.is-loading { opacity: .6; pointer-events: none; }

.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin: 0 0 6px; font-size: 20px; }

/* ---------- Watch page ---------- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 402px; gap: 24px; max-width: 1754px; margin: 0 auto; padding-top: 12px; }
.player { border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.player video, .player img { width: 100%; height: 100%; object-fit: contain; background: #000; }
.watch-title { font-size: 20px; font-weight: 600; line-height: 28px; margin: 12px 0 8px; }
.watch-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.channel { display: flex; align-items: center; gap: 12px; }
.channel strong { display: block; font-size: 16px; font-weight: 600; }
.channel span { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.desc { margin-top: 12px; padding: 12px; background: var(--surface-2); border-radius: var(--radius); }
.desc p { margin: 0; }
.desc-stats { font-weight: 600; }
.desc-cats { margin-top: 4px !important; display: flex; gap: 8px; flex-wrap: wrap; }
.desc-cats a { color: #3ea6ff; }
.desc-text { margin-top: 8px; white-space: pre-line; }
.side h2 { font-size: 16px; margin: 0 0 12px; }
.side-list { display: grid; gap: 8px; }
.side-item { position: relative; display: grid; grid-template-columns: 168px minmax(0,1fr); gap: 8px; }
.side-item .thumb { border-radius: 8px; }
.side-item h3 { margin: 0 0 4px; font-size: 14px; font-weight: 500; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 18px; }
.side-item .badges span { font-size: 11px; }

/* Watch page: sidebar is a drawer (like YouTube). */
.page-watch .sidebar { display: none; }
.page-watch .main { margin-left: 0; }
.page-watch.sb-open .sidebar { display: block; box-shadow: 8px 0 24px rgba(0,0,0,.4); }

/* ---------- Guest / join screen ---------- */
.guest-body { display: flex; align-items: center; justify-content: center; background:
	radial-gradient(900px 500px at 15% -10%, rgba(242,181,68,.14), transparent 60%),
	radial-gradient(700px 500px at 110% 110%, rgba(62,166,255,.10), transparent 60%), var(--bg); }
.guest { width: 100%; max-width: 440px; margin: 0 auto; padding: 40px var(--gutter); }
.guest .brand { justify-content: center; font-size: 22px; margin-bottom: 8px; }
.guest .brand-mark { width: 38px; height: 28px; font-size: 13px; }
.guest .lead { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 15px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: var(--bg); border-radius: 12px; margin-bottom: 20px; }
.switch button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); }
.switch button.is-active { background: var(--surface-2); color: var(--text); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel] {
	width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); outline: none; font-size: 15px;
}
.field input:focus { border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.pw { position: relative; }
.pw button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.notice-error { background: rgba(255,78,69,.12); border: 1px solid rgba(255,78,69,.4); color: #ffc9c6; }
.notice-ok { background: rgba(79,209,139,.12); border: 1px solid rgba(79,209,139,.4); color: #c4f3d9; }
.notice-info { background: rgba(242,181,68,.1); border: 1px solid rgba(242,181,68,.4); color: #f8deaa; }

/* ---------- Admin bar offset (admins only) ---------- */
.admin-bar .topbar { top: 32px; }
.admin-bar .layout { padding-top: calc(var(--top) + 32px); }
.admin-bar .sidebar { top: calc(var(--top) + 32px); }
.admin-bar .chips-bar { top: calc(var(--top) + 32px); }
@media (max-width: 782px) {
	.admin-bar .topbar { top: 46px; }
	.admin-bar .layout { padding-top: calc(var(--top) + 46px); }
	.admin-bar .sidebar { top: calc(var(--top) + 46px); }
	.admin-bar .chips-bar { top: calc(var(--top) + 46px); }
	html #wpadminbar { position: fixed; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1300px) {
	.watch { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 1100px) {
	/* Sidebar becomes a drawer opened by the menu button. */
	.sidebar { display: none; box-shadow: 8px 0 24px rgba(0,0,0,.4); }
	.main { margin-left: 0; }
	.sb-open .sidebar { display: block; }
	.watch { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
	.topbar { gap: 4px; padding: 0 8px; }
	.brand span:not(.brand-mark) { display: none; }
	.search { margin: 0 4px; }
	.search input { font-size: 15px; padding: 0 12px; }
	.search button { width: 48px; }
	.nav-right .btn span { display: none; }
	.nav-right .btn { padding: 0 10px; }
	.chips-bar { padding: 10px 12px; }
	.content { padding: 8px 0 40px; }
	.page-head, .empty, .more-wrap { padding-left: 12px; padding-right: 12px; }
	.grid { grid-template-columns: 1fr; gap: 24px; }
	.thumb, .card:hover .thumb { border-radius: 0; }
	.card-body { padding: 12px 12px 0; }
	.watch { padding-top: 0; gap: 16px; }
	.player { border-radius: 0; }
	.watch-main > :not(.player), .side { padding: 0 12px; }
	.side-item { grid-template-columns: 150px minmax(0,1fr); }
}
@media (min-width: 540px) and (max-width: 720px) {
	.grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 24px 12px; padding: 0 12px; }
	.thumb, .card:hover .thumb { border-radius: 10px; }
	.card-body { padding: 10px 0 0; }
}

/* "NEW" badge on fresh uploads */
.new-tag { position: absolute; top: 6px; left: 6px; padding: 1px 6px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 800; letter-spacing: .4px; line-height: 18px; }
