/* 🦞 Zoidberg Dashboard System - Core CSS
 * Cutting-edge 2026 features for 2028 vibes
 */

/* ═══════════════════════════════════════════════════════════════
   CSS Custom Properties (Design Tokens)
   ═══════════════════════════════════════════════════════════════ */
:root {
  /* Colors - Dark theme first */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);
  
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  
  --accent-primary: #ff4d4d;      /* F1 Red */
  --accent-secondary: #00d4ff;    /* Cyan */
  --accent-success: #00ff88;      /* Green */
  --accent-warning: #ffaa00;      /* Amber */
  --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  
  /* Glassmorphism */
  --glass-blur: 20px;
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  
  /* Typography - Variable font with emoji support */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-emoji: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', emoji;
  
  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
  
  /* Container query units */
  --card-padding: clamp(1rem, 3cqw, 2rem);
}

/* ═══════════════════════════════════════════════════════════════
   Modern Reset
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════
   Typography
   ═══════════════════════════════════════════════════════════════ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ═══════════════════════════════════════════════════════════════
   Layout - Container Queries
   ═══════════════════════════════════════════════════════════════ */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
  gap: var(--space-lg);
  padding: var(--space-xl);
  max-width: 1800px;
  margin: 0 auto;
}

.dashboard-full {
  grid-column: 1 / -1;
}

/* ═══════════════════════════════════════════════════════════════
   Glassmorphism Card
   ═══════════════════════════════════════════════════════════════ */
.card {
  container-type: inline-size;
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  padding: var(--card-padding);
  transition: transform var(--transition-normal), 
              box-shadow var(--transition-normal);
}

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

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

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-badge {
  font-size: 0.75rem;
  padding: 0.25em 0.75em;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  color: white;
}

/* Container query responsive card content */
@container (min-width: 400px) {
  .card-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
}

@container (min-width: 600px) {
  .card-content {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ═══════════════════════════════════════════════════════════════
   Stat Display
   ═══════════════════════════════════════════════════════════════ */
.stat {
  text-align: center;
  padding: var(--space-md);
}

.stat-value {
  font-size: clamp(1.5rem, 5cqw, 2.5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-change {
  font-size: 0.8rem;
  margin-top: var(--space-xs);
}

.stat-change.positive { color: var(--accent-success); }
.stat-change.negative { color: var(--accent-primary); }

/* ═══════════════════════════════════════════════════════════════
   Animations - Scroll Driven
   ═══════════════════════════════════════════════════════════════ */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fade-in-up var(--transition-slow) ease-out;
  animation-fill-mode: both;
  animation-delay: calc(var(--stagger, 0) * 100ms);
}

/* Stagger children using sibling-index() fallback */
.stagger-children > * {
  --stagger: 0;
}
.stagger-children > *:nth-child(1) { --stagger: 0; }
.stagger-children > *:nth-child(2) { --stagger: 1; }
.stagger-children > *:nth-child(3) { --stagger: 2; }
.stagger-children > *:nth-child(4) { --stagger: 3; }
.stagger-children > *:nth-child(5) { --stagger: 4; }
.stagger-children > *:nth-child(6) { --stagger: 5; }

/* View Transitions */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.3s;
}

/* ═══════════════════════════════════════════════════════════════
   Utilities
   ═══════════════════════════════════════════════════════════════ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════
   Page Layout - Shared across all dashboards
   ═══════════════════════════════════════════════════════════════ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.hero-section {
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  margin-bottom: var(--space-xl);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  margin-bottom: var(--space-md);
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ═══════════════════════════════════════════════════════════════
   Shared Components - Consistency across all pages
   ═══════════════════════════════════════════════════════════════ */

/* Standardized card grid - fixes spacing inconsistency */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}

/* Entry dividers for lists */
.entry-divider {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: var(--space-lg);
  margin-bottom: var(--space-lg);
}

/* Secondary/muted text styling */
.text-tertiary {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

/* Key labels that should stand out */
.label-key {
  font-weight: 600;
  color: var(--text-primary);
}

/* Consistent stats bar */
.stats-row {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  padding: var(--space-lg);
  background: var(--bg-glass);
  backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
}

/* Legend component */
.legend {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-top: var(--space-sm);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
