/* ==========================================================================
   EPT Maricá Lite - Estilos do Mapa em Tempo Real (mapa.css)
   Mobile-First, moderno, clean e focado em usabilidade no smartphone
   ========================================================================== */

.map-page-body {
  padding-bottom: var(--nav-height);
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-app);
}

.map-wrapper {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--header-height) - var(--nav-height));
  min-height: 400px;
  display: flex;
  flex-direction: column;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 400px;
  flex: 1;
  z-index: 10;
  background: #E5E7EB;
}

/* Painel Superior: Seletor Moderno de Linha (Diretriz 20 e 23) */
.map-top-bar {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 12px;
  right: 12px;
  z-index: 900;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.linha-selector-card {
  pointer-events: auto;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.linha-selector-card:active {
  transform: scale(0.99);
}

.linha-selector-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.linha-badge-pill {
  background: var(--color-primary);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(211, 19, 30, 0.3);
}

.linha-names-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.linha-main-name {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.linha-sub-itinerary {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.linha-chevron-icon {
  font-size: 1.1rem;
  color: var(--text-light);
  flex-shrink: 0;
}

/* Seletor de Sentido da Linha (Problema 8) */
.sentido-selector-bar {
  pointer-events: auto;
  display: flex;
  gap: 6px;
  margin-top: 8px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.sentido-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: all 0.15s ease;
}

.sentido-btn.active {
  background: #0284C7;
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.3);
}

.sentido-btn:not(.active):hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-main);
}

/* Modal Bottom-Sheet para Selecionar Linha (Fase 10.3.2 / Responsivo Mobile Viewport) */
:root {
  --app-visual-height: 100vh;
  --app-visual-top: 0px;
}

.selector-modal-backdrop {
  position: fixed;
  top: var(--app-visual-top, 0px);
  left: 0;
  right: 0;
  height: var(--app-visual-height, 100vh);
  height: var(--app-visual-height, 100dvh);
  bottom: auto;
  background: rgba(7, 13, 30, 0.70);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  box-sizing: border-box;
  overflow: hidden;
}

.selector-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.selector-modal-sheet {
  background: #0B132B !important;
  color: #FFFFFF !important;
  width: 100%;
  max-width: 600px;
  max-height: min(80vh, calc(var(--app-visual-height, 100vh) - 10px));
  border-radius: 24px 24px 0 0;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.2s ease, padding 0.2s ease, gap 0.2s ease;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  box-sizing: border-box;
}

.selector-modal-backdrop.open .selector-modal-sheet {
  transform: translateY(0);
}

.selector-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.selector-sheet-header h3 {
  color: #FFFFFF !important;
  font-family: var(--font-display, sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

/* Botão de Fechar com Touch Target Mínimo de 48x48 */
.selector-sheet-header .modal-close-btn {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(255, 255, 255, 0.12) !important;
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.20) !important;
  border-radius: 14px !important;
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: background 0.15s ease, transform 0.1s ease !important;
  padding: 0 !important;
  outline: none;
}

.selector-sheet-header .modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #FFFFFF !important;
}

.selector-sheet-header .modal-close-btn:active {
  transform: scale(0.95);
}

/* Campo de Pesquisa: Texto Branco de Alto Contraste */
.selector-search-box {
  flex-shrink: 0 !important;
  width: 100% !important;
  padding: 12px 16px !important;
  border-radius: 14px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.25) !important;
  background: #070D1E !important;
  color: #FFFFFF !important;
  -webkit-text-fill-color: #FFFFFF !important;
  font-size: 0.95rem !important;
  font-weight: 500 !important;
  outline: none !important;
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) !important;
  caret-color: #D3131E !important;
  box-sizing: border-box !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.selector-search-box:focus {
  border-color: #0284C7 !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(2, 132, 199, 0.35) !important;
}

/* Placeholder claro e distinto */
.selector-search-box::placeholder {
  color: rgba(255, 255, 255, 0.55) !important;
  -webkit-text-fill-color: rgba(255, 255, 255, 0.55) !important;
  opacity: 1 !important;
}

/* Autofill Mobile / Chrome Android */
.selector-search-box:-webkit-autofill,
.selector-search-box:-webkit-autofill:hover,
.selector-search-box:-webkit-autofill:focus,
.selector-search-box:-webkit-autofill:active {
  -webkit-text-fill-color: #FFFFFF !important;
  -webkit-box-shadow: 0 0 0px 1000px #070D1E inset !important;
  box-shadow: 0 0 0px 1000px #070D1E inset !important;
  transition: background-color 5000s ease-in-out 0s !important;
  caret-color: #FFFFFF !important;
}

/* Botão nativo de cancelar (X) no campo search */
.selector-search-box::-webkit-search-cancel-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  height: 24px !important;
  width: 24px !important;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='6' x2='6' y2='18'></line><line x1='6' y1='6' x2='18' y2='18'></line></svg>") no-repeat center center !important;
  background-size: 16px 16px !important;
  cursor: pointer !important;
  opacity: 0.8 !important;
  padding: 12px !important;
}

/* Lista e Itens de Linha: Alto Contraste, sem texto preto */
.selector-lines-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 55vh;
  box-sizing: border-box;
  padding-right: 2px;
}

.selector-line-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #111A35;
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  box-sizing: border-box;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.selector-line-item:hover,
.selector-line-item:focus,
.selector-line-item:active {
  background: #182245;
  border-color: #0284C7;
  transform: translateY(-1px);
}

/* Adaptação Dinâmica quando Teclado Virtual Mobile está Ativo */
.selector-modal-backdrop.keyboard-open .selector-modal-sheet {
  max-height: calc(var(--app-visual-height, 100vh) - 8px);
  padding: 14px 16px 12px 16px;
  gap: 10px;
  border-radius: 20px 20px 0 0;
}

.selector-modal-backdrop.keyboard-open .selector-sheet-header h3 {
  font-size: 1.05rem;
}

.selector-modal-backdrop.keyboard-open .selector-search-box {
  padding: 10px 14px !important;
}

.selector-modal-backdrop.keyboard-open .selector-lines-list {
  max-height: none;
  gap: 8px;
}

.selector-modal-backdrop.keyboard-open .selector-line-item {
  padding: 10px 12px;
}

.selector-line-item strong {
  color: #FFFFFF !important;
}

.selector-line-item span {
  color: #CBD5E1;
}

.selector-line-item .linha-badge-pill {
  background: #D3131E !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
}

/* Indicador de Atualização da Telemetria (Fase 10.4 - Hotfix Visual) */
.telemetry-status-pill {
  position: absolute;
  left: 12px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 1001;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(11, 23, 48, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  color: #FFFFFF;
  pointer-events: none; /* Não captura toques nem bloqueia drag/zoom do Leaflet */
  user-select: none;
  -webkit-user-select: none;
  max-width: fit-content;
  transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.telemetry-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.telemetry-status-text {
  white-space: nowrap;
}

/* Estado RECENTE: Verde com pulso suave */
.telemetry-status-pill.status-recente {
  background: rgba(11, 23, 48, 0.90);
  border-color: rgba(16, 185, 129, 0.40);
  color: #ECFDF5;
}
.telemetry-status-pill.status-recente .telemetry-status-dot {
  background-color: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
  animation: telemetryPulse 2s infinite ease-in-out;
}

/* Estado ATRASADO: Âmbar / Amarelo */
.telemetry-status-pill.status-atrasado {
  background: rgba(28, 22, 10, 0.92);
  border-color: rgba(245, 158, 11, 0.50);
  color: #FEF3C7;
}
.telemetry-status-pill.status-atrasado .telemetry-status-dot {
  background-color: #F59E0B;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
  animation: none;
}

/* Estado INDISPONÍVEL: Vermelho suave */
.telemetry-status-pill.status-indisponivel {
  background: rgba(30, 12, 14, 0.92);
  border-color: rgba(239, 68, 68, 0.50);
  color: #FEE2E2;
}
.telemetry-status-pill.status-indisponivel .telemetry-status-dot {
  background-color: #EF4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
  animation: none;
}

@keyframes telemetryPulse {
  0% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

/* Ocultar quando modais / bottom-sheets estiverem abertos */
body.modal-open #telemetryStatusPill,
body.nearby-open #telemetryStatusPill,
.selector-modal-backdrop.open ~ * #telemetryStatusPill,
.nearby-modal-backdrop.open ~ * #telemetryStatusPill,
#selectorModal.open ~ * #telemetryStatusPill,
#nearbyModal.open ~ * #telemetryStatusPill {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
}

/* Botões Flutuantes de Ação Rápida (Itens 1, 2 e 4 + Fase 10.4) */
/* Aviso de linha sem veiculo transmitindo localizacao em tempo real */
.no-live-vehicles-notice {
  position: absolute;
  left: 12px;
  bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  z-index: 1001;
  width: min(360px, calc(100% - 90px));
  padding: 10px 12px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 12px;
  background: rgba(28, 22, 10, 0.94);
  color: #FEF3C7;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 0.78rem;
  line-height: 1.35;
}

.no-live-vehicles-notice[hidden] {
  display: none !important;
}

body.modal-open #noLiveVehiclesNotice,
body.nearby-open #noLiveVehiclesNotice,
.selector-modal-backdrop.open ~ * #noLiveVehiclesNotice,
.nearby-modal-backdrop.open ~ * #noLiveVehiclesNotice,
#selectorModal.open ~ * #noLiveVehiclesNotice,
#nearbyModal.open ~ * #noLiveVehiclesNotice {
  opacity: 0;
  visibility: hidden;
}

.map-floating-controls {
  position: absolute;
  right: 16px;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-floating-controls button {
  width: 54px;
  height: 54px;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: var(--bg-surface);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-main);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  outline: none;
}

.map-floating-controls button:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.map-floating-controls button:active {
  transform: scale(0.95);
}

/* Modo Direção ↑ (orientação automática do mapa pelo deslocamento) */
.map-floating-controls button.btn-direction-mode {
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.map-floating-controls button.btn-direction-mode.active,
#btn-direction-mode.active {
  background: #0B132B !important;
  color: #38BDF8 !important;
  border-color: #0284C7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.35), 0 6px 18px rgba(0, 0, 0, 0.35) !important;
  transform: scale(1.04);
}

.map-floating-controls button.btn-direction-mode.active::after,
#btn-direction-mode.active::after {
  content: "↑";
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: #38BDF8;
  background: rgba(2, 132, 199, 0.45);
  border-radius: 4px;
  padding: 1px 3px;
}

/* Modo Seguir Passageiro Ativo (GPS Follow) */
.map-floating-controls button#btn-my-location.following,
#btn-my-location.following {
  background: #0B132B !important;
  color: #38BDF8 !important;
  border-color: #0284C7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.4), 0 6px 18px rgba(0, 0, 0, 0.35) !important;
  transform: scale(1.04);
}

.map-floating-controls button#btn-my-location.following::after,
#btn-my-location.following::after {
  content: "●";
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 8px;
  line-height: 1;
  color: #10B981;
  text-shadow: 0 0 4px #10B981;
}

/* Modal Bottom-Sheet para Perto de Você (Fase 10.4) */
.nearby-modal-backdrop {
  position: fixed;
  top: var(--app-visual-top, 0px);
  left: 0;
  right: 0;
  height: var(--app-visual-height, 100vh);
  height: var(--app-visual-height, 100dvh);
  bottom: auto;
  background: rgba(7, 13, 30, 0.70);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  box-sizing: border-box;
  overflow: hidden;
}

.nearby-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.nearby-modal-sheet {
  background: #0B132B !important;
  color: #FFFFFF !important;
  width: 100%;
  max-width: 600px;
  max-height: min(80vh, calc(var(--app-visual-height, 100vh) - 10px));
  border-radius: 24px 24px 0 0;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.2s ease, padding 0.2s ease, gap 0.2s ease;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  box-sizing: border-box;
}

.nearby-modal-backdrop.open .nearby-modal-sheet {
  transform: translateY(0);
}

.nearby-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.nearby-title-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nearby-header-badge {
  font-size: 1.6rem;
  line-height: 1;
}

.nearby-modal-title {
  color: #FFFFFF !important;
  font-family: var(--font-display, sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.nearby-modal-subtitle {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.6);
  display: block;
  margin-top: 2px;
}

/* Banner de precisão reduzida */
.nearby-accuracy-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: #FBBF24;
  flex-shrink: 0;
}

/* Lista de Linhas Próximas */
.nearby-lines-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 55vh;
  box-sizing: border-box;
  padding-right: 2px;
}

.nearby-line-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #111A35;
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  box-sizing: border-box;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.nearby-line-item:hover,
.nearby-line-item:focus,
.nearby-line-item:active {
  background: #182245;
  border-color: #0284C7;
  transform: translateY(-1px);
}

.nearby-item-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.nearby-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nearby-line-name {
  color: #FFFFFF !important;
  font-size: 0.88rem;
  font-weight: 600;
}

.nearby-distance-label {
  font-size: 0.78rem;
  color: #38BDF8;
  font-weight: 600;
}

.nearby-chevron {
  color: #94A3B8;
  font-size: 1.3rem;
  font-weight: bold;
  padding-left: 10px;
  flex-shrink: 0;
}

/* Badge de Veículo Ativo */
.nearby-bus-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 0.74rem;
  color: #34D399;
  font-weight: 600;
  width: fit-content;
  margin-top: 2px;
}

.nearby-bus-pill.nearby-bus-coming {
  background: rgba(2, 132, 199, 0.20);
  border-color: rgba(2, 132, 199, 0.45);
  color: #38BDF8;
}

.nearby-bus-pill-icon {
  font-size: 0.85rem;
}

/* Prompts de Estado do GPS (Vazio, Carregando, Solicitação) */
.nearby-gps-prompt,
.nearby-empty-prompt {
  text-align: center;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #FFFFFF;
}

.nearby-gps-icon,
.nearby-empty-icon {
  font-size: 2.2rem;
}

.nearby-gps-prompt h4,
.nearby-empty-prompt h4 {
  font-family: var(--font-display, sans-serif);
  font-size: 1.05rem;
  margin: 0;
  color: #FFFFFF;
}

.nearby-gps-prompt p,
.nearby-empty-prompt p {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
  max-width: 320px;
  line-height: 1.4;
}

.nearby-btn-activate-gps {
  margin-top: 8px;
  background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nearby-btn-activate-gps:active {
  transform: scale(0.96);
}

.nearby-loading-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 16px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.88rem;
}

.nearby-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #D3131E;
  border-radius: 50%;
  animation: nearbySpin 0.8s linear infinite;
}

@keyframes nearbySpin {
  to { transform: rotate(360deg); }
}

/* Marcador Moderno de Ônibus (Diretriz 12) */
.ept-bus-marker-container {
  background: transparent !important;
  border: none !important;
}

.modern-bus-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modern-bus-pin:hover {
  transform: scale(1.15) translateY(-2px);
}

.bus-badge-circle {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #E30613 0%, #A70C15 100%);
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(211, 19, 30, 0.4);
  position: relative;
}

.modern-bus-pin.is-stopped .bus-badge-circle {
  background: linear-gradient(135deg, #991B1B 0%, #6B7280 100%);
  opacity: 0.92;
}

/* Indicador de Rumo / Bússola do Ônibus */
.bus-direction-indicator {
  position: absolute;
  top: -10px;
  left: 50%;
  margin-left: -6px;
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center 26px; /* Gira ao redor do centro do círculo do ônibus */
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
  z-index: 2;
}

/* Ponto luminoso de status */
.bus-status-pulse {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid #FFFFFF;
}

.bus-status-pulse.moving {
  background-color: #10B981;
  box-shadow: 0 0 6px #10B981;
}

.bus-status-pulse.stopped {
  background-color: #F59E0B;
}

.bus-line-tag {
  background: #111827;
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  margin-top: -4px;
}

/* Marcador Simplificado de Ônibus (Problema 17) */
.clean-bus-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.clean-bus-pin:hover {
  transform: scale(1.15);
}

.clean-bus-circle {
  width: 28px;
  height: 28px;
  background: #D3131E;
  border: 2px solid #FFFFFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.clean-bus-pin.stopped .clean-bus-circle {
  background: #64748B;
}

.clean-bus-tag {
  background: #111827;
  color: #FFFFFF;
  font-size: 0.64rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: -3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  letter-spacing: 0.2px;
}

/* Status Operacional dos Veículos (Diretrizes 7 e 8) */
.clean-bus-pin.off-route .clean-bus-circle {
  border-color: #F59E0B;
}

.clean-bus-pin.off-route .clean-bus-tag {
  background: #B45309;
}

.clean-bus-pin.inactive {
  opacity: 0.60;
  filter: grayscale(35%);
}

.clean-bus-pin.inactive .clean-bus-circle {
  background: #64748B;
  border-color: #94A3B8;
}

.clean-bus-pin.inactive .clean-bus-tag {
  background: #475569;
}

.clean-bus-pin.stale {
  opacity: 0.50;
  filter: grayscale(80%);
}

/* Marcador do Usuário (Diretriz 19 e Problema 6) */
.user-marker-pin {
  width: 16px;
  height: 16px;
  background: #0284C7;
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(2, 132, 199, 0.25), 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background 0.3s ease;
}

.user-marker-pin.approximate {
  background: #D97706;
  box-shadow: 0 0 0 6px rgba(217, 119, 6, 0.25), 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Toast de Feedback de Geolocalização (Posicionado abaixo do seletor de sentido, z-index acima dos controles) */
.gps-feedback-toast {
  position: absolute;
  top: calc(122px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  z-index: 1100;
  max-width: calc(100% - 32px);
  box-sizing: border-box;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 7px 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.gps-feedback-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Destaque do Ônibus Mais Próximo (Item 5)
   ========================================================================== */
.clean-bus-pin.nearest-bus .clean-bus-circle {
  border-color: #FACC15 !important;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.45), 0 0 16px rgba(250, 204, 21, 0.6) !important;
  animation: pulse-nearest-bus 1.8s infinite ease-in-out;
}

.clean-bus-pin.nearest-bus .clean-bus-tag {
  background: #FACC15 !important;
  color: #111827 !important;
  font-weight: 900 !important;
}

@keyframes pulse-nearest-bus {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.5), 0 0 10px rgba(250, 204, 21, 0.4);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 7px rgba(250, 204, 21, 0.25), 0 0 20px rgba(250, 204, 21, 0.8);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.5), 0 0 10px rgba(250, 204, 21, 0.4);
  }
}

/* ==========================================================================
   Card Flutuante: Ônibus Mais Próximo do Passageiro (Item 4 e 6)
   ========================================================================== */
.nearest-bus-card {
  position: absolute;
  left: 14px;
  bottom: 54px;
  right: 84px;
  max-width: 320px;
  z-index: 950;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: slideUpCard 0.3s ease-out;
}

.nearest-bus-card.is-hidden {
  display: none !important;
  pointer-events: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

@keyframes slideUpCard {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nearest-bus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.nearest-bus-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nearest-bus-icon {
  font-size: 1rem;
}

.nearest-bus-heading {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nearest-bus-close {
  background: transparent;
  border: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}

.nearest-bus-close:hover {
  color: var(--color-primary);
  background: rgba(211, 19, 30, 0.08);
}

.nearest-bus-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nearest-bus-main-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nearest-bus-line-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.nearest-bus-code {
  background: var(--color-primary);
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.nearest-bus-dot {
  color: var(--text-muted);
}

.nearest-bus-vehicle {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nearest-bus-distance-badge {
  background: rgba(2, 132, 199, 0.1);
  border: 1px solid rgba(2, 132, 199, 0.25);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-shrink: 0;
}

.distance-number {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0284C7;
  font-family: var(--font-display);
}

.distance-text {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.nearest-bus-sub-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.nearest-bus-sentido {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.nearest-bus-accuracy-tag {
  font-size: 0.68rem;
  font-weight: 600;
  flex-shrink: 0;
}

.nearest-bus-accuracy-tag.precise {
  color: #059669;
}

.nearest-bus-accuracy-tag.approx {
  color: #D97706;
}

.btn-ver-onibus {
  margin-top: 4px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(211, 19, 30, 0.25);
  transition: all 0.18s ease;
}

.btn-ver-onibus:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(211, 19, 30, 0.35);
}

.btn-ver-onibus:active {
  transform: scale(0.98);
}

.btn-ver-onibus .arrow {
  font-size: 1.1rem;
  line-height: 1;
}

.nearest-bus-empty-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-main);
  padding: 4px 0;
}

.nearest-bus-empty-msg .icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.nearest-bus-empty-msg.warning strong {
  color: #D97706;
  font-size: 0.8rem;
}


.sentido-selector-bar { align-items: stretch; }
.sentido-btn { min-width: 0; height: auto; min-height: 36px; white-space: normal; line-height: 1.15; display: flex; align-items: center; justify-content: center; }
.sentido-btn[data-sentido='todos'] { flex: 0 0 auto; padding-left: 12px; padding-right: 12px; }
.sentido-btn[data-sentido='ida'], .sentido-btn[data-sentido='volta'] { flex: 1 1 0; }

.linha-names-column { flex: 1; justify-content: center; }
.linha-main-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; font-size: 0.88rem; overflow: hidden; }
