/**
 * TweakCN Theme - Podcast Intelligence Dashboard
 * Clean, Fresh Monochrome Design with OKLch color space
 * https://tweakcn.com/editor/theme
 */

/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

/* ===== ROOT VARIABLES ===== */
:root {
  /* Font - Clean Montserrat */
  --font-sans: 'Montserrat', system-ui, -apple-system, sans-serif;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Radius - Slightly softer */
  --radius-sm: 0.25rem;
  --radius: 0.35rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;

  /* Light Theme Colors (Clean Fresh Monochrome) */
  --background: oklch(0.9551 0 0);
  --foreground: oklch(0.3211 0 0);
  --card: oklch(0.9702 0 0);
  --card-foreground: oklch(0.3211 0 0);
  --popover: oklch(0.9702 0 0);
  --popover-foreground: oklch(0.3211 0 0);
  --primary: oklch(0.4891 0 0);
  --primary-foreground: oklch(0.9702 0 0);
  --secondary: oklch(0.9067 0 0);
  --secondary-foreground: oklch(0.3211 0 0);
  --muted: oklch(0.8853 0 0);
  --muted-foreground: oklch(0.5103 0 0);
  --accent: oklch(0.9067 0 0);
  --accent-foreground: oklch(0.3211 0 0);
  --destructive: oklch(0.5772 0.2452 27.3252);
  --destructive-foreground: oklch(0.9702 0 0);
  --border: oklch(0.8576 0 0);
  --input: oklch(0.8576 0 0);
  --ring: oklch(0.4891 0 0);

  /* Status Colors - Refined */
  --success: oklch(0.627 0.194 149.214);
  --success-foreground: oklch(0.985 0 0);
  --warning: oklch(0.769 0.188 70.08);
  --warning-foreground: oklch(0.205 0 0);
  --info: oklch(0.6 0.118 184.704);
  --info-foreground: oklch(0.985 0 0);

  /* Chart Colors (vibrant, distinguishable) */
  --chart-1: oklch(0.5772 0.2452 27.3252);   /* Warm red */
  --chart-2: oklch(0.627 0.194 149.214);     /* Green */
  --chart-3: oklch(0.6 0.118 184.704);       /* Teal */
  --chart-4: oklch(0.769 0.188 70.08);       /* Amber */
  --chart-5: oklch(0.5103 0 0);              /* Gray */

  /* Sidebar - Dark contrast */
  --sidebar-background: oklch(0.2178 0 0);
  --sidebar-foreground: oklch(0.8853 0 0);
  --sidebar-primary: oklch(0.8853 0 0);
  --sidebar-primary-foreground: oklch(0.2178 0 0);
  --sidebar-accent: oklch(0.3211 0 0);
  --sidebar-accent-foreground: oklch(0.8853 0 0);
  --sidebar-border: oklch(0.3211 0 0);
  --sidebar-ring: oklch(0.4891 0 0);
}

/* ===== DARK THEME ===== */
[data-theme="dark"] {
  --background: oklch(0.2178 0 0);
  --foreground: oklch(0.8853 0 0);
  --card: oklch(0.2842 0 0);
  --card-foreground: oklch(0.8853 0 0);
  --popover: oklch(0.2842 0 0);
  --popover-foreground: oklch(0.8853 0 0);
  --primary: oklch(0.8853 0 0);
  --primary-foreground: oklch(0.2178 0 0);
  --secondary: oklch(0.3211 0 0);
  --secondary-foreground: oklch(0.8853 0 0);
  --muted: oklch(0.3211 0 0);
  --muted-foreground: oklch(0.5784 0 0);
  --accent: oklch(0.3211 0 0);
  --accent-foreground: oklch(0.8853 0 0);
  --destructive: oklch(0.5772 0.2452 27.3252);
  --destructive-foreground: oklch(0.9702 0 0);
  --border: oklch(0.3211 0 0);
  --input: oklch(0.3211 0 0);
  --ring: oklch(0.5103 0 0);

  --success: oklch(0.627 0.194 149.214);
  --warning: oklch(0.769 0.188 70.08);
  --info: oklch(0.6 0.118 184.704);

  /* Sidebar in dark mode */
  --sidebar-background: oklch(0.1587 0 0);
  --sidebar-foreground: oklch(0.8853 0 0);
  --sidebar-accent: oklch(0.2842 0 0);
  --sidebar-border: oklch(0.2842 0 0);
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ===== LAYOUT ===== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--sidebar-background);
  color: var(--sidebar-foreground);
  padding: var(--spacing-md) var(--spacing-lg) 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  border-right: 1px solid var(--sidebar-border);
  z-index: 1000;
  transition: transform 0.3s ease, width 0.3s ease;
  overflow: hidden;
}

/* Sidebar collapsed state */
.sidebar.collapsed {
  transform: translateX(-260px);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* Hamburger toggle button - sits at edge of sidebar */
.sidebar-toggle {
  position: fixed;
  top: 1rem;
  left: 220px;  /* Inside sidebar when open */
  z-index: 1002;  /* Above sidebar */
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  transition: left 0.3s ease, background-color 0.15s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-toggle:hover {
  background: var(--accent);
}

/* Move toggle button to edge when sidebar is collapsed */
body.sidebar-collapsed .sidebar-toggle {
  left: 0.5rem;
}

.sidebar.collapsed ~ .sidebar-toggle {
  left: 0.5rem;
}

/* Hamburger icon */
.sidebar-toggle span {
  font-size: 1.25rem;
  line-height: 1;
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Make main nav scrollable */
.sidebar-nav.scrollable {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin-right: calc(-1 * var(--spacing-md));
  padding-right: var(--spacing-md);
  padding-bottom: var(--spacing-lg);
}

/* Scrollbar styling for sidebar */
.sidebar-nav.scrollable::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav.scrollable::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav.scrollable::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.sidebar-nav.scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* Sidebar nav groups */
.sidebar-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.1rem 0.75rem;
  margin-top: 0.4rem;
  margin-bottom: 0;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.2;
  color: var(--muted-foreground);
  cursor: pointer;
  user-select: none;
}

.sidebar-group-label:first-child {
  margin-top: 0;
}

.sidebar-group-label:hover {
  color: var(--sidebar-foreground);
}

.sidebar-group-label .chevron {
  transition: transform 0.2s ease;
  font-size: 0.625rem;
}

.sidebar-group-label.collapsed .chevron {
  transform: rotate(-90deg);
}

.sidebar-group-items {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.2s ease;
}

.sidebar-group-items.collapsed {
  max-height: 0 !important;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.75rem;
  border-radius: var(--radius);
  color: var(--sidebar-foreground);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  transition: background-color 0.15s ease;
}

.sidebar-nav a:hover {
  background: var(--sidebar-accent);
}

.sidebar-nav a.active {
  background: var(--sidebar-primary);
  color: var(--sidebar-primary-foreground);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: var(--spacing-xl);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
  max-width: calc(100vw - 260px);
  overflow-x: hidden;
}

/* Main content when sidebar is collapsed */
body.sidebar-collapsed .main-content {
  margin-left: 0;
  max-width: 100vw;
}

/* Responsive: On mobile, sidebar becomes overlay */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-260px);
  }

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

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    left: 1rem !important;
  }
}

/* Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
}

.dashboard-header h1 {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.last-updated {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* ===== FILTER BAR ===== */
.filter-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.03);
}

.filter-bar-inner {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.filter-count {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  padding-right: var(--spacing-md);
  border-right: 1px solid var(--border);
}

.filter-count .icon {
  color: var(--muted-foreground);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-select {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.8125rem;
  color: var(--foreground);
  cursor: pointer;
  min-width: 120px;
  transition: border-color 0.15s ease;
}

.filter-select:hover {
  border-color: var(--ring);
}

.filter-select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgb(0 0 0 / 0.05);
}

.filter-select-sm {
  min-width: 90px;
}

.filter-btn-group {
  display: flex;
  gap: 2px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}

.filter-btn {
  background: transparent;
  border: none;
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  color: var(--foreground);
  background: var(--muted);
}

.filter-btn.active {
  background: var(--primary);
  color: var(--primary-foreground);
}

.filter-reset {
  margin-left: auto;
  font-size: 0.8125rem;
}

/* Filter bar responsive */
@media (max-width: 1024px) {
  .filter-bar-inner {
    gap: var(--spacing-md);
  }

  .filter-count {
    width: 100%;
    padding-right: 0;
    border-right: none;
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border);
  }

  .filter-reset {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .filter-group {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
  }

  .filter-select {
    min-width: 100%;
  }
}

/* ===== CARD COMPONENT (TweakCN Style) ===== */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.03);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 12px 0 rgb(0 0 0 / 0.08);
}

.card-header {
  padding: var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.card-title .icon {
  color: var(--muted-foreground);
  opacity: 0.7;
}

.card-description {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  margin-top: var(--spacing-xs);
}

.card-content {
  padding: var(--spacing-lg);
  padding-top: var(--spacing-sm);
}

.card-footer {
  padding: var(--spacing-lg);
  padding-top: 0;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* Metric Card (TweakCN Style) */
.metric-card {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.3;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--foreground);
}

.metric-value.large {
  font-size: 2.5rem;
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: var(--spacing-sm);
  padding: 2px 8px;
  border-radius: 9999px;
  width: fit-content;
}

.metric-trend.up {
  color: var(--success);
  background: oklch(0.95 0.05 150);
}

.metric-trend.down {
  color: var(--destructive);
  background: oklch(0.95 0.05 30);
}

.metric-trend.neutral {
  color: var(--muted-foreground);
  background: var(--muted);
}

[data-theme="dark"] .metric-trend.up {
  background: oklch(0.25 0.08 150);
}

[data-theme="dark"] .metric-trend.down {
  background: oklch(0.25 0.08 30);
}

/* Feature Card (larger with content) */
.feature-card .card-content {
  min-height: 120px;
}

/* Card Inset - for nested cards within modals/sections */
.card-inset {
  background: var(--card);
  padding: var(--spacing-sm);
  border-radius: var(--radius);
  color: var(--foreground);
}

.card-inset-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: var(--spacing-xs);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

/* Platform Card - for platform-specific sections with colored left border */
.card-platform {
  background: var(--card);
  padding: var(--spacing-sm);
  border-radius: var(--radius-lg);
  color: var(--foreground);
  border-left: 4px solid var(--border);
}

.card-platform.instagram { border-left-color: #e1306c; }
.card-platform.tiktok { border-left-color: #000000; }
.card-platform.linkedin { border-left-color: #0077b5; }
.card-platform.youtube { border-left-color: #dc2626; }
.card-platform.twitter { border-left-color: #1da1f2; }
.card-platform.hackernews { border-left-color: #ff6600; }
.card-platform.reddit { border-left-color: #ff4500; }
.card-platform.gdelt { border-left-color: #4a90d9; }
.card-platform.spotify { border-left-color: #1db954; }
.card-platform.apple { border-left-color: #a855f7; }

/* Info Row - compact row for data display */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  font-size: 0.75rem;
}

.info-row-label {
  color: var(--muted-foreground);
}

.info-row-value {
  font-weight: 500;
}

/* ===== SHOW CARD - Enhanced podcast listing card (TweakCN Style) ===== */
.show-card {
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  padding: var(--spacing-lg);
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.show-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--chart-1), var(--chart-2), var(--chart-4));
  opacity: 0;
  transition: opacity 0.25s ease;
}

.show-card:hover {
  border-color: var(--ring);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
  transform: translateY(-2px);
}

.show-card:hover::before {
  opacity: 1;
}

.show-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.show-card-rank {
  width: 36px;
  height: 36px;
  background: var(--muted);
  color: var(--foreground);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.show-card-rank.top-3 {
  background: linear-gradient(135deg, oklch(0.769 0.188 70.08), oklch(0.646 0.222 41.116));
  color: white;
  box-shadow: 0 4px 8px oklch(0.769 0.188 70.08 / 0.4);
}

.show-card-info {
  flex: 1;
  min-width: 0;
}

.show-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.4;
  margin-bottom: 4px;
  color: var(--foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.show-card-author {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.show-card-scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border);
}

.show-card-score {
  text-align: center;
  padding: var(--spacing-sm);
  background: var(--secondary);
  border-radius: var(--radius);
}

.show-card-score-value {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.show-card-score-value.excellent { color: var(--success); }
.show-card-score-value.good { color: oklch(0.6 0.118 184.704); }
.show-card-score-value.average { color: oklch(0.769 0.188 70.08); }
.show-card-score-value.low { color: var(--muted-foreground); }

.show-card-score-label {
  font-size: 0.6rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
  font-weight: 600;
}

.show-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-md);
}

.show-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: var(--muted);
  padding: 3px 8px;
  border-radius: 9999px;
}

/* Show Card Grid Layout */
.show-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

/* Compact show row for leaderboards (TweakCN Style) */
.show-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--secondary);
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

.show-row:hover {
  background: var(--accent);
  transform: translateX(4px);
}

.show-row-rank {
  width: 28px;
  height: 28px;
  background: var(--muted);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.show-row-rank.top-3 {
  background: linear-gradient(135deg, oklch(0.769 0.188 70.08), oklch(0.646 0.222 41.116));
  color: white;
  box-shadow: 0 2px 4px oklch(0.769 0.188 70.08 / 0.3);
}

.show-row-info {
  flex: 1;
  min-width: 0;
}

.show-row-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.show-row-subtitle {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  margin-top: 2px;
}

.show-row-score {
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--success), oklch(0.55 0.15 150));
  color: white;
  border-radius: var(--radius);
  min-width: 48px;
  text-align: center;
  box-shadow: 0 2px 4px oklch(0.627 0.194 149.214 / 0.2);
}

.show-row-score.warning {
  background: linear-gradient(135deg, var(--warning), oklch(0.7 0.2 60));
  color: oklch(0.25 0 0);
}

.show-row-score.muted {
  background: var(--muted);
  color: var(--muted-foreground);
  box-shadow: none;
}

/* ===== BADGE (TweakCN Style) ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
}

.badge-default {
  background: var(--secondary);
  color: var(--muted-foreground);
}

.badge-success {
  background: oklch(0.92 0.12 154.449);
  color: oklch(0.35 0.1 152.417);
}

.badge-warning {
  background: oklch(0.92 0.14 80);
  color: oklch(0.45 0.12 60);
}

.badge-destructive {
  background: oklch(0.92 0.1 25);
  color: oklch(0.45 0.15 25);
}

.badge-info {
  background: oklch(0.92 0.06 240);
  color: oklch(0.4 0.1 240);
}

[data-theme="dark"] .badge-success {
  background: oklch(0.28 0.1 150);
  color: oklch(0.75 0.15 150);
}

[data-theme="dark"] .badge-warning {
  background: oklch(0.3 0.1 70);
  color: oklch(0.8 0.15 70);
}

[data-theme="dark"] .badge-destructive {
  background: oklch(0.3 0.1 25);
  color: oklch(0.75 0.15 25);
}

[data-theme="dark"] .badge-info {
  background: oklch(0.28 0.08 240);
  color: oklch(0.75 0.1 240);
}

/* ===== BUTTON ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

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

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
}

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

.btn-ghost {
  background: transparent;
  color: var(--foreground);
}

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

/* ===== GRID LAYOUTS ===== */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* Responsive */
@media (max-width: 1400px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1200px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ===== TABLE (TweakCN Style) ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead {
  background: var(--secondary);
}

th {
  padding: var(--spacing-md) var(--spacing-lg);
  text-align: left;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--accent);
}

/* ===== PROGRESS BAR (TweakCN Style) ===== */
.progress {
  height: 6px;
  background: var(--muted);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.success {
  background: var(--success);
}

.progress-bar.warning {
  background: var(--warning);
}

.progress-bar.destructive {
  background: var(--destructive);
}

/* Dark mode: add subtle gradient to progress bars */
[data-theme="dark"] .progress-bar {
  background: linear-gradient(90deg, var(--primary), oklch(0.6 0.12 200));
}

[data-theme="dark"] .progress-bar.success {
  background: linear-gradient(90deg, var(--success), oklch(0.55 0.18 150));
}

[data-theme="dark"] .progress-bar.warning {
  background: linear-gradient(90deg, var(--warning), oklch(0.75 0.18 50));
}

[data-theme="dark"] .progress-bar.destructive {
  background: linear-gradient(90deg, var(--destructive), oklch(0.55 0.2 15));
}

/* ===== SPARKLINE CONTAINER ===== */
.sparkline-container {
  height: 40px;
  margin-top: var(--spacing-sm);
}

/* ===== SECTION ===== */
.section {
  margin-bottom: var(--spacing-xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.section-description {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  margin-top: var(--spacing-xs);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--foreground);
  font-size: 1.25rem;
}

.theme-toggle:hover {
  background: var(--accent);
}

/* ===== LOADING STATE ===== */
.skeleton {
  background: linear-gradient(90deg, var(--muted) 25%, var(--accent) 50%, var(--muted) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== LAZY SECTION PLACEHOLDER ===== */
.lazy-section-placeholder {
  padding: var(--spacing-lg) var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.lazy-placeholder-bar {
  height: 14px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--muted) 25%, var(--accent) 50%, var(--muted) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

/* ===== UTILITIES ===== */
.text-muted {
  color: var(--muted-foreground);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-destructive {
  color: var(--destructive);
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.mt-sm {
  margin-top: var(--spacing-sm);
}

.mt-md {
  margin-top: var(--spacing-md);
}

.mb-md {
  margin-bottom: var(--spacing-md);
}

.mb-lg {
  margin-bottom: var(--spacing-lg);
}

.mb-xs {
  margin-bottom: var(--spacing-xs);
}

.flex-col {
  flex-direction: column;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge info variant */
.badge-info {
  background: oklch(0.882 0.059 254.128);
  color: oklch(0.391 0.09 240.876);
}

/* Chart container */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ===== MODAL (TweakCN Style) ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content {
  background: var(--card);
  color: var(--card-foreground);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-lg) var(--spacing-xl);
  border-bottom: 1px solid var(--border);
  background: var(--secondary);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.modal-close {
  background: var(--muted);
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted-foreground);
  padding: 6px 10px;
  line-height: 1;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.modal-body {
  padding: var(--spacing-xl);
  overflow-y: auto;
  flex: 1;
}

/* Modal grid layout */
.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
}

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

.modal-section {
  background: var(--secondary);
  border-radius: var(--radius);
  padding: var(--spacing-md);
}

.modal-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin-bottom: var(--spacing-sm);
}

.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-xs) 0;
  font-size: 0.875rem;
}

.modal-row-label {
  color: var(--muted-foreground);
}

.modal-row-value {
  font-weight: 500;
}

/* Score display in modal */
.modal-scores {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.modal-score-card {
  background: var(--secondary);
  border-radius: var(--radius);
  padding: var(--spacing-md);
  text-align: center;
}

.modal-score-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.modal-score-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: var(--spacing-xs);
}

/* Progress bar for demographics */
.modal-progress {
  height: 8px;
  background: var(--muted);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: var(--spacing-xs);
}

.modal-progress-bar {
  height: 100%;
  background: var(--chart-1);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Clickable table rows */
.table-row-clickable {
  cursor: pointer;
  transition: background 0.15s;
}

.table-row-clickable:hover {
  background: var(--muted);
}

/* ===== COMPARISON TABLE ===== */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.comparison-table th {
  font-weight: 600;
  background: var(--secondary);
  font-size: 0.85rem;
}

.comparison-table th:first-child {
  width: 30%;
}

.comparison-table td:first-child {
  color: var(--muted-foreground);
}

.comparison-table tbody tr:hover {
  background: var(--muted);
}

/* Form styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--foreground);
}

.form-select {
  width: 100%;
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--border);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select:hover {
  border-color: var(--muted-foreground);
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Responsive grid for forms */
@media (max-width: 768px) {
  .grid-4 {
    grid-template-columns: 1fr 1fr !important;
  }
  .grid[style*="grid-template-columns: 2fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .grid[style*="grid-template-columns: 1fr 1fr 1fr auto"] {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ===== LEADERBOARD TABLE ===== */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
  font-weight: 600;
  background: var(--secondary);
  font-size: 0.85rem;
}

.leaderboard-table tbody tr:hover {
  background: var(--muted);
  cursor: pointer;
}

.leaderboard-table tbody tr:first-child {
  background: rgba(234, 179, 8, 0.1);
}

.leaderboard-table tbody tr:nth-child(2) {
  background: rgba(156, 163, 175, 0.08);
}

.leaderboard-table tbody tr:nth-child(3) {
  background: rgba(217, 119, 6, 0.08);
}

/* ===== LINKS ===== */
/* Modal links (email, website) - white for dark mode visibility */
.modal-content a,
.modal-row a,
.modal-section a {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-color: var(--muted-foreground);
  text-underline-offset: 2px;
  transition: all 0.15s;
}

.modal-content a:hover,
.modal-row a:hover,
.modal-section a:hover {
  color: var(--chart-2);
  text-decoration-color: var(--chart-2);
}

/* General link styles for cards and tables */
.card a,
td a {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-color: var(--muted-foreground);
  text-underline-offset: 2px;
}

.card a:hover,
td a:hover {
  color: var(--chart-2);
  text-decoration-color: var(--chart-2);
}

/* ===== ICONS ===== */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
}

.icon svg {
  width: 1em;
  height: 1em;
}

/* Icon sizes */
.icon-sm svg {
  width: 14px;
  height: 14px;
}

.icon-md svg {
  width: 18px;
  height: 18px;
}

.icon-lg svg {
  width: 24px;
  height: 24px;
}

/* Icon colors - inherit from parent by default */
.icon svg {
  stroke: currentColor;
}

/* Sidebar icons - slightly dimmer */
.sidebar-nav .icon svg {
  opacity: 0.8;
}

.sidebar-nav a:hover .icon svg,
.sidebar-nav a.active .icon svg {
  opacity: 1;
}

/* ===== TOOLTIPS ===== */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: var(--popover);
  color: var(--popover-foreground);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  max-width: 280px;
  min-width: 120px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1000;
  pointer-events: none;
  text-align: left;
}

/* Tooltip arrow */
[data-tooltip]::after {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--border);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1001;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Tooltip positions */
[data-tooltip-position="right"]::before {
  left: calc(100% + 8px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

[data-tooltip-position="right"]::after {
  left: calc(100% + 4px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--border);
}

[data-tooltip-position="left"]::before {
  left: auto;
  right: calc(100% + 8px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

[data-tooltip-position="left"]::after {
  left: auto;
  right: calc(100% + 4px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-left-color: var(--border);
}

[data-tooltip-position="bottom"]::before {
  bottom: auto;
  top: calc(100% + 8px);
}

[data-tooltip-position="bottom"]::after {
  bottom: auto;
  top: calc(100% + 4px);
  border: 4px solid transparent;
  border-bottom-color: var(--border);
}

/* Info icon helper for tooltips */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 10px;
  font-weight: 600;
  margin-left: 4px;
  cursor: help;
  transition: background 0.15s ease;
}

.info-icon:hover {
  background: var(--accent);
  color: var(--foreground);
}

/* Card title with tooltip */
.card-title-with-info {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== EXTENDED UTILITIES (Dashboard Refactor Jan 2026) ===== */

/* Display */
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.hidden { display: none; }

/* Flexbox */
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.flex-shrink-0 { flex-shrink: 0; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

/* Gap */
.gap-xs { gap: var(--spacing-xs); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* Padding */
.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }
.px-sm { padding-left: var(--spacing-sm); padding-right: var(--spacing-sm); }
.px-md { padding-left: var(--spacing-md); padding-right: var(--spacing-md); }
.py-sm { padding-top: var(--spacing-sm); padding-bottom: var(--spacing-sm); }
.py-md { padding-top: var(--spacing-md); padding-bottom: var(--spacing-md); }
.py-lg { padding-top: var(--spacing-lg); padding-bottom: var(--spacing-lg); }
.pt-sm { padding-top: var(--spacing-sm); }
.pb-sm { padding-bottom: var(--spacing-sm); }
.pl-lg { padding-left: var(--spacing-lg); }
.pr-md { padding-right: var(--spacing-md); }

/* Margin */
.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.ml-sm { margin-left: var(--spacing-sm); }
.ml-md { margin-left: var(--spacing-md); }
.mr-sm { margin-right: var(--spacing-sm); }
.mt-xs { margin-top: var(--spacing-xs); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }

/* Width */
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.min-w-md { min-width: 200px; }
.max-w-xs { max-width: 150px; }
.max-w-sm { max-width: 200px; }
.max-w-md { max-width: 280px; }

/* Text */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.leading-tight { line-height: 1.25; }
.leading-none { line-height: 1; }
.whitespace-nowrap { white-space: nowrap; }

/* Borders */
.border { border: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.rounded { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

/* Background */
.bg-muted { background-color: var(--muted); }
.bg-card { background-color: var(--card); }
.bg-accent { background-color: var(--accent); }
.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }
.bg-destructive { background-color: var(--destructive); }
.bg-transparent { background-color: transparent; }

/* Colors */
.text-foreground { color: var(--foreground); }
.text-success { color: var(--success); }
.text-info { color: var(--info); }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.right-0 { right: 0; }

/* Shadow */
.shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
.shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); }
.shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }

/* Transition */
.transition { transition: all 0.15s ease; }
.transition-colors { transition: color 0.15s ease, background-color 0.15s ease; }

/* Grid utilities */
.grid-cols-auto-fit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--min-col-width, 200px), 1fr));
}

/* Extra small text */
.text-2xs { font-size: 0.625rem; }

/* Color backgrounds for badges */
.bg-blue-100 { background-color: #dbeafe; }
.bg-green-100 { background-color: #dcfce7; }
.bg-yellow-100 { background-color: #fef3c7; }
.bg-purple-100 { background-color: #f3e8ff; }
.bg-pink-100 { background-color: #fce7f3; }
.bg-red-100 { background-color: #fee2e2; }

/* Platform colors */
.bg-green-500 { background-color: #22c55e; }
.bg-red-600 { background-color: #dc2626; }
.bg-purple-500 { background-color: #a855f7; }
.text-green-500 { color: #22c55e; }
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.text-blue-500 { color: #3b82f6; }
.text-purple-500 { color: #a855f7; }

/* Small padding for inline badges */
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }

/* ===== LIST COMPONENTS ===== */

/* List item for show lists */
.list-item {
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-content {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex: 1;
  min-width: 0;
}

.list-item-rank {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.list-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

.list-item-subtitle {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: var(--spacing-xs);
  padding-left: calc(24px + var(--spacing-sm));
}

.list-item-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-shrink: 0;
}

/* ===== STAT GRID ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--spacing-md);
}

.stat-item {
  text-align: center;
  padding: var(--spacing-md);
  background: var(--muted);
  border-radius: var(--radius);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: var(--spacing-xs);
}

/* ===== PILL/CHIP COMPONENT ===== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 2px 8px;
  background: var(--muted);
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.pill-success { background: oklch(0.871 0.15 154.449); color: oklch(0.262 0.051 152.417); }
.pill-warning { background: oklch(0.905 0.182 98.111); color: oklch(0.421 0.095 57.708); }
.pill-destructive { background: var(--destructive); color: var(--destructive-foreground); }
.pill-info { background: oklch(0.882 0.059 254.128); color: oklch(0.391 0.09 240.876); }

/* ===== ALERT/NOTICE COMPONENT ===== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.alert-info {
  background: oklch(0.95 0.03 240);
  color: oklch(0.35 0.1 240);
  border-left: 3px solid var(--info);
}

.alert-warning {
  background: oklch(0.97 0.05 80);
  color: oklch(0.4 0.1 60);
  border-left: 3px solid var(--warning);
}

.alert-success {
  background: oklch(0.95 0.05 150);
  color: oklch(0.3 0.08 150);
  border-left: 3px solid var(--success);
}

.alert-destructive {
  background: oklch(0.95 0.05 30);
  color: oklch(0.4 0.15 25);
  border-left: 3px solid var(--destructive);
}

/* ===== DATA ROW ===== */
.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-xs) 0;
  font-size: 0.875rem;
}

.data-row-label {
  color: var(--muted-foreground);
}

.data-row-value {
  font-weight: 500;
  color: var(--foreground);
}

/* ===== SCORE DISPLAY ===== */
.score-display {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.score-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
}

.score-circle-sm {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.score-excellent { background: var(--success); color: var(--success-foreground); }
.score-good { background: oklch(0.6 0.15 200); color: white; }
.score-fair { background: var(--warning); color: var(--warning-foreground); }
.score-poor { background: var(--destructive); color: var(--destructive-foreground); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--muted-foreground);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: var(--spacing-xs);
}

.empty-state-description {
  font-size: 0.875rem;
}

/* ===== ADDITIONAL FONT SIZES (for inline style replacement) ===== */
.text-xxs { font-size: 0.65rem; }
.text-xxxs { font-size: 0.6rem; }
.text-tiny { font-size: 0.7rem; }
.text-base { font-size: 0.85rem; }
.text-normal { font-size: 0.875rem; }
.text-lg { font-size: 0.9rem; }
.text-1xl { font-size: 1rem; }
.text-2xl { font-size: 1.25rem; }
.text-3xl { font-size: 1.5rem; }

/* ===== COMMON LAYOUT PATTERNS ===== */

/* Flex row with space-between and center align (most common) */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Flex row with space-between and top align */
.flex-between-start {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

/* Flex row with items centered and gap */
.flex-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* Flex column with gap */
.flex-col-gap {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

/* ===== LIST/ITEM PATTERNS ===== */

/* Generic item with bottom border (replaces padding + border-bottom styles) */
.item-row {
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid var(--border);
}

.item-row:last-child {
  border-bottom: none;
}

/* Smaller item row */
.item-row-sm {
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border);
}

.item-row-sm:last-child {
  border-bottom: none;
}

/* Extra small item row */
.item-row-xs {
  padding: var(--spacing-xs) 0;
  border-bottom: 1px solid var(--border);
}

.item-row-xs:last-child {
  border-bottom: none;
}

/* ===== STAT/METRIC BOX ===== */
.metric-box {
  padding: var(--spacing-sm);
  background: var(--secondary);
  border-radius: var(--radius);
  text-align: center;
}

.metric-box-lg {
  padding: var(--spacing-md);
  background: var(--secondary);
  border-radius: var(--radius-lg);
  text-align: center;
}

/* ===== CARD-LIKE BLOCKS ===== */
.block-muted {
  padding: var(--spacing-sm);
  background: var(--muted);
  border-radius: var(--radius);
}

.block-secondary {
  padding: var(--spacing-md);
  background: var(--secondary);
  border-radius: var(--radius-lg);
}

/* ===== SUBTITLE/META TEXT ===== */
.meta-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: var(--spacing-xs);
}

.meta-text-indent {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: var(--spacing-xs);
  padding-left: calc(24px + var(--spacing-sm));
}

/* ===== SECTION HEADER (for modal/card sections) ===== */
.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ===== TAG/HASHTAG ===== */
.hashtag {
  font-size: 0.65rem;
  color: var(--primary);
  background: var(--primary-bg, var(--muted));
  padding: 2px 6px;
  border-radius: 8px;
}

/* ===== INLINE HELPERS ===== */
.indent-lg { padding-left: var(--spacing-lg); }
.indent-xl { padding-left: 2rem; }
.shrink-0 { flex-shrink: 0; }

/* Font family */
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* ===== FULL-PAGE SHOW DETAIL PANEL (TweakCN Style) ===== */
/* Replaces cramped modal with clean, spacious full-page slide-in panel */

.show-detail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.show-detail-overlay.active {
  opacity: 1;
  visibility: visible;
}

.show-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 1200px;
  background: var(--background);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.3);
}

.show-detail-panel.active {
  transform: translateX(0);
}

/* Panel Header */
.show-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--spacing-xl) var(--spacing-2xl);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  gap: var(--spacing-lg);
}

.show-detail-title-block {
  flex: 1;
  min-width: 0;
}

.show-detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 var(--spacing-xs) 0;
  line-height: 1.2;
}

.show-detail-author {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0;
}

.show-detail-actions {
  display: flex;
  gap: var(--spacing-sm);
  flex-shrink: 0;
}

.show-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s ease;
}

.show-detail-btn:hover {
  background: var(--secondary);
  border-color: var(--muted-foreground);
}

.show-detail-btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.show-detail-btn-primary:hover {
  opacity: 0.9;
}

.show-detail-close {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* Score Summary Bar */
.show-detail-scores {
  display: flex;
  gap: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-2xl);
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
}

.show-detail-score-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.show-detail-score-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.show-detail-score-value.score-high { color: var(--success); }
.show-detail-score-value.score-medium { color: var(--foreground); }
.show-detail-score-value.score-low { color: var(--warning); }
.show-detail-score-value.score-critical { color: var(--destructive); }

.show-detail-score-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

/* Tab Navigation */
.show-detail-tabs {
  display: flex;
  gap: 0;
  padding: 0 var(--spacing-2xl);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.show-detail-tabs::-webkit-scrollbar {
  display: none;
}

.show-detail-tab {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.show-detail-tab:hover {
  color: var(--foreground);
  background: var(--secondary);
}

.show-detail-tab.active {
  color: var(--foreground);
  border-bottom-color: var(--primary);
}

.show-detail-tab svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.show-detail-tab.active svg {
  opacity: 1;
}

/* Tab Content Container */
.show-detail-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-xl) var(--spacing-2xl);
}

/* Tab Panels */
.show-detail-tab-panel {
  display: none;
}

.show-detail-tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Content Cards within panels */
.detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.detail-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--border);
}

.detail-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.detail-card-title svg {
  width: 18px;
  height: 18px;
  color: var(--muted-foreground);
}

.detail-card-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 9999px;
  background: var(--secondary);
  color: var(--muted-foreground);
}

/* Grid Layouts for content */
.detail-grid {
  display: grid;
  gap: var(--spacing-lg);
}

.detail-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.detail-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.detail-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .detail-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .show-detail-panel {
    max-width: 100%;
  }

  .detail-grid-2,
  .detail-grid-3,
  .detail-grid-4 {
    grid-template-columns: 1fr;
  }

  .show-detail-header {
    padding: var(--spacing-lg);
    flex-direction: column;
  }

  .show-detail-scores {
    flex-wrap: wrap;
    padding: var(--spacing-md) var(--spacing-lg);
  }

  .show-detail-content {
    padding: var(--spacing-lg);
  }
}

/* Metric Display */
.detail-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.detail-metric-label {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Data Rows */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row-label {
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.detail-row-value {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--foreground);
}

/* Mini progress bars for demographics */
.detail-progress {
  height: 6px;
  background: var(--secondary);
  border-radius: 3px;
  overflow: hidden;
  flex: 1;
  margin: 0 var(--spacing-sm);
}

.detail-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

[data-theme="dark"] .detail-progress-bar {
  background: linear-gradient(90deg, var(--primary), oklch(0.6 0.12 200));
}

/* Guest/Sponsor List Items */
.detail-list-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border);
}

.detail-list-item:last-child {
  border-bottom: none;
}

.detail-list-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.detail-list-info {
  flex: 1;
  min-width: 0;
}

.detail-list-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-list-meta {
  font-size: 0.7rem;
  color: var(--muted-foreground);
}

/* Empty state for tabs */
.detail-empty {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--muted-foreground);
}

.detail-empty-icon {
  font-size: 2rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.detail-empty-text {
  font-size: 0.875rem;
}

/* PDF Export Styles (TweakCN Clean Look) */
.pdf-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
  background: white;
  color: #171717;
}

.pdf-header {
  border-bottom: 2px solid #e5e5e5;
  padding-bottom: 24px;
  margin-bottom: 32px;
}

.pdf-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #0a0a0a;
}

.pdf-subtitle {
  font-size: 14px;
  color: #737373;
  margin: 0;
}

.pdf-scores {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
}

.pdf-score-box {
  flex: 1;
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.pdf-score-value {
  font-size: 32px;
  font-weight: 700;
  color: #0a0a0a;
}

.pdf-score-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #737373;
  margin-top: 4px;
}

.pdf-section {
  margin-bottom: 28px;
}

.pdf-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #737373;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e5e5;
}

.pdf-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 13px;
}

.pdf-row-label {
  color: #525252;
}

.pdf-row-value {
  font-weight: 500;
  color: #171717;
}

.pdf-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #e5e5e5;
  font-size: 11px;
  color: #a3a3a3;
  text-align: center;
}

@media print {
  .pdf-container {
    padding: 20px;
  }

  .pdf-score-box {
    break-inside: avoid;
  }

  .pdf-section {
    break-inside: avoid;
  }
}

/* ===== NETWORK GRAPH ENHANCEMENTS ===== */

/* Click-Detail Panel - slides in from right over the graph */
.network-detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 340px;
  max-width: 100%;
  height: 100%;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.network-detail-panel.active {
  transform: translateX(0);
}

.network-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border);
  background: var(--accent);
  flex-shrink: 0;
}

.network-detail-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.network-detail-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0 var(--spacing-xs);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.network-detail-close:hover {
  color: var(--foreground);
}

.network-detail-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
  font-size: 0.85rem;
  color: var(--foreground);
}

/* Metric rows inside detail panel */
.network-detail-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.network-detail-metric {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-sm);
  text-align: center;
}

.network-detail-metric-label {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.network-detail-metric-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--foreground);
  margin-top: 2px;
}

/* Guest list inside detail panel */
.network-detail-guest-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.network-detail-guest-list li {
  padding: var(--spacing-xs) 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.network-detail-guest-list li:last-child {
  border-bottom: none;
}

.network-detail-guest-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.network-detail-shared-badge {
  font-size: 0.7rem;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  flex-shrink: 0;
  margin-left: var(--spacing-xs);
}

/* Shared-with section */
.network-detail-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--foreground);
  margin: var(--spacing-md) 0 var(--spacing-sm) 0;
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--border);
}

.network-detail-shared-show {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) 0;
  font-size: 0.8rem;
}

.network-detail-shared-show-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-detail-shared-count {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

/* View Full Detail button */
.network-detail-view-btn {
  display: block;
  width: 100%;
  margin-top: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--primary);
  color: var(--primary-foreground);
  border: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s ease;
}

.network-detail-view-btn:hover {
  opacity: 0.85;
}

/* Dark theme shadow adjustment */
[data-theme="dark"] .network-detail-panel {
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.35);
}

/* Responsive: collapse detail panel on small screens */
@media (max-width: 640px) {
  .network-detail-panel {
    width: 100%;
  }
}

/* ===== SHOW DATABASE PAGINATED (Server-side browsing) ===== */

/* Controls bar */
.sdb-controls {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.sdb-controls-row {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

/* Search input with icon */
.sdb-search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.sdb-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}

.sdb-search-input {
  width: 100%;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm) 2.25rem;
  font-size: 0.85rem;
  color: var(--foreground);
  font-family: var(--font-sans);
  transition: border-color 0.15s ease;
}

.sdb-search-input::placeholder {
  color: var(--muted-foreground);
}

.sdb-search-input:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgb(0 0 0 / 0.05);
}

/* Filter group */
.sdb-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sdb-filter-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.sdb-filter-select {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.8rem;
  color: var(--foreground);
  font-family: var(--font-sans);
  cursor: pointer;
  min-width: 140px;
  transition: border-color 0.15s ease;
}

.sdb-filter-select:hover {
  border-color: var(--ring);
}

.sdb-filter-select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgb(0 0 0 / 0.05);
}

.sdb-filter-select-sm {
  min-width: 80px;
}

/* Status bar (results info + spinner) */
.sdb-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
  padding: 0 var(--spacing-xs);
  min-height: 1.5rem;
}

.sdb-results-info {
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

/* Loading spinner */
.sdb-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: sdb-spin 0.6s linear infinite;
}

.sdb-spinner.active {
  display: block;
}

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

/* Error banner */
.sdb-error {
  background: oklch(0.95 0.08 25);
  color: oklch(0.45 0.15 25);
  border: 1px solid oklch(0.85 0.1 25);
  border-radius: var(--radius);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.85rem;
  margin-bottom: var(--spacing-md);
}

[data-theme="dark"] .sdb-error {
  background: oklch(0.25 0.08 25);
  color: oklch(0.8 0.12 25);
  border-color: oklch(0.35 0.1 25);
}

/* Sortable header arrows */
.sdb-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sdb-sortable:hover {
  color: var(--foreground);
}

.sdb-sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.65rem;
  opacity: 0.3;
  transition: opacity 0.15s ease;
}

.sdb-sort-arrow::after {
  content: '\25B2\25BC';
  font-size: 0.5rem;
  letter-spacing: -2px;
}

.sdb-sortable.sort-asc .sdb-sort-arrow {
  opacity: 1;
}

.sdb-sortable.sort-asc .sdb-sort-arrow::after {
  content: '\25B2';
}

.sdb-sortable.sort-desc .sdb-sort-arrow {
  opacity: 1;
}

.sdb-sortable.sort-desc .sdb-sort-arrow::after {
  content: '\25BC';
}

/* Loading overlay on table */
#sdbTableContainer.sdb-loading {
  position: relative;
}

#sdbTableContainer.sdb-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  opacity: 0.5;
  border-radius: var(--radius-xl);
  pointer-events: none;
}

/* Pagination controls */
.sdb-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  padding: var(--spacing-sm) 0;
}

.sdb-page-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--foreground);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sdb-page-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--ring);
}

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

.sdb-page-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sdb-page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
}

.sdb-page-num:hover {
  background: var(--accent);
  color: var(--foreground);
}

.sdb-page-num.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  font-weight: 600;
}

.sdb-page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

/* Responsive: stack controls on small screens */
@media (max-width: 768px) {
  .sdb-controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .sdb-search-wrap {
    min-width: 100%;
  }

  .sdb-filter-select {
    min-width: 100%;
  }

  .sdb-page-numbers {
    flex-wrap: wrap;
    justify-content: center;
  }
}
