/* ==========================================================================
   1. APP BEHAVIOR RESETS & SAFE AREA INSETS
   ========================================================================== */
html, body {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body:has(.pwa-bottom-nav) {
  padding-bottom: calc(58px + env(safe-area-inset-bottom)) !important;
}

body.pwa-modal-open {
  overflow: hidden !important;
}

/* ==========================================================================
   2. CUSTOMIZABLE APP BOTTOM NAVIGATION BAR
   ========================================================================== */
.pwa-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 99998;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}

@media (min-width: 769px) {
  .pwa-bottom-nav.pwa-mobile-only {
    display: none !important;
  }
  body:has(.pwa-bottom-nav.pwa-mobile-only) {
    padding-bottom: 0 !important;
  }
}

.pwa-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  color: #6b7280;
  font-size: 11px;
  font-weight: 500;
  flex: 1;
  height: 100%;
}

.pwa-nav-icon-wrap {
  position: relative;
  display: inline-flex;
}

.pwa-nav-item svg {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  stroke: currentColor;
}

.pwa-nav-item:active,
.pwa-nav-item.active {
  color: #111827;
}

.pwa-cart-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9999px;
  padding: 1px 6px;
  min-width: 16px;
  height: 16px;
  line-height: 14px;
  text-align: center;
}

/* ==========================================================================
   3. INSTALL BUTTONS & iOS MODAL
   ========================================================================== */
.pwa-install-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #111827;
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

.pwa-install-trigger:hover {
  background-color: #374151;
}

.pwa-ios-sheet {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.pwa-ios-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.pwa-ios-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  z-index: 10;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
}

.pwa-ios-drag-handle {
  width: 36px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  margin: 0 auto 12px;
}

.pwa-ios-close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  border: none;
  background: #f3f4f6;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  cursor: pointer;
}

.pwa-ios-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.pwa-ios-app-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  object-fit: cover;
}

.pwa-ios-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #111827;
}

.pwa-ios-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: #6b7280;
}

.pwa-ios-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pwa-ios-step {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f9fafb;
  padding: 10px 14px;
  border-radius: 12px;
}

.pwa-step-number {
  background: #e5e7eb;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-step-text {
  font-size: 13px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pwa-share-badge, .pwa-add-badge {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  padding: 4px 6px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pwa-ios-pointer {
  display: flex;
  justify-content: center;
  margin-top: 14px;
  animation: pwaBounce 1.5s infinite;
}

@keyframes pwaBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}