/**
 * CSS cho banner/popup cài đặt PWA - Lời Bác Dạy
 * Responsive: mobile-first, đẹp trên mọi thiết bị
 */

/* ========== OVERLAY NỀN MỜ ========== */
.pwa-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* ========== POPUP CHÍNH ========== */
.pwa-popup {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.pwa-popup.pwa-show {
  transform: translateY(0);
}

/* ========== NỘI DUNG POPUP ========== */
.pwa-popup-content {
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 20px;
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.15);
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}

/* Thanh kéo trên cùng (kiểu bottom sheet) */
.pwa-popup-content::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: #d0d0d0;
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ========== NÚT ĐÓNG (X) ========== */
.pwa-close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
}

.pwa-close-btn:hover {
  background: #f0f0f0;
  color: #333;
}

/* ========== HEADER: ICON + TÊN APP ========== */
.pwa-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.pwa-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(21, 101, 192, 0.2);
  flex-shrink: 0;
}

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

.pwa-app-name {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 2px;
  line-height: 1.3;
}

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

/* ========== MÔ TẢ ========== */
.pwa-description {
  font-size: 14px;
  color: #555;
  line-height: 1.5;
  margin: 0 0 18px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #e3f2fd 0%, #f0f7ff 100%);
  border-radius: 12px;
  border-left: 3px solid #1565C0;
}

.pwa-description strong {
  color: #1565C0;
}

/* ========== DANH SÁCH TÍNH NĂNG ========== */
.pwa-features {
  display: flex;
  justify-content: space-around;
  margin-bottom: 18px;
  padding: 0 4px;
}

.pwa-feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #666;
}

.pwa-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* ========== CÁC NÚT HÀNH ĐỘNG ========== */
.pwa-actions {
  display: flex;
  gap: 10px;
}

/* Nút "Cài đặt" */
.pwa-install-btn {
  flex: 1;
  padding: 13px 20px;
  background: linear-gradient(135deg, #1565C0 0%, #1976D2 50%, #2196F3 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 3px 12px rgba(21, 101, 192, 0.35);
  letter-spacing: 0.3px;
}

.pwa-install-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(21, 101, 192, 0.45);
}

.pwa-install-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(21, 101, 192, 0.3);
}

/* Nút "Để sau" */
.pwa-later-btn {
  padding: 13px 20px;
  background: #f5f5f5;
  color: #666;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.pwa-later-btn:hover {
  background: #e8e8e8;
  color: #333;
}

/* ========== HƯỚNG DẪN CHO iOS (Safari) ========== */
.pwa-ios-guide {
  display: none; /* Mặc định ẩn, chỉ hiện trên iOS */
  margin-top: 14px;
  padding: 12px 14px;
  background: #fff8e1;
  border-radius: 10px;
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  border: 1px solid #ffe082;
}

.pwa-ios-guide .pwa-ios-step {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.pwa-ios-guide .pwa-ios-step:last-child {
  margin-bottom: 0;
}

.pwa-ios-guide .pwa-ios-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1565C0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ========== RESPONSIVE: TABLET + DESKTOP ========== */
@media (min-width: 600px) {
  .pwa-popup {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    width: 440px;
  }

  .pwa-popup.pwa-show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  .pwa-popup-content {
    border-radius: 20px;
    padding: 28px 24px 24px;
  }

  /* Ẩn thanh kéo trên desktop */
  .pwa-popup-content::before {
    display: none;
  }
}

/* ========== ANIMATION ========== */
@keyframes pwa-pulse {
  0%, 100% { box-shadow: 0 3px 12px rgba(21, 101, 192, 0.35); }
  50% { box-shadow: 0 3px 20px rgba(21, 101, 192, 0.55); }
}

.pwa-install-btn {
  animation: pwa-pulse 2s infinite;
}

.pwa-install-btn:hover {
  animation: none;
}
