:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #272727;
  --bg-hover: #2f2f2f;
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --text-tertiary: #717171;
  --accent-purple: #a855f7;
  --accent-cyan: #06b6d4;
  --accent-purple-hover: #9333ea;
  --accent-cyan-hover: #0891b2;
  --border-color: #3f3f3f;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  gap: 20px;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.search-bar {
  flex: 1;
  max-width: 600px;
  display: flex;
  gap: 10px;
}

.search-bar input {
  flex: 1;
  padding: 10px 15px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s;
}

.search-bar input:focus {
  border-color: var(--accent-purple);
}

.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s;
  font-size: 20px;
}

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

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--accent-purple);
}

.user-menu-container {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: 45px;
  right: 0;
  width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s;
  z-index: 1001;
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-header {
  display: flex;
  gap: 12px;
  padding: 15px;
  align-items: center;
}

.dropdown-item {
  display: block;
  padding: 12px 15px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.3s;
}

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

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

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 60px;
  width: 240px;
  height: calc(100vh - 60px);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 20px 0;
  transition: transform 0.3s;
  z-index: 999;
}

.sidebar.collapsed {
  transform: translateX(-240px);
}

.sidebar-section {
  margin-bottom: 20px;
}

.sidebar-title {
  padding: 0 20px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 600;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.3s;
  cursor: pointer;
}

.sidebar-item:hover, .sidebar-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  border-left: 3px solid var(--accent-purple);
}

.sidebar-actions {
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(168, 85, 247, 0.4);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

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

/* Main Content */
.main-content {
  margin-left: 240px;
  margin-top: 60px;
  padding: 20px;
  width: calc(100% - 240px);
  transition: all 0.3s;
}

.main-content.expanded {
  margin-left: 0;
  width: 100%;
}

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

.video-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.video-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-tertiary);
}

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

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

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

.video-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

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

.live-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--error);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.verified-badge {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--accent-cyan);
  border-radius: 50%;
  margin-left: 4px;
}

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

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

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

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

.video-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s;
}

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

.action-btn.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.channel-info-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  margin-top: 15px;
}

.channel-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.channel-details {
  flex: 1;
}

.channel-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

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

.subscribe-btn {
  padding: 10px 20px;
  background: var(--accent-purple);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.subscribe-btn:hover {
  background: var(--accent-purple-hover);
}

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

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

.comment-input {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
}

.comment-input input {
  flex: 1;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  outline: none;
}

.comment {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

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

.comment-content {
  flex: 1;
}

.comment-author {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

.comment-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.comment-actions {
  display: flex;
  gap: 15px;
  font-size: 12px;
  color: var(--text-tertiary);
}

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

.related-video-card {
  display: flex;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s;
  padding: 8px;
  border-radius: 8px;
}

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

.related-thumbnail {
  width: 168px;
  aspect-ratio: 16/9;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent-purple);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 12px;
  border-left: 4px solid var(--accent-purple);
}

.stat-value {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 5px;
}

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

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
}

tr:hover {
  background: var(--bg-hover);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: var(--success);
  color: white;
}

.badge-error {
  background: var(--error);
  color: white;
}

.badge-warning {
  background: var(--warning);
  color: white;
}

.badge-info {
  background: var(--accent-cyan);
  color: white;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.tab {
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  color: var(--text-secondary);
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent-purple);
  border-bottom-color: var(--accent-purple);
}

/* Filters */
.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent-purple);
  color: white;
  border-color: var(--accent-purple);
}

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-240px);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
  }
  
  .video-grid {
    grid-template-columns: 1fr;
  }
  
  .search-bar {
    max-width: none;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Loading */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-tertiary);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
