/* Definição de variáveis CSS - PALETA DE CORES CENTRALIZADA */
:root {
  /* Cores principais */
  --color-primary: #0072C6;
  --color-primary-dark: #002542;
  /* tom mais escuro do primary para hover */
  --color-secondary: #5EDDC1;

  /* Cores de texto */
  --color-text: #000;
  --color-text-light: #fff;

  /* Cores de fundo */
  --color-background-main: white;
  --color-background-header: var(--color-primary);
  --color-controls-bg: rgba(255, 255, 255, 0.9);
  --color-map-bg: white;

  /* Sombras e efeitos atualizadas para coordenar com primárias */
  --color-button-shadow: rgba(0, 114, 198, 0.3);
  /* cor primária com opacidade */
  --color-button-hover-shadow: rgba(0, 90, 158, 0.5);
  /* cor primaria escura */
  --color-button-active-shadow: rgba(0, 90, 158, 0.4);
  --color-input-focus-shadow: rgba(94, 221, 193, 0.6);
  /* cor secundária */
  --color-box-shadow: rgba(0, 0, 0, 0.1);
  --color-map-shadow: rgba(0, 0, 0, 0.25);
  --color-text-shadow: rgba(0, 0, 0, 0.3);

  /* Bordas */
  --color-border-primary: var(--color-primary);
  --color-border-focus: var(--color-secondary);
}

/* Reset básico */
*{
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
header {
  background: var(--color-background-header);
  position: fixed;
  width: 100%;
  top: 0;
  padding: 15px;
}
body {
  font-family: 'Red Hat Display', Roboto, sans-serif;
  background: var(--color-background-main);
  color: var(--color-primary-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 15px 10px 10px;
  margin-top: 5px;
}

h1 {
  font-size: 2rem;
  color: var(--color-text-light);
  text-shadow: 1px 1px 3px var(--color-text-shadow);
  letter-spacing: 1.5px;
  text-align: center;
}

button{
  font-family: 'Red Hat Display';
}
.container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

#controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap:15px;
  padding: 20px 0px 10px;
  border-radius: 12px;
  flex-wrap: wrap;
}

.controls-left,
.controls-right {
  display: flex;
  align-items: center;
}
.controls-left {
  gap: 5px;
}
.controls-right {
  gap: 15px;
}

#stop-search {
  font-family: 'Red Hat Display';
  width: 185px;
  min-width: 100px;
  max-width: 250px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--color-border-primary);
  font-size: 1rem;
  transition: border-color 0.3s ease;
  max-height: 40px;
  flex: 0 1 auto;
}


#stop-search:focus {
  border-color: var(--color-border-focus);
  outline: none;
  box-shadow: 0 0 8px var(--color-input-focus-shadow);
}

.btn-common {
  background-color: #fff;
  border: 1.5px solid var(--color-border-primary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 3px 8px var(--color-button-shadow);
  flex: 0 1 auto;
  white-space: nowrap;
}

#controls button {
  padding: 10px 15px;
}

#controls button:hover,
.button-refresh:hover {
  background-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px var(--color-button-hover-shadow);
  color: #fff;
}

#controls button:active,
.button-refresh:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px var(--color-button-active-shadow);
}

.advice p {
  margin-bottom: 0.5rem;
}
#map {
  height: 65vh;
  width: 100%;
  border-radius: 16px;
  box-shadow: 0 8px 24px var(--color-map-shadow);
  border: 1.5px solid var(--color-border-primary);
  background-color: var(--color-map-bg);
}

footer {
  margin-top: 1rem;
  text-align: center;
  color: var(--color-primary-dark)
}

footer a{
  color:#5EDDC1
}

.stop-info {
  margin-bottom: 20px;
}

.info-card {
  background-color: var(--color-controls-bg);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 6px 15px var(--color-box-shadow);
}

.header-arrivals {
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center; /* Centraliza verticalmente */
}
.button-refresh {
  padding: 5px 10px;
  box-shadow: 0px 0px;
}

.info-card h2 {
  color: var(--color-primary);
  font-size: 1.5rem;
  text-align: left;
}

.arrivals-container {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
}

.arrival-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  background-color: white;
  border-radius: 8px;
  border-left: 4px solid var(--color-primary);
  box-shadow: 0 2px 5px var(--color-box-shadow);
  transition: transform 0.2s ease;
}

.arrival-item:hover {
  transform: translateX(5px);
}

.arrival-line {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  background-color: var(--color-primary);
  padding: 5px 15px;
  border-radius: 8px;
  min-width: 60px;
  text-align: center;
}

.arrival-info {
  flex: 1;
  margin-left: 15px;
}

.arrival-destination {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 5px;
}

.arrival-status {
  font-size: 0.9rem;
  color: #666;
}

.arrival-time {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--color-primary);
  min-width: 80px;
  text-align: right;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 10px;
}

.status-ontime {
  background-color: #d4edda;
  color: #155724;
}

.status-delayed {
  background-color: #ffd392;
  color: #000000;
}

.loading-text {
  text-align: center;
  color: var(--color-text);
  font-style: italic;
  padding: 20px;
}

.no-arrivals {
  text-align: center;
  color: #999;
  padding: 30px;
  font-size: 1.1rem;
}
.info-card #map {
  height: 45vh;
}
/* Estilos para ícones de paragem no mapa */
.stop-marker-icon {
  background-color: var(--color-secondary);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.arrival-item[data-vehicle-id] {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.arrival-item[data-vehicle-id]:hover {
  transform: translateX(8px);
  box-shadow: 0 4px 12px rgba(0, 114, 198, 0.2);
  background-color: #f8f9fa;
}

.arrival-item[data-vehicle-id]:active {
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 114, 198, 0.15);
}

/* Estilo para botão de centrar mapa */
.leaflet-control-center {
  font-size: 18px;
  line-height: 26px;
  display: block;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  width: 26px;
  height: 26px;
}

.leaflet-control-center:hover {
  background-color: #f4f4f4;
}

/* Responsividade */
@media (max-width: 720px) {
  #stop-search {
    width: 100%;
    max-width: 185px;
  }
  #controls {
    gap:10px;
  }
  #controls button {
    width: auto;
    margin-top: 0;
  }
  #map {
    height: 60vh; /* ligeiramente menor para tablets e telas médias */
  }
  .info-card #map {
    height: 35vh;
  }
}

@media (max-width: 500px) {
  #controls {
    gap:5px;
  }
  .controls-right{
    gap: 5px;
  }
  #map {
    height: 50vh; /* menor para dispositivos móveis */
  }
  .advice p {
    font-size: 0.9rem;
  }
  .info-card {
    padding: 12px;
  }
  .info-card h2 {
    font-size: 1.1rem;
  }
  .arrival-item {
    flex-direction: row;  /* Mantém em linha */
    flex-wrap: nowrap;     /* Não quebra linha */
    align-items: center;
    gap: 8px;
    padding: 10px;
  }
  .arrivals-container {
    max-height: 200px;
  }
  .arrival-line {
    font-size: 1rem;
    padding: 4px 10px;
    min-width: 45px;
    flex-shrink: 0;
  }

  .arrival-info {
    flex: 1;
    min-width: 0;  
    margin-left: 10px;
  }

  .arrival-destination {
    font-size: 0.85rem;
    white-space: nowrap;      
    overflow: hidden;         
    text-overflow: ellipsis;
  }

  .arrival-status {
    font-size: 0.7rem;
    white-space: nowrap;
  }

  .arrival-time {
    font-size: 1.2rem;
    text-align: right;
    min-width: 60px;
    flex-shrink: 0;
  }

  .status-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
  }

  .no-arrivals {
    font-size: 0.9rem;
    padding: 20px;
  }

  .loading-text {
    font-size: 0.9rem;
    padding: 15px;
  }

  header {
    padding: 15px;
  }
  h1 {
    font-size: 1.5rem;
    letter-spacing: 0.8px;
  }
}

@media (max-width: 430px) {
  #map {
    height: 40vh; /* mais pequeno para telemóveis muito pequenos */
  }
  .advice p {
    font-size: 0.8rem;
  }
  footer {
    font-size: 0.9rem;
  }
  #stop-search {
    max-width: 150px;
  }
}

@media (max-width: 380px){
  #stop-search {
    max-width: 120px;
  }
}

