/* Banner de instalação do PWA — estilo discreto, inspirado nos "smart
   banners" da Apple (App Clip / Adicionar à Tela de Início). Vive fora de
   web/ de propósito (ver pwa/README.md) e é puro HTML/CSS/JS: nunca toca
   no runtime Flutter, só fica por cima dele. */

#pi-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483000; /* acima de qualquer coisa que o Flutter desenhe */
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  max-width: 420px;
  margin: 0 auto;
  border-radius: 16px;
  background: rgba(28, 28, 30, 0.82);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: #f2f2f7;
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.42s ease;
  pointer-events: none;
}

#pi-install-banner.pi-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#pi-install-banner .pi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex: none;
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.12);
}

#pi-install-banner .pi-copy {
  flex: 1;
  min-width: 0;
}

#pi-install-banner .pi-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
  margin: 0 0 1px;
}

#pi-install-banner .pi-subtitle {
  font-size: 12px;
  line-height: 1.3;
  color: rgba(235, 235, 245, 0.6);
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

#pi-install-banner .pi-action {
  flex: none;
  appearance: none;
  border: none;
  background: #ffd21f;
  color: #1c1c1e;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

#pi-install-banner .pi-action:active {
  opacity: 0.75;
}

#pi-install-banner .pi-close {
  flex: none;
  appearance: none;
  border: none;
  background: rgba(120, 120, 128, 0.24);
  color: rgba(235, 235, 245, 0.7);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#pi-install-banner .pi-close:active {
  opacity: 0.7;
}

/* Passo a passo do iOS ("toque em Compartilhar…") — só aparece depois que
   o usuário toca no botão do banner, no lugar do banner original. */
#pi-install-steps {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483000;
  max-width: 420px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(28, 28, 30, 0.9);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: #f2f2f7;
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.42s ease;
  pointer-events: none;
}

#pi-install-steps.pi-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#pi-install-steps .pi-steps-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 10px;
}

#pi-install-steps ol {
  margin: 0;
  padding: 0 0 0 20px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(235, 235, 245, 0.82);
}

#pi-install-steps .pi-share-glyph {
  display: inline-flex;
  vertical-align: -3px;
  margin: 0 2px;
}

/* Toggle flutuante compacto — fica no lugar do banner cheio depois que ele
   é fechado (ou direto, em visitas repetidas), sempre alcançável. É o
   "clicar no toggle flutuante" pedido: 1 toque cobre Android (instala na
   hora) e iOS (abre o passo a passo). */
#pi-install-toggle {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 2147483000;
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(28, 28, 30, 0.9);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(255, 255, 255, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.6);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.35s ease;
  pointer-events: none;
}

#pi-install-toggle.pi-visible {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
  animation: pi-toggle-pulse 2.6s ease-in-out 1.2s 2;
}

#pi-install-toggle:active {
  transform: scale(0.92);
}

#pi-install-toggle img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  pointer-events: none;
}

@keyframes pi-toggle-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(255, 255, 255, 0.1); }
  50% { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 8px rgba(255, 210, 31, 0.22); }
}

/* Seta apontando pro ícone real de Compartilhar do Safari — posição muda
   entre iPhone (barra embaixo) e iPad (barra em cima). Puramente visual,
   por cima de tudo, sem capturar clique (pointer-events: none). */
.pi-pointer {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.pi-pointer.pi-visible {
  opacity: 1;
}

.pi-pointer-bottom {
  bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  flex-direction: column-reverse;
}

.pi-pointer-top {
  top: calc(6px + env(safe-area-inset-top, 0px));
}

.pi-pointer-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffd21f;
  color: #1c1c1e;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.pi-pointer-bottom .pi-pointer-arrow {
  animation: pi-bounce-down 1.2s ease-in-out infinite;
}

.pi-pointer-top .pi-pointer-arrow {
  animation: pi-bounce-up 1.2s ease-in-out infinite;
}

.pi-pointer-label {
  margin: 6px 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(28, 28, 30, 0.85);
  color: #f2f2f7;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

@keyframes pi-bounce-down {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@keyframes pi-bounce-up {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Dica de ícone em branco, dentro do passo a passo. */
#pi-install-steps .pi-steps-tip {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(235, 235, 245, 0.14);
  font-size: 11.5px;
  line-height: 1.45;
  color: rgba(235, 235, 245, 0.55);
}

@media (prefers-color-scheme: light) {
  #pi-install-toggle {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  }
  .pi-pointer-label {
    background: rgba(255, 255, 255, 0.9);
    color: #1c1c1e;
  }
  #pi-install-steps .pi-steps-tip {
    border-top-color: rgba(60, 60, 67, 0.14);
    color: rgba(60, 60, 67, 0.6);
  }
}

@media (prefers-color-scheme: light) {
  #pi-install-banner,
  #pi-install-steps {
    background: rgba(255, 255, 255, 0.78);
    color: #1c1c1e;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  }
  #pi-install-banner .pi-title,
  #pi-install-steps .pi-steps-title {
    color: #1c1c1e;
  }
  #pi-install-banner .pi-subtitle,
  #pi-install-steps ol {
    color: rgba(60, 60, 67, 0.65);
  }
  #pi-install-banner .pi-close {
    background: rgba(120, 120, 128, 0.16);
    color: rgba(60, 60, 67, 0.7);
  }
}
