/* ═══════════════════════════════════════════════════════════════
   Mobile Conversion Optimization — Task #946323
   Sticky CTA bar, thumb-zone layout, card tap targets
   Target: 390px (iPhone 14) and 360px (small Android)
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Sticky Mobile CTA Bar ───────────────────────────────── */
#sr-mobile-cta-bar {
  display: none; /* hidden on desktop */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 101; /* above content, below modals (10000) */
  height: 60px;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  align-items: center;
  padding: 0 1rem;
  padding-bottom: env(safe-area-inset-bottom);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#sr-mobile-cta-bar .sr-mcta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  background: #16a34a;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  height: 44px;
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

#sr-mobile-cta-bar .sr-mcta-btn:active {
  background: #15803d;
}

#sr-mobile-cta-bar .sr-mcta-dismiss {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 0.5rem;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50%;
}

@media (max-width: 768px) {
  #sr-mobile-cta-bar {
    display: flex;
  }
  /* Push page content up so nothing is hidden under the bar */
  body.sr-mobile-cta-visible {
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
  }
  /* Stack sticky bar above Pro nudge bar if both are visible */
  body.pnb-visible #sr-mobile-cta-bar {
    bottom: 68px;
  }
}

/* ── 2. Settlement Card Mobile Enhancements ─────────────────── */

/* Title: 18px minimum, bold */
@media (max-width: 480px) {
  .sr2-title {
    font-size: 1.125rem !important; /* 18px */
    font-weight: 700 !important;
    line-height: 1.35 !important;
    margin-bottom: 0.6rem !important;
  }

  /* Payout: large, prominent */
  .sr2-payout {
    font-size: 1.2rem !important;
    font-weight: 800 !important;
    margin-bottom: 0.5rem !important;
  }
  .sr2-payout-label {
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* Deadline badge: prominent, urgent-colored */
  .sr2-deadline {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    padding: 0.3rem 0 !important;
  }
  .sr2-urgent-badge {
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca !important;
    border-radius: 6px !important;
    padding: 0.25rem 0.65rem !important;
    display: inline-block !important;
  }
  .sr2-urgent-badge.warning {
    background: #fffbeb !important;
    color: #b45309 !important;
    border-color: #fde68a !important;
  }

  /* Card: no side-by-side on 480px, full width */
  .dir-grid {
    grid-template-columns: 1fr !important;
  }
  a.dir-card {
    padding: 1rem 1rem 3rem !important; /* extra bottom for file claim btn */
  }
}

/* "File Claim" CTA button inside card — mobile only */
.sr2-file-claim-btn {
  display: none; /* hidden on desktop */
}

@media (max-width: 768px) {
  .sr2-file-claim-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    background: #16a34a;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 8px;
    margin-top: 0.75rem;
    text-align: center;
    letter-spacing: -0.01em;
    box-sizing: border-box;
    /* Span inside <a>, so no pointer-events needed */
    pointer-events: none; /* card <a> handles the tap */
  }
  a.dir-card:active .sr2-file-claim-btn {
    background: #15803d;
  }
  a.dir-card {
    /* give room for the new button */
    padding-bottom: 1rem !important;
  }
}

/* ── 3. Homepage Hero Mobile Sizing ─────────────────────────── */
@media (max-width: 480px) {
  /* Heading: 28–32px at 390px */
  .rs-hero-headline,
  .pe-hero-headline {
    font-size: clamp(1.75rem, 7.5vw, 2rem) !important; /* ~29px at 390px */
    letter-spacing: -0.03em !important;
    line-height: 1.1 !important;
    margin-bottom: 0.75rem !important;
  }

  /* Subheading: 16px, 2 lines max */
  .rs-hero-subtitle,
  .rs-hero-subtitle-enhanced,
  .pe-hero-sub {
    font-size: 1rem !important; /* 16px */
    line-height: 1.5 !important;
    margin-bottom: 1.5rem !important;
    max-width: 100% !important;
  }

  /* Hero CTAs: stack vertically, full width */
  .rs-hero-ctas,
  .rs-hero-ctas-redesigned {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  /* Primary CTA: full width, 52px minimum */
  .sr-hero-cta-primary,
  .rs-btn-primary-dominant,
  .rs-btn-primary {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 52px !important;
    text-align: center !important;
    font-size: 1.05rem !important;
    box-sizing: border-box !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    white-space: nowrap !important;
  }

  /* No horizontal scroll on hero */
  .rs-hero,
  .rs-hero-inner {
    overflow-x: hidden !important;
  }

  /* Hero padding: tighter on small screens */
  .rs-hero.rs-hero-redesigned,
  .pe-hero-v2.rs-hero {
    padding: 2rem 1rem 1.5rem !important;
  }
}

/* ── 4. Thumb-Zone Optimization ─────────────────────────────── */
@media (max-width: 768px) {

  /* Form inputs: 48px height, 16px font (prevents iOS zoom) */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="search"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    min-height: 48px !important;
    font-size: 16px !important; /* prevents iOS auto-zoom */
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  /* Exception: tiny UI inputs (search chips, filters) */
  .dir-chip,
  .dir-sort-btn {
    /* Keep existing styles — these aren't text-input fields */
  }

  /* Nav hamburger: 44x44px */
  .nav-hamburger {
    min-width: 44px !important;
    min-height: 44px !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    position: relative !important;
    right: 0 !important;
    border-radius: 8px !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  /* Tap targets: minimum 44px for all interactive elements */
  .dir-cat-pill {
    min-height: 44px !important;
    padding: 0 1rem !important;
  }

  /* Settlement card: entire card is tappable (already is), ensure minimum */
  a.dir-card {
    -webkit-tap-highlight-color: transparent;
  }

  /* CTA buttons globally: minimum 44px */
  .dir-cta-primary,
  .dir-cta-secondary {
    min-height: 44px !important;
  }

  /* Pagination: 44x44 minimum */
  .dir-page-btn {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  /* Details toggle: ensure 44px tap area */
  .sr2-details-toggle {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    padding: 0.5rem 0 !important;
  }

  /* Tap targets spacing: minimum 8px gap between interactive elements */
  .dir-hero-actions {
    gap: 0.75rem !important;
  }
  .dir-hero-actions a {
    min-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
}

/* ── 5. Mobile Page Speed ────────────────────────────────────── */

/* Below-fold images: lazy loaded via JS (see inline script below)
   CSS: prevent layout shift for lazy-loaded images */
img[loading="lazy"] {
  /* Aspect-ratio preservation prevents CLS */
  height: auto;
}

/* Prevent horizontal overflow (no horizontal scroll anywhere) */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }
  img {
    max-width: 100%;
    height: auto;
  }
}

/* ── 6. Back-to-top button: bottom-right, 44x44px ───────────── */
#sr-back-to-top {
  display: none;
  position: fixed;
  bottom: 80px; /* above sticky CTA bar */
  right: 1rem;
  z-index: 100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(22,163,74,0.3);
  font-size: 1.1rem;
  transition: background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
#sr-back-to-top:active {
  background: #15803d;
  transform: scale(0.95);
}
@media (max-width: 768px) {
  #sr-back-to-top.visible {
    display: flex;
  }
  /* When Pro nudge bar is visible, move back-to-top higher */
  body.pnb-visible #sr-back-to-top {
    bottom: 148px;
  }
}

/* ── 7. Settlement directory: full-width cards at 390px ─────── */
@media (max-width: 480px) {
  /* Ensure cards use full available width with proper padding */
  .dir-grid-section {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  .dir-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }
  .dir-card-wrap {
    width: 100% !important;
    min-width: 0 !important;
  }
  a.dir-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 12px !important;
  }
}

/* ── Z-index reference ──────────────────────────────────────────
   sticky-filing-bar: 1002 (from existing code)
   srProNudgeBar:     100
   sr-mobile-cta-bar: 101 (above page, below filing bar)
   #mainNav:          100 / 1000
   Modals:            10000+
   ────────────────────────────────────────────────────────────── */

/* When sticky filing bar is visible, hide generic CTA bar (avoids overlap) */
body.sticky-bar-visible #sr-mobile-cta-bar {
  display: none !important;
}
