@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
  --yt-spec-base-background: #ffffff;
  --yt-spec-raised-background: #f8f9fa;
  --yt-spec-menu-background: #ffffff;
  --yt-spec-text-primary: #0f0f0f;
  --yt-spec-text-secondary: #606060;
  --yt-spec-text-disabled: #909090;
  --yt-spec-icon-active: #0f0f0f;
  --yt-spec-icon-inactive: #606060;
  --yt-spec-badge-chip-background: rgba(0, 0, 0, 0.05);
  --yt-spec-badge-chip-background-active: #0f0f0f;
  --yt-spec-badge-chip-text-active: #ffffff;
  --yt-spec-button-chip-background: #f2f2f2;
  --yt-spec-button-chip-background-hover: #e5e5e5;
  --yt-spec-brand-red: #ff0000;
  --yt-spec-brand-red-hover: #cc0000;
  --yt-spec-subscribe-bg: #0f0f0f;
  --yt-spec-subscribe-text: #ffffff;
  --yt-spec-border: #e5e7eb;
  --yt-sidebar-width: 240px;
  --yt-header-height: 56px;
  --yt-card-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

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

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background-color: var(--yt-spec-base-background);
  color: var(--yt-spec-text-primary);
  line-height: 1.4;
  overflow-x: hidden;
}

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

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

.yt-icon-btn {
  background: transparent;
  border: none;
  color: var(--yt-spec-icon-active);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.yt-icon-btn:hover {
  background: var(--yt-spec-button-chip-background-hover);
}

.yt-icon-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.yt-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 4px;
  position: relative;
}

.yt-logo-svg {
  height: 20px;
}

.yt-country-code {
  font-size: 10px;
  color: var(--yt-spec-text-secondary);
  position: absolute;
  top: -4px;
  right: -16px;
}

/* Header Center Search */
.yt-header-center {
  flex: 0 1 732px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 16px;
}

.yt-search-form {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 600px;
}

.yt-search-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #ccc;
  border-right: none;
  border-radius: 40px 0 0 40px;
  padding: 0 16px;
  height: 40px;
  transition: border-color 0.2s;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}

.yt-search-box:focus-within {
  border-color: #1c62b9;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.yt-search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--yt-spec-text-primary);
  font-size: 16px;
  font-family: inherit;
}

.yt-search-btn {
  width: 64px;
  height: 40px;
  background: #f8f8f8;
  border: 1px solid #ccc;
  border-radius: 0 40px 40px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--yt-spec-icon-active);
  transition: background 0.2s;
}

.yt-search-btn:hover {
  background: #f0f0f0;
}

.yt-search-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.yt-mic-btn {
  margin-left: 12px;
  background: #f8f8f8;
  border: 1px solid transparent;
}

.yt-mic-btn:hover {
  background: #f0f0f0;
}

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

.yt-btn-admin-link {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f2f2f2;
  color: var(--yt-spec-text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 18px;
  border: 1px solid #e0e0e0;
  transition: all 0.2s;
}

.yt-btn-admin-link:hover {
  background: #e5e5e5;
  border-color: #ccc;
}

.yt-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  object-fit: cover;
}

/* Layout Wrapper */
.yt-app-layout {
  padding-top: var(--yt-header-height);
  display: flex;
  min-height: 100vh;
}

/* Left Sidebar Drawer */
.yt-sidebar {
  width: var(--yt-sidebar-width);
  background: var(--yt-spec-base-background);
  position: fixed;
  top: var(--yt-header-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  padding: 12px;
  z-index: 900;
  border-right: 1px solid var(--yt-spec-border);
  transition: transform 0.2s;
}

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

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

.yt-sidebar-item {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--yt-spec-text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: background 0.15s;
}

.yt-sidebar-item:hover {
  background: var(--yt-spec-button-chip-background-hover);
}

.yt-sidebar-item.active {
  background: var(--yt-spec-button-chip-background);
  font-weight: 600;
}

.yt-sidebar-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.yt-sidebar-heading {
  font-size: 14px;
  font-weight: 600;
  padding: 6px 14px;
  color: var(--yt-spec-text-secondary);
}

/* Main Content Area */
.yt-main-content {
  flex: 1;
  margin-left: var(--yt-sidebar-width);
  transition: margin-left 0.2s;
  min-height: calc(100vh - var(--yt-header-height));
  background-color: var(--yt-spec-base-background);
}

.yt-main-content.expanded {
  margin-left: 0;
}

/* Filter Chips Bar (Home Page) */
.yt-chips-container {
  position: sticky;
  top: var(--yt-header-height);
  background: var(--yt-spec-base-background);
  z-index: 100;
  padding: 12px 24px;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid #f0f0f0;
}

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

.yt-chip {
  background: var(--yt-spec-button-chip-background);
  color: var(--yt-spec-text-primary);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}

.yt-chip:hover {
  background: var(--yt-spec-button-chip-background-hover);
}

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

/* Home Video Grid */
.yt-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px 16px;
  padding: 24px;
}

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

.yt-grid-thumb-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  background: #f0f0f0;
  box-shadow: var(--yt-card-shadow);
}

.yt-grid-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

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

.yt-grid-details {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

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

.yt-grid-info {
  flex: 1;
}

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

.yt-grid-channel, .yt-grid-meta {
  font-size: 13px;
  color: var(--yt-spec-text-secondary);
}

.yt-grid-channel {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ====================================================== */
/* WATCH PAGE (Exact YouTube Light Watch Experience)      */
/* ====================================================== */

.yt-watch-layout {
  display: flex;
  justify-content: center;
  padding: 24px;
  gap: 24px;
  max-width: 1750px;
  margin: 0 auto;
}

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

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

/* Source Switcher Buttons */
.yt-source-btn {
  background: #f2f2f2;
  border: 1px solid #e0e0e0;
  color: var(--yt-spec-text-primary);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.yt-source-btn:hover {
  background: #e5e5e5;
}

.yt-source-btn.active {
  background: #0f0f0f;
  color: #ffffff;
  border-color: #0f0f0f;
  font-weight: 600;
}

/* Video Player Box */
.yt-player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.yt-player-iframe, .yt-html5-player {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Video Primary Metadata */
.yt-watch-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 14px;
  margin-bottom: 12px;
  color: var(--yt-spec-text-primary);
}

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

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

.yt-channel-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

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

.yt-channel-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--yt-spec-text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

.yt-verified-badge {
  width: 14px;
  height: 14px;
  fill: var(--yt-spec-text-secondary);
}

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

.yt-btn-subscribe {
  background: var(--yt-spec-subscribe-bg);
  color: var(--yt-spec-subscribe-text);
  border: none;
  border-radius: 20px;
  padding: 0 16px;
  height: 38px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-left: 12px;
}

.yt-btn-subscribe:hover {
  opacity: 0.9;
}

.yt-btn-subscribe.subscribed {
  background: #f2f2f2;
  color: #0f0f0f;
  border: 1px solid #ccc;
}

/* Action Buttons Pills */
.yt-watch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.yt-pill-group {
  display: flex;
  align-items: center;
  background: #f2f2f2;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
}

.yt-pill-btn {
  background: transparent;
  border: none;
  color: var(--yt-spec-text-primary);
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.yt-pill-btn:hover {
  background: #e5e5e5;
}

.yt-pill-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.yt-pill-btn.active svg {
  fill: var(--yt-spec-brand-red);
}

.yt-pill-divider {
  width: 1px;
  height: 20px;
  background: #dcdcdc;
}

.yt-standalone-pill {
  background: #f2f2f2;
  border-radius: 20px;
  padding: 0 16px;
  height: 38px;
  border: 1px solid #e5e5e5;
  color: var(--yt-spec-text-primary);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.yt-standalone-pill:hover {
  background: #e5e5e5;
}

.yt-standalone-pill svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Description Box */
.yt-description-box {
  background: #f2f2f2;
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

.yt-description-box:hover {
  background: #e8e8e8;
}

.yt-description-meta {
  font-weight: 600;
  color: var(--yt-spec-text-primary);
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
}

.yt-description-text {
  color: var(--yt-spec-text-primary);
  white-space: pre-line;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.yt-description-box.expanded .yt-description-text {
  display: block;
}

.yt-btn-toggle-desc {
  font-weight: 600;
  margin-top: 8px;
  display: inline-block;
  color: var(--yt-spec-text-primary);
}

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

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

.yt-comments-count {
  font-size: 20px;
  font-weight: 700;
}

.yt-comments-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--yt-spec-text-primary);
  background: none;
  border: none;
}

.yt-comments-sort svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Add Comment Form */
.yt-add-comment-box {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.yt-comment-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.yt-comment-input-wrap {
  flex: 1;
}

.yt-comment-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #ccc;
  padding-bottom: 6px;
  color: var(--yt-spec-text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
}

.yt-comment-input:focus {
  border-bottom: 2px solid var(--yt-spec-text-primary);
}

.yt-comment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.yt-btn-cancel-comment {
  background: transparent;
  border: none;
  color: var(--yt-spec-text-primary);
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.yt-btn-cancel-comment:hover {
  background: #f2f2f2;
}

.yt-btn-submit-comment {
  background: #065fd4;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.yt-btn-submit-comment:disabled {
  background: #f2f2f2;
  color: #909090;
  cursor: not-allowed;
}

/* Comment Item List */
.yt-comment-item {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.yt-comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.yt-comment-content {
  flex: 1;
}

.yt-comment-author-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.yt-comment-author-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--yt-spec-text-primary);
}

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

.yt-comment-text {
  font-size: 14px;
  line-height: 1.4;
  color: var(--yt-spec-text-primary);
  margin-bottom: 8px;
  word-break: break-word;
}

.yt-comment-footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

.yt-btn-comment-like, .yt-btn-comment-dislike, .yt-btn-comment-reply {
  background: transparent;
  border: none;
  color: var(--yt-spec-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s;
}

.yt-btn-comment-like:hover, .yt-btn-comment-dislike:hover, .yt-btn-comment-reply:hover {
  color: var(--yt-spec-text-primary);
}

.yt-btn-comment-like svg, .yt-btn-comment-dislike svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Right Recommendation Sidebar */
.yt-rec-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.yt-rec-chip {
  background: #f2f2f2;
  color: var(--yt-spec-text-primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.yt-rec-chip.active {
  background: #0f0f0f;
  color: #ffffff;
}

.yt-compact-video-card {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  text-decoration: none;
  color: inherit;
}

.yt-compact-thumb-box {
  position: relative;
  width: 168px;
  min-width: 168px;
  aspect-ratio: 16/9;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
}

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

.yt-compact-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 4px;
}

.yt-compact-info {
  flex: 1;
  min-width: 0;
}

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

.yt-compact-channel, .yt-compact-views {
  font-size: 12px;
  color: var(--yt-spec-text-secondary);
  line-height: 1.3;
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .yt-watch-layout {
    flex-direction: column;
    padding: 16px;
  }
  .yt-watch-secondary {
    width: 100%;
  }
  .yt-compact-thumb-box {
    width: 160px;
    min-width: 160px;
  }
}

@media (max-width: 900px) {
  .yt-sidebar {
    transform: translateX(-100%);
    position: fixed;
    top: var(--yt-header-height);
    left: 0;
    bottom: 0;
    z-index: 2000;
  }
  .yt-main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw;
  }
  .yt-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  }
  .yt-video-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    padding: 16px;
  }
  .yt-chips-container {
    padding: 10px 16px;
  }
}

@media (max-width: 768px) {
  /* Hide channel info, like, dislike, share, download buttons */
  .yt-watch-owner-row {
    display: none !important;
  }
  
  /* Hide video description box */
  .yt-description-box {
    display: none !important;
  }
  
  /* Hide comments section completely */
  .yt-comments-section {
    display: none !important;
  }

  .yt-watch-title {
    font-size: 16px;
    margin-bottom: 12px;
    padding: 0 4px;
  }
}

@media (max-width: 600px) {
  .yt-header {
    padding: 0 10px;
    height: 48px;
  }
  .yt-header-left {
    gap: 8px;
  }
  .yt-header-center {
    flex: 1;
    margin: 0 6px;
  }
  .yt-search-form {
    width: 100%;
  }
  .yt-search-box {
    height: 32px;
    padding: 0 10px;
  }
  .yt-search-input {
    font-size: 13px;
  }
  .yt-search-btn {
    width: 38px;
    height: 32px;
  }
  .yt-search-btn svg {
    width: 18px;
    height: 18px;
  }
  .yt-mic-btn {
    display: none;
  }
  
  /* Home Chips Container */
  .yt-chips-container {
    top: 48px;
    padding: 8px 10px;
    gap: 6px;
  }
  .yt-chip {
    padding: 4px 10px;
    font-size: 12.5px;
    border-radius: 6px;
  }

  /* Home Video Grid (Edge to Edge YouTube Mobile Experience) */
  .yt-video-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 0 0 16px 0;
  }
  .yt-grid-card {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
  }
  .yt-grid-thumb-box {
    border-radius: 0;
    aspect-ratio: 16/9;
  }
  .yt-grid-details {
    padding: 10px 12px 0 12px;
    gap: 10px;
    margin-top: 0;
  }
  .yt-grid-avatar {
    width: 32px;
    height: 32px;
  }
  .yt-grid-title {
    font-size: 14px;
    line-height: 1.35;
    margin-bottom: 3px;
  }
  .yt-grid-channel, .yt-grid-meta {
    font-size: 12px;
  }

  /* Watch layout on mobile */
  .yt-watch-layout {
    padding: 0;
  }
  .yt-player-container {
    border-radius: 0;
  }
  .yt-watch-primary, .yt-watch-secondary {
    padding: 8px 12px;
  }
}
