/* PWA Styles - Install Banner, Update Notification, Offline Indicator */

/* ============================================================
   INSTALL BANNER
   ============================================================ */
.pwa-install-banner {
  position: fixed;
  bottom: -200px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 600px;
  width: calc(100% - 40px);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 15px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 99999;
  transition: bottom 0.3s ease;
}

#pwa-install-banner.show .pwa-install-banner {
  bottom: 20px;
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

.pwa-banner-icon {
  font-size: 40px;
  line-height: 1;
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pwa-banner-text strong {
  font-size: 16px;
  font-weight: 600;
}

.pwa-banner-text span {
  font-size: 13px;
  opacity: 0.9;
}

.pwa-banner-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pwa-install-btn {
  background: white;
  color: #667eea;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.pwa-install-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.pwa-close-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.pwa-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ============================================================
   UPDATE NOTIFICATION
   ============================================================ */
.pwa-update-banner {
  position: fixed;
  top: 70px;
  right: 20px;
  background: #4CAF50;
  color: white;
  padding: 15px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 99998;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.update-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.update-content i {
  font-size: 20px;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.update-btn {
  background: white;
  color: #4CAF50;
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.update-btn:hover {
  transform: scale(1.05);
}

/* ============================================================
   OFFLINE INDICATOR
   ============================================================ */
body.offline::before {
  content: '🔌 Offline';
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: #FF9800;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  z-index: 99997;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    transform: translateX(-50%) translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

/* ============================================================
   GENERIC PWA NOTIFICATION
   ============================================================ */
.pwa-notification {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 400px;
  width: calc(100% - 40px);
  padding: 15px 20px;
  border-radius: 10px;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 99996;
  transition: top 0.3s ease;
}

.pwa-notification.show {
  top: 80px;
}

.pwa-notification.success {
  background: #4CAF50;
}

.pwa-notification.warning {
  background: #FF9800;
}

.pwa-notification.error {
  background: #f44336;
}

.pwa-notification.info {
  background: #2196F3;
}

.pwa-notification strong {
  display: block;
  font-size: 15px;
  margin-bottom: 5px;
}

.pwa-notification p {
  font-size: 13px;
  margin: 0;
  opacity: 0.95;
}

/* ============================================================
   STANDALONE MODE ADJUSTMENTS
   ============================================================ */
body.pwa-standalone .navbar {
  padding-top: env(safe-area-inset-top);
}

body.ios-standalone .navbar {
  padding-top: 20px; /* Status bar iOS */
}

/* ============================================================
   RESPONSIVE - MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .pwa-install-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
  }
  
  .pwa-banner-content {
    width: 100%;
  }
  
  .pwa-banner-actions {
    width: 100%;
    justify-content: space-between;
  }
  
  .pwa-install-btn {
    flex: 1;
    justify-content: center;
  }
  
  .pwa-update-banner {
    right: 10px;
    left: 10px;
    flex-direction: column;
    text-align: center;
  }
  
  body.offline::before {
    top: 50px;
    font-size: 12px;
    padding: 8px 15px;
  }
}

/* ============================================================
   PRINT - HIDE PWA ELEMENTS
   ============================================================ */
@media print {
  .pwa-install-banner,
  .pwa-update-banner,
  .pwa-notification,
  body.offline::before {
    display: none !important;
  }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .pwa-install-banner,
  .pwa-update-banner,
  .pwa-notification,
  body.offline::before {
    animation: none;
    transition: none;
  }
}

/* Focus states */
.pwa-install-btn:focus,
.pwa-close-btn:focus,
.update-btn:focus {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}
