/* =========================================================
   BG STICKY MOBILE CTA BAR
   Mobile-only conversion bar pinned to viewport bottom.
   - Hidden on desktop (>=768px)
   - Hidden on form pages (Lets Talk, Careers apply, etc.)
   - Adds body padding so content is not hidden behind it
   - Sits below the floating chat launcher and the nav drawer
========================================================= */

.bgsc {
  /* Hidden by default — only shown via media query below */
  display: none;
}

@media (max-width: 767px) {
  .bgsc {
    display: flex;
    flex-direction: column; /* Phase 14E: live-chat row above the actions row */
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 8800; /* below concierge panel (9200) + drawer (110 is fine — drawer covers from top:60) */
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
    background:
      linear-gradient(180deg, rgba(4, 7, 15, 0.55) 0%, rgba(4, 7, 15, 0.96) 38%, rgba(4, 7, 15, 0.99) 100%);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-top: 1px solid rgba(79, 200, 255, 0.16);
    box-shadow:
      0 -1px 0 rgba(79, 200, 255, 0.04) inset,
      0 -10px 30px rgba(0, 0, 0, 0.35);
    transform: translate3d(0, 0, 0);
    transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms ease;
    will-change: transform;
    contain: layout style;
  }

  /* Body padding so content is never hidden behind the bar.
     Phase 14E: bar is now two rows (live-chat strip + actions) ≈ 100px. */
  body.bgsc-has {
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  }

  /* Actions row holds the primary + secondary CTAs side by side */
  .bgsc-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
  }

  /* When the user explicitly hides the bar (e.g. nav drawer open, or scrolled
     past the closing CTA into the footer) — slide it offscreen. */
  .bgsc.bgsc-hide {
    transform: translate3d(0, 120%, 0);
    pointer-events: none;
  }
}

/* ---------- Primary CTA: Talk to an AI Architect ---------- */
.bgsc-primary {
  position: relative;
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  font-family: var(--font-display, "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: #04060F;
  background: linear-gradient(135deg, #5EFFC0 0%, #4FC8FF 60%, #4FC8FF 100%);
  border: 0;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow:
    0 0 0 1px rgba(79, 200, 255, 0.6) inset,
    0 8px 24px rgba(79, 200, 255, 0.28),
    0 0 0 0 rgba(79, 200, 255, 0.4);
  transition: transform 160ms ease, box-shadow 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.bgsc-primary:active {
  transform: translateY(1px);
  box-shadow:
    0 0 0 1px rgba(79, 200, 255, 0.6) inset,
    0 4px 14px rgba(79, 200, 255, 0.28);
}
.bgsc-primary:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.bgsc-primary .bgsc-i {
  display: inline-flex; width: 16px; height: 16px;
  color: #04060F;
  flex-shrink: 0;
}
.bgsc-primary .bgsc-arrow {
  width: 14px; height: 14px;
  margin-left: 2px;
  flex-shrink: 0;
  transition: transform 200ms ease;
}
.bgsc-primary:hover .bgsc-arrow { transform: translateX(2px); }

/* Pulse ring on the primary button — subtle attention every ~6s.
   Disabled by prefers-reduced-motion. */
.bgsc-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(79, 200, 255, 0.0);
  animation: bgsc-pulse 6s ease-in-out infinite;
  animation-delay: 1.5s;
}
@keyframes bgsc-pulse {
  0%, 92%, 100% { box-shadow: 0 0 0 0 rgba(79, 200, 255, 0); }
  94%           { box-shadow: 0 0 0 4px rgba(79, 200, 255, 0.18); }
  98%           { box-shadow: 0 0 0 10px rgba(79, 200, 255, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .bgsc-primary::after { animation: none; }
  .bgsc { transition: none; }
}

/* ---------- Compact secondary: View Products ---------- */
.bgsc-secondary {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 92px;
  min-height: 48px;
  padding: 0 12px;
  font-family: var(--font-mono, "JetBrains Mono", "SF Mono", Menlo, monospace);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ECF0FA;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(79, 200, 255, 0.22);
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.bgsc-secondary:hover,
.bgsc-secondary:focus-visible {
  background: rgba(79, 200, 255, 0.08);
  border-color: rgba(79, 200, 255, 0.4);
  color: #fff;
  outline: none;
}
.bgsc-secondary:focus-visible {
  outline: 2px solid var(--site-cyan, #4FC8FF);
  outline-offset: 2px;
}

/* On very small phones (<360px wide) — compress secondary to icon */
@media (max-width: 359px) {
  .bgsc-secondary .bgsc-secondary-l { display: none; }
  .bgsc-secondary { min-width: 48px; padding: 0 10px; }
}

/* On somewhat-narrow phones (360–380px) — secondary remains label-only, but tighter */
@media (max-width: 380px) {
  .bgsc { padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px); }
  .bgsc-primary { font-size: 13.5px; padding: 0 10px; }
  .bgsc-primary .bgsc-arrow { display: none; }
}

/* ---------- Phase 14E — mobile live-chat lives in the sticky bar ----------
   The floating chat launcher (.bgc-launch) overlapped content and clashed
   with this bar on mobile. We hide the floating bubble entirely on mobile and
   surface live chat as the .bgsc-livechat row inside this bar instead. The
   launcher stays in the DOM (hidden) so .click() can still open the concierge.
   Desktop (>=768px) keeps the floating launcher untouched. */
@media (max-width: 767px) {
  body.bgsc-has .bgc-launch {
    display: none !important;
  }
  /* Concierge's own 4-button mobile bar stays suppressed where the sticky bar
     replaces it. On bar-suppressed pages (e.g. Lets Talk) it remains as the
     page's own chat entry, so we DON'T hide it globally. */
  body.bgsc-has .bgc-mob { display: none !important; }
  body.bgsc-has.bgc-has-mob {
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* ----- Live chat row inside the sticky bar ----- */
  .bgsc-livechat {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(11, 20, 24, 0.7), rgba(8, 14, 20, 0.7));
    border: 1px solid rgba(94, 255, 164, 0.24);
    color: #CFEFE0;
    font-family: var(--font-mono, "JetBrains Mono", "SF Mono", Menlo, monospace);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
  }
  .bgsc-livechat:hover,
  .bgsc-livechat:focus-visible {
    background: linear-gradient(180deg, rgba(16, 30, 30, 0.85), rgba(10, 18, 24, 0.85));
    border-color: rgba(94, 255, 164, 0.45);
    color: #fff;
    outline: none;
  }
  .bgsc-livechat:focus-visible {
    outline: 2px solid #5EFFC0;
    outline-offset: 2px;
  }
  .bgsc-livechat:active { transform: translateY(1px); }
  .bgsc-live-l {
    flex: 1 1 auto;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .bgsc-live-cue {
    flex: 0 0 auto;
    color: #5EFFC0;
    letter-spacing: 0.12em;
  }
  /* Soft pulsing live dot — gentle, not flashing */
  .bgsc-live-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #34F5A0;
    box-shadow: 0 0 0 0 rgba(52, 245, 160, 0.5);
    animation: bgsc-live-pulse 2.6s ease-in-out infinite;
  }
  @keyframes bgsc-live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 245, 160, 0.45); opacity: 1; }
    50%      { box-shadow: 0 0 0 6px rgba(52, 245, 160, 0); opacity: 0.6; }
  }
  @media (max-width: 359px) {
    .bgsc-live-cue { display: none; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .bgsc-live-dot { animation: none !important; }
}

/* ---------- Page-level opt-outs ----------
   Form pages and other dedicated-task pages can suppress the bar via this class. */
body.bgsc-suppress .bgsc { display: none !important; }
body.bgsc-suppress { padding-bottom: 0 !important; }
