/* PWA Offline functionality styles */

/* Connection status indicator */
.connection-indicator {
  background: rgba(16, 185, 129, 0.1);
  color: rgb(16, 185, 129);
}

.connection-indicator.offline {
  background: rgba(239, 68, 68, 0.1);
  color: rgb(239, 68, 68);
}

.connection-dot {
  background: currentColor;
  animation: pulse 2s infinite;
}

.connection-indicator.offline .connection-dot {
  animation: none;
}

/* Queue status */
.has-queue {
  background: rgba(245, 158, 11, 0.1) !important;
  color: rgb(245, 158, 11) !important;
}

/* Update notification */
.update-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  color: white;
  padding: 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
  z-index: 1000;
  max-width: 300px;
  animation: slideInRight 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.update-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.update-button {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.update-button:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.dismiss-button {
  background: none;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.dismiss-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Toast notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem;
  border-radius: 0.5rem;
  color: white;
  z-index: 1000;
  max-width: 300px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInRight 0.3s ease;
}

.toast-info { background: #3B82F6; }
.toast-success { background: #10B981; }
.toast-error { background: #EF4444; }
.toast-warning { background: #F59E0B; }

/* PWA Install prompt */
.pwa-install-prompt {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  color: white;
  padding: 1rem;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: slideInUp 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.pwa-install-content {
  flex: 1;
}

.pwa-install-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pwa-install-text {
  flex: 1;
}

.pwa-install-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: white;
}

.pwa-install-description {
  font-size: 0.875rem;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.9);
}

.pwa-install-actions {
  display: flex;
  gap: 0.5rem;
}

.pwa-install-button {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-weight: 500;
}

.pwa-install-button:hover {
  background: rgba(255, 255, 255, 0.25);
  color: white;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.pwa-install-button.primary {
  background: white;
  color: #3B82F6;
  border: 1px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pwa-install-button.primary:hover {
  background: #F8FAFC;
  color: #1D4ED8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Offline page styles */
.offline-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

/* Responsive design */
@media (max-width: 640px) {
  .update-notification,
  .toast {
    left: 20px;
    right: 20px;
    top: auto;
    bottom: 20px;
  }
  
  .pwa-install-prompt {
    flex-direction: column;
    text-align: center;
  }
  
  .pwa-install-actions {
    width: 100%;
    justify-content: center;
  }
  
  .connection-indicator {
    display: none !important;
  }
}

/* Animations */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

/* PWA specific CSS variables */
:root {
  --pwa-primary: #3B82F6;
  --pwa-secondary: #1D4ED8;
  --pwa-success: #10B981;
  --pwa-warning: #F59E0B;
  --pwa-error: #EF4444;
}

/* Data attribute styles for connection status */
[data-connection-status="online"] .connection-indicator {
  background: rgba(16, 185, 129, 0.1);
  color: rgb(16, 185, 129);
}

[data-connection-status="offline"] .connection-indicator {
  background: rgba(239, 68, 68, 0.1);
  color: rgb(239, 68, 68);
}

/* Hide certain elements when offline */
[data-connection-status="offline"] .online-only {
  display: none !important;
}

[data-connection-status="online"] .offline-only {
  display: none !important;
}

/* Install instruction modal styles */
.install-instructions-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 1rem;
  max-width: 28rem;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  animation: fadeInScale 0.3s ease;
}

.modal-header {
  padding: 1.5rem 1.5rem 0 1.5rem;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 1rem;
}

.modal-title-with-icon {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-title-with-icon h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

.close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6B7280;
  padding: 0.25rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
}

.close-button:hover {
  background: #F3F4F6;
  color: #374151;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}