/* ── PWA INSTALL MODAL — Guia Católico de Bolso ─────────────────────────── */

/* Overlay backdrop */
.pwa-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(8, 18, 52, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  padding: 0;
}

.pwa-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── Bottom sheet (mobile default) ── */
.pwa-sheet {
  background: #fff;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 92dvh;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(108%);
  transition: transform 0.48s cubic-bezier(0.32, 1.55, 0.64, 1);
  box-shadow: 0 -12px 60px rgba(8, 18, 52, 0.35);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  will-change: transform;
  overscroll-behavior: contain;
}

.pwa-overlay.active .pwa-sheet {
  transform: translateY(0);
}

/* ── Desktop: centered modal ── */
@media (min-width: 540px) {
  .pwa-overlay {
    align-items: center;
    padding: 1.5rem;
  }

  .pwa-sheet {
    border-radius: 24px;
    max-height: 90vh;
    transform: scale(0.86) translateY(24px);
    opacity: 0;
    transition: transform 0.42s cubic-bezier(0.32, 1.45, 0.64, 1),
                opacity 0.3s ease;
    padding-bottom: 0;
  }

  .pwa-overlay.active .pwa-sheet {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Drag handle */
.pwa-handle {
  width: 44px;
  height: 5px;
  background: #dee2e6;
  border-radius: 99px;
  margin: 14px auto 0;
  flex-shrink: 0;
}

@media (min-width: 540px) {
  .pwa-handle { display: none; }
}

/* ── Header ── */
.pwa-header {
  background: linear-gradient(155deg, #0d1f45 0%, #1a3a6e 45%, #2e5bb8 100%);
  padding: 2rem 1.75rem 2.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.pwa-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 58% 48% at 88% 12%, rgba(201,168,76,.22) 0%, transparent 65%),
    radial-gradient(ellipse 45% 38% at 12% 88%, rgba(255,255,255,.06) 0%, transparent 62%);
  pointer-events: none;
}

.pwa-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.13);
  border: none;
  color: rgba(255,255,255,.88);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .22s;
  line-height: 1;
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
}

.pwa-close-btn:hover,
.pwa-close-btn:focus-visible {
  background: rgba(255,255,255,.24);
  outline: none;
}

.pwa-app-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

.pwa-app-icon {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: linear-gradient(145deg, #162f62, #2354a8);
  border: 2px solid rgba(201,168,76,.55);
  overflow: hidden;
  box-shadow:
    0 8px 28px rgba(0,0,0,.32),
    0 0 0 5px rgba(201,168,76,.14),
    inset 0 1px 0 rgba(255,255,255,.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  margin-bottom: 1.1rem;
  position: relative;
  z-index: 1;
  transition: transform .3s ease;
}

.pwa-overlay.active .pwa-app-icon {
  animation: pwa-icon-bounce 0.6s 0.3s ease both;
}

@keyframes pwa-icon-bounce {
  0%   { transform: scale(0.7); }
  60%  { transform: scale(1.08); }
  80%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.pwa-header-title {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 .38rem;
  letter-spacing: .01em;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 12px rgba(0,0,0,.2);
}

.pwa-header-sub {
  color: rgba(255,255,255,.72);
  font-size: .79rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 400;
  margin: 0;
  position: relative;
  z-index: 1;
}

.pwa-header-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .9rem;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
}

.pwa-badge {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 99px;
  padding: .22rem .65rem;
  font-size: .7rem;
  color: rgba(255,255,255,.88);
  font-weight: 500;
  letter-spacing: .03em;
}

/* ── Body ── */
.pwa-body {
  padding: 1.6rem 1.6rem 1.75rem;
}

/* ── Benefits ── */
.pwa-benefits {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.pwa-benefit {
  display: flex;
  align-items: flex-start;
  gap: .875rem;
  padding: .75rem .875rem;
  background: #f7f9ff;
  border: 1px solid rgba(26,58,110,.07);
  border-radius: 14px;
  transition: background .2s;
}

.pwa-benefit-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #eef1ff, #e3e9ff);
  border: 1px solid rgba(26,58,110,.1);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.pwa-benefit-text strong {
  display: block;
  font-size: .87rem;
  font-weight: 600;
  color: #1a3a6e;
  margin-bottom: .12rem;
  line-height: 1.3;
}

.pwa-benefit-text span {
  font-size: .76rem;
  color: #6c757d;
  line-height: 1.45;
}

/* ── Divider ── */
.pwa-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #dee2e6 20%, #dee2e6 80%, transparent);
  margin: 1.25rem 0;
}

/* ── CTA Buttons ── */
.pwa-btn-install {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 50px;
  background: linear-gradient(135deg, #1a3a6e 0%, #2e5bb8 100%);
  color: #fff;
  font-size: .98rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow:
    0 6px 22px rgba(26,58,110,.38),
    inset 0 1px 0 rgba(255,255,255,.12);
  transition: transform .22s ease, box-shadow .22s ease;
  letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.pwa-btn-install::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, transparent 60%);
  pointer-events: none;
}

.pwa-btn-install:active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(26,58,110,.32);
}

@media (hover: hover) {
  .pwa-btn-install:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(26,58,110,.46);
  }
}

.pwa-btn-later {
  display: block;
  width: 100%;
  text-align: center;
  padding: .7rem;
  color: #adb5bd;
  font-size: .82rem;
  background: none;
  border: none;
  cursor: pointer;
  margin-top: .3rem;
  transition: color .2s;
  -webkit-tap-highlight-color: transparent;
}

.pwa-btn-later:hover { color: #495057; }

/* ── iOS Guide ── */
.pwa-ios-guide {
  display: none;
  margin-bottom: 1.35rem;
}

.pwa-ios-guide.visible { display: block; }

.pwa-ios-title {
  font-size: .75rem;
  font-weight: 700;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin: 0 0 .85rem;
  text-align: center;
}

.pwa-ios-steps {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(26,58,110,.1);
}

.pwa-ios-step {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .9rem 1rem;
  background: #f8f9ff;
  position: relative;
}

.pwa-ios-step + .pwa-ios-step {
  border-top: 1px solid rgba(26,58,110,.07);
  background: #f4f6fd;
}

.pwa-ios-step:last-child {
  background: #f0f3ff;
}

.pwa-ios-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3a6e, #2e5bb8);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(26,58,110,.28);
}

.pwa-ios-step-icon {
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.pwa-ios-step-icon svg {
  display: block;
}

.pwa-ios-step-text {
  flex: 1;
  min-width: 0;
}

.pwa-ios-step-text strong {
  display: block;
  font-size: .84rem;
  font-weight: 600;
  color: #1a3a6e;
  margin-bottom: .1rem;
  line-height: 1.35;
}

.pwa-ios-step-text span {
  font-size: .73rem;
  color: #6c757d;
  line-height: 1.4;
}

/* ── Safari note ── */
.pwa-safari-note {
  display: none;
  align-items: flex-start;
  gap: .65rem;
  background: #fff8e2;
  border: 1px solid rgba(201,168,76,.38);
  border-radius: 12px;
  padding: .78rem 1rem;
  margin-bottom: 1.1rem;
  font-size: .78rem;
  color: #856404;
  line-height: 1.45;
}

.pwa-safari-note.visible { display: flex; }

.pwa-safari-note strong { color: #6d4e00; }

/* ── Android section ── */
.pwa-android-install {
  display: none;
  margin-bottom: 1.35rem;
}

.pwa-android-install.visible { display: block; }

.pwa-android-prompt-note {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: #f0f4ff;
  border: 1px solid rgba(26,58,110,.1);
  border-radius: 14px;
  padding: .9rem 1.1rem;
}

.pwa-android-prompt-note-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.pwa-android-prompt-note-text {
  font-size: .8rem;
  color: #1a3a6e;
  line-height: 1.5;
}

.pwa-android-prompt-note-text strong {
  display: block;
  font-weight: 600;
  margin-bottom: .18rem;
  font-size: .84rem;
}

/* ── Scrollbar (webkit) ── */
.pwa-sheet::-webkit-scrollbar { width: 4px; }
.pwa-sheet::-webkit-scrollbar-thumb { background: rgba(26,58,110,.15); border-radius: 99px; }
.pwa-sheet::-webkit-scrollbar-track { background: transparent; }

/* ── Botão flutuante de instalação ─────────────────────────────────────── */
.pwa-fab {
  position: fixed;
  /* Acima da bottom-nav no mobile (altura ~64px + safe-area) */
  bottom: calc(68px + env(safe-area-inset-bottom, 0px) + .75rem);
  right: .875rem;
  z-index: 9000;

  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .875rem .5rem .6rem;
  border-radius: 99px;

  background: rgba(26, 58, 110, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(201, 168, 76, 0.35);
  box-shadow:
    0 4px 18px rgba(8, 18, 52, 0.32),
    0 1px 0 rgba(255,255,255,.06) inset;
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;

  /* Estado: oculto por padrão */
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.92);
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease,
    transform 0.35s cubic-bezier(0.34, 1.5, 0.64, 1),
    box-shadow 0.2s ease;
  will-change: transform, opacity;
}

.pwa-fab.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.pwa-fab:active {
  transform: scale(0.94);
  box-shadow: 0 2px 8px rgba(8, 18, 52, 0.28);
}

@media (hover: hover) {
  .pwa-fab:hover {
    background: rgba(26, 58, 110, 0.98);
    box-shadow: 0 6px 24px rgba(8, 18, 52, 0.42);
    transform: translateY(-1px) scale(1);
  }
}

.pwa-fab-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.22);
  border: 1px solid rgba(201, 168, 76, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  flex-shrink: 0;
  overflow: hidden;
}

.pwa-fab-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

/* No desktop não há bottom-nav, usar posição simples */
@media (min-width: 768px) {
  .pwa-fab {
    bottom: 1.5rem;
  }
}

/* Pulse sutil para chamar atenção (roda 1× depois de 2s) */
@keyframes pwa-fab-pulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(8,18,52,.32); }
  50%       { box-shadow: 0 4px 18px rgba(8,18,52,.32), 0 0 0 6px rgba(201,168,76,.18); }
}

.pwa-fab.visible {
  animation: pwa-fab-pulse 1.8s ease 1.5s 2;
}
