/* PWA-specific styles for CMH Demo */

/* Prominent Install Button */
.install-button-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9997;
}

.install-button {
  display: flex;
  align-items: center;
  background-color: #3B82F6;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.install-button:hover {
  background-color: #2563EB;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.install-button svg {
  margin-right: 8px;
  width: 20px;
  height: 20px;
}

/* Install Tutorial */
.install-tutorial {
  position: fixed;
  top: 70px;
  right: 20px;
  background-color: white;
  color: #1F2937;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  width: 300px;
  z-index: 9996;
  font-size: 14px;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.install-tutorial.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.install-tutorial h3 {
  margin-top: 0;
  font-size: 16px;
  margin-bottom: 8px;
}

.install-tutorial p {
  margin-bottom: 12px;
}

.install-tutorial-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #6B7280;
}

.install-tutorial-steps {
  margin-bottom: 12px;
}

.install-tutorial-steps li {
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
}

.install-tutorial-steps li span {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: #3B82F6;
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 20px;
  margin-right: 8px;
  flex-shrink: 0;
}

.install-tutorial-image {
  width: 100%;
  border-radius: 4px;
  border: 1px solid #E5E7EB;
  margin-bottom: 12px;
}

/* Offline mode indicator */
body.offline {
  position: relative;
}

body.offline::before {
  content: "Offline Mode";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #f97316;
  color: white;
  text-align: center;
  padding: 4px;
  font-size: 14px;
  z-index: 9999;
}

/* Installation prompt */
#install-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #1F2937;
  color: white;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  z-index: 9998;
}

#install-container p {
  margin: 0;
  font-size: 16px;
}

#install-button {
  background-color: #3B82F6;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}

#install-button:hover {
  background-color: #2563EB;
}

#install-close {
  background: none;
  border: none;
  color: #9CA3AF;
  font-size: 20px;
  cursor: pointer;
  padding: 0 8px;
}

/* Online/Offline notifications */
.status-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 4px;
  color: white;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: 9999;
}

#online-notification {
  background-color: #10B981;
}

#offline-notification {
  background-color: #EF4444;
}

/* Standalone mode (installed PWA) adjustments */
@media (display-mode: standalone) {
  /* Add extra padding to account for system UI */
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  /* Hide browser-specific elements when in standalone mode */
  .browser-only {
    display: none !important;
  }
}

/* PWA-only elements (hidden in browser) */
.pwa-only {
  display: none;
}

@media (display-mode: standalone) {
  .pwa-only {
    display: block;
  }
}

/* Splash screen */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #111827;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.5s;
}

.splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-screen img {
  width: 150px;
  height: 150px;
  margin-bottom: 20px;
}

.splash-screen h1 {
  color: white;
  font-size: 24px;
  margin: 0;
}

/* Loading spinner */
.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 20px auto;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #3B82F6;
  border-radius: 50%;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
