
:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #272727;
  --bg-hover: #3e3e3e;
  --bg-active: #505050;
  --bg-chip: #333333;
  --bg-chip-active: #f1f1f1;
  --text-primary: #f1f1f1;
  --text-secondary: #aaaaaa;
  --text-chip-active: #0f0f0f;
  --border-color: #303030;
  --red-primary: #ff0000;
  --red-hover: #cc0000;
  --blue-link: #3ea6ff;
  --sidebar-width: 240px;
  --sidebar-mini-width: 72px;
  --header-height: 56px;
  --font-primary: 'Roboto', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

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

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

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

.logo {
  display: flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-text {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -1.5px;
}

.logo-country {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: -10px;
  margin-left: 2px;
}

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

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

.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 640px;
  margin: 0 40px;
}

.search-form {
  display: flex;
  flex: 1;
  height: 40px;
}

.search-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: 20px 0 0 20px;
  padding: 0 16px;
  position: relative;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.clear-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn {
  width: 64px;
  height: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0 20px 20px 0;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.voice-btn {
  background: var(--bg-secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  justify-content: flex-end;
}

.notifications-btn {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--red-primary);
  color: white;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
}

.avatar-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  margin-left: 8px;
}

.avatar-btn img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-primary);
  overflow-y: auto;
  padding: 12px 0;
  z-index: 900;
  transition: transform 0.3s ease;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 4px;
}

.sidebar-section {
  padding: 0 12px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 12px;
  height: 40px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  transition: background 0.2s;
}

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

.sidebar-link.active {
  background: var(--bg-secondary);
  font-weight: 500;
}

.sidebar-link svg {
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-color);
  margin: 12px 0;
}

.sidebar-title {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.channel-link {
  gap: 24px;
}

.channel-link img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.sidebar-footer {
  padding: 16px 24px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Mini Sidebar */
.sidebar-mini {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-mini-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-primary);
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  z-index: 900;
}

.sidebar-mini-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 64px;
  height: 74px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 10px;
  transition: background 0.2s;
}

.sidebar-mini-link:hover {
  background: var(--bg-secondary);
}

.sidebar-mini-link.active {
  background: var(--bg-secondary);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 16px 24px;
  min-height: calc(100vh - var(--header-height));
}

/* Chips */
.chips-container {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 16px;
  position: sticky;
  top: var(--header-height);
  background: var(--bg-primary);
  z-index: 100;
  padding-top: 8px;
}

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

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

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

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

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

.video-card {
  cursor: pointer;
  transition: transform 0.2s;
}

.video-card:hover {
  transform: scale(1.02);
}

.thumbnail-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.thumbnail-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.video-info-card {
  display: flex;
  gap: 12px;
  padding: 12px 0;
}

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

.video-details {
  flex: 1;
}

.video-title-card {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.video-meta p {
  margin-bottom: 2px;
}

.video-meta .channel-name-card {
  display: flex;
  align-items: center;
  gap: 4px;
}

.verified-badge {
  width: 14px;
  height: 14px;
}

/* Video Page */
.video-page {
  margin-left: 0;
  margin-top: var(--header-height);
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
}

.video-page-content {
  max-width: 1800px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
}

.video-primary {
  max-width: 100%;
}

.video-player-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.video-player {
  width: 100%;
  height: 100%;
  position: relative;
}

.video-player img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  opacity: 1;
  transition: opacity 0.3s;
}

.player-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.play-btn-large {
  width: 68px;
  height: 48px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.play-btn-large:hover {
  background: var(--red-primary);
}

.player-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  padding: 40px 12px 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.video-player:hover .player-controls {
  opacity: 1;
}

.progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  margin-bottom: 8px;
}

.progress-bar:hover {
  height: 5px;
}

.progress-filled {
  height: 100%;
  background: var(--red-primary);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s;
}

.progress-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 13px;
  height: 13px;
  background: var(--red-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.2s;
}

.progress-bar:hover .progress-handle {
  opacity: 1;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.time-display {
  font-size: 13px;
  color: white;
  margin-left: 8px;
}

/* Video Info */
.video-info {
  padding: 16px 0;
}

.video-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 12px;
}

.video-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.video-channel-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.video-channel-info img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.channel-details {
  display: flex;
  flex-direction: column;
}

.channel-name {
  font-size: 16px;
  font-weight: 500;
}

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

.subscribe-btn {
  padding: 10px 16px;
  border-radius: 20px;
  border: none;
  background: white;
  color: #0f0f0f;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

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

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

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

.action-group {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: 20px;
  overflow: hidden;
}

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

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

.like-btn {
  border-right: 1px solid var(--border-color);
}

.like-btn.liked {
  color: var(--blue-link);
}

.share-btn, .download-btn, .more-btn {
  background: var(--bg-secondary);
  border-radius: 20px;
}

/* Description */
.video-description {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 24px;
  font-size: 14px;
}

.video-description p {
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.video-description.expanded p {
  max-height: none;
}

.video-description:not(.expanded) p {
  max-height: 60px;
  overflow: hidden;
}

.show-more-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
}

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

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

.comments-header h3 {
  font-size: 16px;
  font-weight: 600;
}

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

.comment-input-container {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.comment-input-container img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.comment-input-wrapper {
  flex: 1;
}

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

.comment-input:focus {
  border-bottom-color: white;
}

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

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

.cancel-btn:hover {
  background: var(--bg-secondary);
}

.comment-submit-btn {
  padding: 10px 16px;
  border-radius: 20px;
  border: none;
  background: var(--blue-link);
  color: #0f0f0f;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.5;
}

.comment-submit-btn:not(:disabled) {
  opacity: 1;
}

.comment-submit-btn:not(:disabled):hover {
  background: #65b8ff;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.comment-item {
  display: flex;
  gap: 16px;
}

.comment-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.comment-content {
  flex: 1;
}

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

.comment-author {
  font-size: 13px;
  font-weight: 500;
}

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

.comment-text {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
}

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

.comment-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
}

.comment-action-btn:hover {
  color: var(--text-primary);
}

/* Related Videos */
.video-secondary {
  max-width: 400px;
}

.related-header {
  margin-bottom: 16px;
}

.related-chips {
  display: flex;
  gap: 8px;
}

.related-chip {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: var(--bg-chip);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

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

.related-video-card {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.2s;
}

.related-video-card:hover {
  background: var(--bg-secondary);
}

.related-thumbnail {
  width: 168px;
  height: 94px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  background: var(--bg-secondary);
}

.related-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 4px;
  border-radius: 4px;
}

.related-info {
  flex: 1;
}

.related-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-channel {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

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

/* User Menu */
.user-menu {
  position: fixed;
  top: var(--header-height);
  right: 16px;
  width: 300px;
  background: var(--bg-secondary);
  border-radius: 12px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
  z-index: 1100;
  overflow: hidden;
}

.user-menu-header {
  display: flex;
  gap: 16px;
  padding: 16px;
}

.user-menu-header img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.user-name {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 2px;
}

.user-email {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.manage-account {
  font-size: 14px;
  color: var(--blue-link);
  text-decoration: none;
}

.manage-account:hover {
  text-decoration: underline;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-color);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 14px;
  transition: background 0.2s;
}

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

/* Responsive */
@media (max-width: 1200px) {
  .video-page-content {
    grid-template-columns: 1fr;
  }
  .video-secondary {
    max-width: 100%;
  }
  .related-videos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
  }
  .related-video-card {
    flex-direction: column;
  }
  .related-thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-mini {
    display: flex;
  }
  .main-content {
    margin-left: var(--sidebar-mini-width);
  }
}

@media (max-width: 768px) {
  .header-center {
    margin: 0 16px;
  }
  .voice-btn {
    display: none;
  }
  .video-grid {
    grid-template-columns: 1fr;
  }
  .main-content {
    margin-left: 0;
    padding: 16px;
  }
  .sidebar-mini {
    display: none;
  }
  .video-meta-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .video-actions {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .header-left {
    min-width: auto;
  }
  .logo-text {
    display: none;
  }
  .header-right {
    min-width: auto;
  }
  .create-btn {
    display: none;
  }
}
