/* Moumachi UI — search results, app-like mobile view (MobileAppLikeView in appsettings.json). Loaded after search.css. */

/* ============================================================
   Phones and tablets (below 1024px): the app layout. The list opens first; the map waits
   behind a floating Map / List button and opens full screen; the cards take the home page's
   card look (same information); the Filters sheet gets a grab handle and black buttons.
   Desktop keeps its side-by-side list and map.
============================================================ */
@media (max-width: 1023.98px) {
  /* Filter row: under the 56px bar, solid white */
  .search-page div.sticky:has(> .container > .search-filter-toolbar) {
    top: 56px;
    background-color: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .search-page div.sticky:has(> .container > .search-filter-toolbar) > .container {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  #searchFiltersOpen,
  .search-active-chip {
    min-height: 36px;
    padding: 0 12px;
    border-color: #e3e3e3;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
  }

  .search-active-chip {
    gap: 8px;
    border-color: #0b0b0b;
  }

  #searchClearAll {
    padding: 0 6px;
    font-size: 13px;
    font-weight: 600;
  }

  /* Title and one count line */
  .search-page main > .search-results-sec.common-sec {
    padding-top: 14px;
  }

  .search-title-row {
    margin-bottom: 14px;
  }

  #searchTitle {
    margin-bottom: 2px;
    font-size: 18px;
    letter-spacing: -.3px;
  }

  #searchResultCount {
    font-size: 12.5px;
  }

  #searchPageBadge {
    display: none !important;
  }

  /* The map: kept laid out (Google Maps needs a size) but out of sight until "Map" */
  .search-page .search-layout__map {
    position: fixed !important;
    top: var(--mm-map-top, 108px);
    left: 0;
    right: 0;
    bottom: calc(var(--mm-tabbar-height, 60px) + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    width: auto;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    visibility: hidden;
    pointer-events: none;
  }

  body.mm-map-open .search-layout__map {
    visibility: visible;
    pointer-events: auto;
  }

  body.mm-map-open {
    overflow: hidden;
  }

  .mm-map-toggle {
    position: fixed;
    left: 50%;
    bottom: calc(var(--mm-tabbar-height, 60px) + env(safe-area-inset-bottom, 0px) + 16px);
    z-index: 46;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 14px;
    background-color: #0b0b0b;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    transform: translateX(-50%);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mm-map-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mm-map-toggle svg[hidden] {
    display: none;
  }

  /* Room under the last card and the page numbers for the floating button */
  .search-layout__list {
    padding-bottom: 64px;
  }

  /* Cards: the home page's card look, full width, same information */
  #searchResults {
    row-gap: 12px;
  }

  #searchResults .search-card {
    border-color: #ececec;
    border-radius: 16px;
  }

  #searchResults .search-card > a > div:first-child > img:first-child {
    aspect-ratio: auto;
    height: 132px;
  }

  #searchResults .search-card__logo {
    left: 12px;
    right: auto;
    bottom: -22px;
    width: 46px;
    height: 46px;
    border: 2px solid #fff;
    border-radius: 12px;
    box-shadow: 0 0 0 1px #ececec;
  }

  #searchResults .search-card > a > div:last-child {
    padding: 30px 12px 12px;
  }

  #searchResults .search-card h3 {
    font-size: 15px;
  }

  #searchResults .search-card h3 + div {
    margin-bottom: 10px;
    padding-bottom: 10px;
    font-size: 12.5px;
  }

  #searchResults .search-card > a > div:last-child > div:first-child > div:first-child {
    max-width: none;
    margin-bottom: 6px;
  }

  #searchResults .search-card > a > div:last-child > div:first-child > div:first-child > span {
    padding: 2px 6px;
    border-radius: 6px;
    background-color: #f5f5f5;
    color: #6b6b6b;
    font-size: 10.5px;
  }

  #searchResults .search-card > a > div:last-child > div:last-child {
    font-size: 12.5px;
  }

  #searchResults .search-card > a > div:last-child > div:last-child * {
    font-size: inherit;
  }

  .search-pagination {
    justify-content: center;
  }

  /* Filters sheet */
  .search-filters-modal__panel {
    border-radius: 20px 20px 0 0;
  }

  .search-filters-modal__panel::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    z-index: 1;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 2px;
    background-color: #d6d6d6;
  }

  #searchFiltersTitle {
    font-size: 20px;
    letter-spacing: -.4px;
  }

  .search-filters-modal .search-chip {
    border-radius: 10px;
  }

  .search-filters-modal__panel form > div:last-child {
    gap: 10px;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .search-filters-modal__panel form > div:last-child > a[data-search-clear-filters] {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    height: 48px;
    border: 1.5px solid #0b0b0b;
    border-radius: 14px;
    color: #0b0b0b;
    font-size: 14px;
    font-weight: 700;
  }

  #searchFilterApply {
    flex: 2;
    justify-content: center;
    height: 48px;
    border-radius: 14px;
    background-color: #0b0b0b;
    box-shadow: none;
    color: #fff;
    font-size: 14px;
  }
}
