/* Mobile-first UI. Scoped to Home, archive/search and authentication/dashboard. */
@media (max-width: 768px) {
  body.home:not(.single-listing),
  body.post-type-archive-listing:not(.single-listing),
  body.page-template-template-dashboard-php:not(.single-listing),
  body.page-id-34161:not(.single-listing) {
    --ip-ui-content-width: min(100%, 680px);
  }

  /* Home: compact live-status actions without altering their widgets or links. */
  body.home .mailbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--ip-ui-space-xs);
    width: min(calc(100% - (var(--ip-ui-page-padding-mobile) * 2)), 680px);
    margin: var(--ip-ui-space-md) auto var(--ip-ui-space-sm);
  }

  body.home .mailbar .mail-pill {
    min-width: 0;
    min-height: var(--ip-ui-control-height);
    padding: var(--ip-ui-space-xs);
    border-radius: var(--ip-ui-radius-md);
    box-shadow: none;
  }

  body.home .mailbar .mail-label .elementor-heading-title,
  body.home .mailbar .mail-label a {
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.home .mostra-cont-app {
    padding-top: var(--ip-ui-space-md);
    padding-bottom: var(--ip-ui-space-lg);
  }

  body.home .elementor-widget-listeo-text-typed h1 {
    margin-bottom: var(--ip-ui-space-md);
    font-size: clamp(30px, 9vw, 40px);
    line-height: 1.08;
  }

  body.home .elementor-widget-button .elementor-button {
    min-height: var(--ip-ui-control-height);
    padding: 12px 18px;
    border-radius: 999px;
  }

  body.home .elementor-widget-heading .elementor-heading-title {
    line-height: 1.2;
  }

  /* Half Map: remove the obsolete IP Custom compensation and preserve compact controls. */
  body.post-type-archive-listing.half-archive-listings-layout #wrapper {
    padding-top: 0;
  }

  body.post-type-archive-listing.half-archive-listings-layout .lhb-frontend-header {
    position: sticky;
    top: 0;
  }

  body.post-type-archive-listing.half-archive-listings-layout #map-container:not(.expanded) {
    height: clamp(128px, 24dvh, 200px);
    max-height: 200px;
  }

  body.post-type-archive-listing.half-archive-listings-layout .split-top-inputs {
    padding: var(--ip-ui-space-md) var(--ip-ui-page-padding-mobile);
  }

  body.post-type-archive-listing.half-archive-listings-layout .split-top-inputs input,
  body.post-type-archive-listings-layout .split-top-inputs .bootstrap-select > .dropdown-toggle,
  body.post-type-archive-listing.half-archive-listings-layout .show-map-button {
    min-height: var(--ip-ui-control-height);
    border-radius: var(--ip-ui-radius-sm);
  }

  body.post-type-archive-listing .ibp-custom-filter-toolbar {
    gap: var(--ip-ui-space-xs);
    padding: var(--ip-ui-space-sm) var(--ip-ui-page-padding-mobile);
  }

  body.post-type-archive-listing .ibp-custom-filter-pill {
    min-height: var(--ip-ui-touch-target);
    padding: 0 14px;
    border-radius: 999px;
    position: relative;
    isolation: isolate;
    border-color: transparent;
    background: transparent;
  }

  /* Keep the 44px interactive target while drawing the original compact pill. */
  body.post-type-archive-listing .ibp-custom-filter-pill::before {
    content: '';
    position: absolute;
    inset: 7px 0;
    z-index: -1;
    border: 1px solid var(--ibp-custom-pill-border, #dcdcdc) !important;
    border-radius: 999px;
    background: var(--ibp-custom-pill-bg, #f7f7f7) !important;
    pointer-events: none;
  }

  body.post-type-archive-listing .ibp-custom-filter-pill.is-active {
    --ibp-custom-pill-border: var(--ibp-custom-pill-active-bg, #4ba3f2);
    --ibp-custom-pill-bg: var(--ibp-custom-pill-active-bg, #4ba3f2);
    border-color: transparent;
    background: transparent;
  }

  body.post-type-archive-listing .ibp-custom-filter-pill.is-active:hover,
  body.post-type-archive-listing .ibp-custom-filter-pill.is-active:focus {
    border-color: transparent;
    background: transparent;
  }

  body.post-type-archive-listing .ibp-custom-filter-pill:focus-visible {
    box-shadow: 0 0 0 3px rgba(22, 135, 183, .4) !important;
  }

  body.post-type-archive-listing .listing-card-container-nl {
    margin-bottom: var(--ip-ui-space-md);
  }

  /* Listeo login, registration, lost-password and dashboard forms. */
  body.page-template-template-dashboard-php #titlebar,
  body.page-id-34161 #titlebar {
    padding: var(--ip-ui-space-lg) var(--ip-ui-page-padding-mobile);
  }

  body.page-template-template-dashboard-php .container.full-width,
  body.page-id-34161 .container.full-width {
    width: min(100%, 560px);
    padding-right: var(--ip-ui-page-padding-mobile);
    padding-left: var(--ip-ui-page-padding-mobile);
  }

  body.page-template-template-dashboard-php form.login .form-row,
  body.page-template-template-dashboard-php form.register .form-row,
  body.page-id-34161 #lostpasswordform .form-row {
    margin-bottom: var(--ip-ui-space-md);
  }

  body.page-template-template-dashboard-php form.login input.input-text,
  body.page-template-template-dashboard-php form.register input.input-text,
  body.page-id-34161 #lostpasswordform input[type='text'] {
    min-height: var(--ip-ui-control-height);
    border-radius: var(--ip-ui-radius-sm);
  }

  body.page-template-template-dashboard-php form.login input[type='submit'],
  body.page-template-template-dashboard-php form.register input[type='submit'],
  body.page-id-34161 #lostpasswordform input[type='submit'],
  body.page-template-template-dashboard-php .dashboard-list-box a.button {
    min-height: var(--ip-ui-control-height);
    border-radius: var(--ip-ui-radius-sm);
  }

  body.page-template-template-dashboard-php .lost_password a,
  body.page-template-template-dashboard-php .form-row label,
  body.page-id-34161 #lostpasswordform label {
    line-height: 1.4;
  }

  body.page-template-template-dashboard-php #dashboard,
  body.page-template-template-dashboard-php .dashboard-list-box {
    border-radius: var(--ip-ui-radius-md);
  }
}
