/* JosRide PWA install UI */

.pwa-install-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.pwa-install-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.pwa-install-card {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  z-index: 9999;
  width: min(420px, calc(100vw - 2rem));
  padding: 1.5rem 1.5rem 1.25rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.22),
    0 0 0 1px rgba(6, 95, 70, 0.08);
  text-align: center;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
  opacity: 0;
}

.pwa-install-card.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.pwa-install-card__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.pwa-install-card__icon img {
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(6, 95, 70, 0.25);
}

.pwa-install-card__title {
  margin: 0.875rem 0 0.375rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #111827;
}

.pwa-install-card__desc {
  margin: 0 0 1.125rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: #6b7280;
}

.pwa-install-card__cta {
  display: block;
  width: 100%;
  padding: 0.875rem 1rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #0d6b38, #065f46);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(6, 95, 70, 0.35);
}

.pwa-install-card__ghost {
  display: block;
  width: 100%;
  margin-top: 0.625rem;
  padding: 0.625rem;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
}

/* iOS bottom sheet */
.pwa-ios-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  padding: 0.75rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 -16px 48px rgba(15, 23, 42, 0.18);
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.pwa-ios-sheet__handle {
  width: 40px;
  height: 4px;
  margin: 0 auto 0.875rem;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.35);
}

.pwa-ios-sheet__close {
  position: absolute;
  top: 0.875rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
  font-size: 1.25rem;
  cursor: pointer;
}

.pwa-ios-sheet__header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 1rem;
}

.pwa-ios-sheet__logo {
  border-radius: 12px;
  flex-shrink: 0;
}

.pwa-ios-sheet__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
}

.pwa-ios-sheet__subtitle {
  margin: 0.125rem 0 0;
  font-size: 0.8125rem;
  color: #6b7280;
}

.pwa-ios-sheet__steps {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pwa-ios-sheet__steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9375rem;
  color: #374151;
}

.pwa-ios-step__num {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pwa-ios-step__icon {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.125rem 0.375rem;
  border-radius: 6px;
  background: rgba(107, 114, 128, 0.12);
  font-size: 0.8125rem;
}

.pwa-ios-sheet__arrow {
  height: 28px;
  margin: 0 auto 0.75rem;
  width: 2px;
  background: linear-gradient(to bottom, transparent, #065f46);
  position: relative;
}

.pwa-ios-sheet__arrow::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #065f46;
}

.pwa-ios-sheet__dismiss {
  width: 100%;
  padding: 0.875rem;
  border: none;
  border-radius: 12px;
  background: #065f46;
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

/* Update toast */
.pwa-update-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  z-index: 9997;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 14px;
  background: #111827;
  color: #f9fafb;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: min(480px, calc(100vw - 2rem));
}

.pwa-update-toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

.pwa-update-toast__text {
  margin: 0;
  flex: 1;
  font-size: 0.875rem;
}

.pwa-update-toast__btn {
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.875rem;
  background: #065f46;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.pwa-update-toast__dismiss {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

@media (prefers-color-scheme: dark) {
  .pwa-install-card {
    background: rgba(30, 41, 59, 0.94);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .pwa-install-card__title {
    color: #f8fafc;
  }

  .pwa-install-card__desc {
    color: #94a3b8;
  }

  .pwa-ios-sheet {
    background: rgba(30, 41, 59, 0.96);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .pwa-ios-sheet__title {
    color: #f8fafc;
  }

  .pwa-ios-sheet__steps li {
    color: #cbd5e1;
  }
}

@media (min-width: 768px) {
  .pwa-install-card {
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.92);
  }

  .pwa-install-card.is-visible {
    transform: translate(-50%, -50%) scale(1);
  }

  .pwa-ios-sheet {
    left: 50%;
    right: auto;
    bottom: 1.5rem;
    width: min(440px, calc(100vw - 2rem));
    border-radius: 20px;
    transform: translateX(-50%) translateY(120%);
  }

  .pwa-ios-sheet.is-visible {
    transform: translateX(-50%) translateY(0);
  }
}
