/* Modern Design System Tokens */
:root {
  /* Light Theme Defaults */
  --bg-primary: radial-gradient(circle at 50% 0%, #f8fafc 0%, #e2e8f0 100%);
  --bg-panel: rgba(255, 255, 255, 0.45);
  --bg-card: rgba(255, 255, 255, 0.65);
  --bg-card-hover: rgba(255, 255, 255, 0.85);
  --border-glass: rgba(255, 255, 255, 0.4);
  --border-glass-hover: rgba(255, 255, 255, 0.7);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-inverse: #ffffff;
  --accent-ios: #4f46e5;
  --accent-ios-glow: rgba(79, 70, 229, 0.15);
  --accent-android: #059669;
  --accent-android-glow: rgba(5, 150, 105, 0.15);
  --accent-gradient-primary: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --shadow-sm: 0 2px 8px -1px rgba(15, 23, 42, 0.04), 0 1px 3px -1px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.1);
  --card-blur: 16px;
}

/* Dark Theme Overrides */
html.dark {
  --bg-primary: radial-gradient(circle at 50% 0%, #0f172a 0%, #020617 100%);
  --bg-panel: rgba(15, 23, 42, 0.35);
  --bg-card: rgba(30, 41, 59, 0.35);
  --bg-card-hover: rgba(30, 41, 59, 0.55);
  --border-glass: rgba(255, 255, 255, 0.05);
  --border-glass-hover: rgba(255, 255, 255, 0.12);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  --accent-ios: #818cf8;
  --accent-ios-glow: rgba(129, 140, 248, 0.25);
  --accent-android: #34d399;
  --accent-android-glow: rgba(52, 211, 153, 0.25);
  --accent-gradient-primary: linear-gradient(135deg, #6366f1 0%, #22d3ee 100%);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

/* Base resets & styles */
body {
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  transition: background 0.5s ease, color 0.3s ease;
}

/* Typography styles */
h1, h2, h3, .font-heading {
  font-family: 'Outfit', sans-serif;
}

/* Frosted glass utilities */
.glass-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-md);
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease, 
              border-color 0.3s ease, 
              background-color 0.3s ease;
}

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

/* Platforms Specific Gradients & Shadows on hover */
.glass-card.card-ios:hover {
  border-color: var(--accent-ios);
  box-shadow: 0 12px 24px -10px var(--accent-ios-glow);
}

.glass-card.card-android:hover {
  border-color: var(--accent-android);
  box-shadow: 0 12px 24px -10px var(--accent-android-glow);
}

/* Compact modern scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  opacity: 0.3;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-main);
}

/* Beautiful Animated Gauges */
.gauge-bar {
  position: relative;
  overflow: hidden;
}
.gauge-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-image: linear-gradient(
    90deg, 
    rgba(255, 255, 255, 0.15) 25%, 
    transparent 25%, 
    transparent 50%, 
    rgba(255, 255, 255, 0.15) 50%, 
    rgba(255, 255, 255, 0.15) 75%, 
    transparent 75%, 
    transparent
  );
  background-size: 20px 20px;
  animation: bar-stripes 1.5s linear infinite;
  opacity: 0.12;
}

@keyframes bar-stripes {
  from { background-position: 0 0; }
  to { background-position: 20px 0; }
}

/* Responsive bottom sheet filters (Mobile Drawer) */
@keyframes slide-up {
  from {
    transform: translateY(100%);
    opacity: 0.5;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.mobile-filters-drawer {
  animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Discrete element animations with @starting-style */
.fade-item {
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 1;
  transform: translateY(0);
}

@starting-style {
  .fade-item {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* Layout views transitions */
.layout-transition-active {
  transition: opacity 0.25s ease-in-out;
}

/* High dynamic range meters */
.meter-fill-low {
  background: linear-gradient(90deg, #10b981, #34d399);
}
.meter-fill-med {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}
.meter-fill-high {
  background: linear-gradient(90deg, #ef4444, #f87171);
}

/* Shimmer skeleton loading */
.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 20%,
    rgba(255, 255, 255, 0.2) 60%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer-anim 1.6s infinite;
}

html.dark .shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.03) 20%,
    rgba(255, 255, 255, 0.08) 60%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
}

@keyframes shimmer-anim {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}
