/* PWA Specific Styles */

/* Install Button */
#install-app-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1050;
  background: linear-gradient(45deg, #0d6efd, #6f42c1);
  border: none;
  border-radius: 50px;
  color: white;
  padding: 12px 24px;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

#install-app-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
  }
  50% {
    box-shadow: 0 4px 25px rgba(13, 110, 253, 0.5);
  }
  100% {
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
  }
}

/* Offline Banner */
#offline-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #dc3545, #fd7e14);
  color: white;
  text-align: center;
  padding: 10px;
  z-index: 1060;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Update Banner */
#update-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #198754, #20c997);
  color: white;
  text-align: center;
  padding: 10px;
  z-index: 1060;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Connection Status Indicator */
#connection-status {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1040;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 12px;
}

/* Offline State Styling */
body.offline {
  position: relative;
}

body.offline::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.05);
  z-index: -1;
  pointer-events: none;
}

/* Offline Form Styling */
body.offline form {
  position: relative;
  opacity: 0.8;
}

body.offline form::after {
  content: 'Offline - Changes will sync when online';
  position: absolute;
  top: -30px;
  left: 0;
  right: 0;
  background: #ffc107;
  color: #000;
  text-align: center;
  padding: 5px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

/* PWA Navigation Enhancements */
.pwa-nav {
  position: relative;
}

.pwa-nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #0d6efd, transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pwa-nav.active::after {
  opacity: 1;
}

/* Toast Container */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1070;
  max-width: 350px;
}

/* PWA Loading Indicators */
.pwa-loading {
  position: relative;
  overflow: hidden;
}

.pwa-loading::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #0d6efd, transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* PWA Card Enhancements */
.pwa-card {
  border: none;
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pwa-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Splash Screen Styling */
.pwa-splash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0d6efd, #6f42c1);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.pwa-splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.pwa-splash .logo {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: logoFloat 2s ease-in-out infinite;
}

.pwa-splash .title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.pwa-splash .subtitle {
  font-size: 1.1rem;
  opacity: 0.8;
  margin-bottom: 2rem;
}

.pwa-splash .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* PWA Bottom Navigation */
.pwa-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid #dee2e6;
  padding: 8px 0;
  z-index: 1040;
  display: none;
}

.pwa-bottom-nav.show {
  display: block;
}

.pwa-bottom-nav .nav {
  justify-content: space-around;
}

.pwa-bottom-nav .nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #6c757d;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-size: 12px;
}

.pwa-bottom-nav .nav-link.active {
  color: #0d6efd;
  background: rgba(13, 110, 253, 0.1);
}

.pwa-bottom-nav .nav-link i {
  font-size: 20px;
  margin-bottom: 4px;
}

/* PWA Responsive Enhancements */
@media (max-width: 768px) {
  body {
    padding-bottom: 70px;
  }
  
  .pwa-bottom-nav {
    display: block;
  }
  
  #install-app-btn {
    bottom: 80px;
  }
  
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* PWA Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .pwa-card {
    background: #1a1a1a;
    color: white;
  }
  
  .pwa-bottom-nav {
    background: #1a1a1a;
    border-top-color: #333;
  }
  
  .pwa-bottom-nav .nav-link {
    color: #adb5bd;
  }
  
  .pwa-bottom-nav .nav-link.active {
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.2);
  }
}

/* PWA Print Styles */
@media print {
  #install-app-btn,
  #offline-banner,
  #update-banner,
  #connection-status,
  .pwa-bottom-nav {
    display: none !important;
  }
}

/* PWA Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
  #install-app-btn,
  .pwa-loading::before,
  .pwa-splash .logo,
  .pwa-splash .spinner {
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .pwa-card {
    border: 2px solid;
  }
  
  #install-app-btn {
    border: 2px solid white;
  }
}
