@font-face {
  font-family: "Publico";
  src: url("http://logiserp.com/LP/5dad43c83e7c94396bc207cc39085355.ttf")
    format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Publico";
}

.container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 10px;
  position: relative;
}

h1 {
  color: #ff0000;
  text-align: center;
  margin-bottom: 20px;
  font-size: 24px;
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
}

.candidates-grid {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  margin: 0 auto;
  width: 100%;
}

.candidate-card {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 2px;
  text-align: center;
  position: relative;
  width: calc(10% - 5px);
  min-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  background-color: #fff;
}

/* Estilos para los enlaces de tarjetas de candidatos */
a.candidate-card {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

a.candidate-card:hover {
  text-decoration: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.party-leader::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 4px;
  color: white;
  font-size: 12px;
  font-weight: bold;
  background-color: #28a745;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.candidate-image {
  width: 60px;
  height: 60px;
  background-color: #f0f0f0;
  margin: 12px auto 6px;
  object-fit: cover;
}

.candidate-name {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 0px;
  line-height: 1.2;
  font-family: "Publico", serif;
}

.first-name {
  color: #333;
  font-size: 16px;
}

.last-name {
  color: #333;
  font-size: 16px;
}

.candidate-percentage {
  font-size: 14px;
  color: #666;
  margin-bottom: 5px;
  transition: all 0.5s ease;
  display: flex;
  justify-content: center;
}

.vote-count {
  font-size: 12px;
  color: #888;
  margin-top: 3px;
  text-align: center;
  font-family: "Archivo", sans-serif;
}

.progress-bar {
  width: 90%;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin: 0 0 4px 0;
}

.progress-value {
  height: 100%;
  transition: width 0.5s ease;
}

.partido-libre .progress-value {
  background: #8b0000;
}

.partido-nacional .progress-value {
  background: #0000ff;
}

.partido-liberal .progress-value {
  background: #ff0000;
}

/* Carrusel personalizado */
.carousel-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin: 0 auto;
  touch-action: pan-y;
}

.carousel-track {
  display: flex;
  transition: transform 0.3s ease;
  cursor: grab;
}

.carousel-slide {
  flex: 0 0 auto;
  padding: 0 5px;
  box-sizing: border-box;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  background-color: #ff0000;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.carousel-arrow:hover {
  background-color: #cc0000;
}

.carousel-arrow-prev {
  left: 5px;
}

.carousel-arrow-next {
  right: 5px;
}

/* Fuente y hora de actualización */
.footer-info {
  display: flex;
  justify-content: flex-end;
  margin-top: 15px;
  font-size: 12px;
  color: #666;
  padding: 0 5px;
  font-family: Arial, sans-serif;
}

.source {
  font-weight: bold;
  margin-right: 15px;
}

.last-update {
  opacity: 1;
  transition: opacity 0.5s ease;
}

/* Desktop styles */
@media (min-width: 1024px) {
  .carousel-container {
    display: none;
  }
  .candidates-grid {
    display: flex;
  }
}

/* Tablet styles */
@media (min-width: 768px) and (max-width: 1023px) {
  .carousel-container {
    display: none;
  }
  .candidates-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }
  .candidate-card {
    width: calc(20% - 10px);
    min-width: 100px;
  }
}

/* Mobile styles */
@media (max-width: 767px) {
  .candidates-grid {
    display: none;
  }
  .carousel-container {
    display: block;
  }
  .carousel-slide {
    width: 33.333%;
  }
  .candidate-card {
    width: 100%;
    min-width: auto;
    padding: 6px 2px;
  }
  .candidate-image {
    width: 45px;
    height: 45px;
  }
  .candidate-name {
    font-size: 12px;
    line-height: 1.1;
    margin: 4px 0 3px;
  }
  .first-name {
    display: block;
    margin-bottom: 1px;
  }
  .last-name {
    display: block;
  }
  .candidate-percentage {
    font-size: 12px;
  }
  .vote-count {
    font-size: 10px;
  }

  /* Mantenemos tres candidatos incluso en pantallas muy pequeñas */
  @media (max-width: 450px) {
    .carousel-slide {
      width: 33.333%;
    }
    .candidate-image {
      width: 60px;
      height: 60px;
    }
    .candidate-name {
      font-size: 11px;
    }
  }

  /* Ajustes adicionales para pantallas muy pequeñas */
  @media (max-width: 350px) {
    .candidate-image {
      width: 35px;
      height: 35px;
      margin: 8px auto 4px;
    }
    .candidate-percentage {
      font-size: 10px;
    }
    .vote-count {
      font-size: 9px;
    }
  }
}

/* Animación mejorada para el efecto de resaltado */
@keyframes highlight {
  0% {
    background-color: transparent;
  }
  50% {
    background-color: #ffeb3b;
  }
  100% {
    background-color: transparent;
  }
}

.highlighted {
  animation: highlight 1.5s ease !important; /* Duración aumentada y !important para forzar */
  z-index: 10; /* Asegurar que esté por encima */
  position: relative; /* Necesario para z-index */
}
