/* ===============================================
   琉急式 PWA 安裝卡片 - 現代設計版本
   =============================================== */

#pwa-install-card {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  width: 90%;
  max-width: 520px;
  animation: slideInUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 背景模糊效果 */
.pwa-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  backdropfilter: blur(0px);
  pointer-events: none;
  z-index: -1;
}

#pwa-install-card.pwa-showing .pwa-backdrop {
  background: rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

/* ============ 主卡片樣式 ============ */
.pwa-card-modern {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.88) 100%
  );
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    0 8px 32px rgba(0, 100, 200, 0.15),
    0 0 1px rgba(255, 255, 255, 0.5) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

/* 背景光斑動畫 */
.pwa-card-modern::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(0, 180, 255, 0.1) 0%, transparent 70%);
  animation: orb-move 8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes orb-move {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}

/* ============ 左側內容區 ============ */
.pwa-left-section {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

/* 圖示容器 */
.pwa-icon-wrapper {
  position: relative;
  flex-shrink: 0;
}

.pwa-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  animation: iconPulse 0.8s ease-in-out;
}

@keyframes iconPulse {
  0% { transform: scale(0.8) rotate(-10deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* 內容文案 */
.pwa-content {
  flex: 1;
  min-width: 0;
}

.pwa-title {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 700;
  color: #001f3f;
  letter-spacing: 0.3px;
}

.pwa-description {
  margin: 0;
  font-size: 13px;
  color: #4a7ba7;
  line-height: 1.5;
  margin-bottom: 8px;
}

/* 功能特性列表 */
.pwa-features {
  display: flex;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.pwa-features li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #0077b6;
  font-weight: 500;
  padding: 4px 8px;
  background: rgba(0, 180, 255, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(0, 180, 255, 0.2);
}

.feature-icon {
  font-size: 13px;
}

/* ============ 右側按鈕區 ============ */
.pwa-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

/* 安裝按鈕（主按鈕） */
.pwa-btn-install {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #0ca678 0%, #098268 100%);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(12, 166, 120, 0.3);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.pwa-btn-install::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.pwa-btn-install:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(12, 166, 120, 0.4);
}

.pwa-btn-install:hover::before {
  left: 100%;
}

.pwa-btn-install:active {
  transform: translateY(0);
}

.btn-icon {
  font-size: 14px;
  transition: transform 0.3s ease;
}

.pwa-btn-install:hover .btn-icon {
  transform: translateX(3px);
}

/* 關閉按鈕（副按鈕） */
.pwa-btn-dismiss {
  padding: 8px 12px;
  border: 1px solid rgba(0, 100, 180, 0.2);
  background: rgba(0, 100, 180, 0.04);
  color: #0077b6;
  font-weight: 500;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pwa-btn-dismiss:hover {
  background: rgba(0, 100, 180, 0.08);
  border-color: rgba(0, 100, 180, 0.3);
}

/* 禁用按鈕 */
.pwa-btn-install.pwa-btn-disabled {
  background: #cccccc; /* 灰色背景 */
  cursor: not-allowed; /* 禁用游標 */
  box-shadow: none;
  pointer-events: none;
}

.pwa-btn-install.pwa-btn-disabled::before {
  content: none;
}

/* ============ 叉叉按鈕 ============ */
.pwa-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: #666;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.pwa-close-btn:hover {
  background: rgba(0, 0, 0, 0.12);
  color: #333;
}

/* ============ 隱藏狀態 ============ */
.pwa-hidden {
  display: none !important;
}

/* ============ 動畫 ============ */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideOutDown {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(30px);
  }
}

#pwa-install-card.pwa-hiding {
  animation: slideOutDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ============ 手機版 RWD ============ */
@media (max-width: 640px) {
  #pwa-install-card {
    width: 92%;
    bottom: 16px;
  }

  .pwa-card-modern {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .pwa-left-section {
    gap: 12px;
  }

  .pwa-icon {
    width: 48px;
    height: 48px;
  }

  .pwa-actions {
    flex-direction: row;
    gap: 6px;
  }

  .pwa-btn-install {
    flex: 1;
    padding: 9px 12px;
    font-size: 12px;
  }

  .pwa-btn-dismiss {
    flex: 0.6;
    padding: 9px 8px;
  }

  .pwa-title {
    font-size: 14px;
    margin-bottom: 4px;
  }

  .pwa-description {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .pwa-features {
    gap: 8px;
  }

  .pwa-features li {
    font-size: 11px;
    padding: 3px 6px;
  }
}

@media (max-width: 480px) {
  .pwa-card-modern {
    padding: 14px;
    gap: 12px;
  }

  .pwa-icon {
    width: 44px;
    height: 44px;
  }

  .pwa-title {
    font-size: 13px;
  }

  .pwa-description {
    font-size: 11px;
  }

  .pwa-btn-install,
  .pwa-btn-dismiss {
    padding: 8px 10px;
    font-size: 11px;
  }
}
