/* ===================================================
   PWA INSTALL PROMPT STYLES
   สำหรับ บ้านนับตังค์ Cosmetics
   =================================================== */

/* ===================================================
   1. INSTALL BANNER (แบนเนอร์ด้านบน)
   =================================================== */
.pwa-install-banner {
  position: fixed;
  top: -200px;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%);
  color: white;
  padding: 1rem;
  box-shadow: 0 4px 20px rgba(233, 30, 99, 0.3);
  z-index: 9999;
  transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.pwa-install-banner.show {
  top: 0;
}

.pwa-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pwa-banner-icon {
  flex-shrink: 0;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.pwa-banner-text {
  flex: 1;
  min-width: 0;
}

.pwa-banner-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-banner-description {
  font-size: 0.9rem;
  opacity: 0.95;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-btn-install {
  background: white;
  color: #e91e63;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwa-btn-install:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.pwa-btn-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.pwa-btn-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* ===================================================
   2. FLOATING BUTTON (ปุ่มลอยด้านล่างขวา)
   =================================================== */
.pwa-floating-btn {
  position: fixed;
  bottom: -100px;
  right: 20px;
  background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%);
  color: white;
  border: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(233, 30, 99, 0.4);
  z-index: 9998;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  animation: pulse-shadow 2s infinite;
}

.pwa-floating-btn.show {
  bottom: 80px;
}

.pwa-floating-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(233, 30, 99, 0.5);
}

.pwa-floating-btn:active {
  transform: scale(0.95);
}

.pwa-floating-text {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@keyframes pulse-shadow {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(233, 30, 99, 0.4);
  }
  50% {
    box-shadow: 0 4px 30px rgba(233, 30, 99, 0.6);
  }
}

/* ===================================================
   3. MODAL (หน้าต่าง Popup)
   =================================================== */
.pwa-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.pwa-modal.show {
  opacity: 1;
  visibility: visible;
}

.pwa-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.pwa-modal-content {
  position: relative;
  background: white;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pwa-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: #f0f0f0;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #666;
}

.pwa-modal-close:hover {
  background: #e0e0e0;
  transform: rotate(90deg);
  color: #e91e63;
}

.pwa-modal-icon {
  text-align: center;
  margin-bottom: 1.5rem;
}

.pwa-modal-icon img {
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(233, 30, 99, 0.3);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.pwa-modal-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #333;
  text-align: center;
  margin-bottom: 0.5rem;
}

.pwa-modal-description {
  text-align: center;
  color: #666;
  font-size: 1rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* ===================================================
   4. FEATURES LIST (รายการคุณสมบัติ)
   =================================================== */
.pwa-modal-features {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.pwa-feature {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: linear-gradient(135deg, #fff9fb 0%, #fce4ec 100%);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.pwa-feature:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(233, 30, 99, 0.15);
}

.pwa-feature-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.pwa-feature span:last-child {
  color: #333;
  font-weight: 500;
}

/* ===================================================
   5. BUTTONS (ปุ่มต่างๆ)
   =================================================== */
.pwa-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pwa-btn-primary {
  background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.pwa-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 30, 99, 0.4);
}

.pwa-btn-primary:active {
  transform: translateY(0);
}

.pwa-btn-secondary {
  background: white;
  color: #666;
  border: 2px solid #e0e0e0;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pwa-btn-secondary:hover {
  border-color: #e91e63;
  color: #e91e63;
  background: #fff9fb;
}

/* ===================================================
   6. NOTES & SUCCESS MESSAGE
   =================================================== */
.pwa-modal-note {
  text-align: center;
  font-size: 0.85rem;
  color: #999;
  margin-top: 1rem;
}

.pwa-success-message {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 15px;
  padding: 1.5rem 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 10001;
  max-width: 400px;
  width: 90%;
  transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.pwa-success-message.show {
  top: 20px;
}

.pwa-success-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pwa-success-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
  animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

.pwa-success-text {
  flex: 1;
}

.pwa-success-text strong {
  display: block;
  color: #28a745;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.pwa-success-text p {
  color: #666;
  font-size: 0.9rem;
  margin: 0;
}

/* ===================================================
   7. RESPONSIVE DESIGN
   =================================================== */
@media (max-width: 768px) {
  .pwa-banner-content {
    flex-wrap: wrap;
  }
  
  .pwa-banner-title {
    font-size: 1rem;
  }
  
  .pwa-banner-description {
    font-size: 0.85rem;
  }
  
  .pwa-btn-install {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
  
  .pwa-modal-content {
    padding: 2rem 1.5rem;
  }
  
  .pwa-modal-title {
    font-size: 1.5rem;
  }
  
  .pwa-modal-actions {
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .pwa-banner-icon {
    display: none;
  }
  
  .pwa-banner-text {
    text-align: center;
  }
  
  .pwa-banner-actions {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }
  
  .pwa-floating-btn {
    right: 15px;
    width: 56px;
    height: 56px;
  }
  
  .pwa-floating-btn.show {
    bottom: 70px;
  }
  
  .pwa-modal-content {
    padding: 1.5rem 1rem;
  }
  
  .pwa-feature {
    padding: 0.75rem;
  }
  
  .pwa-feature-icon {
    font-size: 1.25rem;
  }
  
  .pwa-feature span:last-child {
    font-size: 0.9rem;
  }
}

/* ===================================================
   8. ACCESSIBILITY
   =================================================== */
.pwa-btn-install:focus,
.pwa-btn-close:focus,
.pwa-btn-primary:focus,
.pwa-btn-secondary:focus,
.pwa-floating-btn:focus {
  outline: 3px solid #e91e63;
  outline-offset: 2px;
}

/* ===================================================
   9. ANIMATIONS
   =================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================================
   10. PRINT STYLES
   =================================================== */
@media print {
  .pwa-install-banner,
  .pwa-floating-btn,
  .pwa-modal,
  .pwa-success-message {
    display: none !important;
  }
}