/* ============================================
   MatchUp — Global Mobile Polish
   Applies on top of each page's existing CSS.
   Loaded on every HTML page after its own styles.
   ============================================ */

/* --- 1. Prevent iOS Safari auto-zoom on input focus --- */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* --- 2. Tap-target minimum size (Apple/Google guideline: 44x44px) --- */
@media (max-width: 768px) {
  button,
  .btn,
  .nav-login,
  .cat-btn,
  .fpill,
  .fpill-opt,
  .map-action,
  .share-btn,
  .view-toggle button,
  a.nav-profile,
  a.reset-btn {
    min-height: 44px;
  }
}

/* --- 3. Hamburger nav for mobile --- */
@media (max-width: 768px) {
  .mu-hamburger {
    display: flex !important;
    width: 42px; height: 42px;
    border-radius: 10px;
    background: #F8F9FA;
    border: none;
    align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    margin-left: auto;
  }
  .nav-center { display: none !important; }
  .nav-right  { display: none !important; }

  .mu-mobile-menu {
    display: none;
    position: fixed; top: 68px; left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
    z-index: 99;
    padding: 16px 20px 20px;
    flex-direction: column;
    gap: 4px;
  }
  .mu-mobile-menu.open { display: flex; }
  .mu-mobile-menu a,
  .mu-mobile-menu button {
    text-align: left;
    padding: 14px 16px;
    border: none;
    background: #F8F9FA;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: .95rem;
    color: #1A1A2E;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
  }
  .mu-mobile-menu a.active,
  .mu-mobile-menu a:hover,
  .mu-mobile-menu button:hover {
    background: #FFF3EF;
    color: #FF5722;
  }
  .mu-mobile-menu .divider {
    height: 1px; background: #E5E7EB; margin: 8px 0;
  }
}
@media (min-width: 769px) {
  .mu-hamburger,
  .mu-mobile-menu { display: none !important; }
}

/* --- 4. Filter pills: horizontal scroll instead of wrap on mobile --- */
@media (max-width: 600px) {
  .filter-pills {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding: 4px 2px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-pills::-webkit-scrollbar { display: none; }
  .filter-pills > * { flex-shrink: 0; }

  .filters-row h2 { font-size: 1.15rem !important; }

  /* Popover stays on screen */
  .fpill-pop {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    bottom: 12px !important;
    max-height: 60vh;
    overflow-y: auto;
    min-width: 0 !important;
    border-radius: 18px !important;
    box-shadow: 0 -4px 30px rgba(0,0,0,.15) !important;
  }
  .dist-wrap { min-width: 0 !important; }
}

/* --- 5. Category strip: horizontal scroll --- */
@media (max-width: 600px) {
  .cat-strip {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    padding-bottom: 8px;
  }
  .cat-strip::-webkit-scrollbar { display: none; }
}

/* --- 6. Map height on mobile --- */
@media (max-width: 600px) {
  #eventsMap { height: 440px !important; }
  #map       { height: 280px !important; }
}

/* --- 7. Modals scrollable on short screens --- */
@media (max-width: 600px) {
  .modal,
  #editModal > div,
  .modal-overlay .modal {
    max-height: calc(100vh - 20px) !important;
    overflow-y: auto;
    border-radius: 18px !important;
  }
  .modal-overlay { padding: 10px !important; align-items: flex-start !important; }
}

/* --- 8. Event hero smaller on mobile --- */
@media (max-width: 600px) {
  .event-hero { height: 260px !important; }
  .hero-inner { padding: 20px !important; }
  .ev-hero-title { font-size: 1.5rem !important; }
  .ev-hero-meta { font-size: .82rem !important; gap: 10px !important; }
}

/* --- 9. Page padding squeeze --- */
@media (max-width: 600px) {
  .page-wrap,
  .main-wrap,
  .dash-grid,
  .profile-wrap {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  nav { padding: 0 14px !important; }
}

/* --- 10. Organizer controls: full-width on mobile --- */
@media (max-width: 600px) {
  #organizerControls button { font-size: .85rem !important; }
  .join-card { padding: 20px !important; }
}

/* --- 11. Dashboard: bigger hero, smaller stats gap --- */
@media (max-width: 500px) {
  .hero-strip { padding: 24px 20px !important; }
  .stat-card { padding: 14px !important; }
  .stat-num { font-size: 1.5rem !important; }
}

/* --- 12. Disable Leaflet scroll-hijack on touch screens --- */
@media (hover: none) {
  .leaflet-container { touch-action: pan-x pan-y; }
}

/* --- 13. Bottom-safe-area for iOS (avoids home-bar overlap) --- */
body {
  padding-bottom: env(safe-area-inset-bottom);
}

/* --- 14. Prevent horizontal scroll on any page --- */
html, body { overflow-x: hidden; max-width: 100vw; }
