/* ============================================
   🎨 SISTEMA DE VOTACIÓN ELECTORAL v3.0.0
   Estilos Globales Modernos
   ============================================ */

:root {
  /* Colores principales */
  --primary-color: #4472C4;
  --secondary-color: #70AD47;
  --danger-color: #E74C3C;
  --success-color: #27AE60;
  --warning-color: #F39C12;
  --info-color: #3498DB;
  
  /* Colores de partidos */
  --partido-rojo: #E74C3C;
  --partido-verde: #27AE60;
  
  /* Colores de fondo */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F8F9FA;
  --bg-dark: #2C3E50;
  --bg-darker: #1A252F;
  
  /* Colores de texto */
  --text-primary: #2C3E50;
  --text-secondary: #7F8C8D;
  --text-light: #FFFFFF;
  
  /* Sombras */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  
  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  /* Transiciones */
  --transition: all 0.3s ease;
}

/* Reset y base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Containers */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.container-fluid {
  width: 100%;
  padding: 20px;
}

/* Cards */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 25px;
  margin-bottom: 20px;
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}

.card-header {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--primary-color);
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 10px;
}

.card-body {
  padding: 15px 0;
}

/* Grid system */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: -10px;
}

.col-1 { flex: 0 0 8.333%; max-width: 8.333%; }
.col-2 { flex: 0 0 16.666%; max-width: 16.666%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-8 { flex: 0 0 66.666%; max-width: 66.666%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

.col-1, .col-2, .col-3, .col-4, .col-6, .col-8, .col-12 {
  padding: 10px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  position: relative;
  overflow: hidden;
}

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

.btn-primary {
  background: var(--primary-color);
  color: var(--text-light);
}

.btn-primary:hover:not(:disabled) {
  background: #3661B3;
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: var(--success-color);
  color: var(--text-light);
}

.btn-success:hover:not(:disabled) {
  background: #229954;
}

.btn-danger {
  background: var(--danger-color);
  color: var(--text-light);
}

.btn-danger:hover:not(:disabled) {
  background: #C0392B;
}

.btn-warning {
  background: var(--warning-color);
  color: var(--text-light);
}

.btn-secondary {
  background: var(--text-secondary);
  color: var(--text-light);
}

.btn-block {
  width: 100%;
  display: block;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 15px;
  font-size: 1rem;
  border: 2px solid #E0E0E0;
  border-radius: var(--radius-md);
  transition: var(--transition);
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(68, 114, 196, 0.1);
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Stats cards */
.stat-card {
  background: linear-gradient(135deg, var(--primary-color), #5A7FC4);
  color: var(--text-light);
  padding: 25px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

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

.stat-card h3 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.stat-card p {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
}

.stat-card.success {
  background: linear-gradient(135deg, var(--success-color), #32BF70);
}

.stat-card.danger {
  background: linear-gradient(135deg, var(--danger-color), #EF6D5D);
}

.stat-card.warning {
  background: linear-gradient(135deg, var(--warning-color), #F5AC37);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

thead {
  background: var(--primary-color);
  color: var(--text-light);
}

th, td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid #E0E0E0;
}

tbody tr:hover {
  background: #F8F9FA;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 5px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-align: center;
}

.badge-success {
  background: var(--success-color);
  color: var(--text-light);
}

.badge-danger {
  background: var(--danger-color);
  color: var(--text-light);
}

.badge-warning {
  background: var(--warning-color);
  color: var(--text-light);
}

.badge-info {
  background: var(--info-color);
  color: var(--text-light);
}

/* Progress bar */
.progress {
  width: 100%;
  height: 30px;
  background: #E0E0E0;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success-color), #32BF70);
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-weight: 600;
}

/* Alerts */
.alert {
  padding: 15px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-weight: 500;
}

.alert-success {
  background: #D5F4E6;
  color: #0F5132;
  border-left: 4px solid var(--success-color);
}

.alert-danger {
  background: #F8D7DA;
  color: #842029;
  border-left: 4px solid var(--danger-color);
}

.alert-warning {
  background: #FFF3CD;
  color: #664D03;
  border-left: 4px solid var(--warning-color);
}

.alert-info {
  background: #CFE2FF;
  color: #084298;
  border-left: 4px solid var(--info-color);
}

/* Loading spinner */
.spinner {
  border: 4px solid #F3F3F3;
  border-radius: 50%;
  border-top: 4px solid var(--primary-color);
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-primary);
  padding: 30px;
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #E0E0E0;
  padding-bottom: 15px;
}

.modal-header h2 {
  margin: 0;
  color: var(--primary-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

/* Navbar */
.navbar {
  background: var(--bg-dark);
  color: var(--text-light);
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 15px;
}

.navbar-user span {
  font-weight: 500;
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.p-1 { padding: 10px; }
.p-2 { padding: 20px; }
.p-3 { padding: 30px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

/* Responsive */
@media (max-width: 768px) {
  .col-1, .col-2, .col-3, .col-4, .col-6, .col-8 {
    flex: 0 0 100%;
    max-width: 100%;
  }
  
  .navbar {
    flex-direction: column;
    gap: 15px;
  }
  
  table {
    font-size: 0.9rem;
  }
  
  th, td {
    padding: 10px;
  }
}

/* Chart containers */
.chart-container {
  position: relative;
  height: 300px;
  margin: 20px 0;
}

/* Login page specific */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--bg-primary);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 450px;
  width: 100%;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h1 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 10px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.login-logo {
  font-size: 4rem;
  margin-bottom: 20px;
}

/* ============================================
   ✨ ANIMACIONES Y MEJORAS VISUALES
   ============================================ */

/* Animación de entrada para estadísticas */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Animación de pulso para números importantes */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Efecto de brillo en hover */
@keyframes shine {
  0% {
    background-position: -200%;
  }
  100% {
    background-position: 200%;
  }
}

/* Aplicar animaciones a stat-cards */
.stat-card {
  animation: fadeInUp 0.5s ease-out;
  animation-fill-mode: both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card h3:hover {
  animation: pulse 0.6s ease-in-out;
}

/* Efecto de hover mejorado para botones */
.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
  pointer-events: none;
  z-index: 0;
}

.btn:hover::before {
  left: 100%;
}

.btn > * {
  position: relative;
  z-index: 1;
}

/* Mejora visual de las cards */
.card {
  animation: fadeInUp 0.6s ease-out;
  position: relative;
  overflow: hidden;
}

.card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  transform: scale(0);
  transition: transform 0.6s ease-out;
  pointer-events: none;
}

.card:hover::after {
  transform: scale(1);
}

/* Animación para tablas */
.table tbody tr {
  animation: fadeInUp 0.3s ease-out;
  animation-fill-mode: both;
}

.table tbody tr:nth-child(odd) { animation-delay: 0.05s; }
.table tbody tr:nth-child(even) { animation-delay: 0.1s; }

/* Efecto ripple en botones */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Skeleton loading para gráficos */
@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 0px,
    #e0e0e0 40px,
    #f0f0f0 80px
  );
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s infinite;
}

/* Toast notifications mejorados */
@keyframes toastSlideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast {
  animation: toastSlideIn 0.3s ease-out;
}

/* Progress bar animado */
@keyframes progressBar {
  from {
    width: 0%;
  }
  to {
    width: var(--progress-width);
  }
}

.progress-bar {
  animation: progressBar 1s ease-out;
}

/* Efecto de foco mejorado para inputs */
.form-control:focus {
  box-shadow: 0 0 0 3px rgba(68, 114, 196, 0.2);
  transform: translateY(-2px);
  transition: all 0.3s ease;
}

/* Contador animado */
@keyframes countUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.count-up {
  animation: countUp 0.6s ease-out;
}

/* Icono de carga giratorio */
.spinner-border {
  animation: spin 0.75s linear infinite;
}

/* Badge con efecto de notificación */
@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.badge-notification {
  animation: badgePulse 2s infinite;
}

/* Scroll suave */
html {
  scroll-behavior: smooth;
}

/* Mejora de accesibilidad - focus visible */
*:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}
