/* PWA install ("Add to Home Screen") UI — banner + iOS instructions sheet.
 *
 * Kept in a standalone file (linked from base.html) rather than folded into the
 * hand-built style.min.css, since the repo has no CSS minify pipeline. Uses the
 * shared design tokens so it adapts to light/dark automatically.
 */

/* ── Install banner ──────────────────────────────────────────────── */
.pwa-install-banner {
  position: fixed;
  left: 50%;
  bottom: -120px;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 14px;
  width: calc(100% - 32px);
  max-width: 440px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  transition: bottom 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.32s ease;
  opacity: 0;
}

.pwa-install-banner.pwa-install-show {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  opacity: 1;
}

.pwa-install-icon {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.pwa-install-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.pwa-install-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
  line-height: 1.2;
}

.pwa-install-text span {
  font-size: 0.8rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.3;
}

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

.pwa-install-go {
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 9px 18px;
  border-radius: 10px;
  color: #fff;
  background: var(--accent, #0ea5e9);
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.pwa-install-go:hover { opacity: 0.92; transform: translateY(-1px); }
.pwa-install-go:active { transform: translateY(0); }

.pwa-install-dismiss {
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 8px;
}

.pwa-install-dismiss:hover { color: var(--text-primary, #1e293b); }

/* ── iOS "Add to Home Screen" instructions sheet ─────────────────── */
.pwa-ios-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
}

.pwa-ios-backdrop.pwa-ios-show { background: rgba(0, 0, 0, 0.45); }

.pwa-ios-sheet {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 12px;
  padding: 26px 22px calc(env(safe-area-inset-bottom, 0px) + 26px);
  border-radius: 22px 22px 0 0;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.3);
  transform: translateY(110%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  text-align: center;
}

.pwa-ios-show .pwa-ios-sheet { transform: translateY(0); }

.pwa-ios-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.pwa-ios-sheet h3 {
  margin: 12px 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary, #1e293b);
}

.pwa-ios-sheet p {
  margin: 0 auto 18px;
  max-width: 360px;
  font-size: 0.88rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.45;
}

.pwa-ios-steps {
  list-style: none;
  counter-reset: pwa-step;
  margin: 0;
  padding: 0;
  text-align: left;
}

.pwa-ios-steps li {
  counter-increment: pwa-step;
  position: relative;
  padding: 12px 12px 12px 46px;
  font-size: 0.9rem;
  color: var(--text-primary, #1e293b);
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.07));
  line-height: 1.4;
}

.pwa-ios-steps li:last-child { border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.07)); }

.pwa-ios-steps li::before {
  content: counter(pwa-step);
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent, #0ea5e9);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-ios-share {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 7px;
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent, #0ea5e9);
  font-weight: 600;
  white-space: nowrap;
}

.pwa-ios-share svg { display: block; }

.pwa-ios-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted, #94a3b8);
  padding: 4px 8px;
}

.pwa-ios-close:hover { color: var(--text-primary, #1e293b); }

@media (min-width: 600px) {
  .pwa-ios-backdrop { align-items: center; }
  .pwa-ios-sheet {
    border-radius: 22px;
    transform: translateY(20px) scale(0.96);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .pwa-ios-show .pwa-ios-sheet { transform: translateY(0) scale(1); opacity: 1; }
}
