@import url("https://fonts.googleapis.com/css2?family=Libre+Franklin:ital,wght@0,100..900;1,100..900&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap");

body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: "Libre Franklin", sans-serif;
}

header {
  margin: 0 auto;
  margin-top: 2em;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 0;
  padding-bottom: 0;
}

header h1 {
  font-family: "Playfair Display", serif;
  font-optical-sizing: auto;
  font-weight: 800;
  font-style: normal;
  text-align: center;
  font-size: 3.2em;
  margin: 1em auto;
  color: #1b748c;
}

header p {
  font-family: "Libre Franklin", sans-serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-style: normal;
  font-size: 1.2em;
  margin: 0 auto;
  width: 50%;
  text-align: center;
  line-height: 1.3em;
  color: #1b748c;
}

#lupa {
  width: 250px;
  height: 250px;
  margin: 0 auto;
  transform: translateY(-55px);
}

main {
  width: 100%;
  margin-top: 3em;
}

/* THREE MAPS */

.maps-flex {
  display: flex;
  flex-direction: row;
  width: 95vw;
  height: 100vh;
  align-items: stretch;
  justify-content: center;
  margin: 0 auto;
}

#porto-flex {
  margin-bottom: 5em;
}

.map-wrapper {
  width: 50%;
  height: 50%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 1em 0;
  align-self: flex-start;
}

.map-wrapper h2 {
  text-align: center;
  color: #1a8694;
  text-transform: uppercase;
  font-weight: 300;
  font-size: 1.3em;
}

.region-map {
  width: 100%;
  height: 90%;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.tooltip {
  position: fixed;
  background-color: #1b748c;
  color: #faebd7;
  padding: 6px 10px;
  font-size: 1.5em;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
  transform: translate(10px, 10px);
  transition: opacity 0.1s ease;
}

.region-map svg {
  width: 100%;
  height: 100%;
  display: block;
}

svg path {
  pointer-events: auto;
  stroke: #1a8694 !important;
}

.region-map .citymap-disabled {
  pointer-events: none !important;
  fill: rgba(26, 134, 148, 0.3);
}

.region-map .citymap {
  fill: #ffad4f;
  opacity: 1;
  cursor: pointer;
  pointer-events: all;
}

.region-map .citymap:hover {
  fill: #ff5e14 !important;
  cursor: pointer;
}

.region-map .citymap.active {
  fill: #ff5e14 !important;
  transition: fill 0.2s ease;
}

/* CANDIDATES */

.candidates-wrapper {
  height: 100%;
  width: 50%;
  display: flex;
  flex-direction: column;
  gap: 2em;
}

/* .candidates {
  width: 100%;
  height: 50%;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  padding: 20px;
  gap: 20px;
  cursor: grab;
  scrollbar-width: auto;
  scrollbar-color: #e83535e6 transparent;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  scrollbar-gutter: stable; /* mantém espaço mesmo sem barra 
} */

.candidates {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  padding: 20px 0 26px 20px; /* adiciona espaço inferior p/ barra */
  gap: 20px;
  cursor: grab;
  scrollbar-width: thin;
  scrollbar-color: #e83535e6 transparent;
  box-sizing: border-box;
  overflow-x: scroll; /* força scroll sempre visível */
  scrollbar-gutter: stable; /* mantém espaço p/ barra */
}

.candidates:active {
  cursor: grabbing;
}

/* WebKit (Chrome, Safari, Edge) */
.candidates::-webkit-scrollbar {
  height: 10px;
  background: #f1f1f1; /* cor de fundo clara para ser visível */
}

.candidates::-webkit-scrollbar-thumb {
  background: #e83535e6;
  border-radius: 5px;
}

.candidates::-webkit-scrollbar-thumb:hover {
  background: #b31e1e;
}

/* Firefox */
.candidates {
  scrollbar-width: thin;
  scrollbar-color: #e83535e6 #f1f1f1;
}
.candidates::-webkit-scrollbar-track {
  background: transparent;
}

.candidates::-webkit-scrollbar-button {
  display: none;
  height: 0;
  width: 0;
}

.candidate-card {
  flex: 0 0 auto;
  width: 220px;
  max-width: 220px;
  height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: space-evenly;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  background-color: #1b748c;
  color: #faebd7;
  box-sizing: border-box;
  overflow: hidden;
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
  -webkit-user-drag: none;
  -moz-user-select: none;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.4s ease forwards;
  position: relative;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.candidate-card img {
  width: 150px; /* Set the fixed width */
  height: 150px; /* Set the fixed height */
  border-radius: 50%; /* This makes the image circular */
  object-fit: cover; /* Ensures the image covers the entire circle without distortion */
  object-position: center;
  overflow: hidden; /* Hides anything outside the circle */
  margin: 0 auto;
  flex-shrink: 0;
  align-self: center;
  pointer-events: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.badge {
  position: absolute;
  z-index: 10;
}

.deputado-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #2c7be5;
  color: white;
  border-radius: 50%;
  padding: 6px;
  font-size: 1rem;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.exautarca-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #f39c12;
  color: white;
  border-radius: 50%;
  padding: 6px;
  font-size: 1rem;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

/* Ensure content inside the card stays within height */
.candidate-card h3,
.candidate-card h4,
.candidate-card p {
  margin: 5px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 2.4em;
  line-height: 1.2em;
}

#candidates.dragging,
#candidates:hover {
  cursor: grabbing;
  cursor: -webkit-grabbing;
}

.candidate-card .profissao {
  min-height: 3.5em; /* mais espaço vertical */
  overflow-wrap: break-word;
  font-size: 0.9rem;
  margin: 0.3em 0 0.6em;
  text-align: center;
}

.legend {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: #333;
}

.legend i {
  margin-right: 4px;
  font-size: 1rem;
}

.deputado-icon {
  color: #2c7be5;
}

.exautarca-icon {
  color: #f39c12;
}

.scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-size: 1rem;
  color: #1b748c;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.5em;
  opacity: 0.9;
  animation: fadeHint 1.8s ease-in-out infinite alternate;
}

.scroll-hint i {
  font-size: 1.1em;
  color: #e83535;
}

/* pequeno brilho animado para chamar a atenção */
@keyframes fadeHint {
  from {
    opacity: 0.3;
    transform: translateY(0);
  }
  to {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.city-text {
  text-align: center;
  padding: 15px;
  background-color: #faebd7;
  border-radius: 10px;
}

.city-name {
  font-size: 1.5em;
  color: #1b748c;
  margin-bottom: 8px;
}

.city-text p,
.city-text a.debate-link {
  color: #1b748c;
  font-weight: bold;
  font-size: 1.1em;
  text-decoration: none;
  transition: color 0.2s;
  cursor: pointer;
}

.city-text a.debate-link:hover {
  color: #ffae3d;
  text-decoration: underline;
}

#infoIcon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  cursor: pointer;
  max-width: 40px;
  margin: 0 auto;
}

#infoIcon:hover {
  transform: scale(1.1);
  transition: all 0.2s ease;
}

#infoBox {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgb(250, 235, 215, 0.9); /* Semi-transparent background */
  color: white; /* Text color */
  padding: 20px; /* Padding for content */
  font-size: 16px; /* Font size */
  z-index: 9999; /* Ensure it appears on top of other elements */
  font-size: 1.5em;
  display: none;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  display: none;
}

#infoBox p {
  width: 60%;
  background-color: #e83535e6;
  padding: 2em 2em;
  border-radius: 5px 5px;
  box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5);
}

#infoBox a {
  color: #fff;
  text-decoration: none;
}

#infoBox a:hover {
  color: #ffad4f;
}

#closeInfoBox {
  position: absolute;
  top: 10px;
  right: 60px;
  cursor: pointer;
  font-size: 2.5em;
  color: #e83535;
  transition: transform 750ms;
  will-change: transform;
}

#closeInfoBox:hover,
#closeInfoBox:focus {
  transform: translateY(10px);
}

/* MOBILE */

/* @media (max-width: 900px) {

  #candidates {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .candidate-card {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  #infoBox {
    font-size: 1em;
  }

  #infoBox p {
    width: 90%;
  }

  #closeInfoBox {
    top: -15px;
    right: 5px;
    font-size: 4em;
  }
} */

@media (max-width: 900px) {
  body {
    height: 100%;
  }

  header {
    margin-bottom: 2em;
  }

  header h1 {
    font-size: 2.8em;
    width: 90%;
  }

  header p {
    font-size: 1.2em;
    width: 90%;
  }

  main {
    margin-top: 0;
  }

  .maps-flex {
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
  }

  #porto-flex {
    margin-bottom: 5em;
  }

  #lisboa-flex {
    flex-direction: column-reverse;
  }

  .map-wrapper {
    width: 90%;
    margin-bottom: 2em;
  }

  .candidates-wrapper {
    width: 100%;
    margin: 0;
    background-color: #faebd7;
    padding: 1em 0;
    flex-direction: column-reverse !important;
  }

  .candidates {
    display: flex;
    overflow-x: auto;
    gap: 0.8rem;
    padding: 1rem;
    height: 100%;
    scroll-snap-type: x mandatory; /* deslize suave */
  }

  .candidate-card {
    min-width: 180px;
    flex-shrink: 0;
    scroll-snap-align: center;
    width: 180px;
  }

  .candidate-card img {
    width: 120px !important;
    height: 120px !important;
  }

  .scroll-hint {
    font-size: 0.9rem;
    margin-top: 1em;
  }

  .city-text {
    text-align: center;
    padding: 10px;
    background-color: transparent;
    border-radius: 0;
  }

  .legend {
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.8rem;
  }

  #infoBox {
    width: 90%;
    font-size: 0.9rem;
  }

  .tooltip{
    display: none !important;
  }
}

/* --- Fix rápido: reduzir "anel" dos candidatos em mobile --- */
@media (max-width: 900px) {
  /* O wrapper circular (primeiro div dentro de .candidate-card) */
  .candidate-card > div:first-child {
    padding: 4px !important; /* reduz o espaço que cria o anel colorido */
    width: 120px !important; /* reduz a dimensão do círculo */
    height: 120px !important;
    box-sizing: border-box !important;
  }

  /* A própria imagem — reduz a largura da borda inline */
  .candidate-card img {
    border-width: 4px !important; /* reduz 4px -> 2px */
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
}
