/**
 * PWA安装提示条样式
 * 参考设计：蓝色渐变背景，左侧图标+文字，右侧安装按钮+关闭按钮
 */

.pwa-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #2f80ed 0%, #56ccf2 100%);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  display: none;
  animation: slideUp 0.3s ease-out;
  overflow: hidden; /* 隐藏溢出的圆圈 */
}

/* 装饰性圆圈 */
.pwa-prompt::before {
  content: '';
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  top: -75px;
  right: 15%;
  pointer-events: none;
}

.pwa-prompt::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  bottom: -50px;
  left: 10%;
  pointer-events: none;
}

.pwa-prompt.show {
  display: block;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pwa-prompt-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.pwa-prompt-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.pwa-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  padding: 4px;
  flex-shrink: 0;
}

.pwa-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #ffffff;
  min-width: 0;
}

.pwa-text strong {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-text span {
  font-size: 13px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-prompt-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.pwa-install-button {
  background: #ffffff;
  color: #4169E1;
  border: none;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pwa-install-button:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-install-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.pwa-install-button .icon {
  font-size: 18px;
  line-height: 1;
  position: relative;
  top: -2px; /* 微调图标位置，往上移2px */
}

.pwa-close-button {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.pwa-close-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* 移动端适配 */
@media (max-width: 768px) {
  .pwa-prompt {
    /* 移动端默认在底部，如果有底部导航栏，通过JS动态调整bottom值 */
    bottom: 0;
  }
  
  .pwa-prompt-content {
    padding: 10px 15px;
    gap: 10px;
  }
  
  .pwa-icon {
    width: 40px;
    height: 40px;
  }
  
  .pwa-text strong {
    font-size: 14px;
  }
  
  .pwa-text span {
    font-size: 12px;
  }
  
  .pwa-install-button {
    padding: 6px 16px;
    font-size: 13px;
    border-radius: 18px;
  }
  
  .pwa-install-button .icon {
    font-size: 16px;
    top: -2px; /* 移动端也微调 */
  }
  
  .pwa-close-button {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }
}

/* 641px-1132px范围：PWA提示栏在底部导航条上方 */
@media (min-width: 641px) and (max-width: 1132px) {
  .pwa-prompt {
    bottom: 50px !important; /* 底部导航条高度约50px */
  }
}

/* 小屏幕手机 */
@media (max-width: 480px) {
  .pwa-prompt-content {
    padding: 8px 12px;
  }
  
  .pwa-text span {
    display: none; /* 小屏幕隐藏描述文字 */
  }
  
  .pwa-install-button {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* 平板和桌面 */
@media (min-width: 769px) {
  .pwa-prompt {
    bottom: 0; /* PC端固定在页面底部 */
  }
  
  .pwa-prompt-content {
    padding: 15px 30px;
  }
}

/* 打印时隐藏 */
@media print {
  .pwa-prompt {
    display: none !important;
  }
}

/* 当PWA提示显示时，调整返回顶部按钮位置 */
.pwa-prompt.show ~ .am-gotop-fixed,
body:has(.pwa-prompt.show) .am-gotop-fixed {
  bottom: 80px !important; /* 提示条高度约70px，留10px间距 */
  transition: bottom 0.3s ease;
}

/* 移动端调整 */
@media (max-width: 768px) {
  .pwa-prompt.show ~ .am-gotop-fixed,
  body:has(.pwa-prompt.show) .am-gotop-fixed {
    bottom: 70px !important; /* 移动端提示条稍矮 */
  }
}

/* 辅助功能 - 高对比度模式 */
@media (prefers-contrast: high) {
  .pwa-prompt {
    border-top: 2px solid #ffffff;
  }
  
  .pwa-install-button {
    border: 2px solid #4169E1;
  }
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
  .pwa-prompt {
    animation: none;
  }
  
  .pwa-install-button {
    transition: none;
  }
}
