/* ============================================
   PWA Install Popup — Slide-up Bottom Sheet
   ============================================ */

/* Backdrop overlay */
.pwa-install-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

/* Bottom sheet container */
.pwa-install-popup {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}

.pwa-install-popup.active {
  transform: translateY(0);
  pointer-events: auto;
}

/* Card body */
.pwa-install-card {
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15),
              0 -2px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

/* Pull handle indicator */
.pwa-install-handle {
  width: 40px;
  height: 5px;
  background: #d0d0d0;
  border-radius: 3px;
  margin: 12px auto 0;
}

/* Content wrapper */
.pwa-install-content {
  padding: 20px 24px 28px;
}

/* Top row: icon + info + close */
.pwa-install-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

/* App icon */
.pwa-install-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background: #f5f5f5;
}

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

/* App info text */
.pwa-install-info {
  flex: 1;
  min-width: 0;
}

.pwa-install-info h3 {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 2px;
  line-height: 1.3;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

.pwa-install-info p {
  font-size: 13px;
  color: #666;
  margin: 0;
  line-height: 1.4;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

/* Close button */
.pwa-install-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f0f0f0;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease;
  line-height: 1;
  padding: 0;
}

.pwa-install-close:hover {
  background: #e0e0e0;
  transform: scale(1.1);
}

/* Description text */
.pwa-install-desc {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 20px;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

/* Feature badges row */
.pwa-install-features {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.pwa-install-feature {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f0f7ff;
  border-radius: 20px;
  font-size: 12px;
  color: #1a73e8;
  font-weight: 600;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

.pwa-install-feature svg {
  width: 14px;
  height: 14px;
  fill: #1a73e8;
}

/* Action buttons */
.pwa-install-actions {
  display: flex;
  gap: 12px;
}

/* Install button */
.pwa-install-btn {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.pwa-install-btn.primary {
  background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(26, 115, 232, 0.35);
}

.pwa-install-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(26, 115, 232, 0.45);
}

.pwa-install-btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

/* Shimmer animation on install button */
.pwa-install-btn.primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: pwa-shimmer 2.5s infinite;
}

@keyframes pwa-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.pwa-install-btn.secondary {
  background: #f5f5f5;
  color: #555;
  box-shadow: none;
  flex: 0 0 auto;
  padding: 14px 20px;
}

.pwa-install-btn.secondary:hover {
  background: #e8e8e8;
}

/* Install icon inside button */
.pwa-install-btn .btn-icon {
  margin-right: 8px;
  font-size: 16px;
}

/* ============================================
   iOS Install Instructions (for Safari)
   ============================================ */
.pwa-ios-instructions {
  display: none;
}

.pwa-ios-instructions.show {
  display: block;
}

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

.pwa-ios-steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 14px;
  color: #333;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  border-bottom: 1px solid #f0f0f0;
}

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

.pwa-ios-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a73e8, #0d47a1);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-ios-steps li svg {
  width: 20px;
  height: 20px;
  margin: 0 2px;
  vertical-align: middle;
}

/* ============================================
   Responsive
   ============================================ */
@media (min-width: 481px) {
  .pwa-install-popup {
    left: 50%;
    right: auto;
    transform: translate(-50%, 100%);
    width: 480px;
  }

  .pwa-install-popup.active {
    transform: translate(-50%, 0);
  }
}

@media (max-width: 380px) {
  .pwa-install-content {
    padding: 16px 18px 22px;
  }

  .pwa-install-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
  }

  .pwa-install-info h3 {
    font-size: 15px;
  }

  .pwa-install-features {
    gap: 6px;
  }

  .pwa-install-feature {
    padding: 5px 10px;
    font-size: 11px;
  }

  .pwa-install-btn {
    padding: 12px 16px;
    font-size: 14px;
  }
}

/* ============================================
   Rating stars
   ============================================ */
.pwa-install-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.pwa-install-rating .stars {
  display: flex;
  gap: 1px;
}

.pwa-install-rating .stars svg {
  width: 12px;
  height: 12px;
  fill: #fbbc04;
}

.pwa-install-rating .rating-text {
  font-size: 11px;
  color: #999;
  margin-left: 4px;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

/* ============================================
   Entrance animation for content
   ============================================ */
.pwa-install-popup.active .pwa-install-content {
  animation: pwa-content-in 0.5s 0.2s ease both;
}

@keyframes pwa-content-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
