/* ===============================================
 mobile-fixes.css - SPF Mobile Responsive Fixes v6
 Handles Group A (.nav-links, .nav-inner, .mobile-menu)
 and Group B (#navLinks, #navToggle, #mobileNav) pages
 Fixes ALL floating button stacking + overflow + font sizes
 =============================================== */

/* ---- GLOBAL OVERFLOW FIX: Prevent horizontal scroll on ALL pages ---- */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

/* ---- ALWAYS HIDDEN: Mobile menus hidden by default on ALL screen sizes ---- */
.mobile-menu {
  display: none !important;
  position: fixed !important;
  top: 64px !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 99990 !important;
  background: rgba(10,10,10,0.98) !important;
  border-bottom: 2px solid rgba(255,107,53,0.3) !important;
  padding: 8px 0 !important;
  max-height: 80vh !important;
  overflow-y: auto !important;
  flex-direction: column !important;
}

.mobile-menu[style*="display: block"],
.mobile-menu[style*="display:block"] {
  display: block !important;
}

#mobileNav {
  z-index: 99990 !important;
}

/* ---- FLOATING BUTTON STACKING: Fix ALL overlaps on ALL screen sizes ---- */

#spfChatBtn {
  bottom: 24px !important;
  right: 24px !important;
}

.fab-wrap {
  bottom: 88px !important;
  right: 24px !important;
}

.float-wa {
  bottom: 88px !important;
  right: 24px !important;
}

.float-donate {
  bottom: 152px !important;
  right: 24px !important;
}

#chatWidget {
  bottom: 152px !important;
  right: 24px !important;
}

/* ---- DESKTOP nav ---- */
@media (min-width: 901px) {
  .nav-links, #navLinks { display: flex !important; }
  .nav-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }
  .nav-toggle, #navToggle { display: none !important; }
  #spfLangSwitcher {
    position: fixed !important;
    top: 75px !important;
    right: 16px !important;
    bottom: auto !important;
    z-index: 9000 !important;
  }
}

/* ---- MOBILE nav and layout ---- */
@media (max-width: 900px) {
  .nav-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
    height: 64px !important;
  }
  .nav-links, #navLinks { display: none !important; }
  .nav-links.open, #navLinks.open {
    display: flex !important;
    min-height: fit-content !important;
    height: auto !important;
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 64px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    background: rgba(10,10,10,0.98) !important;
    z-index: 99990 !important;
    padding: 8px 0 !important;
    border-bottom: 2px solid rgba(255,107,53,0.3) !important;
    list-style: none !important;
    margin: 0 !important;
  }
  .nav-links.open li, #navLinks.open li {
    display: block !important;
    list-style: none !important;
  }
  .nav-links.open a, #navLinks.open li a {
    padding: 12px 20px !important;
    color: #9CA3AF !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    display: block !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
  }
  .nav-links.open a:hover, #navLinks.open li a:hover {
    color: #FF6B35 !important;
    padding-left: 28px !important;
  }
  .nav-toggle, #navToggle {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
    cursor: pointer !important;
    padding: 8px !important;
    background: none !important;
    border: none !important;
    z-index: 99999 !important;
  }
  .nav-toggle span, #navToggle span {
    display: block !important;
    width: 22px !important;
    height: 2px !important;
    background: #fff !important;
    border-radius: 2px !important;
    transition: 0.3s !important;
  }
  .mobile-menu a, #mobileNav a {
    padding: 12px 20px !important;
    color: #9CA3AF !important;
    text-decoration: none !important;
    font-size: 0.9rem !important;
    display: block !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
  }
  .mobile-menu a:hover, #mobileNav a:hover {
    color: #FF6B35 !important;
    padding-left: 28px !important;
  }
  #spfLangSwitcher {
    position: fixed !important;
    bottom: 290px !important;
    right: 12px !important;
    top: auto !important;
    z-index: 9000 !important;
  }
  #spfLangSwitcher .lang-dropdown {
    bottom: 100% !important;
    top: auto !important;
  }
  [style*="grid-template-columns:1fr 1fr 1fr"],[style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns:1fr 1fr"],[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .nav-donate { font-size: 12px !important; padding: 6px 12px !important; }
  footer { padding-bottom: 240px !important; }

  /* ---- FONT SIZE FIXES: Prevent hero headings from overflowing ---- */
  h1 {
    font-size: clamp(1.4rem, 5.5vw, 2.2rem) !important;
    line-height: 1.3 !important;
    word-break: break-word !important;
  }
  h2 {
    font-size: clamp(1.2rem, 4.5vw, 1.8rem) !important;
    line-height: 1.3 !important;
    word-break: break-word !important;
  }
  .hero h1 {
    font-size: clamp(1rem, 5vw, 2rem) !important;
    word-break: break-word !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
  }

  /* ---- HERO CONTAINER OVERFLOW FIX ---- */
  .hero, .page-hero {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  .hero-content, .page-hero-content {
    overflow: hidden !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ---- CONTAINER FIX ---- */
  .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* ---- SECTION OVERFLOW FIX ---- */
  section {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }

  /* ---- TRUST BAR FIX: index.html trust strip ---- */
  .trust-strip, [class*="trust-bar"], [id*="trustBar"] {
    flex-wrap: wrap !important;
    gap: 8px !important;
    overflow: hidden !important;
  }

  /* ---- CONTACT PAGE GRID FIX ---- */
  .contact-grid {
    grid-template-columns: 1fr !important;
  }

  /* ---- DONATE PAGE GRID FIX ---- */
  .donate-grid, .payment-grid {
    grid-template-columns: 1fr !important;
  }

  /* ---- ABOUT PAGE GRID FIX ---- */
  .about-grid, .team-grid {
    grid-template-columns: 1fr !important;
  }

  /* ---- CARD MIN-WIDTH FIX ---- */
  .card, [class*="-card"] {
    min-width: 0 !important;
    word-break: break-word !important;
  }

  /* ---- TICKER FIX ---- */
  .ticker-wrapper {
    overflow: hidden !important;
    width: 100% !important;
  }

  /* ---- IMAGE FIX ---- */
  img {
    max-width: 100% !important;
    height: auto !important;
  }


  /* ---- HERO STATS GRID: 2 columns on mobile ---- */
  .hero-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }

  /* ---- TRUST STRIP OVERFLOW FIX ---- */
  .trust-strip {
    white-space: normal !important;
    overflow: hidden !important;
  }
  .trust-inner {
    flex-wrap: wrap !important;
    gap: 8px 16px !important;
    padding-right: 70px !important;
  }
  .trust-item {
    font-size: 11px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* ---- TABLE FIX ---- */
  table {
    max-width: 100% !important;
    overflow-x: auto !important;
    display: block !important;
  }
}

/* ---- SMALL PHONE (max 400px) ---- */
@media (max-width: 400px) {
  h1 {
    font-size: clamp(1.2rem, 7vw, 1.5rem) !important;
  }
  h2 {
    font-size: clamp(1.1rem, 6vw, 1.3rem) !important;
  }
  .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .nav-logo img, .logo img {
    height: 32px !important;
  }

  .hero h1, #heroTitle {
    font-size: clamp(1rem, 6.5vw, 1.4rem) !important;
  }
}