/* ============================================================
   App Promo — sticky download bar, mid-page banner, smart popup
   Loaded by governorate pages. Depends on :root vars in style.css
   ============================================================ */

/* ---------- Sticky download bar (mobile only) ---------- */
.app-sticky-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 900;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--green-900);
  box-shadow: 0 -8px 28px rgba(7, 41, 31, 0.28);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.28s var(--ease-out), opacity 0.28s var(--ease-out);
}
.app-sticky-bar.is-visible {
  transform: translateY(0);
  opacity: 1;
}
.app-sticky-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  flex-shrink: 0;
}
.app-sticky-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.35;
}
.app-sticky-text strong {
  color: var(--cream);
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-sticky-text span {
  color: var(--gold-pale);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-sticky-stores {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.app-sticky-store {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  background: rgba(250, 247, 240, 0.12);
  border: 1px solid rgba(250, 247, 240, 0.22);
  color: var(--cream);
  transition: transform 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
.app-sticky-store:active {
  transform: scale(0.97);
  background: rgba(250, 247, 240, 0.22);
}
.app-sticky-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin-inline-start: -6px;
  background: none;
  border: none;
  color: var(--gold-pale);
  cursor: pointer;
  flex-shrink: 0;
}
@media (max-width: 767px) {
  .app-sticky-bar { display: flex; }
  body.app-bar-visible { padding-bottom: 76px; }
}

/* ---------- Mid-page download banner ---------- */
.app-banner-section {
  padding: 0 0 72px;
  background: var(--cream);
}
.app-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: 28px 30px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--green-900), var(--green-700));
  box-shadow: var(--shadow-lift);
  position: relative;
  overflow: hidden;
}
.app-banner::after {
  content: "";
  position: absolute;
  inset-inline-end: -60px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.22), transparent 70%);
  pointer-events: none;
}
.app-banner-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}
.app-banner-copy {
  flex: 1;
  min-width: 220px;
}
.app-banner-title {
  color: var(--cream);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.app-banner-title .gold-text {
  color: var(--gold-bright);
}
.app-banner-sub {
  color: rgba(250, 247, 240, 0.82);
  font-size: 0.95rem;
  line-height: 1.7;
}
.app-banner-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.app-store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--cream);
  color: var(--green-900);
  border: 1px solid rgba(250, 247, 240, 0.4);
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}
.app-store-badge:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}
.app-store-badge:active {
  transform: scale(0.97);
}
.app-store-badge-soon {
  opacity: 0.65;
  cursor: default;
}
.app-store-badge-soon:hover {
  transform: none;
  box-shadow: none;
}
.app-store-badge small {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
}
.app-store-badge strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
}

/* ---------- Smart popup (first-time visitors) ---------- */
.app-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 41, 31, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-out), visibility 0.25s var(--ease-out);
}
.app-popup-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}
.app-popup {
  width: min(420px, 100%);
  background: var(--cream);
  border-radius: var(--radius-lg);
  padding: 32px 28px 28px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-lift);
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.25s var(--ease-out), opacity 0.25s var(--ease-out);
}
.app-popup-overlay.is-visible .app-popup {
  transform: scale(1);
  opacity: 1;
}
.app-popup-close {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
}
.app-popup-close:hover {
  color: var(--green-900);
}
.app-popup-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-soft);
}
.app-popup-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--green-900);
  margin-bottom: 8px;
}
.app-popup-sub {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 20px;
}
.app-popup .app-banner-badges {
  justify-content: center;
}
.app-popup .app-store-badge {
  background: var(--green-800);
  color: var(--cream);
  border: none;
}
.app-popup .app-store-badge small {
  color: var(--gold-pale);
}

@media (prefers-reduced-motion: reduce) {
  .app-sticky-bar,
  .app-popup-overlay,
  .app-popup,
  .app-store-badge,
  .app-sticky-store {
    transition: none;
  }
}
