/* PWA Install Button */
.pwa-install-btn {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 9999;
  background: linear-gradient(135deg, #FF6B35 0%, #FF8C42 100%);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
  display: none;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: translateY(20px);
}

.pwa-install-btn.show {
  opacity: 1;
  transform: translateY(0);
}

.pwa-install-btn:hover {
  background: linear-gradient(135deg, #FF8C42 0%, #FF6B35 100%);
  box-shadow: 0 6px 30px rgba(255, 107, 53, 0.5);
  transform: translateY(-2px);
}

.pwa-install-btn:active {
  transform: translateY(0);
}

.pwa-install-btn i {
  font-size: 1.1rem;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .pwa-install-btn {
    bottom: 70px;
    right: 15px;
    padding: 12px 20px;
    font-size: 0.875rem;
  }
}

/* PWA Installed Badge */
.pwa-installed .pwa-install-btn {
  display: none !important;
}

/* Standalone mode styles */
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Hide browser UI hints when in standalone */
  .browser-only {
    display: none !important;
  }

  /* Add app-like header spacing */
  .navbar {
    padding-top: max(env(safe-area-inset-top), 0px);
  }
}

/* iOS PWA status bar */
@supports (-webkit-touch-callout: none) {
  @media (display-mode: standalone) {
    body {
      padding-top: env(safe-area-inset-top);
    }
  }
}

/* Offline indicator */
.offline-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #dc3545;
  color: white;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.875rem;
  z-index: 10000;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.offline-indicator.show {
  transform: translateY(0);
}

.offline-indicator i {
  margin-right: 8px;
}

/* Online indicator */
.online-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #28a745;
  color: white;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.875rem;
  z-index: 10000;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.online-indicator.show {
  transform: translateY(0);
}

/* Update notification */
.pwa-update-notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: white;
  border-radius: 12px;
  padding: 16px 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 9998;
  transition: transform 0.3s ease;
}

.pwa-update-notification.show {
  transform: translateX(-50%) translateY(0);
}

.pwa-update-notification .update-icon {
  font-size: 1.5rem;
  color: #FF6B35;
}

.pwa-update-notification .update-text {
  flex: 1;
}

.pwa-update-notification .update-text h6 {
  margin: 0 0 4px 0;
  font-weight: 600;
  color: #333;
}

.pwa-update-notification .update-text p {
  margin: 0;
  font-size: 0.875rem;
  color: #666;
}

.pwa-update-notification .update-btn {
  background: #FF6B35;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.pwa-update-notification .update-btn:hover {
  background: #FF8C42;
}

/* Loading spinner for PWA */
.pwa-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: pwa-spin 0.8s linear infinite;
}

@keyframes pwa-spin {
  to { transform: rotate(360deg); }
}

/* iOS Add to Home Screen prompt */
.ios-install-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #e0e0e0;
  padding: 16px 20px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 9997;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.ios-install-prompt.show {
  display: flex;
}

.ios-install-prompt .ios-icon {
  font-size: 2rem;
  color: #FF6B35;
}

.ios-install-prompt .ios-text {
  flex: 1;
}

.ios-install-prompt .ios-text h6 {
  margin: 0 0 4px 0;
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
}

.ios-install-prompt .ios-text p {
  margin: 0;
  font-size: 0.875rem;
  color: #666;
}

.ios-install-prompt .ios-close {
  background: none;
  border: none;
  color: #999;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.ios-share-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: #007AFF;
  border-radius: 3px;
  color: white;
  text-align: center;
  line-height: 16px;
  font-size: 12px;
  margin: 0 4px;
}
