/* ========================================
   PWA Styles
   ======================================== */

/* Install Button */
.pwa-install-btn {
  display: none;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #60A561, #4a8c4a);
  color: white;
  border: none;
  border-radius: var(--border-radius-md);
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(96, 165, 97, 0.3);
  white-space: nowrap;
}

.pwa-install-btn:hover {
  background: linear-gradient(135deg, #4a8c4a, #60A561);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(96, 165, 97, 0.4);
}

.pwa-install-btn.floating {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 1001;
  border-radius: 25px;
  padding: 12px 20px;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(96, 165, 97, 0.4);
}

/* Offline Message */
.offline-message {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  padding: 12px 20px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 500;
  z-index: 1002;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.offline-message i {
  font-size: 1.1rem;
  animation: pulse 2s infinite;
}

/* Update Message */
.update-message {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  padding: 16px 20px;
  z-index: 1002;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.update-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.update-content button {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--border-radius-sm);
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.update-content button:hover {
  background: rgba(255, 255, 255, 0.3);
}

.update-content button:first-of-type {
  background: white;
  color: #3498db;
  border-color: white;
  font-weight: 600;
}

.update-content button:first-of-type:hover {
  background: #f8f9fa;
}

/* PWA Loading States */
.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 1s ease-in-out infinite;
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Splash Screen Simulation */
.pwa-splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #E34A6F, #F7B2BD);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: white;
}

.pwa-splash-logo {
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin-bottom: 20px;
  animation: bounceIn 1s ease-out;
}

.pwa-splash-text {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  animation: fadeInUp 1s ease-out 0.3s both;
}

.pwa-splash-subtitle {
  font-size: 1rem;
  opacity: 0.9;
  animation: fadeInUp 1s ease-out 0.6s both;
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3) translateY(-20px);
  }
  50% {
    opacity: 1;
    transform: scale(1.05) translateY(0);
  }
  70% {
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

/* Mobile PWA Optimizations */
@media (max-width: 768px) {
  .pwa-install-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
  
  .pwa-install-btn.floating {
    bottom: 70px;
    right: 15px;
    padding: 10px 16px;
    font-size: 0.9rem;
  }
  
  .offline-message {
    top: 60px;
    padding: 10px 15px;
    font-size: 0.9rem;
  }
  
  .update-content {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .update-content button {
    width: 100%;
    max-width: 200px;
  }
  
  .language-selector {
    display: none; /* Hide desktop language selector on mobile */
  }
}

/* Standalone PWA Mode Adjustments */
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .layout-header {
    top: env(safe-area-inset-top);
  }
  
  .mobile-bottom-nav {
    bottom: env(safe-area-inset-bottom);
  }
  
  .pwa-install-btn.floating {
    bottom: calc(70px + env(safe-area-inset-bottom));
  }
}

/* Dark Mode Support for PWA */
@media (prefers-color-scheme: dark) {
  .pwa-splash {
    background: linear-gradient(135deg, #2c3e50, #34495e);
  }
  
  .offline-message {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .pwa-install-btn {
    background: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
  }
  
  .offline-message {
    background: #ff0000;
    color: #ffffff;
    border: 2px solid #ffffff;
  }
}