/* BhorTube — design system (YouTube-like)
   Fonts (max 2): Roboto (Latin UI) + Hind Siliguri (Bengali).
   Palette: light pure white, dark #0f0f0f, accent red #ff0000.
   No gradients, no playful colors, no chunky rounding. */

:root {
  --accent: #ff0000;
  --accent-hover: #cc0000;
  --focus: #1c62b9;
  --radius: 12px;
  --radius-sm: 8px;
  --topbar-h: 56px;
  --font-ui: "Roboto", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", sans-serif;
}
[data-theme="dark"] {
  --bg: #0f0f0f;
  --surface: #212121;
  --surface2: #272727;
  --surface3: #3d3d3d;
  --text: #f1f1f1;
  --muted: #aaaaaa;
  --border: #303030;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --chip-bg: #272727;
  --chip-hover: #3d3d3d;
  --input-bg: #121212;
  --chip-active-bg: #f1f1f1;
  --chip-active-text: #0f0f0f;
}
[data-theme="light"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #f2f2f2;
  --surface3: #e5e5e5;
  --text: #0f0f0f;
  --muted: #606060;
  --border: #e5e5e5;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  --chip-bg: #f2f2f2;
  --chip-hover: #e5e5e5;
  --input-bg: #ffffff;
  --chip-active-bg: #0f0f0f;
  --chip-active-text: #ffffff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  padding-bottom: 60px; /* bottom nav space on mobile */
}
@media (min-width: 900px) { body { padding-bottom: 0; } }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }
img { max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.clickable { cursor: pointer; }

/* inline SVG icons */
.ico { width: 24px; height: 24px; flex-shrink: 0; display: block; }
.ico-sm { width: 18px; height: 18px; }
.ico-xs { width: 15px; height: 15px; display: inline-block; vertical-align: -2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
}
.topbar-inner {
  max-width: 1760px; margin: 0 auto;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.brand-mark { width: 30px; height: 21px; }
.brand-name {
  font-weight: 700; font-size: 20px; letter-spacing: -0.5px;
  color: var(--text); white-space: nowrap;
}
.search-box {
  flex: 1; display: none; align-items: center;
  max-width: 640px; margin: 0 auto;
}
@media (min-width: 700px) { .search-box { display: flex; } }
.search-box input, .search-row-mobile input {
  flex: 1; height: 40px; padding: 0 16px;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 40px 0 0 40px;
  outline: none; min-width: 0; font-size: 16px;
}
.search-box input:focus, .search-row-mobile input:focus { border-color: var(--focus); }
.search-box button, .search-row-mobile button {
  height: 40px; width: 64px; border: 1px solid var(--border); border-left: none;
  border-radius: 0 40px 40px 0; background: var(--surface2); color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.search-box button:hover { background: var(--surface3); }
.search-row-mobile {
  display: flex; padding: 0 12px 10px; gap: 0;
}
@media (min-width: 700px) { .search-row-mobile { display: none; } }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: transparent; color: var(--text);
}
.icon-btn:hover { background: var(--surface2); }
.lang-btn { font-size: 13px; font-weight: 500; width: auto; padding: 0 12px; border-radius: 18px; border: 1px solid var(--border); height: 36px; }

#authArea { position: relative; display: flex; align-items: center; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 20px; }
.user-chip:hover { background: var(--surface2); }
.user-name { font-weight: 500; font-size: 14px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .user-name { display: none; } }
.user-photo { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-menu {
  position: absolute; right: 0; top: 46px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 200px; padding: 8px;
}
.user-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px;
  background: none; border: none; color: var(--text); font-size: 14px; border-radius: var(--radius-sm);
}
.user-menu button:hover { background: var(--surface2); }

/* ---------- layout ---------- */
.layout { max-width: 1760px; margin: 0 auto; display: flex; }
.sidebar {
  display: none; width: 240px; flex-shrink: 0;
  padding: 12px; position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
@media (min-width: 900px) { .sidebar { display: block; } }
.sidebar-note { color: var(--muted); font-size: 12px; padding: 12px 10px; border-top: 1px solid var(--border); margin-top: 12px; }
.nav-item {
  display: flex; align-items: center; gap: 24px;
  padding: 0 12px; height: 40px; border-radius: 10px; font-size: 14px; font-weight: 400;
}
.nav-item:hover { background: var(--surface2); }
.nav-item.active { background: var(--surface2); font-weight: 500; }
.nav-ico { width: 24px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.view { flex: 1; min-width: 0; padding: 12px 16px 32px; }
@media (min-width: 900px) { .view { padding: 16px 24px 40px; } }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--bg); border-top: 1px solid var(--border);
  height: 60px; padding: 0 4px;
}
@media (min-width: 900px) { .bottom-nav { display: none; } }
.bn-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text); padding: 6px 12px; border-radius: 10px; min-width: 56px;
}
.bn-item span { font-size: 10px; }
.bn-item.active { font-weight: 500; }
.bn-upload {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--text);
  justify-content: center; padding: 0; min-width: 0;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; background: var(--surface2);
  color: var(--text); border-radius: 18px; padding: 10px 16px;
  font-size: 14px; font-weight: 500;
}
.btn:hover { background: var(--surface3); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sub { background: var(--accent); color: #fff; }
.btn-sub:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface2); }
.btn-danger { background: #cc0000; color: #fff; }
.btn-danger:hover { background: #a80000; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-google { background: #fff; color: #222; border: 1px solid #dadce0; width: 100%; font-size: 15px; }

/* ---------- home ---------- */
.demo-banner {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-size: 14px;
}
.chips { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; border: none; background: var(--chip-bg);
  color: var(--text); border-radius: 8px; padding: 8px 12px; font-size: 14px; font-weight: 500;
}
.chip:hover { background: var(--chip-hover); }
.chip.active { background: var(--chip-active-bg); color: var(--chip-active-text); }
.page-title { font-size: 20px; font-weight: 700; margin: 4px 0 16px; }
.section-title { font-size: 18px; font-weight: 700; margin: 20px 0 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.sort-wrap { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sort-wrap select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px;
}
.rail { margin-bottom: 8px; }
.rail h2 { font-size: 18px; font-weight: 700; margin: 14px 0 10px; }
.hscroll {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}
.hscroll .vcard { flex: 0 0 310px; scroll-snap-align: start; }
@media (max-width: 600px) { .hscroll .vcard { flex-basis: 260px; } }

.vgrid {
  display: grid; gap: 20px 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .vgrid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .vgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1400px) { .vgrid { grid-template-columns: repeat(4, 1fr); } }
.vcard { cursor: pointer; }
.vthumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius);
  background: var(--surface2); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback { font-size: 34px; color: var(--muted); }
.vdur {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0, 0, 0, 0.8); color: #fff;
  font-size: 12px; font-weight: 500; padding: 2px 6px; border-radius: 4px;
}
.vbadge {
  position: absolute; left: 6px; top: 6px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 4px;
}
.vbadge.archive { background: rgba(0, 0, 0, 0.8); }
.vmeta { display: flex; gap: 12px; padding-top: 12px; }
.vavatar { flex-shrink: 0; }
.vinfo { min-width: 0; }
.vtitle {
  margin: 0 0 4px; font-size: 16px; font-weight: 500; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vchan, .vstats { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.4; }
.empty-note { color: var(--muted); text-align: center; padding: 32px 12px; }

/* avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; color: #fff;
  font-weight: 500; font-size: 16px; flex-shrink: 0;
}
.avatar.xs { width: 32px; height: 32px; font-size: 14px; }
.avatar.sm { width: 36px; height: 36px; font-size: 15px; }
.avatar.lg { width: 72px; height: 72px; font-size: 30px; }

/* ---------- watch ---------- */
.watch-layout { display: grid; gap: 24px; }
@media (min-width: 1000px) { .watch-layout { grid-template-columns: minmax(0, 1fr) 360px; } }
.player-wrap {
  background: #000; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9;
}
.player-wrap video { width: 100%; height: 100%; display: block; }
.watch-title { font-size: 18px; font-weight: 700; margin: 12px 0 10px; line-height: 1.4; }
@media (min-width: 900px) { .watch-title { font-size: 20px; } }
.watch-channel-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.watch-channel-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.watch-channel-name { font-weight: 500; font-size: 16px; }
.watch-channel-subs { font-size: 12px; color: var(--muted); }
.watch-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; align-items: center; }
.like-dislike {
  display: flex; align-items: center;
  background: var(--surface2); border-radius: 18px; overflow: hidden;
}
.like-dislike .pill-btn { background: transparent; border-radius: 0; }
.like-dislike .pill-btn + .pill-btn { border-left: 1px solid var(--border); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: var(--surface2);
  color: var(--text); border-radius: 18px; padding: 8px 14px;
  font-size: 14px; font-weight: 500;
}
.pill-btn:hover { background: var(--surface3); }
.pill-btn.on { background: var(--text); color: var(--bg); }
.watch-meta {
  background: var(--surface2); border-radius: var(--radius); padding: 12px;
}
.watch-meta p { margin: 6px 0; }
.watch-desc { white-space: pre-wrap; word-break: break-word; }
.archive-note {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 13px; color: var(--muted);
}
.comments { margin-top: 20px; }
.comment-form { display: flex; gap: 8px; margin: 12px 0 18px; align-items: flex-start; }
.comment-form textarea {
  flex: 1; resize: vertical; min-height: 44px;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
}
.comment-form textarea:focus { border-color: var(--focus); outline: none; }
.comment { display: flex; gap: 12px; margin-bottom: 16px; }
.comment-author { margin: 0 0 2px; font-weight: 500; font-size: 13px; }
.comment-time { color: var(--muted); font-weight: 400; margin-left: 6px; }
.comment-text { margin: 0; white-space: pre-wrap; word-break: break-word; }
.comment-likes { margin: 4px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.watch-side h3 { margin-top: 0; font-size: 16px; font-weight: 700; }

/* related videos — compact horizontal rows (YouTube style) */
.vgrid.compact { grid-template-columns: 1fr; gap: 12px; }
.vgrid.compact .vcard { display: flex; gap: 8px; }
.vgrid.compact .vthumb { width: 168px; flex-shrink: 0; border-radius: 8px; }
.vgrid.compact .vmeta { padding-top: 0; gap: 0; }
.vgrid.compact .vavatar { display: none; }
.vgrid.compact .vtitle { font-size: 14px; }
.vgrid.compact .vchan, .vgrid.compact .vstats { font-size: 12px; }

/* ---------- channel ---------- */
.channel-head { margin-bottom: 8px; }
.channel-banner {
  height: 120px; border-radius: var(--radius);
  background: var(--ch-color, #606060);
}
@media (min-width: 900px) { .channel-banner { height: 170px; } }
.channel-top { display: flex; align-items: center; gap: 14px; margin-top: -28px; padding: 0 8px; flex-wrap: wrap; }
.channel-top h1 { margin: 0; font-size: 22px; font-weight: 700; }
.channel-top .btn { margin-left: auto; }
.channel-desc { margin: 14px 4px; white-space: pre-wrap; }
.channel-stats { margin: 0 4px; color: var(--muted); font-size: 14px; }

/* ---------- shorts ---------- */
.shorts-feed {
  display: flex; flex-direction: column; gap: 16px; align-items: center;
}
.short-slide {
  position: relative; width: 100%; max-width: 420px;
  aspect-ratio: 9 / 16; max-height: calc(100dvh - 160px);
  border-radius: 12px; overflow: hidden; background: #000;
  scroll-snap-align: start;
}
.short-slide video { width: 100%; height: 100%; object-fit: cover; display: block; }
.short-side {
  position: absolute; right: 10px; bottom: 90px;
  display: flex; flex-direction: column; gap: 14px; z-index: 2;
}
.short-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(0, 0, 0, 0.45); color: #fff; border: none;
  width: 52px; height: 52px; border-radius: 50%; justify-content: center;
}
.short-btn span { font-size: 11px; white-space: nowrap; }
.short-info {
  position: absolute; left: 0; right: 70px; bottom: 0; z-index: 2;
  padding: 14px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}
.short-title { margin: 0 0 4px; font-weight: 500; }
.short-chan { margin: 0; font-size: 13px; opacity: 0.9; }

/* ---------- forms / upload / center ---------- */
.center-box { max-width: 640px; margin: 24px auto; text-align: center; }
.center-box.wide { text-align: left; }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; font-weight: 500; font-size: 14px; }
.field input[type="text"], .field input[type="url"], .field input[type="email"],
.field textarea, .field select {
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-weight: 400; width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--focus); outline: none; }
.field input[type="file"] { font-weight: 400; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.form-msg { min-height: 20px; font-size: 14px; margin: 0; }
.form-msg.ok { color: #2e7d32; }
.form-msg.err { color: #d32f2f; }
.tabs { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.tab {
  border: none; background: var(--surface2);
  color: var(--text); border-radius: 8px; padding: 9px 16px; font-weight: 500; font-size: 14px;
}
.tab:hover { background: var(--surface3); }
.tab.active { background: var(--text); color: var(--bg); }
.progress { height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* ---------- library / subscriptions ---------- */
.chgrid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .chgrid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .chgrid { grid-template-columns: repeat(4, 1fr); } }
.chcard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 12px; text-align: center; cursor: pointer;
}
.chcard p { margin: 6px 0 0; }
section { margin-bottom: 28px; }

/* ---------- studio / admin ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-card b { font-size: 24px; font-weight: 700; }
.stat-card span { color: var(--muted); font-size: 13px; }
.studio-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 20px; }
.studio-row, .admin-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.studio-thumb { width: 96px; flex-shrink: 0; }
.studio-thumb .vthumb { border-radius: var(--radius-sm); }
.studio-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.studio-row-actions, .admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-user { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 1px; }
.admin-user .muted { display: block; }
.admin-stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.status-badge {
  font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 12px;
  background: var(--surface3); color: var(--text);
}
.status-badge.suspended { background: #cc0000; color: #fff; }
.status-badge.featured { background: var(--text); color: var(--bg); }
.admin-note {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px;
}

/* ---------- modal / toast / footer ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  position: relative; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 16px; font-size: 19px; font-weight: 700; }
.modal-x {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border: none; border-radius: 50%;
  background: var(--surface2); color: var(--text); font-size: 15px;
}
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0; }
.toast {
  position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%) translateY(20px);
  background: #212121; color: #fff;
  padding: 12px 20px; border-radius: 8px; font-weight: 400; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  z-index: 200; max-width: calc(100vw - 32px); text-align: center;
  box-shadow: var(--shadow);
}
@media (min-width: 900px) { .toast { bottom: 28px; } }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.footer {
  border-top: 1px solid var(--border);
  max-width: 1760px; margin: 0 auto; padding: 20px 16px 28px;
  font-size: 13px; color: var(--muted);
}
.footer p { margin: 4px 0; }
