/**
 * K12 Mobile Search Layout - Airbnb-Style Mobile Optimization
 * ============================================================
 *
 * This file implements the mobile-first layout for K12/S page:
 * - Map visible at top 40% of screen
 * - Bottom sheet for results at bottom 60%
 * - Bottom navigation bar (80px)
 * - Touch-optimized interactions
 *
 * Breakpoint: <768px activates mobile layout
 * Reference: Airbnb mobile search experience
 */

/* ==========================================================================
   CSS Variables - Mobile Layout Configuration
   ========================================================================== */

:root {
  /* Bottom Sheet Dimensions - Airbnb style */
  /* Higher initial resting position (closer to Airbnb) */
  --bs-collapsed-top: clamp(314px, 51.8vh, 594px); /* iPhone refinement: sheet starts another 8px lower */
  --bs-expanded-top: 0px; /* Expanded aligns to viewport; header overlaps so it feels "under" */
  /* Fully-closed tab must remain grab-able (avoid disappearing under bottom nav). */
  /* Keep the minimized detent visually consistent even if nav height changes. */
  /* Minimized (map mode) should still show the handle + "Over 1,000 schools" row. */
  --bs-minimized-top: calc(100vh - var(--bottom-nav-height) - var(--bottom-nav-safe-area) - (var(--bs-header-height) + 64px));

  /* Handle */
  --bs-handle-width: 30px;
  --bs-handle-height: 3px;
  --bs-handle-color: #dddddd;

  /* Appearance */
  --bs-radius: 32px;                  /* Airbnb-like rounding for sheet */
  /* Reduce the "top chrome" (handle area) to match Airbnb. */
  --bs-header-height: 34px;
  --bs-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  --bs-transition-timing: cubic-bezier(0.32, 0.72, 0, 1);
  --bs-transition-duration: 0.4s;

  /* Map - stays full height behind the sheet (Airbnb behavior) */
  --mobile-map-height: 100dvh;

  /* Bottom Navigation */
  /* Airbnb-like: slightly shorter than 80px, while keeping tap targets. */
  --bottom-nav-height: 72px;
  --bottom-nav-safe-area: env(safe-area-inset-bottom, 0px);

  /* Touch Targets */
  --touch-target-min: 44px;
  --touch-target-comfortable: 48px;

  /* Z-index Layers */
  --z-map: 1;
  --z-bottom-sheet: 980;
  --z-bottom-sheet-backdrop: 970;
  --z-bottom-nav: 1030;
  --z-filter-modal: 1050;
}


/* ==========================================================================
   Mobile Layout Container
   Only activates at <768px viewport width
   ========================================================================== */

@media (max-width: 767px) {
  /* Page-scoped overrides so other global CSS vars can't accidentally win. */
  body.k12-search-page {
    /* Shorter Airbnb-like nav without breaking iPhone safe-area padding. */
    --bottom-nav-height: 58px;
    /* Tighten the sheet "chrome" (handle area) so the "Prices include all fees" row sits higher. */
    --bs-header-height: 16px;
    /* Keep the fully-closed/map detent visually stable vs the default. */
    /* Minimized tab sits at the bottom safe-area; bottom nav is hidden when sheet is near-bottom. */
    --bs-minimized-top: calc(100vh - var(--bottom-nav-safe-area) - (var(--bs-header-height) + 42px));
  }

  /* Hide desktop-only elements */
  .search-results-header,
  .search-info-bar,
  .search-pagination {
    display: none !important;
  }

  /* Mobile Search Layout Wrapper */
  html,
  body {
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  .mobile-search-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
  }

  /* Override the default search layout */
  .search-split-layout {
    display: contents; /* Let children participate in mobile layout */
  }

  .search-split-content {
    display: contents;
  }

  /* Mobile Map Region - Top 40% */
  .search-map-column {
    display: block !important; /* Override desktop hide */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: var(--mobile-map-height) !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 0 !important;
    z-index: var(--z-map);
  }

  /* Mobile /k12/s: show the map behind the sheet by default.
     The floating "Map" toggle is gated separately (see bottom-sheet.js). */

  .search-map-container {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
  }

  #schoolsMap {
    height: 100% !important;
    width: 100% !important;
  }

  .search-cards-column {
    display: none !important;
  }

  /* On mobile search, match Airbnb: show Where / Dates / Kids in the condensed pill. */
  body.k12-search-page .condensed-dates,
  body.k12-search-page .condensed-kids {
    display: inline;
  }

  body.k12-search-page .condensed-location {
    /* Let the location line use the full pill width (Airbnb-style).
       JS will swap to "Schools nearby" if the full label truly can't fit. */
    max-width: 100% !important;
    width: 100% !important;
    align-self: stretch;
    padding: 0 !important;
  }

  /* When the search modal is open, hide the floating Map button (Airbnb behavior). */
  body.k12-hero-modal-open .k12-mobile-map-toggle {
    display: none !important;
  }

  /* Airbnb-like: modal is a dedicated flow; hide bottom nav so the modal footer can sit at the bottom. */
  body.k12-hero-modal-open .k12-bottom-nav {
    display: none !important;
  }

  /* Results container adjustments */
  .search-results-container {
    padding: 0 !important;
    min-height: auto !important;
    margin-bottom: 0 !important;
  }

  /* Cards grid - vertical layout for mobile */
  .search-cards-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 24px !important;
    padding: 8px 16px 48px !important; /* Reduced top padding, extra bottom */
    max-width: 100% !important;
    overflow-x: hidden !important;
    touch-action: pan-y;
  }

  /* Adjust card styling for mobile - full width single column */
  .loveform-listing-card {
    width: 100% !important;
    max-width: 100% !important;
    flex-shrink: 0;
    margin: 0 !important;
    box-sizing: border-box;
    touch-action: pan-y;
  }

  /* Mobile card image aspect ratio - Airbnb uses shorter cards */
  .loveform-listing-card__image {
    aspect-ratio: 3 / 4;
    border-radius: 24px;
    overflow: hidden;
  }

  .loveform-listing-card__content {
    padding-top: 16px;
    gap: 4px;
  }

}


/* ==========================================================================
   Map Recenter Button (Mobile)
   ========================================================================== */

@media (max-width: 767px) {

  .map-recenter-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    background: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .map-recenter-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  }

  .map-recenter-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #222222;
    stroke-width: 2;
  }

  /* Search This Area button (mobile) */
  .map-search-area-btn {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: white;
    border: none;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 600;
    color: #222222;
    cursor: pointer;
    white-space: nowrap;
    z-index: 10;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .map-search-area-btn:active {
    transform: translateX(-50%) scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  }

}


/* ==========================================================================
   Bottom Navigation Bar
   ========================================================================== */

@media (max-width: 767px) {

  .k12-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    /* iOS safe-area: include inset inside the bar height (no double height). */
    box-sizing: border-box;
    height: calc(var(--bottom-nav-height) + var(--bottom-nav-safe-area));
    padding-bottom: var(--bottom-nav-safe-area);
    background: white;
    border-top: 1px solid #ebebeb;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-top: 0;
    z-index: var(--z-bottom-nav);
    transition: transform 0.25s ease, opacity 0.25s ease;
    will-change: transform, opacity;
  }

  .k12-bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: var(--touch-target-comfortable);
    min-height: var(--touch-target-comfortable);
    padding: 3px 12px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: #717171;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .k12-bottom-nav__item:active {
    color: #222222;
  }

  .k12-bottom-nav__item.is-active {
    color: #2AC8C8; /* Brand teal */
  }

  .k12-bottom-nav__icon {
    width: 24px;
    height: 24px;
    margin-bottom: 3px;
  }

  .k12-bottom-nav__icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    stroke: none;
  }

  .k12-bottom-nav__icon--stroke svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
  }

  /* B Logo image styling */
  .k12-bottom-nav__icon--image {
    margin-bottom: 0;
  }

  .k12-bottom-nav__logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }

  /* Hide hamburger menu on mobile - no menu needed */
  .hero-nav-menu-btn,
  .navbar-toggler,
  .mobile-menu-toggle {
    display: none !important;
  }

  /* Hide map navigation controls on mobile */
  .gm-bundled-control,
  .gmnoprint,
  .gm-style-mtc,
  .gm-fullscreen-control,
  .gm-svpc {
    display: none !important;
  }

  /* Keep only the map type selector if needed, but hide it too for cleaner look */
  .gm-style > div > div:last-child > div[style*="position: absolute"] {
    display: none !important;
  }

  .k12-bottom-nav__label {
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
  }

}


/* ==========================================================================
   Mobile Utility Classes
   ========================================================================== */

@media (max-width: 767px) {

  /* Hide on mobile */
  .mobile-hidden {
    display: none !important;
  }

  /* Show only on mobile */
  .mobile-only {
    display: block !important;
  }

  /* Touch-friendly button base */
  .touch-btn {
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* Prevent text selection on touch elements */
  .no-select {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

}

/* Default state for mobile-only elements on desktop - HIDE EVERYTHING */
@media (min-width: 768px) {

  .mobile-only,
  .k12-bottom-nav,
  .k12-bottom-sheet-container,
  .k12-mobile-map-toggle,
  .map-recenter-btn,
  .map-search-area-btn,
  .hero-mobile-back-btn,
  .k12-mobile-back-btn {
    display: none !important;
  }

  /* Ensure desktop header elements remain unchanged */
  .hero-nav-header > * {
    /* Don't apply mobile hiding rules on desktop */
  }

}


/* ==========================================================================
   AIRBNB-STYLE MOBILE HEADER - Back Arrow + Centered Search Pill + Filter Icon
   Exact match to Airbnb mobile search experience
   ========================================================================== */

@media (max-width: 767px) {

  /* ==========================================================================
     HIDE ELEMENTS - Logo, Menu, Desktop Nav
     ========================================================================== */

  /* Hide the main logo on mobile (Airbnb hides logo - brand recognition) */
  body.k12-search-page .hero-nav-logo,
  body.k12-search-page .k12-header-logo,
  body.k12-search-page .navbar-brand,
  body.k12-search-page .header-logo,
  body.k12-search-page .site-logo {
    display: none !important;
  }

  /* Hide desktop navigation elements */
  body.k12-search-page .k12-desktop-nav,
  body.k12-search-page .desktop-nav-links,
  body.k12-search-page .header-actions {
    display: none !important;
  }

  /* Hide the hamburger menu button on mobile - MUST use high specificity */
  body.k12-search-page .hero-nav-collapsed .hero-nav-menu-btn,
  body.k12-search-page .hero-nav-header .hero-nav-menu-btn,
  body.k12-search-page .hero-nav-menu-btn,
  body.k12-search-page #heroMenuBtn,
  body.k12-search-page #heroMenuBtnCollapsed,
  body.k12-search-page .k12-header-hamburger,
  body.k12-search-page .hamburger-btn,
  body.k12-search-page .mobile-menu-toggle {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  /* Hide the search icon inside condensed button */
  body.k12-search-page .condensed-search-icon {
    display: none !important;
  }

  /* Hide expanded hero nav on mobile - only show collapsed version */
  body.k12-search-page .hero-nav-expanded {
    display: none !important;
  }

  /* ==========================================================================
     COLLAPSED HEADER ROW - Airbnb Layout
     [Back] [-------- Search Pill --------] [Filter]
     ========================================================================== */

  body.k12-search-page .hero-nav-collapsed {
    --k12-header-row-height: 58px;
    display: block !important;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(6px);
    padding: 12px 24px !important;
    height: auto !important;
  }

  /* Push down body content to prevent overlap with fixed header (56px pill + 24px padding = 80px) */
  /* /k12/s uses a fixed collapsed header on mobile; /k12 (landing) should NOT be offset. */
  body.k12-search-page {
    padding-top: 82px !important;
  }

  body.k12-search-page .hero-nav-collapsed .hero-nav-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 0;
    min-height: 58px;
  }

  /* ONLY show back button + (search + filter) group - hide everything else */
  body.k12-search-page .hero-nav-collapsed .hero-nav-header > *:not(.hero-mobile-back-btn):not(.hero-nav-collapsed__search-group) {
    display: none !important;
  }

  /* Ensure the condensed search + filter group participates in the mobile header row */
  body.k12-search-page .hero-nav-collapsed__search-group {
    display: flex !important;
    flex: 1 1 auto;
    min-width: 0;
    gap: 12px;
    order: 2; /* After back button (order: 1) - Airbnb pattern: [←] [Search] [Filter] */
    align-items: center;
    justify-content: flex-start;
  }

  /* Make the search pill span the space between back + filter (Airbnb-style). */
  body.k12-search-page #condensedSearchBtn {
    flex: 1 1 calc(100vw - 152px) !important;
    min-width: 0 !important;
    width: calc(100vw - 152px) !important;
    max-width: calc(100vw - 152px) !important;
    height: 58px !important;
    padding: 10px 19px !important;
    justify-content: center !important;
    border: 1px solid #dddddd !important;
    border-radius: 40px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10) !important;
    background: #ffffff !important;
  }

  /* Mobile /k12/s pill uses a two-row grid:
     line 1 = location, line 2 = dates · kids (side-by-side like Airbnb). */
  body.k12-search-page #condensedSearchBtn .condensed-text-stack {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas:
      "location location"
      "dates kids";
    align-items: center;
    justify-content: center;
    text-align: center;
    row-gap: 1px;
    column-gap: 4px;
  }

  /* ==========================================================================
     BACK BUTTON - Airbnb style: minimal, no background circle
     ========================================================================== */

  /* Back button - Match Airbnb: 40x40px */
  body.k12-search-page .hero-mobile-back-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    max-height: 40px;
    background: transparent;
    border: none;
    border-radius: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    order: 1;
    padding: 0;
    appearance: none;
    line-height: 0;
  }

  body.k12-search-page .hero-mobile-back-btn:active {
    opacity: 0.7;
  }

	  body.k12-search-page .hero-mobile-back-btn svg {
	    width: 16px;
	    height: 16px;
	    stroke: #222222;
	    stroke-width: 2;
	    fill: none;
	  }

	  body.k12-search-page .hero-mobile-back-btn .hero-mobile-back-icon {
	    width: 24px;
	    height: 24px;
	    display: block;
	  }

  /* Landing page: collapsed pill header container */
  body.k12-landing-page .hero-nav-collapsed {
    background: #ffffff !important;
    padding: 12px 24px !important;
    height: auto !important;
    box-shadow: none !important;
    border-bottom: none !important;
  }

  /* Hide expanded hero on mobile landing too, use the collapsed pill as the main trigger */
  body.k12-landing-page .hero-nav-expanded {
    display: none !important;
  }

  /* Hide Back Button on Landing Page */
  body.k12-landing-page .hero-mobile-back-btn {
    display: none !important;
  }

  /* Header Container */
  body.k12-landing-page .hero-nav-collapsed .hero-nav-header {
    display: flex !important;
    justify-content: center !important;
    width: 100%;
    padding: 0;
    gap: 0 !important;
  }

  /* Search Group - Full Width */
  body.k12-landing-page .hero-nav-collapsed__search-group {
    width: auto;
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    order: 0 !important; /* Reset order */
  }

  /* Search Pill - Airbnb home geometry (375px viewport: 327x56 with 24px gutters) */
  body.k12-landing-page #condensedSearchBtn {
    width: calc(100vw - 48px) !important;
    max-width: calc(100vw - 48px) !important;
    min-width: 0 !important;
    height: 56px !important;
    background: #ffffff !important;
    border-radius: 40px !important;
    border: 1px solid #dddddd !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10) !important;
    padding: 10px 19px !important;
    display: flex;
    align-items: center;
    justify-content: center !important;
    gap: 8px !important;
  }

  body.k12-landing-page #condensedSearchBtn .condensed-school-icon {
    display: none !important;
  }

  /* Search Icon - Left side */
  body.k12-landing-page #condensedSearchBtn .condensed-search-icon {
    display: flex !important;
    order: -1;
    background: transparent;
    width: auto;
    height: auto;
    margin: 0;
  }

  body.k12-landing-page #condensedSearchBtn .condensed-search-icon svg {
    width: 24px;
    height: 24px;
    stroke: #222222;
    stroke-width: 2.5;
  }

  /* Text Stack - Should NOT grow, so it stays next to icon in center */
  body.k12-landing-page #condensedSearchBtn .condensed-text-stack {
    flex: 0 1 auto !important; /* Don't grow */
    width: auto !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    gap: 0 !important;
  }

  body.k12-landing-page #condensedSearchBtn .condensed-location {
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 18px !important;
    color: #222222 !important;
  }

  body.k12-landing-page #condensedSearchBtn .condensed-subtitle {
     display: none !important;
  }

  /* Ensure Filter button is hidden if it somehow exists */
  body.k12-landing-page .hero-filter-pill {
    display: none !important;
  }

  /* Line 1: location - allow ellipsis inside the pill */
  body.k12-search-page #condensedSearchBtn .condensed-location {
    grid-area: location;
    display: block;
    width: 100%;
    padding: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 18px !important;
  }

  body.k12-search-page #condensedSearchBtn .condensed-dates,
  body.k12-search-page #condensedSearchBtn .condensed-kids {
    display: inline;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #6a6a6a !important;
    line-height: 18px !important;
    padding: 0;
    white-space: nowrap;
  }

  body.k12-search-page #condensedSearchBtn .condensed-dates {
    grid-area: dates;
    justify-self: end;
  }

  body.k12-search-page #condensedSearchBtn .condensed-kids {
    grid-area: kids;
    justify-self: start;
  }

  body.k12-search-page #condensedSearchBtn .condensed-kids::before {
    content: '·';
    display: inline-block;
    margin-right: 4px;
    color: #dddddd;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
  }

  /* Hide the desktop dividers on mobile; the row separator is recreated via ::before above. */
  body.k12-search-page #condensedSearchBtn .condensed-divider,
  body.k12-search-page #condensedSearchBtn .condensed-dot,
  body.k12-search-page #condensedSearchBtn .condensed-subtitle,
  body.k12-search-page #condensedSearchBtn .condensed-meta-row {
    display: none !important;
  }

  /* ==========================================================================
     FILTER BUTTON - Right side (Airbnb-like)
     ========================================================================== */

  /* Filter button - Match Airbnb: 40x40px */
  body.k12-search-page #heroFilterPill {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    border: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    gap: 0 !important;
    cursor: pointer;
    order: 3;
    margin-left: 0 !important;
    appearance: none;
    line-height: 0;
  }

  /* Airbnb-like: only show a bold circle when filters are actually applied */
  body.k12-search-page #heroFilterPill.has-filters {
    border: 2px solid #222222 !important;
    border-radius: 999px !important;
    background: #ffffff !important;
  }

  body.k12-search-page #heroFilterPill:active {
    transform: scale(0.95);
  }

  /* Hide filter text */
  body.k12-search-page #heroFilterPill .filter-text {
    display: none !important;
  }

  /* Show only the icon */
  body.k12-search-page #heroFilterPill svg {
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
    fill: #222222;
    stroke: none;
  }

  /* Filter badge - top right corner - ONLY show when > 0 */
  body.k12-search-page #heroFilterPill .filter-count-badge {
    position: absolute !important;
    top: -4px !important;
    right: -4px !important;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #222222 !important;
    color: white !important;
    border-radius: 9px;
    font-size: 11px !important;
    font-weight: 700;
    display: none !important; /* Hidden by default */
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  /* Show badge ONLY when it has a non-zero value */
  body.k12-search-page #heroFilterPill .filter-count-badge.has-filters {
    display: flex !important;
  }


  /* ==========================================================================
     HIDE MAP CONTROLS - Zoom buttons, fullscreen, etc.
     ========================================================================== */

  /* Hide Google Maps default controls */
  .gm-control-active,
  .gm-svpc,
  .gm-fullscreen-control,
  .gmnoprint:not([data-marker-price]),
  .gm-bundled-control {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }

  /* Hide zoom controls specifically */
  .gm-control-active.gm-fullscreen-control,
  div[aria-label="Zoom in"],
  div[aria-label="Zoom out"],
  button[aria-label="Zoom in"],
  button[aria-label="Zoom out"],
  div[controlheight="81"] {
    display: none !important;
  }

  /* Hide custom map controls on mobile */
  .search-map-container .map-control-btn {
    display: none !important;
  }

  /* Prevent horizontal scroll drift on sheet + list */
  .k12-bottom-sheet,
  .k12-bottom-sheet-content,
  .k12-bottom-sheet-list,
  .search-cards-column,
  .search-cards-grid,
  .loveform-listing-card {
    overflow-x: hidden !important;
    touch-action: pan-y;
  }

  /* Hide custom mobile map buttons (Airbnb has none) */
  .map-recenter-btn,
  .map-search-area-btn {
    display: none !important;
  }


  /* ==========================================================================
     HIDE FOOTER / NEWSLETTER SECTION
     ========================================================================== */

	  /* Hide site footer on mobile search page */
	  body.k12-search-page #main-footer,
	  body.k12-search-page .site-footer,
	  body.k12-search-page .k12-footer,
	  body.k12-search-page .newsletter-section,
	  body.k12-search-page .subscribe-section,
	  body.k12-search-page [class*="newsletter"],
	  body.k12-search-page [class*="subscribe"] {
	    display: none !important;
	  }


  /* ==========================================================================
     MOBILE CAROUSEL - Show dots + reveal arrows on tap (Airbnb-like)
     ========================================================================== */

  .k12-smart-carousel {
    touch-action: pan-y;
  }

	  .k12-smart-carousel__track {
	    display: flex;
	    width: 100%;
	    height: 100%;
	    will-change: transform;
	    transition: transform 0.22s ease;
	    /* IMPORTANT: Do not clip on the moving track (breaks slide translation).
	       The viewport (.k12-smart-carousel / parent image wrapper) handles clipping. */
	    overflow: visible;
	  }

	  .k12-smart-carousel__track img {
	    flex: 0 0 100%;
	    width: 100%;
	    height: 100%;
	    object-fit: cover;
	    display: block;
	  }

  .k12-smart-carousel__btn {
    opacity: 0;
    pointer-events: none;
    width: 44px;
    height: 44px;
  }

  .k12-smart-carousel.is-active .k12-smart-carousel__btn,
  .k12-smart-carousel:focus-within .k12-smart-carousel__btn {
    opacity: 1;
    pointer-events: auto;
  }

  .k12-smart-carousel__dots {
    display: flex;
  }


  /* ==========================================================================
     BOTTOM NAVIGATION - 4 Items with B Logo
     ========================================================================== */

  .k12-bottom-nav {
    display: flex !important;
    justify-content: space-around;
  }

  .k12-bottom-nav__item {
    flex: 1;
    max-width: 80px;
  }

  /* B Logo item styling */
  .k12-bottom-nav__item--logo {
    color: #2AC8C8 !important; /* Always brand color */
  }

  .k12-bottom-nav__item--logo .k12-bottom-nav__icon {
    width: 28px;
    height: 28px;
  }

  .k12-bottom-nav__item--logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

}


/* ==========================================================================
   MAP TOGGLE BUTTON (Mobile) - Airbnb style
   ========================================================================== */

@media (max-width: 767px) {
  .k12-mobile-map-toggle {
    position: fixed;
    left: 50%;
    bottom: calc(var(--bottom-nav-height) + var(--bottom-nav-safe-area) + 16px);
    transform: translateX(-50%);
    display: none !important; /* Must beat `.mobile-only { display:block !important; }` */
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 0;
    border-radius: 999px;
    background: #222222;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
    z-index: calc(var(--z-bottom-nav) + 1);
    -webkit-tap-highlight-color: transparent;
  }

  .k12-mobile-map-toggle.is-visible {
    /* Guard against iOS restoring state / premature JS: we only allow showing
       the map toggle when JS explicitly marks it as allowed. */
    display: none;
  }

  body.k12-map-toggle-allowed .k12-mobile-map-toggle.is-visible {
    display: inline-flex !important;
  }

  .k12-mobile-map-toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
  }

  .k12-mobile-map-toggle__text {
    order: 1;
  }

  .k12-mobile-map-toggle svg {
    order: 2;
  }

  body.k12-map-mode {
    /* Map mode is a UI state only; do not mutate sheet snap metrics via CSS vars. */
  }

  body.k12-map-mode .k12-bottom-nav {
    display: none !important;
  }

  /* Airbnb-like: when fully in map mode, hide the map toggle button. */
  body.k12-map-mode .k12-mobile-map-toggle {
    display: none !important;
  }

  body.k12-sheet-near-bottom .k12-bottom-nav {
    opacity: 0;
    transform: translateY(120%);
    pointer-events: none;
  }

  body.k12-bottom-nav-hidden .k12-bottom-nav {
    opacity: 0;
    transform: translateY(120%);
    pointer-events: none;
  }

  body.k12-sheet-near-bottom .k12-mobile-map-toggle {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  }
}

/* ==========================================================================
   MOBILE MAP SELECTED LISTING CARD (Airbnb-style)
   - Shown when a price marker is tapped
   - Positioned above the minimized bottom-sheet "tab"
   ========================================================================== */

@media (max-width: 767px) {
  /* When a map marker is selected, Airbnb hides the bottom sheet and shows the marker card in its place. */
  body.k12-mobile-map-selected-open .k12-bottom-sheet {
    opacity: 0;
    pointer-events: none;
  }

  body.k12-mobile-map-selected-open .k12-bottom-sheet-backdrop.is-visible {
    pointer-events: none;
    background: rgba(0, 0, 0, 0);
  }

  .k12-mobile-map-selected {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0; /* Set dynamically by JS to sit above the bottom sheet */
    padding: 0 16px;
    z-index: calc(var(--z-bottom-sheet) + 20);
    pointer-events: none;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.16s ease, transform 0.16s ease;
  }

  .k12-mobile-map-selected.is-visible {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
  }

  .k12-mobile-map-selected__card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  }

  .k12-mobile-map-selected__card .k12-airbnb-map-image {
    position: relative;
    width: 100%;
    padding-top: 66.66%;
    background: #f7f7f7;
    overflow: hidden;
  }

  .k12-mobile-map-selected__card .k12-airbnb-map-image .k12-smart-carousel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  /* Map selected card: swipe + dots; hide arrows to match Airbnb mobile. */
  .k12-mobile-map-selected__card .k12-airbnb-map-image .k12-smart-carousel__btn {
    display: none;
  }

  .k12-mobile-map-selected__content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .k12-mobile-map-selected__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .k12-mobile-map-selected__name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #222222;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .k12-mobile-map-selected__rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #222222;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .k12-mobile-map-selected__rating svg {
    width: 12px;
    height: 12px;
  }

  .k12-mobile-map-selected__details {
    margin: 0;
    font-size: 13px;
    color: #717171;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .k12-mobile-map-selected__price {
    margin: auto 0 0;
    font-size: 14px;
    color: #222222;
  }

  .k12-mobile-map-selected__price strong {
    font-weight: 600;
  }

  .k12-mobile-map-selected__card .k12-airbnb-map-actions {
    z-index: 10;
  }
}


/* ==========================================================================
   PRICE NOTICE - "Prices include all fees" like Airbnb
   ========================================================================== */

@media (max-width: 767px) {

  .k12-price-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    font-size: 14px;
    color: #222222;
  }

  .k12-price-notice__icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }

}

/* Mobile retains the same heart styling as desktop (Airbnb-style). */
