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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f172a;
  color: #f1f5f9;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.header h1 { font-size: 1.8rem; }

.live-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: #1e293b;
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-card.subscribers::before { background: #3b82f6; }
.stat-card.views::before { background: #22c55e; }
.stat-card.posts::before { background: #a855f7; }
.stat-card.average::before { background: #f97316; }

.stat-icon { font-size: 2rem; margin-bottom: 10px; }
.stat-value { font-size: 2rem; font-weight: 700; }
.stat-label { color: #94a3b8; margin-top: 5px; }
.stat-change { margin-top: 10px; font-size: 0.9rem; }
.positive { color: #22c55e; }
.negative { color: #ef4444; }
.neutral { color: #94a3b8; }

.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: #1e293b;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

.chart-card h2 {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.chart-container {
  height: 250px;
  position: relative;
}

/* Subscriber Chart Styles */
.subscriber-section {
  margin-bottom: 30px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.chart-header h2 {
  margin-bottom: 0;
}

.time-selector {
  display: flex;
  gap: 8px;
}

.time-btn {
  background: #334155;
  border: none;
  color: #94a3b8;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  font-weight: 500;
}

.time-btn:hover {
  background: #475569;
  color: #f1f5f9;
}

.time-btn.active {
  background: #22c55e;
  color: white;
}

.chart-stats {
  margin-top: 12px;
  text-align: right;
}

.growth-indicator {
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 500;
}

.growth-indicator.positive {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.growth-indicator.negative {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.growth-indicator.neutral {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.subscriber-chart {
  height: 280px;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  gap: 3px;
}

.heatmap-hour, .heatmap-day {
  font-size: 0.7rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: #334155;
}

.heatmap-cell.level-1 { background: rgba(59, 130, 246, 0.2); }
.heatmap-cell.level-2 { background: rgba(59, 130, 246, 0.4); }
.heatmap-cell.level-3 { background: rgba(59, 130, 246, 0.6); }
.heatmap-cell.level-4 { background: rgba(59, 130, 246, 0.8); }
.heatmap-cell.level-5 { background: #3b82f6; }
.heatmap-cell.level-0 { background: #1e293b; }
.heatmap-cell.level-6 { background: #2563eb; }
.heatmap-cell.level-7 { background: #1d4ed8; }

.posts-list { display: flex; flex-direction: column; gap: 12px; }

.post-item {
  display: flex;
  align-items: center;
  gap: 15px;
  background: #334155;
  padding: 16px;
  border-radius: 12px;
}

.post-rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: #475569;
}

.post-rank.rank-1 { background: #fbbf24; color: #0f172a; }
.post-rank.rank-2 { background: #94a3b8; color: #0f172a; }
.post-rank.rank-3 { background: #d97706; color: #0f172a; }

.post-type { font-size: 1.5rem; }
.post-content { flex: 1; }
.post-preview { margin-bottom: 5px; }
.post-meta { font-size: 0.8rem; color: #94a3b8; }
.post-stats { text-align: right; }
.post-views { font-weight: 600; }
.post-forwards { font-size: 0.8rem; color: #94a3b8; }

.footer {
  text-align: center;
  color: #94a3b8;
  padding: 20px;
  font-size: 0.9rem;
}

.error-page {
  text-align: center;
  padding: 100px 20px;
}

.error-page h1 { font-size: 3rem; margin-bottom: 20px; }
.back-link { color: #3b82f6; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
  .chart-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .header { flex-direction: column; gap: 15px; text-align: center; }
  .time-selector {
    flex-wrap: wrap;
  }
  .time-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
}

/* Channel Header Styles */
.channel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 24px;
  border: 1px solid rgba(247, 147, 26, 0.2);
}

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

.channel-avatar img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #f7931a;
  object-fit: cover;
}

.channel-details h1 {
  margin: 0 0 4px 0;
  font-size: 1.75rem;
  color: #f1f5f9;
}

.channel-link {
  color: #f7931a;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.2s;
}

.channel-link:hover {
  color: #fbbf24;
  text-decoration: underline;
}

.channel-about {
  margin: 8px 0 0 0;
  color: #94a3b8;
  font-size: 0.9rem;
  max-width: 500px;
  line-height: 1.4;
}

.header-right {
  display: flex;
  align-items: center;
}
