/**
 * Proxnum — mobile & desktop UX (scroll, touch, layout)
 */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.25rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.proxnum-ui {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fixed nav must stay above scrolling page heroes and content */
.proxnum-ui #header.header,
.proxnum-ui header.primary-header {
  z-index: 1080 !important;
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
}

.proxnum-ui .main {
  position: relative;
  z-index: 0;
}

.proxnum-ui #footer.footer {
  position: relative;
  z-index: 1;
}

@media (max-width: 991.98px) {
  .proxnum-ui #footer.footer .container,
  .proxnum-ui #footer.footer .container-fluid,
  .proxnum-ui #footer.footer .pn-seo-footer-strip > .container {
    padding-left: max(2.25rem, calc(env(safe-area-inset-left, 0px) + 1.75rem)) !important;
    padding-right: 1.5rem !important;
  }

  .proxnum-ui #footer.footer .footer-top > .row > .footer-about {
    padding-left: 0.75rem !important;
  }
}

.proxnum-ui .pn-page-hero {
  position: relative;
  z-index: 0;
}

.proxnum-ui .main {
  min-height: 60vh;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

/* Pages with bottom sticky bars need extra padding */
.proxnum-ui .virtual-num-shell,
.proxnum-ui .pn-seo-landing {
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
  .proxnum-ui .virtual-num-shell,
  .proxnum-ui .pn-seo-landing {
    padding-bottom: 1.5rem;
  }
}

/* Smooth momentum scrolling in tables / panels (desktop / wide screens) */
.pn-scroll-region {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(14, 165, 233, 0.45) transparent;
}

/* Mobile: one page scroll — avoid nested scroll traps at end of listings */
@media (max-width: 991.98px) {
  .proxnum-ui .pn-scroll-region {
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto;
    -webkit-overflow-scrolling: auto;
  }
}

.pn-scroll-region::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.pn-scroll-region::-webkit-scrollbar-thumb {
  background: rgba(14, 165, 233, 0.35);
  border-radius: 999px;
}

/* Touch-friendly controls on phones */
@media (max-width: 991.98px) {
  .proxnum-ui .btn:not(.btn-sm):not(.btn-link),
  .proxnum-ui .pn-btn,
  .proxnum-ui .form-control,
  .proxnum-ui .form-select,
  .proxnum-ui .input-group-text {
    min-height: 2.75rem;
  }

  .proxnum-ui .btn-sm {
    min-height: 2.35rem;
    padding: 0.4rem 0.65rem;
  }

  .proxnum-ui .accordion-button {
    padding: 1rem 1.1rem;
    font-size: 1rem;
  }

  .proxnum-ui .list-group-item {
    padding: 0.9rem 1rem;
  }
}

/* —— Back to top —— */
.pn-scroll-top {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 1035;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 50%;
  background: var(--pn-gradient, linear-gradient(135deg, #14b8a6, #0ea5e9));
  color: #fff;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.4);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.pn-scroll-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.pn-scroll-top:hover {
  filter: brightness(1.06);
}

.virtual-num-shell ~ .pn-scroll-top,
.pn-seo-landing ~ .pn-scroll-top {
  bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
  .virtual-num-shell ~ .pn-scroll-top,
  .pn-seo-landing ~ .pn-scroll-top {
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }
}

/* —— Virtual numbers: mobile —— */
@media (max-width: 991.98px) {
  .virtual-num-shell .pn-page-hero {
    padding: 1.25rem 0;
  }

  .virtual-num-shell .pn-page-hero h1 {
    font-size: 1.2rem;
  }

  .virtual-num-shell .pn-page-hero p {
    font-size: 0.82rem;
  }

  /* Collapsible filters (toggled via JS) */
  .virtual-num-shell #filterControls.pn-vn-filters:not(.pn-vn-filters--open) {
    display: none !important;
    margin-bottom: 0.75rem;
  }

  .virtual-num-shell #filterControls.pn-vn-filters.pn-vn-filters--open {
    display: block !important;
    animation: pn-vn-slide 0.22s ease;
  }

  @keyframes pn-vn-slide {
    from {
      opacity: 0;
      transform: translateY(-6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .virtual-num-shell #numbersContainer .btn-buy-number,
  .virtual-num-shell #numbersContainer .btn {
    min-width: 4.5rem;
    font-weight: 600;
  }

}

/* Sticky mobile action bar (virtual-num) */
.pn-vn-mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
}

body.theme-dark .pn-vn-mobile-bar {
  background: rgba(15, 23, 42, 0.96);
  border-top-color: rgba(148, 163, 184, 0.15);
}

.pn-vn-mobile-bar__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.65rem;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  color: var(--pn-text, #0f172a);
  cursor: pointer;
}

body.theme-dark .pn-vn-mobile-bar__btn {
  background: #1e293b;
  color: #f1f5f9;
  border-color: rgba(148, 163, 184, 0.2);
}

.pn-vn-mobile-bar__btn--primary {
  background: var(--pn-gradient, linear-gradient(135deg, #14b8a6, #0ea5e9));
  border: none;
  color: #fff !important;
  text-decoration: none !important;
}

.pn-vn-mobile-bar__btn[aria-expanded='true'] {
  border-color: #0ea5e9;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25);
}

/* Virtual-num: keep footer SEO strip readable above page content; clear sticky bar */
@media (max-width: 991.98px) {
  .virtual-num-shell ~ #footer {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }

  .virtual-num-shell ~ #footer .pn-seo-footer-strip {
    background: #0f172a !important;
    color: #e5e7eb !important;
  }

  .virtual-num-shell ~ #footer .pn-seo-footer-strip .small {
    color: #cbd5e1 !important;
  }
}

/* Activations: horizontal scroll stats on small screens */
@media (max-width: 767.98px) {
  .act-page .act-analytics-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.65rem;
    padding-bottom: 0.35rem;
    margin-bottom: 1rem;
    scrollbar-width: none;
  }

  .act-page .act-analytics-row::-webkit-scrollbar {
    display: none;
  }

  .act-page .act-analytics-row > * {
    flex: 0 0 auto;
    min-width: 8.5rem;
  }

  .act-page .act-hero-inner {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 1rem;
  }

  .act-page .act-btn-new {
    width: 100%;
    justify-content: center;
  }
}

/* Rentals: pill nav scroll */
@media (max-width: 991.98px) {
  .rentals-shell .rentals-pill-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
  }

  .rentals-shell .rentals-pill-nav::-webkit-scrollbar {
    display: none;
  }

  .rentals-shell .rentals-pill-nav .btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* Fund page: stack payment tiles */
@media (max-width: 575.98px) {
  .pn-fund-shell .pn-payment-tile {
    flex-direction: row;
  }

  .pn-fund-hero__grid {
    flex-direction: column;
    align-items: stretch;
  }

  .pn-fund-balance-card {
    width: 100%;
  }

  .pn-fund-methods {
    grid-template-columns: 1fr;
  }

  .pn-mpesa-hero__grid {
    flex-direction: column;
    align-items: stretch;
  }

  .pn-mpesa-rate-card {
    width: 100%;
  }
}

/* SEO sticky CTA spacing */
.pn-seo-sticky-cta + .pn-scroll-top {
  bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

/* Homepage: comfortable section spacing on small screens */
@media (max-width: 767.98px) {
  .pn-home .pn-section-title {
    font-size: 1.35rem;
  }

  .pn-home .pn-hero {
    padding: 2.5rem 0 2.75rem;
    margin-bottom: 1.5rem;
  }

  .pn-home .pn-trust-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}
