/**
 * PWA-specific styles
 * Install button, update notifications, and standalone mode adjustments
 */

/* Hide PWA elements when JavaScript is disabled */
.no-js .pwa-install-button,
.no-js .pwa-update-notification {
  display: none !important;
}

/* Install Button */
.pwa-install-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;

  display: none; /* Hidden by default, shown by JS when available */
  align-items: center;
  gap: 8px;
  
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50px;
  
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  
  transition: all 0.3s ease;
  animation: slideInUp 0.5s ease;
}

.pwa-install-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

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

.pwa-install-button .install-icon {
  font-size: 18px;
  line-height: 1;
}

.pwa-install-button .install-text {
  line-height: 1;
}

/* Update Notification */
.pwa-update-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  
  animation: slideInDown 0.5s ease;
}

.pwa-update-notification .update-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.pwa-update-notification .update-icon {
  font-size: 20px;
  line-height: 1;
}

.pwa-update-notification .update-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.pwa-update-notification .update-button,
.pwa-update-notification .update-dismiss {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pwa-update-notification .update-button {
  background: #667eea;
  color: white;
}

.pwa-update-notification .update-button:hover {
  background: #5568d3;
}

.pwa-update-notification .update-dismiss {
  background: transparent;
  color: #666;
}

.pwa-update-notification .update-dismiss:hover {
  background: #f0f0f0;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .pwa-update-notification {
    background: #1e1e1e;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  
  .pwa-update-notification .update-text {
    color: #e0e0e0;
  }
  
  .pwa-update-notification .update-dismiss {
    color: #999;
  }
  
  .pwa-update-notification .update-dismiss:hover {
    background: #2a2a2a;
  }
}

/* Standalone mode adjustments */
.pwa-installed {
  /* Add any styles specific to installed PWA mode */
}

/* iOS safe area support */
@supports (padding: max(0px)) {
  .pwa-installed {
    padding-top: max(0px, env(safe-area-inset-top));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Animations */
@keyframes slideInUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .pwa-install-button {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
    font-size: 13px;
  }
  
  .pwa-update-notification {
    top: 16px;
    right: 16px;
    left: 16px;
    max-width: calc(100% - 32px);
  }
  
  .pwa-update-notification .update-content {
    flex-wrap: wrap;
    padding: 12px 16px;
  }
  
  .pwa-update-notification .update-text {
    flex-basis: 100%;
    margin-bottom: 8px;
  }
}

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

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

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

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

/* PWA splash screen styles (for custom splash) */
.pwa-splash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  
  background: #0d1117;
  color: white;
}

.pwa-splash .splash-icon {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  animation: pulse 2s ease-in-out infinite;
}

.pwa-splash .splash-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.pwa-splash .splash-subtitle {
  font-size: 14px;
  color: #8b949e;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(0.95);
  }
}

