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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #0f1419;
  color: #e7e9ea;
  min-height: 100vh;
  padding: 0;
}

.dashboard {
  display: none;
}

.dashboard.active {
  display: block;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: #16181c;
  border-right: 1px solid #2f3336;
  padding: 20px;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  font-size: 24px;
  font-weight: 700;
  color: #1d9bf0;
  margin-bottom: 32px;
  padding: 0 12px;
}

.sidebar-menu {
  list-style: none;
}

.sidebar-item {
  margin-bottom: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  color: #e7e9ea;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  transition: background 0.2s;
  cursor: pointer;
}

.sidebar-link:hover {
  background: #1d1f23;
}

.sidebar-link.active {
  background: #1d1f23;
  color: #1d9bf0;
}

.sidebar-footer {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
}

.logout-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: #f4212e;
  border: 1px solid #f4212e;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(244, 33, 46, 0.1);
}

.main-content {
  margin-left: 260px;
  padding: 20px;
  min-height: 100vh;
}

.header {
  background: #16181c;
  padding: 24px 28px;
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid #2f3336;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.header h1 {
  color: #e7e9ea;
  font-size: 28px;
  font-weight: 700;
}

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

.btn-refresh {
  padding: 10px 20px;
  background: #1d9bf0;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
}

.btn-refresh:hover {
  background: #1a8cd8;
}

.last-update {
  color: #71767b;
  font-size: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: #16181c;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid #2f3336;
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: #1d9bf0;
}

.stat-card h3 {
  color: #71767b;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.stat-card .value {
  font-size: 36px;
  font-weight: 700;
  color: #e7e9ea;
  margin-bottom: 8px;
}

.stat-card .trend {
  font-size: 14px;
  color: #00ba7c;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend.down {
  color: #f4212e;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.card {
  background: #16181c;
  padding: 24px;
  border-radius: 16px;
  border: 1px solid #2f3336;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.card h2 {
  color: #e7e9ea;
  font-size: 20px;
  font-weight: 700;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-small {
  padding: 8px 16px;
  background: #1d1f23;
  color: #e7e9ea;
  border: 1px solid #2f3336;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background: #2f3336;
  border-color: #1d9bf0;
}

.btn-small.active {
  background: #1d9bf0;
  border-color: #1d9bf0;
  color: white;
}

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-label {
  color: #71767b;
  font-size: 14px;
  font-weight: 600;
}

select {
  padding: 8px 12px;
  background: #1d1f23;
  color: #e7e9ea;
  border: 1px solid #2f3336;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  min-width: 150px;
}

select:focus {
  outline: none;
  border-color: #1d9bf0;
}

.search-box {
  flex: 1;
  min-width: 250px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #2f3336;
  background: #1d1f23;
  color: #e7e9ea;
  border-radius: 8px;
  font-size: 14px;
}

.search-box input:focus {
  outline: none;
  border-color: #1d9bf0;
  background: #0f1419;
}

.table-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #2f3336;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th, td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid #2f3336;
}

th {
  background: #1d1f23;
  color: #71767b;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th:hover {
  color: #1d9bf0;
}

th.sortable::after {
  content: ' ⇅';
  color: #71767b;
  font-size: 10px;
}

th.sorted-asc::after {
  content: ' ↑';
  color: #1d9bf0;
}

th.sorted-desc::after {
  content: ' ↓';
  color: #1d9bf0;
}

td {
  color: #e7e9ea;
  font-size: 14px;
}

tr:hover {
  background: #1d1f23;
}

tr.clickable {
  cursor: pointer;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
  white-space: nowrap;
}

.badge.prestige {
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.badge.level {
  background: rgba(29, 155, 240, 0.15);
  color: #1d9bf0;
  border: 1px solid rgba(29, 155, 240, 0.3);
}

.badge.live {
  background: rgba(0, 186, 124, 0.15);
  color: #00ba7c;
  border: 1px solid rgba(0, 186, 124, 0.3);
  animation: pulse 2s infinite;
}

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

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d9bf0, #7856ff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  margin-right: 12px;
  font-size: 16px;
  position: relative;
  flex-shrink: 0;
}

.user-avatar.live::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #00ba7c;
  border: 2px solid #16181c;
  border-radius: 50%;
}

.user-info {
  display: flex;
  align-items: center;
}

.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.username {
  font-weight: 600;
  color: #e7e9ea;
  word-break: break-word;
}

.user-id {
  font-size: 12px;
  color: #71767b;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-container {
  height: 320px;
  margin-top: 20px;
  position: relative;
}

.loading {
  text-align: center;
  padding: 48px;
  color: #71767b;
}

.spinner {
  border: 3px solid #2f3336;
  border-top: 3px solid #1d9bf0;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: #71767b;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 8px 14px;
  background: #1d1f23;
  color: #e7e9ea;
  border: 1px solid #2f3336;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  min-width: 40px;
  text-align: center;
}

.page-btn:hover:not(:disabled) {
  background: #2f3336;
  border-color: #1d9bf0;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-btn.active {
  background: #1d9bf0;
  border-color: #1d9bf0;
  color: white;
}

.page-info {
  color: #71767b;
  font-size: 14px;
  padding: 0 12px;
}

.chat-message {
  padding: 12px;
  background: #1d1f23;
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 3px solid #1d9bf0;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-username {
  font-weight: 600;
  color: #1d9bf0;
  word-break: break-word;
}

.chat-time {
  font-size: 12px;
  color: #71767b;
  white-space: nowrap;
}

.chat-category {
  font-size: 12px;
  color: #71767b;
  margin-bottom: 6px;
}

.chat-text {
  color: #e7e9ea;
  font-size: 14px;
  word-break: break-word;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #16181c;
  border: 1px solid #2f3336;
  border-radius: 16px;
  width: 100%;
  max-width: 800px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid #2f3336;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.modal-header h2 {
  color: #e7e9ea;
  font-size: 20px;
  font-weight: 700;
  word-break: break-word;
}

.modal-close {
  background: transparent;
  border: none;
  color: #71767b;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  flex-shrink: 0;
}

.modal-close:hover {
  background: #1d1f23;
  color: #e7e9ea;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.chat-feed {
  max-height: 500px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.checkbox-label {
  color: #e7e9ea;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Tablet Styles */
@media (max-width: 1024px) {
  .sidebar {
    width: 80px;
  }

  .sidebar-logo {
    font-size: 20px;
    text-align: center;
  }

  .sidebar-link span:last-child {
    display: none;
  }

  .sidebar-link {
    justify-content: center;
  }

  .main-content {
    margin-left: 80px;
  }

  .grid-2col {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

/* Mobile Styles */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 240px;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 12px;
  }

  .header {
    padding: 16px;
    border-radius: 12px;
  }

  .header h1 {
    font-size: 22px;
    width: 100%;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .last-update {
    font-size: 12px;
  }

  .btn-refresh {
    padding: 8px 16px;
    font-size: 13px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card .value {
    font-size: 28px;
  }

  .card {
    padding: 16px;
    border-radius: 12px;
  }

  .card h2 {
    font-size: 18px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-actions {
    width: 100%;
  }

  .btn-small {
    flex: 1;
    text-align: center;
  }

  .filter-bar {
    flex-direction: column;
    gap: 8px;
  }

  .filter-group {
    width: 100%;
  }

  .search-box {
    width: 100%;
    min-width: auto;
  }

  select {
    width: 100%;
    min-width: auto;
  }

  .filter-label {
    min-width: 60px;
  }

  th, td {
    padding: 12px 8px;
    font-size: 13px;
  }

  th {
    font-size: 11px;
  }

  .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 14px;
    margin-right: 8px;
  }

  .username {
    font-size: 14px;
  }

  .user-id {
    font-size: 11px;
  }

  .badge {
    padding: 3px 8px;
    font-size: 11px;
  }

  .chart-container {
    height: 250px;
  }

  .grid-2col {
    grid-template-columns: 1fr;
  }

  .pagination {
    gap: 4px;
  }

  .page-btn {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 36px;
  }

  .page-info {
    font-size: 12px;
    padding: 0 8px;
  }

  .modal {
    padding: 10px;
  }

  .modal-content {
    max-height: 90vh;
    border-radius: 12px;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-header h2 {
    font-size: 18px;
  }

  .modal-body {
    padding: 16px;
  }

  .chat-message {
    padding: 10px;
  }

  .chat-text {
    font-size: 13px;
  }

  .empty-state {
    padding: 48px 16px;
  }

  .empty-state-icon {
    font-size: 48px;
  }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
  .header h1 {
    font-size: 20px;
  }

  .stat-card .value {
    font-size: 24px;
  }

  .stat-card h3 {
    font-size: 12px;
  }

  .stat-card .trend {
    font-size: 12px;
  }

  table {
    min-width: 500px;
  }

  th, td {
    padding: 10px 6px;
  }

  .page-btn {
    padding: 6px 8px;
    font-size: 12px;
    min-width: 32px;
  }
}