/* ================================================================
   Milan Nivas — PWA UI Styles
   Encapsulates all installation banners, splash screens, push banners,
   and offline indicators so that they render correctly on every page.
   ================================================================ */

.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #1e2435;
  border-top: 1px solid #2a3048;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
  display: none;
  animation: pwaSlideUp 0.3s ease-out;
}

@keyframes pwaSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.pwa-install-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  max-width: 600px;
  margin: 0 auto;
}

.pwa-install-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}

.pwa-install-text {
  flex: 1;
  min-width: 0;
}

.pwa-install-text strong {
  display: block;
  color: #e8eaf0;
  font-size: 14px;
}

.pwa-install-text span {
  display: block;
  color: #8b92a8;
  font-size: 12px;
  margin-top: 2px;
}

button.pwa-install-btn {
  padding: 8px 20px;
  background: #4f8ef7;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

button.pwa-install-btn:hover { background: #3b7de6; }
button.pwa-install-btn:active { transform: scale(0.97); }

.pwa-install-dismiss {
  background: none;
  border: none;
  color: #5a6278;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.pwa-install-dismiss:hover { color: #e8eaf0; }

/* Offline Banner (top bar) */
.pwa-offline-banner {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 13px;
  gap: 8px;
  animation: pwaSlideDown 0.3s ease-out;
}

@keyframes pwaSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);      opacity: 1; }
}

.pwa-offline-banner--offline {
  background: #b91c1c;
  color: #fff;
}

.pwa-offline-banner--online {
  background: #16a34a;
  color: #fff;
}

.pwa-offline-banner__content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-offline-banner__content i {
  font-size: 14px;
}

/* Update Available Toast */
.pwa-update-toast {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 9997;
  background: #1e2435;
  border: 1px solid #4f8ef7;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: pwaSlideUp 0.3s ease-out;
}

.pwa-update-toast__text {
  color: #e8eaf0;
  font-size: 13px;
}

.pwa-update-toast__btn {
  padding: 6px 14px;
  background: #4f8ef7;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Push Notification Opt-in Banner */
.pwa-push-banner {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9996;
  background: #1e2435;
  border: 1px solid #2a3048;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  display: none;
  max-width: 380px;
  width: calc(100% - 32px);
  animation: pwaSlideUp 0.3s ease-out;
}

.pwa-push-banner__content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pwa-push-banner__text {
  color: #e8eaf0;
  font-size: 13px;
  line-height: 1.5;
}

.pwa-push-banner__actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.pwa-push-banner__btn {
  padding: 6px 16px;
  background: #4f8ef7;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pwa-push-banner__btn--secondary {
  background: transparent;
  border: 1px solid #2a3048;
  color: #8b92a8;
}

.pwa-push-banner__btn--secondary:hover {
  color: #e8eaf0;
  border-color: #3a4268;
}

/* Standalone display adjustments */
@media all and (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
  body { padding-bottom: env(safe-area-inset-bottom); }
  .main-header { padding-top: env(safe-area-inset-top); padding-right: env(safe-area-inset-right); }
  .main-sidebar { padding-left: env(safe-area-inset-left); }
  .main-footer { padding-bottom: env(safe-area-inset-bottom); }
}

/* PWA: Splash Screen */
.pwa-splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #13161f;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease;
}
.pwa-splash-screen.pwa-splash--fadeout {
  opacity: 0;
  pointer-events: none;
}
.pwa-splash-content {
  text-align: center;
}
.pwa-splash-icon {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  margin-bottom: 16px;
}
.pwa-splash-title {
  font-size: 18px;
  font-weight: 600;
  color: #e8eaf0;
  margin-bottom: 24px;
}
.pwa-splash-loader {
  width: 32px;
  height: 32px;
  border: 3px solid #2a3048;
  border-top-color: #4f8ef7;
  border-radius: 50%;
  animation: pwaSpin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes pwaSpin {
  to { transform: rotate(360deg); }
}

/* PWA: iOS Install Banner */
.pwa-ios-install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #1e2435;
  border-bottom: 1px solid #2a3048;
  padding: 12px 16px;
  z-index: 9999;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.pwa-ios-install-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: #c8ccd4;
}
.pwa-ios-install-dismiss {
  background: none;
  border: none;
  color: #8b92a8;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}
.pwa-ios-install-dismiss:hover {
  color: #fff;
}
