/* assets/style.css */
/* ============================================================
   YouView – YouTube-style Dark UI
   - Mobile-first layout
   - Larger logo
   - Video grid cards with thumbnails
   - Channel profiles + subscriber count + avatar
   - Clean, minimal text
   - Extended for:
     * Channel tip line
     * Player theatre mode + mini player
     * Recommended videos panel
     * DMs panel (wallet-to-wallet messaging)
     * Upload retry + draft hint
     * Offline / cache indicators
============================================================ */

:root {
  --bg: #0f0f0f;
  --bg-elevated: #181818;
  --bg-hover: #272727;
  --sidebar-bg: #0f0f0f;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --accent: #3ea6ff;
  --accent-soft: rgba(62, 166, 255, 0.16);
  --accent-strong: #4cc9ff;
  --accent-danger: #f97373;
  --accent-success: #4ade80;
  --text-main: #f1f1f1;
  --text-muted: #aaaaaa;
  --text-faint: #777777;
  --danger: #f87171;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.6);
  --shadow-elevated: 0 16px 40px rgba(0, 0, 0, 0.85);
  --topbar-h: 56px;
  --max-page-width: 1440px;
}

/* Reset-ish */

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

html,
body {
  margin: 0;
  padding: 0;
  background: #000;
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

/* Utilities */

.hidden {
  display: none !important;
}

/* Layout */

.app-root {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #1a1a1a, #000000 55%);
  color: var(--text-main);
}

/* Topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 8px;
  background: radial-gradient(circle at top left, #161616, #050505 50%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.topbar .logo-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.logo-image {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 6px 14px rgba(0, 0, 0, 0.8);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-main {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.topbar .search-form {
  flex: 1;
  max-width: 520px;
  display: flex;
}

.topbar .search-form input {
  width: 100%;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: #181818;
  color: var(--text-main);
  padding: 6px 12px;
  font-size: 13px;
}

.topbar .search-form input::placeholder {
  color: var(--text-faint);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Connection badge */

.badge-offline {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.6);
}

/* Buttons */

.primary-btn,
.secondary-btn,
.link-btn,
.icon-button {
  font: inherit;
  border: none;
  cursor: pointer;
  outline: none;
  transition: background 120ms ease, transform 80ms ease,
    box-shadow 120ms ease, border-color 120ms ease, color 120ms ease;
}

.primary-btn {
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #000;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.primary-btn:hover {
  background: linear-gradient(135deg, #56b8ff, #5dd5ff);
  transform: translateY(-0.5px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.9);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.75);
}

.primary-btn--full {
  width: 100%;
  justify-content: center;
}

.secondary-btn {
  border-radius: var(--radius-pill);
  background: #1b1b1b;
  color: var(--text-main);
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid var(--border-subtle);
}

.secondary-btn:hover {
  background: #222;
}

.secondary-btn--small {
  padding: 4px 10px;
  font-size: 12px;
}

.link-btn {
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.icon-button {
  background: rgba(0, 0, 0, 0.65);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background: rgba(0, 0, 0, 0.9);
}

/* Layout main */

.main-layout {
  max-width: var(--max-page-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px 16px;
}

/* Sidebar */

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: flex-start;
  padding-right: 4px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px 10px;
  border-radius: var(--radius-lg);
  background: var(--sidebar-bg);
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-main);
  font-size: 13px;
  border: none;
}

.nav-item span:first-child {
  width: 20px;
  text-align: center;
}

.nav-item:hover {
  background: var(--bg-hover);
}

.nav-item--active {
  background: rgba(255, 255, 255, 0.08);
}

/* Desktop sidebar (always visible) */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: flex-start;
  padding-right: 4px;
}

/* Backdrop (for mobile only) */
.sidebar-backdrop {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease-out;
}

/* When .sidebar-open is on <body>, show backdrop */
body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Prevent body scrolling when sidebar is open on mobile */
body.no-scroll {
  overflow: hidden;
}

/* Upload card */

.sidebar-upload {
  margin-top: 4px;
  padding: 12px 10px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(145deg, #181818, #101010);
  box-shadow: var(--shadow-soft);
}

.sidebar-upload h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

#uploadForm {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#uploadForm input[type="text"],
#uploadForm textarea,
#uploadForm select,
#uploadForm input[type="file"] {
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.8);
  color: var(--text-main);
  padding: 6px 8px;
  font-size: 12px;
}

#uploadForm textarea {
  resize: vertical;
}

#uploadForm input::placeholder,
#uploadForm textarea::placeholder {
  color: var(--text-faint);
}

.upload-quota {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-faint);
}

.sidebar-how {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-how h3 {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-how p {
  margin: 0;
  font-size: 11px;
  color: var(--text-faint);
}

/* Upload progress */

.upload-progress {
  margin-top: 4px;
}

.upload-progress__bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #101010;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.upload-progress__fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  transition: width 140ms linear;
}

.upload-progress__label {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}

/* Status text */

.status-text {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.status-text--error {
  color: #fecaca;
}

.status-text--success {
  color: #bbf7d0;
}

/* Main content */

.main-content {
  min-width: 0;
}

/* Category row */

.chip-row {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 6px 0 10px;
  margin-bottom: 6px;
}

.chip-row::-webkit-scrollbar {
  height: 5px;
}

.chip-row::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.chip {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.chip--active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* Section title */

.section-title {
  margin: 8px 0 6px;
  font-size: 14px;
}

/* Trending row (top horizontal strip) */
.trending-section {
  margin-bottom: 14px;
}

.trending-row {
  display: flex;
  gap: 10px;
  padding: 6px 2px 10px;
  overflow-x: auto;
  overflow-y: hidden;

  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;

  scrollbar-gutter: stable;
}

.trending-row > .video-card {
  flex: 0 0 220px;            /* consistent card width */
  scroll-snap-align: start;   /* snaps to each card */
}

/* Scrollbar styling */
.trending-row::-webkit-scrollbar {
  height: 6px;
}

.trending-row::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.trending-row::-webkit-scrollbar-track {
  background: transparent;
}

/* Video cards */

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.video-card {
  border-radius: var(--radius-md);
  background: radial-gradient(circle at top left, #222, #101010);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  transition: transform 120ms ease, box-shadow 120ms ease,
    border-color 120ms ease;
}

.video-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
  border-color: rgba(255, 255, 255, 0.16);
}

/* Thumbnail image – enforce 16:9 and cover */
.video-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px;
  background: #050505;
}

.video-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Fallback: video element used as thumbnail */
.video-thumb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

/* Offline badge on cards */

.video-badge-offline {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  background: rgba(248, 250, 252, 0.08);
  color: #e5e7eb;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

/* Duration pill */

.video-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  border-radius: 6px;
  padding: 2px 5px;
  background: rgba(0, 0, 0, 0.75);
  color: #f9fafb;
  font-size: 11px;
}

/* Cached indicator */

.video-cached {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.6);
  font-size: 10px;
  color: #bbf7d0;
}

/* Video meta */

.video-body {
  padding: 8px 8px 7px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 6px;
}

.video-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #232323;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background-size: cover;
  background-position: center;
  color: #ffffff;
}

.video-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.video-title {
  margin: 0;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;

  /* fallback */
  max-height: calc(1.3em * 2);
}

@supports (-webkit-line-clamp: 2) {
  .video-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

.video-meta-line {
  margin-top: 3px;
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.video-meta-line span {
  white-space: nowrap;
}

/* Premium pill */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 10px;
  gap: 4px;
}

.pill--premium {
  background: radial-gradient(circle at top left, #22c55e, #14532d);
  color: #ecfdf3;
  border-color: rgba(34, 197, 94, 0.7);
}

/* Load more */

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin: 10px 0 4px;
}

/* Channel profile */

.channel-profile {
  margin-top: 8px;
}

.channel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.channel-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #232323;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background-size: cover;
  background-position: center;
  color: #ffffff;
}

.channel-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel-meta h1,
#channelName {
  margin: 0;
  font-size: 18px;
}

#channelHandle {
  font-size: 13px;
  color: var(--text-muted);
}

#channelSubCount {
  font-size: 12px;
  color: var(--text-faint);
}

.channel-link {
  font-size: 11px;
  color: var(--accent);
}

.channel-link a {
  color: inherit;
  text-decoration: none;
}

.channel-link a:hover {
  text-decoration: underline;
}

.channel-tip {
  margin-top: 4px;
}

/* Profile forms */

.profile-handle-form,
.profile-avatar-form,
.profile-extras-form,
.profile-premium,
.analytics-card,
.pinned-video-section {
  margin: 10px 0;
  padding: 10px;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at top left, #161616, #050505);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-handle-form label,
.profile-avatar-form label,
.profile-extras-form label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.handle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.handle-row span {
  font-size: 12px;
  color: var(--text-faint);
}

#handleInput,
#externalLinkInput {
  flex: 1;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.85);
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 13px;
}

#handleInput::placeholder {
  color: var(--text-faint);
}

.handle-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-faint);
}

#avatarInput {
  width: 100%;
  font-size: 11px;
  color: var(--text-main);
}

.avatar-actions-row {
  margin-top: 6px;
}

.profile-extras-form .pin-label {
  margin-top: 8px;
  display: block;
}

/* Premium card */

.profile-premium h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.profile-premium p {
  margin: 4px 0;
  font-size: 11px;
}

#premiumTxInput {
  width: 100%;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: #050505;
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 12px;
  margin: 4px 0;
}

/* Analytics card */

.analytics-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}

.analytics-item {
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 11px;
}

.analytics-item span {
  display: block;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.analytics-item strong {
  font-size: 13px;
}

.analytics-top {
  margin: 6px 0 0;
  font-size: 12px;
}

/* Pinned video */

.pinned-video-section .section-title {
  margin-bottom: 4px;
}

/* Player modal */

.player-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  justify-content: center;
  align-items: center;
}

.player-modal.hidden {
  display: none;
}

.player-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
}

.player-modal-body {
  position: relative;
  z-index: 1;
  width: min(1100px, 100vw);
  max-height: calc(100vh - 20px);
  margin: 0 auto;
  background: radial-gradient(circle at top left, #171717, #050505);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
}

/* Player layout desktop */

/* Player layout: main video + recommendations column */
.player-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Recommended list: scrollable on all viewports */
.player-recommendations {
  max-height: 40vh;          /* default on mobile: keeps it compact */
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

/* Desktop: recommendations on the right, scrollable */
@media (min-width: 900px) {

  .player-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
  }

  /* Main video column */
  .player-main {
    flex: 2 1 0;
    min-width: 0;
  }

  /* Recommendations column */
  .player-recommendations {
    flex: 1 1 320px;
    max-height: calc(100vh - 160px);  /* stay fully inside viewport */
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;         /* prevents layout shift */
    overscroll-behavior: contain;     /* avoids bouncing the whole page */
  }

  /* Optional: cleaner scrollbar */
  .player-recommendations::-webkit-scrollbar {
    width: 6px;
  }
  .player-recommendations::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
  }
  .player-recommendations::-webkit-scrollbar-track {
    background: transparent;
  }
}

/* Player layout: main video + recommendations column */
.player-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Desktop: recommendations on the right, scrollable */
@media (min-width: 900px) {
  .player-layout {
    flex-direction: row;
    align-items: flex-start;
  }

  .player-main {
    flex: 2 1 auto;
    min-width: 0;
  }

  .player-recommendations {
    flex: 1 1 320px;
    max-height: calc(100vh - 160px); /* keeps it inside the viewport */
    overflow-y: auto;                /* <— makes list scrollable */
    padding-right: 4px;
  }

  /* optional: nicer scrollbar */
  .player-recommendations::-webkit-scrollbar {
    width: 6px;
  }

  .player-recommendations::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Video element */

.player-video-shell {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 1px rgba(248, 250, 252, 0.04);
}

.player-video {
  width: 100%;
  height: 100%;
  max-height: 60vh;
  display: block;
  background: #000;
}

/* Player close button – larger & top-right */

.player-close {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 13px;
  padding: 4px 10px;
  z-index: 2;
}

/* Player info */

.player-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-info h1 {
  margin: 4px 0 0;
  font-size: 16px;
}

.player-meta {
  font-size: 12px;
  color: var(--text-faint);
}

/* Player actions */

.player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Up next + comments layout */

.player-upnext {
  margin-top: 16px;
}

.player-upnext-title {
  margin: 0 0 8px;
  font-size: 14px;
}

.player-comments h2 {
  margin: 8px 0 4px;
  font-size: 14px;
}

#commentForm input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #181818;
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 13px;
}

#commentForm input::placeholder {
  color: var(--text-faint);
}

#commentList {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-item {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(30, 64, 175, 0.7);
}

.comment-author {
  font-weight: 500;
  margin-bottom: 2px;
}

.comment-meta {
  font-size: 11px;
  color: var(--text-faint);
}

/* Tip presets */

.tip-presets {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Mini player mode */

.player-modal--mini .player-modal-backdrop {
  background: transparent;
  pointer-events: none;
}

.player-modal--mini .player-modal-body {
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: 320px;
  max-width: 90vw;
  padding: 4px;
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.9);
}

.player-modal--mini .player-video-shell {
  border-radius: 10px;
}

.player-modal--mini .player-video {
  max-height: 180px;
}

.player-modal--mini .player-info,
.player-modal--mini .player-actions,
.player-modal--mini .player-comments,
.player-modal--mini .player-upnext {
  display: none;
}

/* Theatre mode */

.player-layout--theatre .player-modal-body {
  max-width: 100vw;
}

.player-layout--theatre .player-layout {
  grid-template-columns: minmax(0, 2.8fr) minmax(260px, 1fr);
}

/* Load skeleton */

.video-card--skeleton {
  background: radial-gradient(circle at top left, #18181b, #020617);
  animation: pulse 1.2s ease-in-out infinite;
}

.video-card--skeleton .video-thumb,
.video-card--skeleton .video-avatar,
.video-card--skeleton .video-title,
.video-card--skeleton .video-meta-line {
  background: rgba(24, 24, 27, 0.9);
  border-radius: 10px;
}

.video-card--skeleton .video-title {
  height: 26px;
}

.video-card--skeleton .video-meta-line {
  height: 16px;
  margin-top: 6px;
}

/* Offline banner */

.offline-banner {
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-lg);
  background: rgba(248, 250, 252, 0.02);
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 11px;
  color: #e5e7eb;
}

/* DMs panel */

.dm-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 38;
  width: 320px;
  max-width: 90vw;
  max-height: 420px;
  background: #101010;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dm-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: radial-gradient(circle at top left, #111827, #020617);
}

.dm-panel-header span {
  font-size: 12px;
  color: var(--text-muted);
}

.dm-panel-body {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  min-height: 220px;
}

.dm-thread-list {
  border-right: 1px solid var(--border-subtle);
  background: #050505;
  overflow-y: auto;
}

.dm-thread-item {
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(15, 23, 42, 0.6);
}

.dm-thread-item:hover {
  background: rgba(30, 64, 175, 0.2);
}

.dm-thread-item--active {
  background: rgba(37, 99, 235, 0.3);
}

.dm-thread-handle {
  font-weight: 500;
}

.dm-thread-preview {
  font-size: 11px;
  color: var(--text-faint);
}

.dm-thread-empty {
  font-size: 11px;
  color: var(--text-faint);
  padding: 8px;
}

.dm-messages {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  overflow-y: auto;
  font-size: 12px;
}

.dm-message {
  max-width: 85%;
  padding: 4px 8px;
  border-radius: 10px;
  margin-bottom: 3px;
}

.dm-message--outgoing {
  align-self: flex-end;
  background: rgba(37, 99, 235, 0.85);
}

.dm-message--incoming {
  align-self: flex-start;
  background: rgba(15, 23, 42, 0.85);
}

.dm-message-meta {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
}

.dm-form {
  margin-top: 6px;
}

.dm-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
}

.dm-input-row input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #181818;
  color: var(--text-main);
  font-size: 12px;
  padding: 5px 10px;
}

/* -------- Mobile tweaks -------- */

@media (max-width: 900px) {
  .topbar {
    padding-inline: 8px;
  }

  .topbar .search-form {
    max-width: none;
  }
}

/* Mobile: single-column layout */
@media (max-width: 768px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

/* Mobile: sidebar becomes an off-canvas drawer */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: -270px;              /* hide it off-screen */
    width: 260px;
    max-width: 80%;
    height: calc(100vh - var(--topbar-h));
    background: var(--sidebar-bg);
    z-index: 40;
    padding-right: 4px;
    transition: left 160ms ease-out;
    box-shadow: var(--shadow-elevated);

    /* allow vertical scrolling in the drawer */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* When JS adds .sidebar--open, slide it in */
  .sidebar.sidebar--open {
    left: 8px;
  }
}

/* Desktop: sidebar is always visible and not transformed off-screen */
@media (min-width: 769px) {
  .sidebar {
    position: sticky;
    top: var(--topbar-h);
    transform: none !important;
    left: 0 !important;
    box-shadow: none;
  }
}

  /* When JS adds .sidebar--open, slide it in */
  .sidebar.sidebar--open {
    left: 8px;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-upload {
    max-height: calc(100vh - 72px);
    overflow-y: auto;
  }

  .main-content {
    padding-top: 4px;
  }

  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .player-modal-body {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0; /* full-screen player on tiny phones */
  }

  .player-video {
    max-height: 55vh;
  }

  .player-layout {
    grid-template-columns: 1fr;
  }

  .player-layout--theatre .player-layout {
    grid-template-columns: 1fr;
  }

  .player-modal--mini .player-modal-body {
    right: 6px;
    bottom: 6px;
    width: 260px;
  }

  .dm-panel {
    right: 6px;
    bottom: 6px;
    width: 260px;
    max-height: 320px;
  }


/* Extra small devices */

@media (max-width: 430px) {
  .video-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions .primary-btn {
    padding-inline: 10px;
  }

  .player-video {
    max-height: 48vh;
  }

  .player-layout--theatre {
    flex-direction: column;
  }
}

/* Base video sizing */
#playerVideo {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #000;
}

/* Mini player: video only, 16:9 */
.player-modal.player-modal--mini {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 320px;
  max-width: 90vw;
  z-index: 9999;
  padding: 0;
}

.player-modal.player-modal--mini .player-modal-body {
  padding: 0;
  max-height: none;
}

.player-modal.player-modal--mini .player-layout {
  flex-direction: column;
  gap: 0;
}

/* Hide recommendations + comments in mini mode */
.player-modal.player-modal--mini .player-recommendations,
.player-modal.player-modal--mini .player-info,
.player-modal.player-modal--mini .player-actions,
.player-modal.player-modal--mini .player-comments {
  display: none !important;
}

/* Keep just the video shell in mini mode */
.player-modal.player-modal--mini #playerVideoShell,
.player-modal.player-modal--mini #playerVideo {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
}

/* Sidebar toggle (logo / mobile only) */
@media (max-width: 768px) {
  /* Base state: hidden off-canvas (works with existing .sidebar rules above) */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  /* Open states – support both legacy body class and new .sidebar--open class */
  body.sidebar-open .sidebar,
  .sidebar.sidebar--open {
    transform: translateX(0);
  }

  /* Backdrop for mobile */
  #sidebarBackdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 30;
  }

  #sidebarBackdrop.sidebar-backdrop--visible {
    opacity: 1;
    pointer-events: auto;
  }

  /* Prevent scrolling when sidebar is open */
  body.no-scroll {
    overflow: hidden;
  }
}

/* Recommended videos list in player (right-hand column) */

.player-recommendation-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px;
  margin-bottom: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 120ms ease-out, transform 120ms ease-out;
}

.player-recommendation-card:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.player-recommendation-thumb {
  flex: 0 0 140px;          /* smaller width */
  aspect-ratio: 16 / 9;     /* perfect 16:9 box */
  border-radius: 10px;
  overflow: hidden;
  background: #111;
}

.player-recommendation-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.player-recommendation-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.player-recommendation-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  margin: 0 0 2px;
  line-height: 1.3;
}

.player-recommendation-channel {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

/* Even smaller thumbs on narrow mobile screens */
@media (max-width: 768px) {
  .player-recommendation-thumb {
    flex-basis: 120px;
  }

  .player-recommendation-title {
    font-size: 12px;
  }

  .player-recommendation-channel {
    font-size: 10px;
  }
}


@media (max-width: 768px) {
  /* Layout becomes single-column on mobile */
  .main-layout {
    max-width: var(--max-page-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px 10px 16px;
  }

  /* Sidebar becomes off-canvas drawer */
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: -270px;              /* hide it off-screen */
    width: 260px;
    max-width: 80%;
    height: calc(100vh - var(--topbar-h));
    background: var(--sidebar-bg);
    z-index: 40;
    padding-right: 4px;
    transition: left 160ms ease-out;
    box-shadow: var(--shadow-elevated);
  }

  /* When JS adds .sidebar--open, slide it in */
  .sidebar.sidebar--open {
    left: 8px;
  }
}

/* Upload panel container */
.upload-card {
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 20px 18px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  margin-bottom: 20px;
}

/* Upload title */
.upload-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.upload-card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

/* File + text fields */
.upload-form-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-form-row input[type="text"],
.upload-form-row textarea,
.upload-form-row select {
  background: #1b1b1b;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

.upload-form-row input[type="text"]:focus,
.upload-form-row textarea:focus,
.upload-form-row select:focus {
  border-color: var(--accent);
}

/* File input wrapper */
.upload-file-input {
  background: #1b1b1b;
  border-radius: 10px;
  border: 1px dashed var(--border-subtle);
  padding: 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Progress bar */
#uploadProgress {
  margin-top: 12px;
  height: 8px;
  border-radius: 6px;
  background: #262626;
  overflow: hidden;
}

#uploadProgressFill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* Status + quota text */
#uploadStatus {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upload-quota-text {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.upload-draft-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-faint);
}

.upload-draft-hint--visible {
  display: block;
}