/**
 * PWA Installer CSS
 * Custom styling for PWA installation UI, for both desktop and mobile
 */

/* Base container styles */
.pwa-install-container {
  position: fixed;
  bottom: 250px; /* Moved up from bottom edge */
  right: 20px; /* Aligned to right instead of centered */
  z-index: 9999;
  padding: 1rem;
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
  display: flex;
  justify-content: flex-end; /* Align to right */
  pointer-events: none;
}

/* Visible state animation */
.pwa-install-container.pwa-install-visible {
  transform: translateY(0);
}

/* Hidden state */
.pwa-install-container.hidden {
  display: none;
}

/* Card styles */
.pwa-install-card {
  background-color: #2a1e5c;
  color: #ffffff;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  padding: 1rem;
  max-width: 280px;
  width: 100%;
  position: relative;
  pointer-events: auto;
  animation: slide-up 0.4s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Desktop size adjustments */
@media (min-width: 640px) {
  .pwa-install-card {
    display: grid;
    grid-template-rows: auto auto;
    gap: 0.5rem;
    min-width: 240px;
    max-width: 280px;
  }
}

/* Close button styles */
.pwa-install-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s;
}

.pwa-install-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* Header styles */
.pwa-install-header {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.pwa-install-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  margin-right: 0.75rem;
  object-fit: contain;
  background-color: white;
  padding: 3px;
}

.pwa-install-header h3 {
  font-size: 0.95rem;  /* 调小字体以适应更长文本 */
  font-weight: 600;
  margin: 0;
  color: white;
  line-height: 1.2;  /* 确保多行文本有合适的行高 */
}

/* iOS-specific guidance styles */
.pwa-ios-instructions {
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.ios-share-icon {
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
}

.pwa-ios-instructions span {
  font-size: 0.8rem;
  line-height: 1.3;
}

/* Button area */
.pwa-install-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Dismiss button styles */
.pwa-install-dismiss {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.pwa-install-dismiss:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

/* Install button styles */
.pwa-install-button {
  background: #4e3ac8;
  color: white;
  border: none;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.pwa-install-button:hover {
  background: #3a2baa;
  transform: translateY(-1px);
}

/* Button click effect */
.pwa-install-button:active {
  transform: translateY(1px);
}

/* Animation effect */
@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile adaptations */
@media (max-width: 639px) {
  .pwa-install-container {
    bottom: 60px;
    right: 10px;
    padding: 0.5rem;
    left: auto;
    width: calc(100% - 20px);
    max-width: 280px;
  }
  
  .pwa-install-card {
    padding: 0.75rem;
  }
  
  .pwa-install-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }
  
  .pwa-install-button,
  .pwa-install-dismiss {
    width: 100%;
    padding: 0.5rem;
    text-align: center;
  }
  
  .pwa-install-close {
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    font-size: 14px;
  }
}

/* Handle safe areas, e.g. iPhone X and newer */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .pwa-install-container {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}
