/* زر نزّل التطبيق + إشعار تثبيت يظهر تلقائيًا حتى التثبيت */

.hub-pwa-actions {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.hub-pwa-install-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #d70000, #8a000c) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 6px 14px rgba(120, 0, 14, 0.28) !important;
  cursor: pointer;
  font-family: 'Cairo', 'Tajawal', sans-serif !important;
  font-weight: 800 !important;
  animation: hub-pwa-pulse 2.4s ease-in-out infinite;
}

.hub-pwa-install-btn:hover,
.hub-pwa-install-btn:focus-visible {
  filter: brightness(1.08);
}

.hub-pwa-installed-badge {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.82) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  cursor: default;
  user-select: none;
  opacity: 0.88;
  font-family: 'Cairo', 'Tajawal', sans-serif !important;
  font-weight: 800 !important;
  pointer-events: none;
}

.hub-pwa-tip {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 80;
  min-width: 220px;
  max-width: min(320px, 80vw);
  padding: 10px 12px;
  border-radius: 10px;
  background: #1f2937;
  color: #f8fafc;
  font-family: 'Cairo', 'Tajawal', sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
  text-align: right;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  white-space: normal;
}

.hub-pwa-notice {
  position: fixed;
  inset-inline-end: 16px;
  bottom: 18px;
  z-index: 1300;
  width: min(420px, calc(100vw - 24px));
  font-family: 'Cairo', 'Tajawal', sans-serif;
}

.hub-pwa-notice-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1a0508 0%, #3a0008 55%, #120204 100%);
  border: 1px solid rgba(215, 0, 0, 0.55);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  color: #fff;
}

.hub-pwa-notice-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #d70000, #8a000c);
  font-size: 16px;
}

.hub-pwa-notice-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hub-pwa-notice-copy strong {
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.hub-pwa-notice-copy span {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
}

.hub-pwa-notice-cta {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #8a000c;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.hub-pwa-notice-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.hub-pwa-tip[hidden],
.hub-pwa-install-btn[hidden],
.hub-pwa-installed-badge[hidden],
.hub-pwa-notice[hidden] {
  display: none !important;
}

@keyframes hub-pwa-pulse {
  0%,
  100% {
    box-shadow: 0 6px 14px rgba(120, 0, 14, 0.28);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(215, 0, 0, 0.22), 0 8px 18px rgba(120, 0, 14, 0.4);
  }
}

@media (max-width: 900px) {
  .hub-pwa-notice {
    inset-inline: 12px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
  }

  .hub-pwa-notice-inner {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }

  .hub-pwa-notice-copy span {
    display: none;
  }

  .hub-pwa-notice-cta {
    order: 0;
    width: auto;
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }

  body.homepage .top-nav.is-mobile-nav-ready.is-mobile-nav-open .hub-pwa-actions {
    width: 100%;
    margin-top: 8px;
  }

  body.homepage .top-nav.is-mobile-nav-ready.is-mobile-nav-open .hub-pwa-install-btn,
  body.homepage .top-nav.is-mobile-nav-ready.is-mobile-nav-open .hub-pwa-installed-badge {
    width: 100%;
    justify-content: center;
  }

  body.homepage .top-nav.is-mobile-nav-ready.is-mobile-nav-open .hub-pwa-tip {
    inset-inline-end: auto;
    inset-inline-start: 0;
    max-width: 100%;
  }
}
