/* 🚀 BRAINYS GLOBAL FUTURISTIC DESIGN SYSTEM 🚀 */

/* =====================================================
   CORE VARIABLES & CUSTOM PROPERTIES
   ===================================================== */

:root {
  /* 🎨 Cyber Colors */
  --cyber-blue: #00F5FF;
  --neon-purple: #8A2BE2;
  --electric-green: #39FF14;
  --plasma-pink: #FF1493;
  --quantum-orange: #FF6B35;
  --void-black: #0A0A0F;
  --space-gray: #1A1A2E;
  --quantum-dark: #16213E;
  --neural-blue: #0f3460;
  
  /* 🔤 Typography */
  --font-primary: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
  --font-secondary: 'Rajdhani', 'Roboto', sans-serif;
  --font-code: 'Fira Code', 'Consolas', monospace;
  
  /* 📏 Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* 🎭 Effects */
  --transition-normal: 0.3s ease;
  --border-radius: 8px;
  --border-radius-lg: 12px;
}

/* Global icon size cap: brain/cell images */
img[alt*="Brain" i], img[alt*="brain" i],
img[src*="brain" i], img[src*="cell" i],
.brain-icon, .cell-icon, .logo-brain {
  max-width: 24px !important;
  max-height: 24px !important;
  width: 24px !important;
  height: 24px !important;
}

/* =====================================================
   BASE STYLES & RESET
   ===================================================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--void-black);
  color: white;
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* 🌟 COSMIC BACKGROUND */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(0, 245, 255, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(138, 43, 226, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 40% 40%, rgba(57, 255, 20, 0.02) 0%, transparent 40%),
    linear-gradient(135deg, var(--void-black) 0%, #111122 50%, #0f1829 100%);
  opacity: 1;
  z-index: -2;
}

/* ⚡ PARTICLE FIELD */
.particle-field {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--cyber-blue);
  border-radius: 50%;
  animation: float 25s linear infinite;
  opacity: 0.3;
}

@keyframes float {
  0% { transform: translateY(100vh) translateX(0); opacity: 0; }
  10% { opacity: 0.3; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-10vh) translateX(100px); opacity: 0; }
}

/* =====================================================
   TYPOGRAPHY & HEADINGS
   ===================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  color: #ffffff;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h1 {
  font-size: 2.2rem;
  text-align: center;
  color: var(--cyber-blue);
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.5);
  letter-spacing: 1px;
}

h2 {
  font-size: 1.6rem;
  color: #ffffff;
  border-bottom: 2px solid rgba(0, 245, 255, 0.3);
  padding-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

h3 {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-sm);
}

h4 {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.85);
}

p, span, div {
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
}

.text-secondary {
  color: rgba(255, 255, 255, 0.65);
}

/* ⚡ NEON EFFECTS */
.neon-text {
  color: var(--cyber-blue);
  text-shadow: 
    0 0 5px var(--cyber-blue),
    0 0 10px var(--cyber-blue),
    0 0 15px var(--cyber-blue);
  animation: neonGlow 2s ease-in-out infinite alternate;
}

@keyframes neonGlow {
  from { text-shadow: 0 0 5px var(--cyber-blue), 0 0 10px var(--cyber-blue), 0 0 15px var(--cyber-blue); }
  to { text-shadow: 0 0 10px var(--cyber-blue), 0 0 20px var(--cyber-blue), 0 0 30px var(--cyber-blue); }
}

/* =====================================================
   CARDS & CONTAINERS
   ===================================================== */

.card, article, section, .panel, .container-card {
  background: rgba(18, 18, 35, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 245, 255, 0.15);
  border-radius: var(--border-radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all var(--transition-normal);
}

.card:hover, article:hover, section:hover, .panel:hover {
  border-color: rgba(0, 245, 255, 0.3);
  box-shadow: 
    0 12px 48px rgba(0, 245, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

/* 💎 GLASSMORPHISM EFFECTS */
.glass-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* =====================================================
   BUTTONS & INTERACTIONS
   ===================================================== */

button, input[type="submit"], .btn {
  font-family: var(--font-secondary);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  padding: 12px 20px;
  border: 1px solid rgba(0, 245, 255, 0.4);
  background: rgba(0, 245, 255, 0.08);
  color: #ffffff;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

button:hover, input[type="submit"]:hover, .btn:hover {
  background: rgba(0, 245, 255, 0.15);
  border-color: var(--cyber-blue);
  box-shadow: 0 4px 16px rgba(0, 245, 255, 0.2);
  transform: translateY(-1px);
  color: #ffffff;
}

button:active, input[type="submit"]:active, .btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Primary Button Style */
.btn-primary, button[type="submit"], .primary {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.2), rgba(0, 245, 255, 0.1));
  border-color: var(--cyber-blue);
  font-weight: 700;
}

.btn-primary:hover, button[type="submit"]:hover, .primary:hover {
  background: linear-gradient(135deg, rgba(0, 245, 255, 0.3), rgba(0, 245, 255, 0.15));
  box-shadow: 0 0 25px rgba(0, 245, 255, 0.4);
}

/* Secondary Button Style */
.btn-secondary, .secondary {
  background: rgba(138, 43, 226, 0.1);
  border-color: var(--neon-purple);
}

.btn-secondary:hover, .secondary:hover {
  background: rgba(138, 43, 226, 0.2);
  border-color: var(--neon-purple);
  box-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
}

/* Danger Button Style */
.btn-danger, .danger {
  background: rgba(255, 20, 147, 0.1);
  border-color: var(--plasma-pink);
}

.btn-danger:hover, .danger:hover {
  background: rgba(255, 20, 147, 0.2);
  border-color: var(--plasma-pink);
  box-shadow: 0 0 20px rgba(255, 20, 147, 0.3);
}

/* Success Button Style */
.btn-success, .success {
  background: rgba(57, 255, 20, 0.1);
  border-color: var(--electric-green);
}

.btn-success:hover, .success:hover {
  background: rgba(57, 255, 20, 0.2);
  border-color: var(--electric-green);
  box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

/* =====================================================
   FORMS & INPUTS
   ===================================================== */

input, select, textarea {
  background: rgba(18, 18, 35, 0.9);
  border: 1px solid rgba(0, 245, 255, 0.25);
  border-radius: var(--border-radius);
  color: #ffffff;
  padding: 12px 16px;
  font-family: var(--font-secondary);
  font-size: 14px;
  transition: all var(--transition-normal);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyber-blue);
  box-shadow: 
    0 0 10px rgba(0, 245, 255, 0.2),
    inset 0 1px 3px rgba(0, 0, 0, 0.3);
  background: rgba(18, 18, 35, 0.95);
}

input::placeholder, textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

label {
  display: block;
  margin-bottom: var(--space-sm);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 14px;
}

/* =====================================================
   NAVIGATION & MENUS
   ===================================================== */

nav, .navigation, .navbar {
  background: rgba(18, 18, 35, 0.95);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 245, 255, 0.15);
  border-radius: var(--border-radius-lg);
  padding: 12px 20px;
  margin-bottom: var(--space-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

nav ul, .nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

nav a, .nav-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--border-radius);
  transition: all var(--transition-normal);
  font-family: var(--font-secondary);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.3px;
}

nav a:hover, nav a.active, .nav-link:hover, .nav-link.active {
  color: #ffffff;
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid rgba(0, 245, 255, 0.2);
  box-shadow: 0 0 15px rgba(0, 245, 255, 0.2);
}

/* =====================================================
   ICON FIXES & SIZING
   ===================================================== */

/* 🧠 BRAIN/CELL ICON SIZE FIX */
.brain-icon, .logo-brain, [class*="brain"], img[src*="brain"],
.cell-icon, img[src*="cell"], img[alt*="Cell"], img[alt*="cell"] {
  max-width: 20px !important;
  max-height: 20px !important;
  width: 20px !important;
  height: 20px !important;
}

/* Specific cell icon targeting */
img.cell-icon {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

/* Force specific image dimensions */
img[src="/cell.png"], img[src="./cell.png"] {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
}

/* =====================================================
   TABLES & DATA DISPLAY
   ===================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(18, 18, 35, 0.6);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
  background: rgba(0, 245, 255, 0.1);
  color: var(--cyber-blue);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
}

tr:hover {
  background: rgba(0, 245, 255, 0.05);
}

/* =====================================================
   STATUS MESSAGES & ALERTS
   ===================================================== */

.error, .alert-error {
  color: var(--plasma-pink);
  background: rgba(255, 20, 147, 0.1);
  border: 1px solid var(--plasma-pink);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  text-shadow: 0 0 5px var(--plasma-pink);
}

.success, .alert-success {
  color: var(--electric-green);
  background: rgba(57, 255, 20, 0.1);
  border: 1px solid var(--electric-green);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  text-shadow: 0 0 5px var(--electric-green);
}

.warning, .alert-warning {
  color: var(--quantum-orange);
  background: rgba(255, 107, 53, 0.1);
  border: 1px solid var(--quantum-orange);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  text-shadow: 0 0 5px var(--quantum-orange);
}

.info, .alert-info {
  color: var(--cyber-blue);
  background: rgba(0, 245, 255, 0.1);
  border: 1px solid var(--cyber-blue);
  border-radius: var(--border-radius);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  text-shadow: 0 0 5px var(--cyber-blue);
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */

.center {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  justify-content: center;
}

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

.hidden {
  display: none;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 245, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--cyber-blue);
  animation: spin 1s ease-in-out infinite;
}

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

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 768px) {
  body {
    font-size: 13px;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.4rem;
  }
  
  .card, article, section, .panel {
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
  }
  
  button, input[type="submit"], .btn {
    padding: 10px 16px;
    font-size: 13px;
  }
  
  nav, .navigation {
    padding: var(--space-sm) var(--space-md);
  }
  
  nav ul, .nav-list {
    gap: 4px;
  }
  
  nav a, .nav-link {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* =====================================================
   SCROLLBAR STYLING
   ===================================================== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--quantum-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--cyber-blue);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--neon-purple);
}

/* =====================================================
   MODAL STYLING
   ===================================================== */

.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.9) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
  backdrop-filter: blur(8px) !important;
  margin: 0 !important;
  padding: 0 !important;
}

.modal-content {
  background: var(--quantum-dark) !important;
  border: 2px solid var(--cyber-blue) !important;
  border-radius: var(--border-radius-lg) !important;
  padding: var(--space-xl) !important;
  max-width: 400px !important;
  width: 90% !important;
  box-shadow: 0 0 30px rgba(0, 245, 255, 0.3) !important;
  animation: modalSlideIn 0.3s ease-out !important;
  position: relative !important;
  z-index: 100000 !important;
  margin: 0 !important;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* =====================================================
   ROLE PROGRESSION STYLING
   ===================================================== */

.role-progression-container {
  display: grid;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.role-info, .xp-progress, .available-roles, .achievements {
  background: var(--quantum-dark);
  border: 1px solid var(--cyber-blue);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
}

.role-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--cyber-blue), var(--neon-purple));
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-bar {
  background: var(--space-gray);
  border-radius: 10px;
  height: 20px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  background: linear-gradient(90deg, var(--cyber-blue), var(--electric-green));
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.role-card {
  background: var(--space-gray);
  border: 1px solid rgba(0, 245, 255, 0.3);
  border-radius: var(--border-radius);
  padding: 1rem;
  transition: all 0.3s ease;
}

.role-card.unlocked {
  border-color: var(--electric-green);
  background: rgba(57, 255, 20, 0.1);
}

.role-card.current {
  border-color: var(--cyber-blue);
  background: rgba(0, 245, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 245, 255, 0.3);
}

.role-card h4 {
  margin: 0 0 0.5rem 0;
  color: var(--cyber-blue);
  font-size: 1.1rem;
}

.role-card p {
  margin: 0 0 1rem 0;
  color: #ccc;
  font-size: 0.9rem;
}

.role-requirements {
  font-size: 0.8rem;
  color: #999;
}

.unlocked-text {
  color: var(--electric-green) !important;
  font-weight: 600;
}

.achievements-list {
  display: grid;
  gap: 1rem;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--space-gray);
  border-radius: var(--border-radius);
  border: 1px solid rgba(0, 245, 255, 0.2);
}

.achievement-icon {
  font-size: 2rem;
}

.no-achievements {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 2rem;
}

.vote-container {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-right: 12px;
}

.vote-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
  color: #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s ease;
}

.vote-button:hover { background: rgba(255,255,255,0.08); }
.vote-button.vote-active { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.35); }
.vote-button.downvote.vote-active { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.35); }

.vote-score { font-weight: 700; opacity: .85; min-width: 20px; text-align: center; }

.report-button {
  margin-left: .5rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
  color: #fbbf24;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}
.report-button:hover { background: rgba(251,191,36,0.12); }

.modal-content h3 {
  color: var(--cyber-blue);
  margin: 0 0 var(--space-md) 0;
  font-size: 1.4rem;
  text-align: center;
}

.modal-content p {
  color: #ccc;
  margin: 0 0 var(--space-lg) 0;
  text-align: center;
}

.modal-content .form-group {
  margin-bottom: var(--space-lg);
}

.modal-content label {
  display: block;
  color: var(--cyber-blue);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

.access-code-input {
  width: 100%;
  padding: var(--space-md);
  background: var(--space-gray);
  border: 2px solid var(--cyber-blue);
  border-radius: var(--border-radius);
  color: white;
  font-size: 1rem;
  font-family: var(--font-code);
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.access-code-input:focus {
  outline: none;
  border-color: var(--neon-purple);
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.modal-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
}

.btn-secondary {
  background: var(--space-gray);
  color: #ccc;
  border: 2px solid #666;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition-normal);
}

.btn-secondary:hover {
  background: #333;
  border-color: #999;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyber-blue), var(--neon-purple));
  color: white;
  border: none;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition-normal);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 245, 255, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
