/* =====================================================
   🗳️ VotoSmart - Design System
   Sistema de Optimización del Voto Electrónico
   ===================================================== */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS Variables ── */
:root {
  /* Primary - Electric Blue */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* Accent - Gold */
  --accent-400: #facc15;
  --accent-500: #eab308;
  --accent-600: #ca8a04;

  /* Success */
  --success-400: #4ade80;
  --success-500: #22c55e;
  --success-600: #16a34a;

  /* Error */
  --error-400: #f87171;
  --error-500: #ef4444;
  --error-600: #dc2626;

  /* Warning */
  --warning-400: #fb923c;
  --warning-500: #f97316;

  /* Neutrals - Dark theme */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-hover: rgba(255, 255, 255, 0.08);
  --bg-glass-active: rgba(255, 255, 255, 0.12);

  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-tertiary: #9ca3af;
  --text-muted: #6b7280;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
  --shadow-glow-lg: 0 0 40px rgba(59, 130, 246, 0.4);

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #7c3aed 100%);
  --gradient-hero: linear-gradient(135deg, #0a0e1a 0%, #1e1b4b 30%, #0a0e1a 100%);
  --gradient-card: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(124, 58, 237, 0.05));
  --gradient-success: linear-gradient(135deg, #059669, #10b981);
  --gradient-gold: linear-gradient(135deg, #f59e0b, #eab308, #fbbf24);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Font sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  /* Z-index layers */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--primary-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-300);
}

img {
  max-width: 100%;
  height: auto;
}

/* ── Animated Background ── */
.bg-animated {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: var(--gradient-hero);
  overflow: hidden;
}

.bg-animated::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent 70%);
  top: -200px;
  right: -200px;
  animation: float-blob 15s ease-in-out infinite;
}

.bg-animated::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.1), transparent 70%);
  bottom: -150px;
  left: -150px;
  animation: float-blob 20s ease-in-out infinite reverse;
}

@keyframes float-blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ── Grid particles (subtle) ── */
.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-image: 
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: 40px 40px;
}

/* ── Container ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-sm { max-width: 800px; margin: 0 auto; padding: 0 var(--space-lg); }
.container-lg { max-width: 1400px; margin: 0 auto; padding: 0 var(--space-lg); }

/* ── Navigation ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  padding: var(--space-md) 0;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--text-primary);
}

.navbar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

.navbar-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
  position: relative;
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--text-primary);
}

.navbar-links a.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary-500);
  border-radius: 1px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::before { opacity: 1; }

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-md), 0 0 20px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: var(--shadow-md), 0 0 15px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(16, 185, 129, 0.3);
}

.btn-gold {
  background: var(--gradient-gold);
  color: #1a1a2e;
  box-shadow: var(--shadow-md), 0 0 15px rgba(245, 158, 11, 0.2);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(245, 158, 11, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn-xl {
  padding: 1rem 2.5rem;
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn:active { transform: translateY(0) scale(0.98); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
}

.card-body { padding: var(--space-xl); }

.card-glass {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  padding: var(--space-xl);
}

.card-glass:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
}

.card-highlight {
  border-color: var(--primary-600);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3), var(--shadow-glow);
}

/* ── Stats cards ── */
.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-normal);
}

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

.stat-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-400);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success-400);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-warning {
  background: rgba(249, 115, 22, 0.15);
  color: var(--warning-400);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-gold {
  background: rgba(234, 179, 8, 0.15);
  color: var(--accent-400);
  border: 1px solid rgba(234, 179, 8, 0.3);
}

/* ── Progress bar ── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* ── Toast/Notifications ── */
.toast-container {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  animation: slideInRight 0.3s var(--transition-spring);
  min-width: 300px;
}

.toast-success { border-left: 4px solid var(--success-500); }
.toast-error { border-left: 4px solid var(--error-500); }
.toast-warning { border-left: 4px solid var(--warning-500); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-2xl);
  max-width: 500px;
  width: 100%;
  padding: var(--space-2xl);
  transform: scale(0.9);
  transition: transform var(--transition-spring);
  box-shadow: var(--shadow-xl);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-md);
}

/* ── Typography Utilities ── */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.text-muted { color: var(--text-tertiary); }
.font-mono { font-family: 'JetBrains Mono', monospace; }

/* ── Flex Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.gap-2xl { gap: var(--space-2xl); }

/* ── Grid ── */
.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Spacing Utilities ── */
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mt-3xl { margin-top: var(--space-3xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes bounce-subtle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.anim-fade-in { animation: fadeIn 0.5s ease; }
.anim-fade-up { animation: fadeInUp 0.5s ease; }
.anim-fade-down { animation: fadeInDown 0.5s ease; }
.anim-scale { animation: scaleIn 0.3s var(--transition-spring); }
.anim-pulse { animation: pulse 2s infinite; }
.anim-bounce { animation: bounce-subtle 2s ease-in-out infinite; }

/* Staggered animations */
.stagger > * { opacity: 0; animation: fadeInUp 0.5s ease forwards; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .container { padding: 0 var(--space-md); }
  .navbar-links { display: none; }
  
  :root {
    --text-5xl: 2.25rem;
    --text-6xl: 2.75rem;
  }
}

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Selection ── */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: white;
}
