/* PWA Install Prompt — Android bottom-sheet */
#pwaInstallPrompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10050;
  padding: 8px 16px 16px;
  background: #fff;
  box-shadow: 0 -2px 24px rgba(0, 0, 0, 0.13), 0 -1px 6px rgba(0, 0, 0, 0.07);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
  display: block !important;
}

#pwaInstallPrompt.pwa-install-visible {
  transform: translateY(0);
}

.pwa-install-handle {
  width: 36px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin: 0 auto 14px;
}

.pwa-install-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.pwa-install-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.pwa-install-app-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.22);
}

.pwa-install-app-name {
  font-weight: 700;
  font-size: 15px;
  color: #1e293b;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pwa-install-app-desc {
  font-size: 12.5px;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.4;
}

.pwa-install-cta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pwa-install-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff !important;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.38);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  text-decoration: none !important;
  -webkit-tap-highlight-color: transparent;
}

.pwa-install-btn:hover {
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.48);
  transform: translateY(-1px);
  color: #fff !important;
}

.pwa-install-btn:active {
  transform: translateY(0) scale(0.96);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.pwa-install-btn.loading {
  opacity: 0.75;
  pointer-events: none;
}

.pwa-install-close {
  background: none;
  border: none;
  padding: 8px;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.pwa-install-close:hover {
  background: #f1f5f9;
  color: #475569;
}

/* Safe area for bottom notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #pwaInstallPrompt {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* Desktop: centered card above the fold */
@media (min-width: 768px) {
  #pwaInstallPrompt {
    max-width: 420px;
    left: 50%;
    right: auto;
    transform: translateX(-50%) translateY(100%);
    border-radius: 20px 20px 0 0;
  }
  #pwaInstallPrompt.pwa-install-visible {
    transform: translateX(-50%) translateY(0);
  }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  #pwaInstallPrompt {
    background: #1e1b4b;
    box-shadow: 0 -2px 24px rgba(0, 0, 0, 0.45);
  }
  .pwa-install-handle {
    background: #312e81;
  }
  .pwa-install-app-name {
    color: #e0e7ff;
  }
  .pwa-install-app-desc {
    color: #a5b4fc;
  }
  .pwa-install-close {
    color: #6366f1;
  }
  .pwa-install-close:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
  }
}
