/* ============================================
   E-BRAIN Neural Dashboard - Futuristic Theme
   ============================================
   A stunning, balanced neural-inspired theme
   for the bio-inspired memory platform
   ============================================ */

/* CSS Variables - Neural Color System */
:root {
  /* Primary Neural Colors */
  --neural-cyan: #00D4FF;
  --neural-blue: #3B82F6;
  --electric-purple: #8B5CF6;
  --deep-violet: #7C3AED;

  /* Secondary Synaptic Colors */
  --synaptic-green: #10B981;
  --synapse-teal: #14B8A6;
  --memory-amber: #F59E0B;
  --pulse-pink: #EC4899;
  --neural-gold: #FBBF24;

  /* Background Gradient (Balanced - Not Too Dark) */
  --bg-start: #0F172A;
  --bg-mid: #1E293B;
  --bg-end: #334155;
  --bg-accent: #475569;

  /* Surface Colors (Glassmorphism) */
  --surface-primary: rgba(30, 41, 59, 0.85);
  --surface-secondary: rgba(51, 65, 85, 0.7);
  --surface-tertiary: rgba(71, 85, 105, 0.5);
  --surface-hover: rgba(30, 41, 59, 0.95);

  /* Border Colors */
  --border-glow: rgba(0, 212, 255, 0.3);
  --border-subtle: rgba(148, 163, 184, 0.2);
  --border-accent: rgba(139, 92, 246, 0.3);

  /* Text Colors */
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --text-accent: #00D4FF;

  /* Memory Type Colors */
  --mem-episodic: #00D4FF;
  --mem-semantic: #8B5CF6;
  --mem-procedural: #10B981;
  --mem-working: #F59E0B;
  --mem-learned: #EC4899;

  /* Status Colors */
  --status-healthy: #10B981;
  --status-warning: #F59E0B;
  --status-error: #EF4444;
  --status-info: #3B82F6;

  /* Shadows */
  --shadow-glow-sm: 0 0 15px rgba(0, 212, 255, 0.2);
  --shadow-glow-md: 0 0 25px rgba(0, 212, 255, 0.3);
  --shadow-glow-lg: 0 0 40px rgba(0, 212, 255, 0.4);
  --shadow-depth: 0 4px 20px rgba(0, 0, 0, 0.4);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* ============================================
   Global Styles
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: linear-gradient(
    135deg,
    var(--bg-start) 0%,
    var(--bg-mid) 40%,
    var(--bg-end) 100%
  );
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Neural Network Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

/* Grid Pattern Overlay */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: -1;
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-mid);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--neural-cyan), var(--electric-purple));
  border-radius: 5px;
  border: 2px solid var(--bg-mid);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--neural-cyan), var(--deep-violet));
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

.gradient-text {
  background: linear-gradient(135deg, var(--neural-cyan), var(--electric-purple), var(--pulse-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mono-text {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ============================================
   Layout - Dashboard Container
   ============================================ */

.neural-dashboard {
  min-height: 100vh;
  padding: 0;
}

.neural-header {
  background: var(--surface-primary);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glow);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-glow-sm);
}

.neural-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.neural-header .brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--neural-cyan), var(--electric-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse-glow 3s ease-in-out infinite;
}

.neural-header .brand-text {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--neural-cyan), var(--electric-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============================================
   Navigation Tabs
   ============================================ */

.neural-tabs {
  background: var(--surface-secondary);
  border-radius: var(--radius-lg);
  padding: 6px;
  display: flex;
  gap: 4px;
  margin-bottom: 1.5rem;
}

.neural-tab {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 8px;
}

.neural-tab:hover {
  color: var(--text-primary);
  background: var(--surface-tertiary);
}

.neural-tab.active {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid var(--border-glow);
  box-shadow: var(--shadow-glow-sm);
}

.neural-tab i {
  font-size: 1.1rem;
}

/* ============================================
   Glassmorphism Cards
   ============================================ */

.neural-card {
  position: relative;
  background: var(--surface-primary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  transition: all var(--transition-base);
  overflow: hidden;
}

.neural-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neural-cyan), transparent);
  opacity: 0.5;
}

.neural-card:hover {
  background: var(--surface-hover);
  border-color: rgba(0, 212, 255, 0.5);
  box-shadow: var(--shadow-glow-md);
  transform: translateY(-2px);
}

.neural-card.pulse {
  animation: card-pulse 3s ease-in-out infinite;
}

/* Card Variants */
.neural-card.primary {
  border-color: rgba(0, 212, 255, 0.4);
}

.neural-card.success {
  border-color: rgba(16, 185, 129, 0.4);
}

.neural-card.warning {
  border-color: rgba(245, 158, 11, 0.4);
}

.neural-card.danger {
  border-color: rgba(239, 68, 68, 0.4);
}

.neural-card.purple {
  border-color: rgba(139, 92, 246, 0.4);
}

/* ============================================
   Metric Cards
   ============================================ */

.metric-card {
  text-align: center;
}

.metric-card .metric-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid var(--border-glow);
}

.metric-card .metric-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.metric-card .metric-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.metric-card .metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

.metric-card .metric-trend.up {
  background: rgba(16, 185, 129, 0.15);
  color: var(--synaptic-green);
}

.metric-card .metric-trend.down {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-error);
}

/* ============================================
   Status Indicators
   ============================================ */

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}

.status-dot.healthy {
  background: var(--status-healthy);
  box-shadow: 0 0 10px var(--status-healthy);
}

.status-dot.warning {
  background: var(--status-warning);
  box-shadow: 0 0 10px var(--status-warning);
}

.status-dot.error {
  background: var(--status-error);
  box-shadow: 0 0 10px var(--status-error);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.healthy {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-healthy);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ============================================
   Memory Type Badges
   ============================================ */

.memory-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.memory-badge.episodic {
  background: rgba(0, 212, 255, 0.15);
  color: var(--mem-episodic);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.memory-badge.semantic {
  background: rgba(139, 92, 246, 0.15);
  color: var(--mem-semantic);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.memory-badge.procedural {
  background: rgba(16, 185, 129, 0.15);
  color: var(--mem-procedural);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.memory-badge.working {
  background: rgba(245, 158, 11, 0.15);
  color: var(--mem-working);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.memory-badge.learned {
  background: rgba(236, 72, 153, 0.15);
  color: var(--mem-learned);
  border: 1px solid rgba(236, 72, 153, 0.3);
}

/* ============================================
   Charts & Graphs Container
   ============================================ */

.chart-container {
  background: var(--surface-primary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
}

.chart-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-title i {
  color: var(--neural-cyan);
}

/* ============================================
   Buttons
   ============================================ */

.neural-btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
}

.neural-btn.primary {
  background: linear-gradient(135deg, var(--neural-cyan), var(--neural-blue));
  color: white;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.neural-btn.primary:hover {
  box-shadow: 0 6px 25px rgba(0, 212, 255, 0.5);
  transform: translateY(-2px);
}

.neural-btn.secondary {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
}

.neural-btn.secondary:hover {
  background: var(--surface-tertiary);
  border-color: var(--neural-cyan);
}

.neural-btn.ghost {
  background: transparent;
  color: var(--text-secondary);
}

.neural-btn.ghost:hover {
  background: var(--surface-tertiary);
  color: var(--text-primary);
}

/* ============================================
   Form Inputs
   ============================================ */

.neural-input,
.neural-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--transition-base);
}

.neural-input:focus,
.neural-select:focus {
  outline: none;
  border-color: var(--neural-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.neural-input::placeholder {
  color: var(--text-muted);
}

/* ============================================
   Data Tables
   ============================================ */

.neural-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.neural-table th {
  background: var(--surface-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.neural-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.neural-table tr:hover td {
  background: var(--surface-tertiary);
}

/* ============================================
   Progress Bars
   ============================================ */

.neural-progress {
  height: 8px;
  background: var(--surface-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.neural-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--neural-cyan), var(--electric-purple));
  border-radius: 4px;
  transition: width var(--transition-slow);
}

.neural-progress-bar.success {
  background: linear-gradient(90deg, var(--synaptic-green), var(--synapse-teal));
}

.neural-progress-bar.warning {
  background: linear-gradient(90deg, var(--memory-amber), var(--neural-gold));
}

.neural-progress-bar.danger {
  background: linear-gradient(90deg, var(--status-error), var(--pulse-pink));
}

/* ============================================
   Animations
   ============================================ */

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.6);
  }
}

@keyframes card-pulse {
  0%, 100% {
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
  }
}

@keyframes synapse-fire {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes data-flow {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(100%);
    opacity: 0;
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes rotate-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Utility Animation Classes */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-pulse-glow {
  animation: pulse-glow 3s ease-in-out infinite;
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

.animate-shimmer {
  background: linear-gradient(
    90deg,
    var(--surface-primary) 0%,
    var(--surface-secondary) 50%,
    var(--surface-primary) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
}

/* ============================================
   Loading States
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-secondary) 25%,
    var(--surface-tertiary) 50%,
    var(--surface-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
  .neural-tabs {
    flex-wrap: wrap;
  }

  .neural-tab {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .neural-header {
    padding: 0.75rem 1rem;
  }

  .neural-card {
    padding: 1rem;
  }

  .metric-card .metric-value {
    font-size: 2rem;
  }

  .neural-tabs {
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .neural-tab {
    white-space: nowrap;
    padding: 8px 12px;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
  .metric-card .metric-icon {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .metric-card .metric-value {
    font-size: 1.75rem;
  }

  .neural-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  body {
    background: white;
    color: black;
  }

  .neural-card {
    background: white;
    border: 1px solid #ddd;
    box-shadow: none;
  }

  .neural-header {
    display: none;
  }
}
