/* ================================================
   PWA Premium Styles - Samudra Supermarket
   ================================================ */

/* ========== SPLASH SCREEN ========== */
#pwa-splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  background: linear-gradient(135deg, #0F3193 0%, #1565c0 40%, #0d47a1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#pwa-splash.fade-out {
  opacity: 0;
  visibility: hidden;
}
.splash-logo {
  width: 100px;
  height: 100px;
  background: #fff;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  animation: splashLogoIn 0.6s ease-out;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.splash-logo img {
  max-width: 70px;
  max-height: 70px;
  object-fit: contain;
}
@keyframes splashLogoIn {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}
.splash-title {
  font-family: 'Poppins', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
  animation: splashTextIn 0.8s ease-out 0.3s both;
  letter-spacing: -0.5px;
}
.splash-tagline {
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
  animation: splashTextIn 0.8s ease-out 0.5s both;
}
@keyframes splashTextIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.splash-loader {
  margin-top: 40px;
  display: flex;
  gap: 8px;
  animation: splashTextIn 0.8s ease-out 0.7s both;
}
.splash-loader-dot {
  width: 10px;
  height: 10px;
  background: rgba(255,255,255,0.6);
  border-radius: 50%;
  animation: splashDot 1.4s ease-in-out infinite;
}
.splash-loader-dot:nth-child(2) { animation-delay: 0.2s; }
.splash-loader-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes splashDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ========== INSTALL BANNER ========== */
#pwa-install-banner {
  position: fixed;
  bottom: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99998;
  width: 380px;
  max-width: calc(100vw - 30px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  padding: 24px;
  transition: bottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Poppins', sans-serif;
}
#pwa-install-banner.show {
  bottom: 20px;
}
.install-banner-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.install-banner-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffffff, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.install-banner-icon img {
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
}
.install-banner-info h3 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
  line-height: 1.3;
}
.install-banner-info p {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}
.install-banner-body p {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 18px;
}
.install-banner-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.install-btn-dismiss {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.install-btn-dismiss:hover {
  background: #e2e8f0;
}
.install-btn-accept {
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #0F3193, #1565c0);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(15,49,147,0.3);
}
.install-btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(15,49,147,0.4);
}

/* ========== BOTTOM NAVIGATION ========== */
#pwa-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  display: none;
  padding: 6px 0 env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  font-family: 'Poppins', sans-serif;
}
.pwa-bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
}
.pwa-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px 4px;
  text-decoration: none;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
  position: relative;
  min-width: 60px;
}
.pwa-nav-item.active {
  color: #0F3193;
}
.pwa-nav-item.active::before {
  content: '';
  position: absolute;
  top: -6px;
  width: 24px;
  height: 3px;
  background: linear-gradient(135deg, #ffffff, #ffffff);
  border-radius: 3px;
}
.pwa-nav-icon {
  font-size: 22px;
  margin-bottom: 4px;
  transition: transform 0.2s ease;
}
.pwa-nav-item.active .pwa-nav-icon {
  transform: translateY(-2px);
}
.pwa-nav-label {
  letter-spacing: 0.3px;
}



/* ========== OFFLINE INDICATOR ========== */
#pwa-offline-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99997;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  text-align: center;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(220,38,38,0.3);
}
#pwa-offline-indicator.show {
  transform: translateY(0);
}
#pwa-online-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99997;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  text-align: center;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
#pwa-online-indicator.show {
  transform: translateY(0);
}

/* ========== SKELETON LOADING ========== */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 8px;
  min-height: 20px;
}
.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: skeletonShimmer 1.5s infinite;
}
@keyframes skeletonShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}
.skeleton-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.skeleton-card .skeleton-img {
  height: 200px;
  margin-bottom: 16px;
  border-radius: 12px;
}
.skeleton-card .skeleton-title {
  height: 20px;
  width: 80%;
  margin-bottom: 12px;
}
.skeleton-card .skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
}
.skeleton-card .skeleton-text.short {
  width: 60%;
}
.skeleton-card .skeleton-btn {
  height: 36px;
  width: 120px;
  border-radius: 18px;
  margin-top: 16px;
}

/* ========== UPDATE NOTIFICATION ========== */
#pwa-update-toast {
  position: fixed;
  bottom: -100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99998;
  width: 340px;
  max-width: calc(100vw - 30px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.25);
  padding: 20px;
  transition: bottom 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Poppins', sans-serif;
}
#pwa-update-toast.show {
  bottom: 80px;
}
.update-toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
}
.update-toast-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0F3193, #1565c0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}
.update-toast-text h4 {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}
.update-toast-text p {
  font-size: 12px;
  color: #64748b;
}
.update-toast-btn {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
}
.update-btn-dismiss {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.update-btn-apply {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #0F3193, #1565c0);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  #pwa-bottom-nav {
    display: block;
  }
  #pwa-whatsapp-fab {
    display: flex;
  }
  body {
    padding-bottom: 70px;
  }
  #pwa-install-banner {
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 100%;
  }
  #pwa-install-banner.show {
    bottom: 0;
  }
  .scroll-to-top {
    bottom: 80px !important;
    right: 16px !important;
  }
  #samudra-chatbot {
    bottom: 80px !important;
  }
}

@media (max-width: 480px) {
  .pwa-nav-item {
    min-width: 50px;
    font-size: 10px;
  }
  .pwa-nav-icon {
    font-size: 20px;
  }
  #pwa-whatsapp-fab {
    width: 50px;
    height: 50px;
    font-size: 24px;
    bottom: 80px;
    right: 14px;
  }
}

@media (min-width: 769px) {
  #pwa-bottom-nav {
    display: none;
  }
  #pwa-whatsapp-fab {
    display: flex;
    bottom: 30px;
    right: 20px;
  }
}

/* ========== STANDALONE MODE ========== */
@media all and (display-mode: standalone) {
  .header_top {
    display: none;
  }
  #pwa-bottom-nav {
    display: block;
  }
  #pwa-whatsapp-fab {
    display: flex;
  }
  body {
    padding-bottom: 70px;
  }
  .scroll-to-top {
    bottom: 80px;
  }
  #samudra-chatbot {
    bottom: 80px;
  }
}

/* ========== LAZY LOAD IMAGE ========== */
[data-lazy] {
  opacity: 0;
  transition: opacity 0.4s ease;
}
[data-lazy].loaded {
  opacity: 1;
}

/* ========== PWA BODY ADJUSTMENTS ========== */
body.pwa-ready .bg_load {
  display: none;
}