:root {
  --bg-deep: #0a0a0f;
  --bg-card: #12121a;
  --bg-elevated: #1a1a2e;
  
  --text-primary: #ffffff;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;
  
  --accent-red: #FF0000;
  --accent-cyan: #00D4FF;
  --accent-gradient: linear-gradient(135deg, #FF0050 0%, #7000FF 100%);
  
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: 1px solid rgba(255, 255, 255, 0.06);
  --glass-blur: blur(16px);
  
  --skel-bg: linear-gradient(90deg, #1a1a2e 25%, #2a2a3e 50%, #1a1a2e 75%);
  
  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-pill: 50px;
  
  --font-body: 'Inter', sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;
}

[data-theme="light"] {
  --bg-deep: #f0f3f9;
  --bg-card: #ffffff;
  --bg-elevated: #e2e8f0;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: 1px solid rgba(0, 0, 0, 0.08);
  
  --skel-bg: linear-gradient(90deg, #e2e8f0 25%, #cbd5e1 50%, #e2e8f0 75%);
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  margin-bottom: 0.5em;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: all 0.3s ease;
}

a:hover {
  color: var(--text-primary);
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

header {
  padding: 1.5rem 2rem;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-title {
  font-size: 2rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.theme-toggle-btn {
  background: var(--glass-bg);
  border: var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.theme-toggle-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 4rem 1rem;
}

/* Glass Card */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

/* Search Section */
#search-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 3rem;
  animation: fadeInUp 0.8s ease-out;
}

.search-title {
  font-size: 2.2rem;
  font-family: var(--font-heading);
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.search-container {
  display: flex;
  width: 100%;
  max-width: 600px;
  position: relative;
  margin-bottom: 1rem;
}

#search-input {
  flex: 1;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

#search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

#search-button {
  position: absolute;
  right: 6px;
  top: 6px;
  bottom: 6px;
  padding: 0 1.5rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent-gradient);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#search-button:hover {
  animation: pulse 1.5s infinite;
  box-shadow: 0 0 15px rgba(255, 0, 80, 0.5);
}

.search-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.hidden {
  display: none !important;
}

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

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes glow {
  0% { box-shadow: 0 0 5px rgba(0, 212, 255, 0.2); }
  50% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.6); }
  100% { box-shadow: 0 0 5px rgba(0, 212, 255, 0.2); }
}

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

/* Hero Section */
#hero-section {
  position: relative;
  margin-bottom: 2rem;
  animation: fadeInUp 0.5s ease-out;
}

.banner {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-card);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

.banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg-deep), transparent);
}

.banner.no-image {
  background: var(--accent-gradient);
  opacity: 0.5;
}

.channel-info {
  display: flex;
  align-items: flex-end;
  margin-top: -60px;
  position: relative;
  z-index: 2;
  padding: 0 2rem;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--bg-deep);
  background: var(--bg-card);
  object-fit: cover;
}

.info-text {
  margin-left: 1.5rem;
  padding-bottom: 0.5rem;
}

.channel-name {
  font-size: 2.5rem;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.verified-badge {
  color: var(--accent-cyan);
  font-size: 1.5rem;
}

.channel-meta {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.copy-id-btn {
  background: var(--glass-bg);
  border: var(--glass-border);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s;
}

.copy-id-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

/* Stats Section */
#stats-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
  animation: fadeInUp 0.6s ease-out;
}

.stat-card {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  animation: glow 2s infinite;
  border-color: var(--accent-cyan);
}

.stat-value {
  font-size: 2.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Analytics Section */
#analytics-section {
  margin-bottom: 2rem;
  animation: fadeInUp 0.7s ease-out;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
}

.analytics-item {
  display: flex;
  flex-direction: column;
}

.analytics-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.analytics-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Layout for Description, Links, Keywords */
.meta-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .meta-grid {
    grid-template-columns: 1fr;
  }
}

/* Description Section */
#description-section {
  animation: fadeInUp 0.8s ease-out;
}

.description-text {
  color: var(--text-secondary);
  white-space: pre-wrap;
  position: relative;
  overflow: hidden;
  max-height: 150px;
  transition: max-height 0.3s ease;
}

.description-text.expanded {
  max-height: 2000px;
}

.show-more-btn {
  background: none;
  border: none;
  color: var(--accent-cyan);
  cursor: pointer;
  font-weight: 600;
  margin-top: 0.5rem;
  padding: 0;
}

/* Keywords Section */
#keywords-section {
  animation: fadeInUp 0.9s ease-out;
  margin-bottom: 1.5rem;
}

.keywords-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.keyword-tag {
  background: var(--glass-bg);
  border: 1px solid rgba(255, 0, 80, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.keyword-tag:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* Links Section */
#links-section {
  animation: fadeInUp 0.9s ease-out;
}

.links-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.link-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-primary);
  transition: all 0.3s;
}

.link-btn:hover {
  background: var(--accent-cyan);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

/* Videos Section */
#videos-section {
  margin-bottom: 2rem;
  animation: fadeInUp 1s ease-out;
}

.section-title {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 24px;
  background: var(--accent-gradient);
  border-radius: 4px;
}

.videos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.video-card {
  background: var(--glass-bg);
  border: var(--glass-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: all 0.3s;
  display: block;
}

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

.video-thumb-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
}

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

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

.video-info {
  padding: 1rem;
}

.video-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.video-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.video-meta span::after {
  content: '•';
  margin-left: 0.5rem;
}
.video-meta span:last-child::after {
  content: '';
}

/* Trailer Section */
#trailer-section {
  margin-bottom: 2rem;
  animation: fadeInUp 1.1s ease-out;
}

.trailer-container {
  aspect-ratio: 16/9;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.trailer-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Playlists Section */
#playlists-section {
  margin-bottom: 2rem;
  animation: fadeInUp 1.2s ease-out;
}

.playlists-row {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  padding-bottom: 1rem;
  scrollbar-width: thin;
}

.playlist-card {
  min-width: 240px;
  max-width: 240px;
  flex: 0 0 auto;
}

.playlist-thumb-container {
  position: relative;
  aspect-ratio: 16/9;
}

.playlist-count {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40%;
  background: rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
}

.playlist-info {
  padding: 0.75rem 0;
}

.playlist-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Skeleton */
.skeleton {
  background: var(--skel-bg);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

#skeleton-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.skel-hero { height: 200px; border-radius: var(--radius-card); }
.skel-avatar { width: 120px; height: 120px; border-radius: 50%; margin-top: -60px; margin-left: 2rem; }
.skel-text { height: 20px; width: 50%; margin-bottom: 0.5rem; margin-left: 2rem;}
.skel-stats { display: flex; gap: 1.5rem; margin-top: 1rem; }
.skel-stat { height: 100px; flex: 1; border-radius: var(--radius-card); }
.skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.skel-video { height: 250px; border-radius: var(--radius-card); }

/* Error/Empty */
#error-section, #empty-state {
  text-align: center;
  padding: 4rem 1rem;
  animation: fadeInUp 0.5s ease-out;
}

.error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: var(--accent-red);
}

.retry-btn {
  margin-top: 1.5rem;
  padding: 0.75rem 2rem;
  background: var(--glass-bg);
  border: 1px solid var(--accent-red);
  color: var(--text-primary);
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: all 0.3s;
}

.retry-btn:hover {
  background: var(--accent-red);
}

footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-primary);
  color: var(--bg-deep);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 480px) {
  .channel-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: -60px;
  }
  .info-text { margin-left: 0; margin-top: 1rem; }
  .channel-meta { justify-content: center; flex-wrap: wrap;}
  .videos-grid { grid-template-columns: 1fr; }
}
