/* YouTube Clone Dark Theme Stylesheet */
:root {
  --yt-bg-black: #0f0f0f;
  --yt-bg-sidebar: #0f0f0f;
  --yt-card-bg: #1f1f1f;
  --yt-hover-bg: #272727;
  --yt-active-bg: #3f3f3f;
  --yt-text-primary: #f1f1f1;
  --yt-text-secondary: #aaaaaa;
  --yt-red: #ff0000;
  --yt-red-hover: #cc0000;
  --yt-border: #303030;
  --yt-chip-bg: #272727;
  --yt-chip-active-bg: #f1f1f1;
  --yt-chip-active-text: #0f0f0f;
  --yt-sidebar-width: 240px;
  --yt-header-height: 56px;
  --font-family: "Roboto", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--yt-bg-black);
  color: var(--yt-text-primary);
  font-family: var(--font-family);
  overflow-x: hidden;
  line-height: 1.4;
}

/* Header Navbar */
.yt-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--yt-header-height);
  background-color: var(--yt-bg-black);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  border-bottom: 1px solid var(--yt-border);
}

.yt-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.yt-menu-btn {
  background: none;
  border: none;
  color: var(--yt-text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-menu-btn:hover {
  background-color: var(--yt-hover-bg);
}

.yt-logo {
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--yt-text-primary);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.yt-logo-icon {
  background-color: var(--yt-red);
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-header-center {
  flex: 0 1 600px;
  display: flex;
  align-items: center;
}

.yt-search-box {
  display: flex;
  width: 100%;
  align-items: center;
}

.yt-search-input {
  width: 100%;
  height: 40px;
  background-color: #121212;
  border: 1px solid var(--yt-border);
  border-radius: 40px 0 0 40px;
  padding: 0 16px;
  color: var(--yt-text-primary);
  font-size: 16px;
  outline: none;
}

.yt-search-input:focus {
  border-color: #1c62b9;
}

.yt-search-btn {
  height: 40px;
  width: 64px;
  background-color: var(--yt-hover-bg);
  border: 1px solid var(--yt-border);
  border-left: none;
  border-radius: 0 40px 40px 0;
  color: var(--yt-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.yt-search-btn:hover {
  background-color: var(--yt-active-bg);
}

.yt-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.yt-icon-btn {
  background: none;
  border: none;
  color: var(--yt-text-primary);
  font-size: 18px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-icon-btn:hover {
  background-color: var(--yt-hover-bg);
}

.yt-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: #795548;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

/* Sidebar Drawer */
.yt-sidebar {
  position: fixed;
  top: var(--yt-header-height);
  left: 0;
  bottom: 0;
  width: var(--yt-sidebar-width);
  background-color: var(--yt-bg-sidebar);
  padding: 12px;
  overflow-y: auto;
  z-index: 990;
  transition: transform 0.2s ease;
}

.yt-sidebar-section {
  border-bottom: 1px solid var(--yt-border);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.yt-sidebar-section:last-child {
  border-bottom: none;
}

.yt-sidebar-title {
  color: var(--yt-text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.yt-sidebar-link {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 12px;
  color: var(--yt-text-primary);
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}

.yt-sidebar-link:hover {
  background-color: var(--yt-hover-bg);
}

.yt-sidebar-link.active {
  background-color: var(--yt-hover-bg);
  font-weight: 600;
}

.yt-channel-avatar-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  font-weight: bold;
}

/* Main Container Layout */
.yt-main-content {
  margin-top: var(--yt-header-height);
  margin-left: var(--yt-sidebar-width);
  padding: 24px;
  min-height: calc(100vh - var(--yt-header-height));
  transition: margin-left 0.2s ease;
}

body.sidebar-collapsed .yt-sidebar {
  transform: translateX(-100%);
}

body.sidebar-collapsed .yt-main-content {
  margin-left: 0;
}

/* Category Filter Chips */
.yt-chips-container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 20px;
  scrollbar-width: none;
}

.yt-chips-container::-webkit-scrollbar {
  display: none;
}

.yt-chip {
  background-color: var(--yt-chip-bg);
  color: var(--yt-text-primary);
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
}

.yt-chip:hover {
  background-color: var(--yt-active-bg);
}

.yt-chip.active {
  background-color: var(--yt-chip-active-bg);
  color: var(--yt-chip-active-text);
}

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

.yt-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.yt-thumbnail-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background-color: #272727;
  border-radius: 12px;
  overflow: hidden;
}

.yt-thumbnail-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.yt-card:hover .yt-thumbnail-img {
  transform: scale(1.03);
}

.yt-duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #ffffff;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.yt-resolution-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(255, 0, 0, 0.85);
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.yt-card-info {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.yt-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  font-size: 14px;
}

.yt-card-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.yt-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--yt-text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.yt-card-channel {
  font-size: 13px;
  color: var(--yt-text-secondary);
  text-decoration: none;
}

.yt-card-channel:hover {
  color: var(--yt-text-primary);
}

.yt-card-meta {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

/* Watch Page Layout */
.yt-watch-layout {
  display: flex;
  gap: 24px;
  max-width: 1700px;
  margin: 0 auto;
}

.yt-watch-primary {
  flex: 1;
  min-width: 0;
}

.yt-watch-secondary {
  width: 400px;
  flex-shrink: 0;
}

.yt-player-container {
  width: 100%;
  padding-top: 56.25%;
  position: relative;
  background-color: #000000;
  border-radius: 12px;
  overflow: hidden;
}

.yt-player-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.yt-watch-title {
  font-size: 20px;
  font-weight: 700;
  margin-top: 16px;
  margin-bottom: 12px;
}

.yt-watch-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 16px;
}

.yt-channel-owner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.yt-channel-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  font-weight: bold;
}

.yt-owner-meta {
  display: flex;
  flex-direction: column;
}

.yt-owner-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--yt-text-primary);
  text-decoration: none;
}

.yt-owner-name:hover {
  text-decoration: underline;
}

.yt-owner-subs {
  font-size: 12px;
  color: var(--yt-text-secondary);
}

.yt-btn-subscribe {
  background-color: var(--yt-text-primary);
  color: var(--yt-bg-black);
  border: none;
  padding: 10px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-left: 12px;
}

.yt-btn-subscribe:hover {
  background-color: #d9d9d9;
}

.yt-btn-subscribe.subscribed {
  background-color: var(--yt-chip-bg);
  color: var(--yt-text-primary);
}

.yt-action-buttons {
  display: flex;
  gap: 8px;
}

.yt-btn-action {
  background-color: var(--yt-chip-bg);
  color: var(--yt-text-primary);
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.yt-btn-action:hover {
  background-color: var(--yt-hover-bg);
}

/* Description Box */
.yt-description-box {
  background-color: var(--yt-card-bg);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.yt-description-box.collapsed {
  max-height: 100px;
  overflow: hidden;
  position: relative;
}

.yt-description-toggle {
  background: none;
  border: none;
  color: var(--yt-text-primary);
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

/* Comments Section */
.yt-comments-section {
  margin-top: 24px;
}

.yt-comments-header {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.yt-comment-input-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.yt-comment-input {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 1px solid var(--yt-border);
  color: var(--yt-text-primary);
  font-size: 14px;
  padding: 8px 0;
  outline: none;
}

.yt-comment-input:focus {
  border-bottom-color: var(--yt-text-primary);
}

/* Sidebar Recommended Grid */
.yt-secondary-card {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
}

.yt-secondary-thumb {
  width: 168px;
  height: 94px;
  background-color: #272727;
  border-radius: 8px;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.yt-secondary-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-secondary-info {
  display: flex;
  flex-direction: column;
}

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

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

/* Channel Header Banner */
.yt-channel-banner {
  height: 180px;
  background: linear-gradient(135deg, #1c62b9 0%, #009688 100%);
  border-radius: 16px;
  margin-bottom: 20px;
}

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

.yt-channel-header-avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: white;
  font-weight: bold;
}

/* Responsive Rules */
@media (max-width: 1024px) {
  .yt-watch-layout {
    flex-direction: column;
  }
  .yt-watch-secondary {
    width: 100%;
  }
}

@media (max-width: 768px) {
  :root {
    --yt-sidebar-width: 0px;
  }

  .yt-sidebar {
    position: fixed !important;
    top: var(--yt-header-height) !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 250px !important;
    background-color: #0f0f0f !important;
    z-index: 9999 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1) !important;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.8) !important;
    display: block !important;
  }

  body.mobile-sidebar-open .yt-sidebar,
  body.sidebar-open .yt-sidebar {
    transform: translateX(0) !important;
  }

  /* Backdrop overlay */
  .yt-sidebar-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.7) !important;
    z-index: 9998 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  body.mobile-sidebar-open .yt-sidebar-backdrop,
  body.sidebar-open .yt-sidebar-backdrop {
    opacity: 1 !important;
    pointer-events: auto !important;
  }


  .yt-main-content {
    margin-left: 0 !important;
    padding: 12px !important;
  }

  .yt-header-center {
    max-width: 200px;
  }

  .yt-search-input {
    font-size: 13px;
    padding: 6px 10px;
  }

  .yt-shorts-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}


/* YouTube Shorts Shelf */
.yt-shorts-shelf {
  margin: 32px 0;
  padding: 20px 0;
  border-top: 1px solid var(--yt-border-color);
  border-bottom: 1px solid var(--yt-border-color);
}

.yt-shorts-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.yt-shorts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.yt-short-card {
  text-decoration: none;
  color: var(--yt-text-primary);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.yt-short-card:hover {
  transform: translateY(-4px);
}

.yt-short-thumb-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background-color: #1f1f1f;
  border-radius: 12px;
  overflow: hidden;
}

.yt-short-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-short-title {
  font-size: 14px;
  font-weight: 500;
  margin-top: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yt-short-views {
  font-size: 12px;
  color: var(--yt-text-secondary);
  margin-top: 4px;
}

