/**
 * PWA Install Prompt Styles
 * A) Chrome/Android 底部 Banner
 * B) iOS Safari 引导弹窗
 */

/* ==================== A) Chrome/Android Install Banner ==================== */

#pwa-install-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  justify-content: center;
  padding: 0 16px env(safe-area-inset-bottom, 0);
}

#pwa-install-banner.visible {
  display: flex;
}

.pwa-banner-card {
  width: 100%;
  max-width: 430px;
  background: #ffffff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: pwa-slide-up 0.4s ease-out;
}

.pwa-banner-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.pwa-banner-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pwa-banner-info {
  flex: 1;
  min-width: 0;
}

.pwa-banner-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-banner-desc {
  font-size: 12px;
  color: #888;
  margin: 0;
}

.pwa-banner-install {
  flex-shrink: 0;
  background: #00D4AA;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.pwa-banner-install:active {
  background: #00b894;
}

.pwa-banner-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #ccc;
  font-size: 20px;
  line-height: 1;
  transition: color 0.2s;
}

.pwa-banner-close:active {
  color: #999;
}

/* ==================== B) iOS Safari 引导弹窗 ==================== */

#pwa-ios-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10001;
  justify-content: center;
  align-items: flex-end;
}

#pwa-ios-overlay.visible {
  display: flex;
}

.pwa-ios-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  animation: pwa-fade-in 0.3s ease-out;
}

.pwa-ios-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0));
  animation: pwa-slide-up 0.4s ease-out;
}

.pwa-ios-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.pwa-ios-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
}

.pwa-ios-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pwa-ios-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 4px;
}

.pwa-ios-subtitle {
  font-size: 13px;
  color: #888;
  margin: 0;
}

.pwa-ios-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}

.pwa-ios-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: #333;
}

.pwa-ios-steps li:last-child {
  border-bottom: none;
}

.pwa-ios-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #00D4AA;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.pwa-ios-step-text {
  flex: 1;
  line-height: 1.4;
}

/* Safari Share 图标 (内联 SVG 样式) */
.pwa-ios-share-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: text-bottom;
  margin: 0 2px;
}

.pwa-ios-close {
  display: block;
  width: 100%;
  background: #f5f5f5;
  color: #333;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.pwa-ios-close:active {
  background: #e8e8e8;
}

/* 指向底部工具栏的箭头 */
.pwa-ios-arrow {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #ffffff;
}

/* ==================== Animations ==================== */

@keyframes pwa-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes pwa-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
