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

:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

html {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--gray-900);
}

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

/* Header */
.header {
  background: white;
  border-radius: 12px;
  margin: 2rem 0 2rem 0;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.875rem;
  font-weight: bold;
  color: var(--primary);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-refresh {
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-refresh:hover {
  background: var(--primary-dark);
}

.btn-refresh.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Loading State */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 2rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-container p {
  color: white;
  font-size: 1.125rem;
}

/* Error State */
.error-container {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  color: var(--danger);
}

.error-container p {
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
}

/* Dashboard */
.dashboard {
  margin-bottom: 2rem;
}

section {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}

section h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--gray-900);
}

section h3 {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
  color: var(--gray-900);
  font-weight: 600;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.card {
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.card-icon {
  font-size: 2.5rem;
  min-width: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-content {
  flex: 1;
}

.card-label {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.card-value {
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--primary);
}

/* Charts Section */
.charts-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.chart-container,
.list-container {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
}

.simple-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 250px;
  gap: 0.75rem;
}

.chart-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 8px 8px 0 0;
  position: relative;
  transition: all 0.3s ease;
  cursor: pointer;
  min-height: 20px;
}

.chart-bar:hover {
  opacity: 0.8;
  filter: brightness(1.1);
}

.chart-bar-label {
  position: absolute;
  bottom: -25px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray-600);
  white-space: nowrap;
}

.chart-bar-value {
  position: absolute;
  top: -25px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
}

/* Lists */
.list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: 8px;
  border-right: 4px solid var(--primary);
  transition: all 0.2s ease;
}

.list-item:hover {
  background: var(--gray-100);
  transform: translateX(-4px);
}

.list-item-title {
  font-weight: 500;
  color: var(--gray-900);
}

.list-item-value {
  font-weight: 600;
  color: var(--primary);
  font-size: 1.125rem;
}

/* Channel Section */
.channel-section {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.channel-name {
  min-width: 150px;
  font-weight: 500;
  color: var(--gray-900);
}

.channel-bar {
  flex: 1;
  height: 40px;
  background: var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}

.channel-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 1rem;
  min-width: 50px;
  font-weight: 600;
  color: white;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

.channel-item:hover .channel-fill {
  filter: brightness(1.1);
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo {
    font-size: 1.5rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .charts-section {
    grid-template-columns: 1fr;
  }

  .chart-container,
  .list-container {
    padding: 1rem;
  }

  .simple-chart {
    height: 200px;
  }

  section {
    padding: 1.5rem;
    margin-bottom: 1rem;
  }

  .header {
    margin: 1rem 0;
    padding: 1.5rem;
  }

  .container {
    padding: 0 0.5rem;
  }
}

@media (max-width: 480px) {
  .logo {
    font-size: 1.25rem;
  }

  section h2 {
    font-size: 1.25rem;
  }

  section h3 {
    font-size: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .card-icon {
    font-size: 2rem;
  }

  .card-value {
    font-size: 1.5rem;
  }

  .cards-grid {
    gap: 1rem;
  }
}
