/* PWA Native Mode Styles */

/* Hide elements in PWA standalone mode */
body.pwa-mode .pwa-hide,
body.pwa-mode footer,
body.pwa-mode .desktop-only,
body.pwa-mode nav:not(.pwa-bottom-nav) {
  display: none !important;
}

/* Show bottom nav only in PWA mode */
.pwa-bottom-nav {
  display: none;
}

body.pwa-mode .pwa-bottom-nav {
  display: block !important;
}

/* Full screen experience */
body.pwa-mode {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

/* Native-like header for PWA */
body.pwa-mode .pwa-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: env(safe-area-inset-top) 0 0 0;
}

body.pwa-mode .pwa-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

body.pwa-mode .pwa-header-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}

/* Card tap animations */
body.pwa-mode .card,
body.pwa-mode .btn,
body.pwa-mode a {
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

body.pwa-mode .card:active,
body.pwa-mode .btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

/* Bottom navigation */
body.pwa-mode .pwa-bottom-nav {
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.95);
}

/* Native-like list items */
body.pwa-mode .list-item {
  padding: 16px;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.15s ease;
}

body.pwa-mode .list-item:active {
  background-color: #f9fafb;
}

/* Pull to refresh indicator */
body.pwa-mode .refresh-indicator {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* iOS-style back button */
body.pwa-mode .back-button {
  display: flex;
  align-items: center;
  color: #10b981;
  font-size: 17px;
  padding: 8px 0;
}

body.pwa-mode .back-button svg {
  width: 20px;
  height: 20px;
  margin-right: 4px;
}

/* Safe areas for notched devices */
body.pwa-mode {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Smooth page transitions */
body.pwa-mode .page-transition {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Native-like form inputs */
body.pwa-mode input,
body.pwa-mode textarea,
body.pwa-mode select {
  font-size: 16px; /* Prevents zoom on iOS */
}

/* Remove browser-specific UI in PWA mode */
body.pwa-mode {
  -webkit-touch-callout: none;
}

/* Status bar theming for iOS */
@media (prefers-color-scheme: light) {
  body.pwa-mode {
    background-color: white;
  }
}

@media (prefers-color-scheme: dark) {
  body.pwa-mode {
    background-color: #111827;
  }
}

/* Floating action button style (if needed) */
body.pwa-mode .fab {
  position: fixed;
  bottom: calc(64px + 16px + env(safe-area-inset-bottom));
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
  z-index: 30;
}

body.pwa-mode .fab:active {
  transform: scale(0.95);
}

/* Hide elements that don't make sense in app mode */
body.pwa-mode .browser-only,
body.pwa-mode #pwa-install-banner {
  display: none !important;
}

/* Loading skeleton for native feel */
body.pwa-mode .skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Native-like alerts and toasts */
body.pwa-mode .alert-success,
body.pwa-mode .alert-error {
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: none;
}

/* Compact spacing for mobile */
body.pwa-mode .container-app {
  padding-left: 16px;
  padding-right: 16px;
}

/* Native-like section headers */
body.pwa-mode .section-header {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  padding: 12px 16px 8px;
  background: #f9fafb;
}
