/**
 * App Promotion System — stylesheet
 *
 * One file for every visual piece this module renders (sticky banner,
 * floating button, download popup, exit-intent popup, in-content promo
 * card, update banner, QR wrapper). Kept in a single file on purpose —
 * it's only enqueued on the front end when at least one of these features
 * is switched on (see inc/frontend.php), so there's no benefit to
 * splitting it into several small requests.
 *
 * Colors reuse this site's real brand blue (#2563eb / #1d4ed8, the value
 * that actually wins in sarkari-home.css's cascade — see the `!important`
 * override block there) rather than inventing a new palette, so this reads
 * as part of the same site instead of a bolted-on widget.
 *
 * Every fixed-position element here (banner, FAB, popups) is deliberately
 * NOT present in the DOM's normal flow above content that's already laid
 * out — they're `position: fixed`, so they cannot shift any existing
 * element and cannot contribute to Cumulative Layout Shift.
 */

:root {
  --sap-primary: #2563eb;
  --sap-primary-dark: #1d4ed8;
  --sap-primary-deep: #1e3a8a;
  --sap-accent-green: #16a34a;
  --sap-accent-green-dark: #15803d;
  --sap-text: #1e293b;
  --sap-text-muted: #64748b;
  --sap-surface: #ffffff;
  --sap-border: #e2e8f0;
  --sap-radius: 16px;
  --sap-shadow: 0 8px 30px rgba(30, 58, 138, 0.18);
  --sap-shadow-sm: 0 4px 14px rgba(30, 58, 138, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --sap-text: #e2e8f0;
    --sap-text-muted: #94a3b8;
    --sap-surface: #0f172a;
    --sap-border: #1e293b;
    --sap-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    --sap-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.35);
  }
}

/* ==========================================================
   1. Sticky mobile download banner
========================================================== */
.sap-sticky-banner {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--sap-radius);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: var(--sap-shadow);
  transform: translateY(140%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
@media (prefers-color-scheme: dark) {
  .sap-sticky-banner { background: rgba(15, 23, 42, 0.72); border-color: rgba(255, 255, 255, 0.08); }
}
.sap-sticky-banner.sap-visible { transform: translateY(0); }
/* Desktop never sees this banner — the floating button + popups cover
   that surface instead, so it isn't shown at all above 768px rather than
   just visually hidden (keeps it out of the accessibility tree there). */
@media (min-width: 769px) {
  .sap-sticky-banner { display: none !important; }
}
.sap-banner-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex: none;
  object-fit: cover;
  background: var(--sap-primary);
}
.sap-banner-text {
  flex: 1 1 auto;
  min-width: 0;
}
.sap-banner-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--sap-text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sap-banner-sub {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--sap-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sap-banner-btn {
  flex: none;
  background: linear-gradient(135deg, var(--sap-accent-green) 0%, var(--sap-accent-green-dark) 100%);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.35);
}
.sap-banner-close {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(100, 116, 139, 0.15);
  color: var(--sap-text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sap-banner-close:focus-visible,
.sap-fab:focus-visible,
.sap-banner-btn:focus-visible,
.sap-btn:focus-visible,
.sap-modal-close:focus-visible {
  outline: 3px solid var(--sap-primary-dark);
  outline-offset: 2px;
}

/* ==========================================================
   2. Floating action button
========================================================== */
.sap-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147482999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--sap-primary) 0%, var(--sap-primary-dark) 100%);
  box-shadow: var(--sap-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.3s ease, transform 0.3s ease, bottom 0.25s ease;
}
.sap-fab.sap-visible { opacity: 1; transform: scale(1); }
.sap-fab svg { width: 26px; height: 26px; }
/* Desktop: 40px margin from both edges, per spec. */
@media (min-width: 769px) {
  .sap-fab { right: 40px; bottom: 40px; }
}
/* Mobile: sits just above the sticky banner instead of overlapping it. */
@media (max-width: 768px) {
  .sap-fab { bottom: 92px; right: 16px; width: 50px; height: 50px; }
  .sap-fab svg { width: 22px; height: 22px; }
}
.sap-fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--sap-primary);
  opacity: 0;
}
.sap-fab.sap-pulse .sap-fab-pulse {
  animation: sap-pulse-ring 1.4s cubic-bezier(0.2, 0.7, 0.4, 1) 1;
}
@keyframes sap-pulse-ring {
  0%   { opacity: 0.55; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.9); }
}
@media (prefers-reduced-motion: reduce) {
  .sap-fab.sap-pulse .sap-fab-pulse { animation: none; }
  .sap-sticky-banner { transition: none; }
}

/* ==========================================================
   3 & 4. Download popup + exit-intent popup (shared modal shell)
========================================================== */
.sap-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}
.sap-modal-overlay.sap-open { opacity: 1; visibility: visible; }
.sap-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--sap-surface);
  border-radius: 20px;
  box-shadow: var(--sap-shadow);
  padding: 28px 24px 24px;
  text-align: center;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.sap-modal-overlay.sap-open .sap-modal { transform: translateY(0) scale(1); }
.sap-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(100, 116, 139, 0.12);
  color: var(--sap-text-muted);
  font-size: 16px;
  cursor: pointer;
}
.sap-modal-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin: 0 auto 12px;
  object-fit: cover;
  background: var(--sap-primary);
}
.sap-modal-stars {
  color: #f59e0b;
  font-size: 16px;
  letter-spacing: 2px;
  margin: 0 0 4px;
}
.sap-modal-trust {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--sap-text-muted);
  font-weight: 600;
}
.sap-modal h2 {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--sap-text);
  line-height: 1.35;
}
.sap-modal-benefits {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  text-align: left;
  display: grid;
  gap: 8px;
}
.sap-modal-benefits li {
  font-size: 13.5px;
  color: var(--sap-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sap-modal-benefits li::before {
  content: "✓";
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(22, 163, 74, 0.15);
  color: var(--sap-accent-green-dark);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sap-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  margin-bottom: 10px;
}
.sap-btn-primary {
  background: linear-gradient(135deg, var(--sap-accent-green) 0%, var(--sap-accent-green-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
}
.sap-btn-secondary {
  background: rgba(37, 99, 235, 0.1);
  color: var(--sap-primary-dark);
}
.sap-btn-tertiary {
  background: transparent;
  color: var(--sap-text-muted);
  font-weight: 600;
  padding: 8px 16px;
  margin-bottom: 0;
}
.sap-modal-qr-panel {
  display: none;
  margin: 4px 0 16px;
}
.sap-modal-qr-panel.sap-open { display: block; }
.sap-modal-qr-panel img { width: 150px; height: 150px; border-radius: 10px; border: 1px solid var(--sap-border); }

/* Exit-intent popup reuses .sap-modal but with a simpler 2-button layout */
.sap-exit-modal h2 { font-size: 19px; }
.sap-exit-modal p { font-size: 13.5px; color: var(--sap-text-muted); margin: 0 0 18px; }

/* ==========================================================
   5. QR wrapper (homepage / footer / sidebar / job pages / PDF pages)
========================================================== */
.sap-qr-block {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.sap-qr-block img {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  border: 1px solid var(--sap-border);
  background: #fff;
}
.sap-qr-caption {
  font-size: 11.5px;
  color: var(--sap-text-muted);
  max-width: 140px;
}

/* ==========================================================
   6. In-content promo card (auto-inserted into job post articles)
========================================================== */
.sap-promo-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(29, 78, 216, 0.1) 100%);
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: var(--sap-radius);
  padding: 16px;
  margin: 22px 0;
}
.sap-promo-card img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--sap-primary);
}
.sap-promo-card-body h4 {
  margin: 0 0 3px;
  font-size: 14.5px;
  color: var(--sap-text);
}
.sap-promo-card-body p {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--sap-text-muted);
}
.sap-promo-card-stars { color: #f59e0b; font-size: 12px; margin-right: 6px; }
.sap-promo-card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sap-promo-card-btn {
  background: var(--sap-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
}
@media (max-width: 480px) {
  .sap-promo-card { grid-template-columns: 1fr; text-align: center; }
  .sap-promo-card img { margin: 0 auto; }
  .sap-promo-card-actions { justify-content: center; }
}

/* ==========================================================
   9. Update-available banner (top of page)
========================================================== */
.sap-update-banner {
  /* Rendered via wp_footer (see inc/frontend.php's doc comment on why —
     this theme's templates don't share one consistent top-of-body hook),
     so it's pinned to the viewport top with CSS rather than relying on
     DOM position to put it at the top of the page. */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2147483002;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--sap-primary) 0%, var(--sap-primary-dark) 100%);
  color: #fff;
  padding: 10px 16px;
  font-size: 13px;
  text-align: center;
}
.sap-update-banner strong { font-weight: 700; }
.sap-update-banner .sap-btn {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 6px 14px;
  font-size: 12.5px;
  background: #fff;
  color: var(--sap-primary-dark);
}
.sap-update-banner .sap-update-dismiss {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

/* Screen-reader-only utility, matches the pattern already used sitewide. */
.sap-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==============================
   HOMEPAGE "GET THE APP" SECTION
   (spec req #7 — additive section under the site's own job-search hero,
   not a replacement for it. Uses the same --sap-* tokens as every other
   surface in this module for visual consistency.)
============================== */
.sap-home-section {
  padding: 56px 20px;
  background: linear-gradient(135deg, var(--sap-primary-deep) 0%, var(--sap-primary-dark) 55%, var(--sap-primary) 100%);
  color: #fff;
}
.sap-home-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
  align-items: center;
}
@media (max-width: 860px) {
  .sap-home-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }
}
.sap-home-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}
.sap-home-section h2 {
  color: #fff;
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.2;
  margin: 0 0 12px;
}
.sap-home-desc {
  color: rgba(255, 255, 255, 0.88);
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 22px;
  max-width: 46ch;
}
@media (max-width: 860px) {
  .sap-home-desc { margin-left: auto; margin-right: auto; }
}
.sap-home-features {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  text-align: left;
}
@media (max-width: 480px) {
  .sap-home-features { grid-template-columns: 1fr; }
}
.sap-home-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.sap-home-feature-icon {
  font-size: 20px;
  line-height: 1;
  flex: none;
}
.sap-home-feature-text {
  display: flex;
  flex-direction: column;
  font-size: 13.5px;
  line-height: 1.4;
}
.sap-home-feature-text strong {
  font-size: 14.5px;
  color: #fff;
}
.sap-home-feature-text span {
  color: rgba(255, 255, 255, 0.78);
}
.sap-home-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin: 0 0 26px;
}
@media (max-width: 860px) {
  .sap-home-stats { justify-content: center; }
}
.sap-home-stat {
  display: flex;
  flex-direction: column;
}
.sap-home-stat-num {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}
.sap-home-stat-label {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.75);
}
.sap-home-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}
@media (max-width: 860px) {
  .sap-home-actions { justify-content: center; }
}
.sap-home-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  color: var(--sap-primary-dark);
  font-weight: 700;
  font-size: 15px;
  padding: 14px 26px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.sap-home-download-btn:hover,
.sap-home-download-btn:focus-visible {
  transform: translateY(-2px);
  color: var(--sap-primary-dark);
}
.sap-home-actions .sap-qr-block {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px;
}
.sap-home-actions .sap-qr-caption {
  color: rgba(255, 255, 255, 0.85);
}
.sap-home-visual {
  display: flex;
  justify-content: center;
}
.sap-home-screenshot {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.sap-home-icon-only {
  width: 160px;
  height: 160px;
  border-radius: 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.12);
  padding: 20px;
}
@media (prefers-reduced-motion: reduce) {
  .sap-home-download-btn { transition: none; }
}

/* ==============================
   FOOTER QR ROW (myfoot.php)
   A single centered row below the existing 4-column footer grid —
   deliberately not a 5th grid column, to leave that grid's tuned layout
   untouched.
============================== */
.footer-app-qr-row {
  display: flex;
  justify-content: center;
  padding: 24px 0 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 16px;
}
.footer-app-qr-row .sap-qr-block {
  text-align: center;
}
.footer-app-qr-row .sap-qr-caption {
  /* Footer background is dark (see .jobsite-footer) — the default muted
     gray caption color has poor contrast there, so lighten it here. */
  color: rgba(255, 255, 255, 0.75);
}
