/* ============================================================
   AllVideo — Main Stylesheet
   AllPixel Technologies | allvideo.in
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Layout ───────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-areas:
    "header header"
    "sidebar main";
  grid-template-rows: var(--header-h) 1fr;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────── */
.header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-left  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-center { flex: 1; max-width: 680px; margin: 0 auto; }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }

/* Logo */
.logo { display: flex; align-items: center; gap: 7px; text-decoration: none; }
.logo-text {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1;
  white-space: nowrap;
}
.logo-all   { color: var(--text); font-weight: 500; }
.logo-video { color: var(--primary); font-weight: 800; }

/* Search */
.search-form { display: flex; align-items: center; gap: 8px; }
.search-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--bg);
  transition: border-color var(--transition);
  flex: 1;
}
.search-box:focus-within { border-color: var(--primary); }
.search-input {
  flex: 1;
  padding: 8px 16px;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
  min-width: 0;
}
.search-btn {
  padding: 0 16px;
  height: 40px;
  background: var(--bg-tertiary);
  border-left: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  transition: background var(--transition);
}
.search-btn:hover { background: var(--border); }

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0 24px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  transition: width var(--transition-slow), transform var(--transition-slow);
  width: var(--sidebar-w);
  z-index: var(--z-sidebar);
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover, .nav-item.active {
  background: var(--bg-tertiary);
  color: var(--text);
}
.nav-item.active { font-weight: 600; }
.nav-item .material-symbols-rounded { font-size: 22px; flex-shrink: 0; }

.nav-divider { height: 1px; background: var(--border); margin: 8px 12px; }
.nav-section-title {
  padding: 8px 20px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Sidebar mini mode */
.sidebar-mini .sidebar { width: var(--sidebar-w-mini); }
.sidebar-mini #app { grid-template-columns: var(--sidebar-w-mini) 1fr; }
.sidebar-mini .nav-item span:not(.material-symbols-rounded),
.sidebar-mini .nav-section-title,
.sidebar-mini .nav-divider { display: none; }
.sidebar-mini .logo-text { display: none; }

/* ── Main Content ─────────────────────────────────────── */
.main-content {
  grid-area: main;
  min-height: calc(100vh - var(--header-h));
  background: var(--bg);
}

.page-container {
  padding: 24px 24px 40px;
  max-width: 1800px;
}

/* ── Video Grid ───────────────────────────────────────── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.video-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition);
}
.video-card:hover { transform: translateY(-2px); }

.video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.video-card:hover .video-thumb img { transform: scale(1.03); }

.video-duration {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: rgba(0,0,0,.8);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.video-live-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--live);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.video-info {
  display: flex;
  gap: 10px;
  padding: 10px 4px 4px;
}

.video-channel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.video-meta { flex: 1; min-width: 0; }

.video-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-channel {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.video-channel:hover { color: var(--text); }

.video-stats {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Category Chips ───────────────────────────────────── */
.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.category-chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text);
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.chip:hover { background: var(--border); }
.chip.active {
  background: var(--text);
  color: var(--bg);
}

/* ── Watch Page ───────────────────────────────────────── */
.watch-page {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  padding: 24px;
  max-width: 1800px;
  margin: 0 auto;
}

.watch-player-section { min-width: 0; }

.video-player-wrap {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.video-player-wrap video {
  width: 100%;
  height: 100%;
  display: block;
}

.watch-info { padding: 16px 0; }

.watch-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.watch-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.watch-stats { color: var(--text-secondary); font-size: 14px; }

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

.action-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: background var(--transition);
  border: 1px solid transparent;
}
.action-pill:hover { background: var(--border); }
.action-pill.active { background: var(--primary-light); color: var(--primary); }
.action-pill .material-symbols-rounded { font-size: 20px; }

.watch-channel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.channel-info { flex: 1; min-width: 0; }
.channel-name {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.channel-subs { font-size: 13px; color: var(--text-secondary); }

/* Related Videos */
.related-videos { display: flex; flex-direction: column; gap: 8px; }

.related-card {
  display: flex;
  gap: 8px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.related-card:hover { background: var(--bg-tertiary); }

.related-thumb {
  width: 168px;
  flex-shrink: 0;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-tertiary);
  position: relative;
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}

.related-meta { flex: 1; min-width: 0; }
.related-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text);
}
.related-channel { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.related-views { font-size: 12px; color: var(--text-secondary); }

/* ── Comments ─────────────────────────────────────────── */
.comments-section { padding: 24px 0; }
.comments-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.comments-count { font-size: 18px; font-weight: 600; }

.comment-input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.comment-textarea {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  resize: none;
  font-size: 14px;
  color: var(--text);
  min-height: 40px;
  transition: border-color var(--transition);
}
.comment-textarea:focus { border-color: var(--text); }

.comment-item {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.comment-body { flex: 1; min-width: 0; }
.comment-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.comment-author-name { font-size: 13px; font-weight: 600; }
.comment-time { font-size: 12px; color: var(--text-secondary); }
.comment-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }

.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.comment-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  transition: background var(--transition);
}
.comment-action-btn:hover { background: var(--bg-tertiary); color: var(--text); }
.comment-action-btn.active { color: var(--primary); }

/* ── Bottom Nav (Mobile) ──────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: var(--z-sidebar);
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  transition: color var(--transition);
  flex: 1;
  min-width: 0;
}
.bottom-nav-item .material-symbols-rounded { font-size: 24px; }
.bottom-nav-item.active, .bottom-nav-item:hover { color: var(--text); }
.bottom-nav-create { color: var(--primary) !important; }

/* ── Search Page ──────────────────────────────────────── */
.search-result-list { display: flex; flex-direction: column; gap: 16px; }

.search-video-card {
  display: flex;
  gap: 16px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}
.search-video-card:hover { background: var(--bg-tertiary); }

.search-thumb {
  width: 240px;
  flex-shrink: 0;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-tertiary);
  position: relative;
}
.search-thumb img { width: 100%; height: 100%; object-fit: cover; }

.search-meta { flex: 1; min-width: 0; }
.search-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.search-info {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.search-description { font-size: 13px; color: var(--text-secondary); }

.search-channel-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  transition: background var(--transition);
}
.search-channel-card:hover { background: var(--bg-tertiary); }

/* ── Channel Page ─────────────────────────────────────── */
.channel-banner {
  height: 200px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
}
.channel-banner img { width: 100%; height: 100%; object-fit: cover; }

.channel-header {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 0 24px 16px;
  flex-wrap: wrap;
}

.channel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  padding: 0 24px;
  margin-bottom: 24px;
}
.channel-tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.channel-tab.active, .channel-tab:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ── Shorts Page ──────────────────────────────────────── */
.shorts-container {
  height: calc(100vh - var(--header-h));
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.shorts-container::-webkit-scrollbar { display: none; }

.short-item {
  height: calc(100vh - var(--header-h));
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
}

.short-video { height: 100%; max-width: 400px; object-fit: contain; }

.short-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: #fff;
}

.short-actions {
  position: absolute;
  right: 16px;
  bottom: 120px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.short-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 12px;
}
.short-action-btn .material-symbols-rounded { font-size: 32px; }

/* ── Skeleton Loading ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card { display: flex; flex-direction: column; gap: 10px; }
.skeleton-thumb { aspect-ratio: 16/9; border-radius: var(--radius-md); }
.skeleton-line { height: 14px; }
.skeleton-line.w-full  { width: 100%; }
.skeleton-line.w-3-4   { width: 75%; }
.skeleton-line.w-1-2   { width: 50%; }
.skeleton-line.w-1-4   { width: 25%; }

/* ── Loading Spinner ──────────────────────────────────── */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilities ────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }

.mt-auto { margin-top: auto; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 20px;
  color: var(--text-secondary);
  text-align: center;
}
.empty-state .material-symbols-rounded { font-size: 64px; opacity: .3; }
.empty-state h3 { font-size: 18px; color: var(--text); }

/* ── Page sections ────────────────────────────────────── */
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1200px) {
  .watch-page { grid-template-columns: 1fr 360px; }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: var(--sidebar-w-mini); }
  .sidebar-nav .nav-item span:not(.material-symbols-rounded),
  .sidebar-nav .nav-section-title,
  .sidebar-nav .nav-divider { display: none; }
  .logo-text { display: none; }
}

@media (max-width: 768px) {
  #app {
    grid-template-areas: "header" "main";
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr;
  }

  .sidebar { display: none; }
  .bottom-nav { display: flex; }
  .main-content { padding-bottom: var(--bottom-nav-h); }

  .watch-page { grid-template-columns: 1fr; }
  .page-container { padding: 16px; }

  .search-thumb { width: 120px; }
  .search-title { font-size: 14px; }

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

@media (max-width: 480px) {
  .header-center .search-mic { display: none; }
  .video-grid { grid-template-columns: 1fr; }
}
