/* ── Category tabs ──────────────────────────────────────────────────────────── */
.category-tabs-wrapper {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 12px 16px;
  background: var(--bg);
  position: sticky;
  top: var(--topbar-height);
  z-index: 40;
}
.category-tabs-wrapper::-webkit-scrollbar { display: none; }

.category-tabs {
  display: flex;
  gap: 8px;
  width: max-content;
}

.category-tab {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition);
  cursor: pointer;
  user-select: none;
}
.category-tab:hover { border-color: #444; color: var(--text); }
.category-tab.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ── Video grid ─────────────────────────────────────────────────────────────── */
.video-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 4px;
}

/* ── Video card ─────────────────────────────────────────────────────────────── */
.card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card__thumb-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.card__thumb-img,
.thumb-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.02em;
}

.card__meta {
  display: flex;
  gap: 10px;
  padding-top: 10px;
  align-items: flex-start;
}

.card__info {
  flex: 1;
  min-width: 0;
}

.card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.card__sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Avatar ─────────────────────────────────────────────────────────────────── */
.avatar {
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
  object-fit: cover;
}
.avatar--sm  { width: 32px; height: 32px; }
.avatar--md  { width: 40px; height: 40px; }
.avatar--lg  { width: 48px; height: 48px; }
.avatar--initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.avatar--sm.avatar--initials  { font-size: 11px; }
.avatar--md.avatar--initials  { font-size: 13px; }
.avatar--lg.avatar--initials  { font-size: 16px; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  border: none;
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn--outline:hover { border-color: #555; background: var(--surface); }

.btn--outline-accent {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn--outline-accent:hover { background: var(--accent-dim); }

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 6px 10px;
}
.btn--ghost:hover { color: var(--text); background: var(--surface); }

.btn--full { width: 100%; border-radius: var(--radius-md); padding: 14px 20px; font-size: 15px; }
.btn--lg   { padding: 12px 28px; font-size: 15px; }
.btn--sm   { padding: 5px 14px; font-size: 12px; }

.btn--subscribed {
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--border);
}

/* ── Tag / chip ─────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}
.chip__remove {
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0 2px;
  transition: color var(--transition);
}
.chip__remove:hover { color: var(--accent); }

.chips-input {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: text;
}
.chips-input input {
  flex: 1;
  min-width: 100px;
  background: none;
  font-size: 13px;
  color: var(--text);
}
.chips-input input::placeholder { color: var(--text-dim); }

/* ── Form fields ────────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.field-input,
.field-textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--transition);
}
.field-input::placeholder,
.field-textarea::placeholder { color: var(--text-dim); }
.field-input:focus,
.field-textarea:focus { border-color: var(--accent); }
.field-textarea { resize: vertical; min-height: 80px; }

/* ── Radio / toggle ─────────────────────────────────────────────────────────── */
.radio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.radio-row:last-child { border-bottom: none; }

.radio-row__label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.radio-dot {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition);
}
.radio-dot.active { border-color: var(--accent); }
.radio-dot.active::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--accent);
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}
.toggle-thumb {
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
  transition: transform var(--transition), background var(--transition);
}
.toggle-switch input:checked ~ .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle-switch input:checked ~ .toggle-thumb {
  transform: translateX(20px);
  background: #fff;
}

/* ── Drag-drop upload zone ───────────────────────────────────────────────────── */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: center;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
}
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.drop-zone__icon { color: var(--text-dim); }
.drop-zone__text { font-size: 13px; color: var(--text-muted); }
.drop-zone__sub  { font-size: 11px; color: var(--text-dim); }

/* ── Progress bar ───────────────────────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar__fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  transition: width 0.2s ease;
  width: 0%;
}

/* ── Studio video row ───────────────────────────────────────────────────────── */
.studio-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.studio-row:last-child { border-bottom: none; }

.studio-row__thumb-wrap {
  position: relative;
  width: 100px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--surface);
}
.studio-row__thumb-img,
.studio-row__thumb-wrap .thumb-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studio-row__info { flex: 1; min-width: 0; }

.studio-row__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.studio-row__meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.studio-row__actions { display: flex; gap: 4px; }

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
  background: none;
  border: none;
}
.action-btn:hover { background: var(--surface-2); color: var(--text); }
.action-btn--danger:hover { background: rgba(232,73,77,0.12); color: var(--accent); }

/* ── Up Next sidebar ────────────────────────────────────────────────────────── */
.upnext-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
}
.upnext-item:hover .upnext-item__title { color: var(--accent); }

.upnext-item__thumb-wrap {
  position: relative;
  width: 96px;
  flex-shrink: 0;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.upnext-item__thumb-img,
.upnext-item__thumb-wrap .thumb-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.upnext-item__duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}

.upnext-item__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
  transition: color var(--transition);
}
.upnext-item__sub { font-size: 11px; color: var(--text-muted); }

/* ── Watch page channel row ──────────────────────────────────────────────────── */
.channel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}
.channel-row__info { flex: 1; min-width: 0; }
.channel-row__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 2px;
}
.channel-row__subs { font-size: 12px; color: var(--text-muted); }

/* ── Thumbnail preview box ───────────────────────────────────────────────────── */
.thumb-preview-box {
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  position: relative;
}
.thumb-preview-box img,
.thumb-preview-box canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Toast notification ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
  max-width: calc(480px - 32px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Loading skeleton ───────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

/* ── Stat badge ─────────────────────────────────────────────────────────────── */
.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.stat-badge svg { width: 13px; height: 13px; opacity: 0.6; }

/* ── Section surface card ───────────────────────────────────────────────────── */
.surface-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
}

/* ── Empty state ────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state__icon { color: var(--text-dim); opacity: 0.5; }
.empty-state__title { font-size: 16px; font-weight: 600; color: var(--text); }
.empty-state__sub   { font-size: 13px; }
