/*
 * Martian OSS Visor - Matrix Dark Theme
 * "Welcome to the Real World" - Morpheus
 */

/* ====== CSS Variables for Matrix Theme ====== */
:root {
  --matrix-green: #00ff41;
  --matrix-green-dim: #00cc33;
  --matrix-green-glow: 0 0 10px #00ff41, 0 0 20px #00ff4180, 0 0 30px #00ff4140;
  --matrix-green-glow-sm: 0 0 5px #00ff41, 0 0 10px #00ff4180;
  --matrix-black: #0a0a0a;
  --matrix-dark: #0d1117;
  --matrix-darker: #010409;
  --matrix-gray: #161b22;
  --matrix-gray-light: #21262d;
  --matrix-border: #30363d;
  --matrix-text: #c9d1d9;
  --matrix-text-dim: #8b949e;
  --matrix-purple: #bc13fe;
  --matrix-cyan: #00d4ff;
  --matrix-red: #ff3131;
}

/* ====== Base Styles ====== */
body {
  font-family: 'Martian Grotesk', ui-sans-serif, system-ui, sans-serif;
  background: var(--matrix-darker);
  color: var(--matrix-text);
  font-size: 14px;
}

/* Scale down text sizes for the wide font */
.text-3xl {
  font-size: 1.5rem !important;
}

.text-2xl {
  font-size: 1.25rem !important;
}

.text-xl {
  font-size: 1.1rem !important;
}

.text-lg {
  font-size: 0.95rem !important;
}

.text-sm {
  font-size: 0.8rem !important;
}

.text-xs {
  font-size: 0.7rem !important;
}

/* Subtle scanline effect on body */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.1) 0px,
    rgba(0, 0, 0, 0.1) 1px,
    transparent 1px,
    transparent 2px
  );
  z-index: 9999;
  opacity: 0.3;
}

code, pre, .font-mono {
  font-family: 'Martian Mono', ui-monospace, monospace;
}

/* ====== Smooth Transitions ====== */
a, button, .btn {
  transition: all 0.2s ease-in-out;
}

/* ====== Focus States - Green Glow ====== */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--matrix-green), var(--matrix-green-glow-sm);
}

/* ====== Cards - Dark with Green Accents ====== */
.bg-white {
  background: var(--matrix-gray) !important;
  border: 1px solid var(--matrix-border);
}

.bg-white.rounded-lg.shadow {
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.05);
  transition: all 0.3s ease;
}

.bg-white.rounded-lg.shadow:hover {
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.1), 0 4px 20px rgba(0, 0, 0, 0.3);
  border-color: var(--matrix-green-dim);
}

/* ====== Stat Cards ====== */
.stat-card {
  background: linear-gradient(145deg, var(--matrix-gray) 0%, var(--matrix-dark) 100%) !important;
  border: 1px solid var(--matrix-border);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--matrix-green), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--matrix-green-dim);
  box-shadow: var(--matrix-green-glow-sm);
}

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

/* ====== Text Colors ====== */
.text-gray-900 {
  color: var(--matrix-text) !important;
}

.text-gray-700 {
  color: var(--matrix-text) !important;
}

.text-gray-600 {
  color: var(--matrix-text-dim) !important;
}

.text-gray-500 {
  color: var(--matrix-text-dim) !important;
}

.text-gray-400 {
  color: #6e7681 !important;
}

/* Headings with subtle glow */
h1, h2, h3 {
  color: var(--matrix-text);
}

h1 {
  text-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
}

/* ====== Links - Green Glow ====== */
a.text-indigo-600,
a.hover\:text-indigo-600:hover,
.text-indigo-600 {
  color: var(--matrix-green) !important;
  text-shadow: none;
  transition: all 0.2s ease;
}

a.text-indigo-600:hover,
a:hover .text-indigo-600 {
  color: var(--matrix-green) !important;
  text-shadow: var(--matrix-green-glow-sm);
}

/* ====== Navigation ====== */
nav.bg-gray-900 {
  background: linear-gradient(180deg, var(--matrix-dark) 0%, var(--matrix-darker) 100%) !important;
  border-bottom: 1px solid var(--matrix-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

nav a.bg-gray-800 {
  background: var(--matrix-gray) !important;
  color: var(--matrix-green) !important;
  text-shadow: var(--matrix-green-glow-sm);
  position: relative;
}

nav a.bg-gray-800::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 2px;
  background: var(--matrix-green);
  box-shadow: var(--matrix-green-glow);
  border-radius: 1px;
}

nav a.text-gray-300:hover {
  color: var(--matrix-green) !important;
  text-shadow: var(--matrix-green-glow-sm);
}

/* ====== Buttons ====== */
button, .btn {
  transition: all 0.2s ease;
}

/* ====== Badges ====== */
.bg-green-100 {
  background: rgba(0, 255, 65, 0.15) !important;
  color: var(--matrix-green) !important;
  border: 1px solid rgba(0, 255, 65, 0.3);
}

.bg-purple-100 {
  background: rgba(188, 19, 254, 0.15) !important;
  color: var(--matrix-purple) !important;
  border: 1px solid rgba(188, 19, 254, 0.3);
}

.bg-gray-100 {
  background: var(--matrix-gray-light) !important;
  color: var(--matrix-text-dim) !important;
  border: 1px solid var(--matrix-border);
}

.bg-yellow-100 {
  background: rgba(255, 193, 7, 0.15) !important;
  color: #ffc107 !important;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.bg-blue-100 {
  background: rgba(0, 212, 255, 0.15) !important;
  color: var(--matrix-cyan) !important;
  border: 1px solid rgba(0, 212, 255, 0.3);
}

/* ====== Year Selector - Prominent ====== */
.bg-indigo-50 {
  background: linear-gradient(145deg, var(--matrix-gray) 0%, var(--matrix-dark) 100%) !important;
  border: 1px solid var(--matrix-green-dim) !important;
  box-shadow: var(--matrix-green-glow-sm);
}

.bg-indigo-50 .text-indigo-700 {
  color: var(--matrix-green) !important;
}

.bg-indigo-50 select {
  background: transparent !important;
  color: var(--matrix-green) !important;
  border: none !important;
  box-shadow: none !important;
  text-shadow: var(--matrix-green-glow-sm);
}

.bg-indigo-50 select:focus {
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* ====== Tables ====== */
.bg-gray-50 {
  background: var(--matrix-dark) !important;
}

thead.bg-gray-50 {
  background: var(--matrix-gray) !important;
}

tbody tr {
  transition: all 0.15s ease;
  border-color: var(--matrix-border);
}

tbody tr:hover {
  background: var(--matrix-gray-light) !important;
}

.divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--matrix-border);
}

/* ====== Contributor/Project Rows ====== */
.bg-indigo-50:not(.rounded-lg) {
  background: rgba(0, 255, 65, 0.1) !important;
  border: 1px solid rgba(0, 255, 65, 0.2);
}

.text-indigo-600 {
  color: var(--matrix-green) !important;
}

/* ====== Mekko Chart Bars ====== */
.mekko-bar {
  height: 0;
}
.animate-now .mekko-bar {
  animation: mekkoGrow 1.5s ease-out forwards;
}

@keyframes mekkoGrow {
  0% {
    height: 0;
  }
  100% {
    height: var(--bar-height);
  }
}

.bg-green-500 {
  background: var(--matrix-green) !important;
  box-shadow: 0 0 10px var(--matrix-green);
}

.bg-green-200 {
  background: rgba(0, 255, 65, 0.3) !important;
}

.bg-purple-500 {
  background: var(--matrix-purple) !important;
  box-shadow: 0 0 10px var(--matrix-purple);
}

.bg-purple-200 {
  background: rgba(188, 19, 254, 0.3) !important;
}

.bg-gray-500 {
  background: #6e7681 !important;
}

.bg-gray-200 {
  background: rgba(110, 118, 129, 0.3) !important;
}

/* ====== Avatar Hover Effects ====== */
.flex.-space-x-1 img:hover,
.flex.-space-x-1 div:hover,
.flex.-space-x-1\.5 img:hover,
.flex.-space-x-1\.5 div:hover {
  transform: scale(1.15);
  z-index: 10;
  box-shadow: 0 0 15px var(--matrix-green);
}

img.rounded-full {
  border: 2px solid var(--matrix-border);
  transition: all 0.2s ease;
}

img.rounded-full:hover {
  border-color: var(--matrix-green);
  box-shadow: 0 0 10px var(--matrix-green);
}

/* ====== Toast Notifications ====== */
.flash-toast {
  background: var(--matrix-gray) !important;
  border: 1px solid var(--matrix-green-dim) !important;
  box-shadow: var(--matrix-green-glow);
  animation: glitchIn 0.3s ease-out;
}

.flash-toast .text-green-700 {
  color: var(--matrix-green) !important;
}

.flash-toast .text-green-400 {
  color: var(--matrix-green) !important;
}

@keyframes glitchIn {
  0% {
    opacity: 0;
    transform: translateX(20px) skewX(-5deg);
  }
  50% {
    transform: translateX(-5px) skewX(2deg);
  }
  100% {
    opacity: 1;
    transform: translateX(0) skewX(0);
  }
}

/* ====== Scrollbar - Matrix Style ====== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--matrix-darker);
}

::-webkit-scrollbar-thumb {
  background: var(--matrix-green-dim);
  border-radius: 4px;
  box-shadow: 0 0 5px var(--matrix-green);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--matrix-green);
}

/* ====== Selection ====== */
::selection {
  background: var(--matrix-green);
  color: var(--matrix-black);
}

/* ====== Progress Bars ====== */
.bg-green-500.h-2 {
  box-shadow: 0 0 10px var(--matrix-green);
}

/* ====== Charts ====== */
[data-chartkick-height] {
  min-height: 200px;
}

/* Pie chart pulsating glow effect */
.pie-chart-glow canvas {
  animation: pieGlow 3s ease-in-out infinite;
}

@keyframes pieGlow {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 25px rgba(0, 255, 65, 0.6)) drop-shadow(0 0 40px rgba(0, 255, 65, 0.3));
  }
}

/* Other charts subtle glow */
canvas:not(.pie-chart-glow canvas) {
  filter: drop-shadow(0 0 8px rgba(0, 255, 65, 0.2));
}

/* Chart-specific glow effects */
.chart-glow-green canvas {
  filter: drop-shadow(0 0 15px rgba(0, 255, 65, 0.4)) drop-shadow(0 0 30px rgba(0, 255, 65, 0.2));
}

.chart-glow-cyan canvas {
  filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.4)) drop-shadow(0 0 30px rgba(0, 212, 255, 0.2));
}

.chart-glow-green:hover canvas,
.chart-glow-cyan:hover canvas {
  filter: drop-shadow(0 0 20px rgba(0, 255, 65, 0.5)) drop-shadow(0 0 40px rgba(0, 255, 65, 0.3));
  transition: filter 0.3s ease;
}

.chart-glow-cyan:hover canvas {
  filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.5)) drop-shadow(0 0 40px rgba(0, 212, 255, 0.3));
}

/* ====== Inputs & Selects ====== */
input, select, textarea {
  background: var(--matrix-dark) !important;
  border-color: var(--matrix-border) !important;
  color: var(--matrix-text) !important;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--matrix-green) !important;
  box-shadow: 0 0 0 1px var(--matrix-green), var(--matrix-green-glow-sm) !important;
}

/* ====== Tabs ====== */
.tab-btn {
  transition: all 0.2s ease;
}

.tab-btn.border-green-500 {
  border-color: var(--matrix-green) !important;
  color: var(--matrix-green) !important;
  text-shadow: var(--matrix-green-glow-sm);
}

/* ====== Filter Tags ====== */
.filter-tag {
  transition: all 0.2s ease;
}

.filter-tag.active {
  border: 1px solid var(--matrix-green-dim);
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.4), 0 0 15px rgba(0, 255, 65, 0.2);
}

.filter-tag.active.bg-green-100 {
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.5), 0 0 15px rgba(0, 255, 65, 0.3);
}

.filter-tag.active.bg-purple-100 {
  border-color: rgba(188, 19, 254, 0.5);
  box-shadow: 0 0 8px rgba(188, 19, 254, 0.5), 0 0 15px rgba(188, 19, 254, 0.3);
}

.filter-tag.active.bg-yellow-100 {
  border-color: rgba(255, 193, 7, 0.5);
  box-shadow: 0 0 8px rgba(255, 193, 7, 0.5), 0 0 15px rgba(255, 193, 7, 0.3);
}

/* Color-specific glows for filter tags */
.filter-tag.active.border-green-500 {
  box-shadow: 0 0 5px #00ff41, 0 0 10px #00ff4180;
}

.filter-tag.active.border-purple-500 {
  box-shadow: 0 0 5px #bc13fe, 0 0 10px #bc13fe80;
}

.filter-tag.active.border-gray-500 {
  box-shadow: 0 0 5px rgba(110, 118, 129, 0.5);
}

/* ====== Language Colors in List ====== */
.space-y-2 a:hover {
  background: var(--matrix-gray-light) !important;
}

/* ====== Empty States ====== */
.text-center.py-8 {
  color: var(--matrix-text-dim);
}

/* ====== Code blocks ====== */
code.bg-gray-100 {
  background: var(--matrix-dark) !important;
  color: var(--matrix-green) !important;
  border: 1px solid var(--matrix-border);
  text-shadow: 0 0 5px var(--matrix-green);
}

/* ====== Special Glow Animation for Key Numbers ====== */
.text-3xl.font-semibold {
  animation: numberPulse 3s ease-in-out infinite;
}

@keyframes numberPulse {
  0%, 100% {
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.3);
  }
  50% {
    text-shadow: 0 0 15px rgba(0, 255, 65, 0.5), 0 0 25px rgba(0, 255, 65, 0.3);
  }
}

/* ====== Logo Glow ====== */
nav img {
  filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.5));
  transition: filter 0.3s ease;
}

nav img:hover {
  filter: drop-shadow(0 0 20px rgba(0, 255, 65, 0.8));
}

/* ====== Border Colors ====== */
.border-gray-200, .border-gray-300 {
  border-color: var(--matrix-border) !important;
}

.border-b {
  border-color: var(--matrix-border);
}

/* ====== Living Effects - Subtle Ambient Animations ====== */

/* Star icons pulse with golden glow */
.text-yellow-400 {
  animation: starPulse 4s ease-in-out infinite;
}

@keyframes starPulse {
  0%, 100% {
    filter: drop-shadow(0 0 2px rgba(250, 204, 21, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(250, 204, 21, 0.8));
  }
}

/* Language color dots glow */
.rounded-full[style*="background-color"] {
  animation: dotPulse 3s ease-in-out infinite;
  box-shadow: 0 0 4px currentColor;
}

@keyframes dotPulse {
  0%, 100% {
    opacity: 0.9;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* Progress bars shimmer effect */
.bg-green-500.h-2,
.bg-green-500.rounded-full {
  position: relative;
  overflow: hidden;
}

.bg-green-500.h-2::after,
.bg-green-500.rounded-full::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  50%, 100% {
    left: 100%;
  }
}

/* Badges subtle breathing */
.bg-green-100,
.bg-purple-100,
.bg-yellow-100,
.bg-blue-100 {
  animation: badgeBreath 4s ease-in-out infinite;
}

/* Stagger badge animations */
.bg-purple-100 { animation-delay: 1s; }
.bg-yellow-100 { animation-delay: 2s; }
.bg-blue-100 { animation-delay: 3s; }

@keyframes badgeBreath {
  0%, 100% {
    box-shadow: 0 0 0 0 transparent;
  }
  50% {
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.2);
  }
}

/* Avatars in stacked groups - subtle ring pulse */
.flex.-space-x-1 img:nth-child(1),
.flex.-space-x-1\.5 img:nth-child(1) {
  animation: avatarPulse 5s ease-in-out infinite;
}

.flex.-space-x-1 img:nth-child(2),
.flex.-space-x-1\.5 img:nth-child(2) {
  animation: avatarPulse 5s ease-in-out infinite 0.5s;
}

.flex.-space-x-1 img:nth-child(3),
.flex.-space-x-1\.5 img:nth-child(3) {
  animation: avatarPulse 5s ease-in-out infinite 1s;
}

@keyframes avatarPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 transparent;
  }
  50% {
    box-shadow: 0 0 6px rgba(0, 255, 65, 0.4);
  }
}

/* Active tab indicator glow - only for tab buttons, not filter tags */
.tab-btn.border-green-500,
.tab-btn.border-yellow-500,
.tab-btn.border-purple-500 {
  position: relative;
}

.tab-btn.border-green-500::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--matrix-green);
  box-shadow: 0 0 10px var(--matrix-green);
  animation: tabGlow 2s ease-in-out infinite;
}

@keyframes tabGlow {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* Cards staggered ambient glow */
.grid > .bg-white:nth-child(4n+1) { animation: cardAmbient 8s ease-in-out infinite; }
.grid > .bg-white:nth-child(4n+2) { animation: cardAmbient 8s ease-in-out infinite 2s; }
.grid > .bg-white:nth-child(4n+3) { animation: cardAmbient 8s ease-in-out infinite 4s; }
.grid > .bg-white:nth-child(4n+4) { animation: cardAmbient 8s ease-in-out infinite 6s; }

@keyframes cardAmbient {
  0%, 100% {
    border-color: var(--matrix-border);
  }
  50% {
    border-color: rgba(0, 255, 65, 0.3);
  }
}

/* Mekko chart bars pulse */
.bg-green-500[style*="height"],
.bg-purple-500[style*="height"] {
  animation: barPulse 4s ease-in-out infinite;
}

.bg-purple-500[style*="height"] {
  animation-delay: 2s;
}

@keyframes barPulse {
  0%, 100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.2);
  }
}

/* Contribution count numbers subtle glow */
.text-green-600,
.text-purple-600,
.text-yellow-600 {
  animation: countGlow 3s ease-in-out infinite;
}

.text-purple-600 { animation-delay: 1s; }
.text-yellow-600 { animation-delay: 2s; }

@keyframes countGlow {
  0%, 100% {
    text-shadow: none;
  }
  50% {
    text-shadow: 0 0 10px currentColor;
  }
}

/* Navigation pending badge pulse */
.bg-yellow-400 {
  animation: pendingPulse 2s ease-in-out infinite;
}

@keyframes pendingPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(250, 204, 21, 0);
  }
}

/* ====== Matrix Loader ====== */
.matrix-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1s ease-out, filter 1s ease-out;
}

.matrix-loader.fading-out {
  opacity: 0;
  filter: blur(8px);
}

.matrix-loader.hidden {
  display: none;
}

.matrix-loader canvas {
  position: absolute;
  top: 0;
  left: 0;
}

.matrix-loader-text {
  position: relative;
  z-index: 1;
  text-align: center;
}

.matrix-loader-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: #00ff41;
  text-shadow: 0 0 10px #00ff41, 0 0 20px #00ff41;
  animation: pulse-glow 1.5s ease-in-out infinite;
}

.matrix-loader-subtitle {
  font-size: 0.875rem;
  color: #00ff41;
  opacity: 0.7;
  margin-top: 0.5rem;
  font-family: monospace;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; text-shadow: 0 0 10px #00ff41, 0 0 20px #00ff41; }
  50% { opacity: 0.7; text-shadow: 0 0 5px #00ff41, 0 0 10px #00ff41; }
}

/* Pause animations while Matrix loader is visible */
body.animations-paused .panel {
  animation-play-state: paused;
  opacity: 0;
}
body.animations-paused .panel::before {
  animation-play-state: paused;
}
body.animations-paused .big-win-row {
  animation-play-state: paused;
}
body.animations-paused .mekko-bar {
  animation-play-state: paused;
}
