/* Mobile Compact Layout for Travel Portal Search & Filters (#3244, #2497) */
.mobile-nav,
.mobile-search-summary,
.mobile-card-details-toggle {
  display: none;
}

.mobile-card-secondary {
  display: contents;
}

@media (max-width: 700px) {
  body {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid #d1deda;
    box-shadow: 0 -2px 10px rgba(17, 24, 39, 0.08);
    backdrop-filter: blur(12px);
    z-index: 1000;
    align-items: center;
    justify-content: space-around;
    padding: 0 10px env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav a {
    flex: 1;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #4b5563;
    text-decoration: none;
    padding: 6px 0;
  }

  .mobile-nav a[aria-current="page"] {
    color: #007d70;
    font-weight: 700;
  }

  /* Compact Topbar */
  .topbar {
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 0 !important;
  }

  .topbar .brand {
    font-size: 15px !important;
    line-height: 1 !important;
  }

  body.has-search-results .topbar .nav,
  body.has-search-results .topbar #compareNav,
  body.has-search-results .topbar #openLeadTop,
  body.has-search-results .topbar .ghost-btn#compareNav,
  body.has-search-results .topbar .btn#openLeadTop {
    display: none !important;
  }

  /* Compact sticky search summary: 2-line layout that never overflows 390px */
  .mobile-search-summary {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    border: 1px solid #cfe2dc;
    border-radius: 8px;
    background: #f4f8f7;
    color: #172033;
    padding: 3px 8px;
    text-align: left;
    cursor: pointer;
    margin: 0;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
  }

  .mobile-search-summary:hover {
    background: #ebf3f1;
  }

  .mobile-search-summary:focus-visible {
    outline: 2px solid #007d70 !important;
    outline-offset: 2px;
  }

  .mobile-search-summary span {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.22;
    white-space: normal;
    word-break: break-word;
    display: block;
  }

  .mobile-search-summary strong {
    flex: 0 0 auto;
    color: #007d70;
    font-size: 10px;
    font-weight: 750;
    background: rgba(0, 125, 112, 0.08);
    padding: 3px 6px;
    border-radius: 4px;
  }

  body.has-search-results .search-strip {
    position: sticky !important;
    top: 40px !important;
    z-index: 950 !important;
    padding: 3px 8px !important;
    margin: 0 0 4px 0 !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 2px 8px rgba(17, 24, 39, .05);
    backdrop-filter: blur(12px);
  }

  body.has-search-results .mobile-search-summary {
    display: flex;
  }

  body.has-search-results:not(.search-form-expanded) .search-strip > :not(.mobile-search-summary) {
    display: none;
  }

  body.has-search-results.search-form-expanded .search-strip {
    padding: 8px;
  }

  /* Hide intermediate noisy widgets on mobile search */
  body.has-search-results .price-calendar,
  body.has-search-results .price-coverage-status,
  body.has-search-results .popular-preset-strip,
  body.has-search-results .recent-strip,
  body.has-search-results .search-map-unavailable,
  body.has-search-results .view-switch,
  body.has-search-results .quick-filters,
  body.has-search-results .search-map-panel {
    display: none !important;
  }

  /* Filter bar directly below summary */
  body.has-search-results .mobile-filter-bar {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin: 2px 0 4px 0 !important;
    padding: 0 !important;
    height: 32px !important;
  }

  .mobile-filter-toggle {
    height: 32px !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border: 1px solid #cfe2dc !important;
    border-radius: 6px !important;
    background: #f8fafc !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .mobile-filter-toggle:focus-visible {
    outline: 2px solid #007d70 !important;
    outline-offset: 2px;
  }

  /* Toolbar */
  body.has-search-results .toolbar {
    margin: 0 0 4px 0 !important;
    padding: 0 !important;
    gap: 2px !important;
  }

  body.has-search-results .toolbar h1 {
    font-size: 15px !important;
    margin: 0 !important;
    line-height: 1.2 !important;
  }

  body.has-search-results .toolbar .muted {
    font-size: 11px !important;
    margin: 0 !important;
  }

  /* Result card ultra-compact geometry */
  body.has-search-results .result-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  body.has-search-results .result-card {
    padding: 6px 8px !important;
    margin: 0 !important;
    border: 1px solid #e2ece8 !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 4px rgba(17, 24, 39, .04) !important;
  }

  body.has-search-results .result-card .thumb {
    height: 95px !important;
    min-height: 95px !important;
    border-radius: 6px !important;
    margin-bottom: 4px !important;
  }

  body.has-search-results .result-card h3 {
    font-size: 15px !important;
    margin: 0 0 2px 0 !important;
    line-height: 1.2 !important;
  }

  body.has-search-results .result-card .meta {
    font-size: 11px !important;
    margin: 0 0 2px 0 !important;
    line-height: 1.2 !important;
  }

  /* Secondary details collapsed by default */
  .mobile-card-details-toggle {
    display: block !important;
    width: 100%;
    padding: 2px 0 4px 0;
    font-size: 12px;
    font-weight: 600;
    color: #007d70;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
  }

  .mobile-card-details-toggle:focus-visible {
    outline: 2px solid #007d70 !important;
    outline-offset: 1px;
  }

  body.has-search-results .result-card:not(.is-mobile-expanded) .mobile-card-secondary {
    display: none !important;
  }

  body.has-search-results .result-card.is-mobile-expanded .mobile-card-secondary {
    display: block !important;
    margin-top: 4px !important;
    font-size: 12px !important;
  }

  body.has-search-results .price-box {
    margin-top: 4px !important;
    padding-top: 4px !important;
    border-top: 1px dashed #e2ece8 !important;
  }

  .price-actions {
    display: flex;
    gap: 6px;
  }

  .range-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .room-gallery-mobile {
    height: 160px;
  }

  /* Search state banners */
  .search-state-banner {
    padding: 18px 16px;
    border-radius: 8px;
    text-align: center;
    margin: 12px 0;
  }

  .search-state-banner.is-timeout {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
  }

  .search-state-banner.is-offline {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
  }

  .search-progress-bar.is-active {
    display: block !important;
    height: 3px !important;
    background: #007d70 !important;
  }

  /* Filter dialog panel and sticky footer */
  .filters {
    display: none;
  }

  body.filter-sheet-open {
    overflow: hidden !important;
  }

  body.filter-sheet-open .mobile-filter-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    z-index: 1100;
    backdrop-filter: blur(2px);
  }

  body.filter-sheet-open .filters {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 5vh !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: #ffffff !important;
    border-radius: 16px 16px 0 0 !important;
    z-index: 1200 !important;
    padding: 0 !important;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
  }

  .filters-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    flex: 0 0 auto;
  }

  .filters-scrollable-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
  }

  .filters-footer {
    display: flex !important;
    gap: 8px !important;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)) 16px !important;
    background: #ffffff !important;
    border-top: 1px solid #e5e7eb !important;
    box-shadow: 0 -4px 12px rgba(17, 24, 39, 0.08) !important;
    flex: 0 0 auto !important;
    z-index: 10;
  }

  .filters-footer .btn,
  .filters-footer .ghost-btn {
    flex: 1 1 50% !important;
    height: 40px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
  }

  .quick-filters,
  .popular-preset-rail,
  .recent-rail {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .quick-filters::-webkit-scrollbar,
  .popular-preset-rail::-webkit-scrollbar,
  .recent-rail::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
}
