/* Mobile application shell shared by public and user-facing pages. */
.mobile-app-header {
  display: none;
}

.mobile-category-nav {
  display: none;
}

@media screen and (max-width: 767px) {
  :root {
    --mobile-app-bg: #f4f6f8;
    --mobile-app-surface: #fff;
    --mobile-app-text: #172033;
    --mobile-app-muted: #778196;
    --mobile-app-border: #e6e9ee;
    --mobile-app-brand: #c79452;
    --mobile-app-header-height: 66px;
  }

  html {
    background: var(--mobile-app-bg);
    scroll-padding-top: calc(var(--mobile-app-header-height) + 12px);
  }

  body.rtl {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    background: var(--mobile-app-bg) !important;
    color: var(--mobile-app-text);
    font-size: 14px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  body.rtl h1,
  body.rtl h2,
  body.rtl h3,
  body.rtl h4,
  body.rtl h5,
  body.rtl h6 {
    color: var(--mobile-app-text);
    letter-spacing: -0.025em;
  }

  body.rtl p {
    line-height: 1.8;
  }

  .mobile-app-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1038;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 10px;
    min-height: calc(var(--mobile-app-header-height) + env(safe-area-inset-top, 0px));
    padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
    border-bottom: 1px solid rgba(23, 32, 51, 0.06);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 4px 18px rgba(23, 32, 51, 0.04);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
  }

  .mobile-app-header__brand,
  .mobile-app-header__action {
    display: grid;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--mobile-app-border);
    border-radius: 14px;
    color: #3c4659;
    background: #fff;
    box-shadow: 0 5px 14px rgba(23, 32, 51, 0.05);
  }

  button.mobile-app-header__action {
    font-family: inherit;
  }

  .mobile-app-header__brand img {
    width: 26px;
    height: 26px;
    border-radius: 9px;
    object-fit: contain;
  }

  .mobile-app-header__action i {
    font-size: 21px;
  }

  .mobile-app-header__title {
    min-width: 0;
    text-align: right;
  }

  .mobile-app-header__title span,
  .mobile-app-header__title small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-app-header__title span {
    font-size: 15px;
    font-weight: 900;
    line-height: 1.45;
  }

  .mobile-app-header__title small {
    color: var(--mobile-app-muted);
    font-size: 10px;
    font-weight: 700;
  }

  .app-wrapper {
    display: block;
  }

  .app-wrapper > nav,
  .app-wrapper .header-main,
  .desktop-page-title,
  .desktop-product-tools,
  .app-wrapper footer {
    display: none !important;
  }

  .rtl .app-wrapper .app-content,
  .app-wrapper .app-content {
    width: 100%;
    min-height: 100svh;
    padding: calc(var(--mobile-app-header-height) + env(safe-area-inset-top, 0px) + 10px) 0 calc(var(--mobile-bottom-nav-height) + 34px) !important;
    overflow: visible;
    background: var(--mobile-app-bg);
    box-shadow: none;
  }

  main {
    width: 100%;
    padding: 0 !important;
  }

  main > .container-fluid {
    max-width: 560px;
    padding: 0 12px;
  }

  .mobile-category-nav {
    position: sticky;
    top: calc(var(--mobile-app-header-height) + env(safe-area-inset-top, 0px));
    z-index: 10;
    display: flex;
    max-width: 560px;
    margin: 0 auto 10px;
    padding: 7px 12px 9px;
    gap: 7px;
    overflow-x: auto;
    background: linear-gradient(to bottom, rgba(244, 246, 248, 0.98) 78%, rgba(244, 246, 248, 0));
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-category-nav::-webkit-scrollbar {
    display: none;
  }

  .mobile-category-nav a {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid var(--mobile-app-border);
    border-radius: 999px;
    color: #5f697c;
    background: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 20px;
    white-space: nowrap;
  }

  .mobile-category-nav a.is-active {
    border-color: #24314a;
    color: #fff;
    background: #24314a;
    box-shadow: 0 6px 15px rgba(36, 49, 74, 0.16);
  }

  main > .container-fluid > .row:last-child,
  main > .container-fluid > .row:last-child > [class*="col-"] > .row {
    --bs-gutter-x: 12px;
    --bs-gutter-y: 12px;
  }

  main .container,
  main .container-fluid {
    max-width: 100%;
  }

  main .container:not(.info-ad-page):not(.mobile-search-page),
  main .container-fluid:not(:first-child) {
    padding-right: 0;
    padding-left: 0;
  }

  main .card,
  .search-box-wrapper,
  .my-ad-section,
  .my-ad-request-card,
  .wizard-card,
  .request-card {
    border: 1px solid var(--mobile-app-border) !important;
    border-radius: 20px !important;
    background: var(--mobile-app-surface);
    box-shadow: 0 8px 28px rgba(23, 32, 51, 0.055) !important;
  }

  main .card .card-body,
  main .card .card-header,
  main .card .card-footer {
    padding: 16px;
  }

  main .card-footer {
    border-top: 1px solid var(--mobile-app-border);
  }

  .btn {
    min-height: 44px;
    border-radius: 13px;
    font-size: 13px;
    font-weight: 800;
  }

  .btn-sm {
    min-height: 38px;
  }

  .form-label {
    margin-bottom: 6px;
    color: #445067;
    font-size: 12px;
    font-weight: 800;
  }

  .form-control,
  .form-select {
    min-height: 48px;
    padding: 10px 13px;
    border-color: #dfe4ea;
    border-radius: 13px;
    background-color: #fff;
    font-size: 14px;
    box-shadow: none;
  }

  textarea.form-control {
    min-height: 104px;
  }

  .form-control:focus,
  .form-select:focus {
    border-color: var(--mobile-app-brand);
    box-shadow: 0 0 0 3px rgba(199, 148, 82, 0.13);
  }

  .form-check-input {
    width: 20px;
    height: 20px;
  }

  .form-check-label {
    padding-top: 1px;
    font-size: 13px;
  }

  .alert {
    border: 0;
    border-radius: 14px;
    font-size: 12px;
  }

  .modal-dialog {
    align-items: flex-end;
    min-height: 100%;
    margin: 0;
  }

  .modal-content {
    max-height: 90svh;
    border: 0;
    border-radius: 24px 24px 0 0 !important;
  }

  .offcanvas {
    width: min(88vw, 360px) !important;
    border: 0 !important;
    border-radius: 0 24px 24px 0;
  }

  .go-top {
    display: none !important;
  }

  /* Compact property cards */
  main .row > [class*="col-"]:has(> .property-card),
  main .row > [class*="col-"]:has(> a > .property-card) {
    width: 100%;
  }

  .property-card,
  .home-property-card {
    position: relative;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 132px;
    direction: rtl !important;
    min-height: 154px !important;
    overflow: hidden;
    border: 1px solid var(--mobile-app-border) !important;
    border-radius: 18px !important;
    background: #fff;
    box-shadow: 0 6px 20px rgba(23, 32, 51, 0.055) !important;
    transform: none !important;
  }

  .property-card .property-img,
  .home-property-card .property-img {
    grid-column: 2;
    grid-row: 1;
    width: 132px !important;
    min-width: 132px;
    height: 100% !important;
    min-height: 154px !important;
    border-radius: 0;
  }

  .property-card .property-img img {
    transform: none !important;
  }

  .property-card .property-content,
  .home-property-card .property-content {
    grid-column: 1;
    grid-row: 1;
    width: auto !important;
    min-width: 0;
    padding: 12px !important;
    direction: rtl;
    text-align: right;
  }

  .property-title,
  .home-property-card .property-title {
    min-height: auto !important;
    margin: 0 0 6px !important;
    color: var(--mobile-app-text);
    font-size: 14px !important;
    font-weight: 900;
    line-height: 1.55;
    -webkit-line-clamp: 2;
  }

  .property-address,
  .home-property-card .property-address {
    min-height: auto;
    margin-bottom: 7px !important;
    overflow: hidden;
    color: var(--mobile-app-muted);
    font-size: 11px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .property-address i,
  .property-features i {
    font-size: 15px;
  }

  .property-price,
  .home-property-card .property-price {
    min-height: auto !important;
    margin-bottom: 8px !important;
    color: #222c40;
    font-size: 12px !important;
    font-weight: 900;
    line-height: 1.6;
  }

  .property-features,
  .home-property-card .property-features {
    display: flex !important;
    margin-top: auto;
    padding-top: 7px !important;
    gap: 5px 9px !important;
    border-color: #edf0f3;
  }

  .property-features span,
  .home-property-card .property-features span {
    max-width: 100%;
    overflow: hidden;
    color: #667187;
    font-size: 10px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .property-badge {
    top: 8px !important;
    right: 8px !important;
    left: 8px;
    gap: 4px;
    max-width: none;
  }

  .property-badge span,
  .home-property-card .property-badge span {
    padding: 3px 7px !important;
    font-size: 9px !important;
    line-height: 1.5;
  }

  .property-type,
  .home-property-card .property-type {
    bottom: 8px;
    left: 8px;
    padding: 3px 8px !important;
    font-size: 9px !important;
  }

  .btn-detail {
    min-height: 34px;
    margin-top: 8px;
    padding: 6px 10px;
    border: 1px solid #e6e9ee;
    border-radius: 10px;
    background: #f8f9fb;
    font-size: 11px;
  }

  .property-content > br {
    display: none;
  }

  /* Property detail */
  .info-ad-page {
    padding: 0 !important;
    margin-top: 0 !important;
  }

  .info-ad-page > .row {
    --bs-gutter-x: 0;
    gap: 12px;
  }

  .info-ad-page > .row > [class*="col-"] {
    padding: 0;
  }

  .info-ad-gallery {
    border-radius: 18px !important;
    box-shadow: none;
  }

  .info-ad-gallery-image {
    height: 270px !important;
  }

  .info-ad-thumbnails {
    gap: 7px;
  }

  .info-ad-thumbnail {
    width: 70px;
    height: 52px;
    border-radius: 10px;
  }

  .info-ad-summary-card,
  .info-ad-details-card {
    border-radius: 18px !important;
  }

  .info-ad-summary-card .card-body {
    padding: 16px !important;
  }

  .info-ad-summary-card .card-title {
    font-size: 18px;
    line-height: 1.6;
  }

  .info-ad-highlights {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 8px 0;
  }

  .info-ad-highlight-item {
    padding: 6px 3px;
  }

  .info-ad-highlight-content {
    font-size: 10px;
  }

  .info-ad-highlight-content i {
    font-size: 19px;
  }

  .info-ad-details-header {
    padding: 14px !important;
  }

  .info-ad-details-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
  }

  .info-ad-details-list li {
    padding: 10px 0;
    font-size: 12px;
  }

  /* Search surface */
  .mobile-search-page {
    padding: 0 !important;
  }

  .search-box-wrapper {
    margin-bottom: 16px;
    padding: 14px !important;
  }

  .search-box-wrapper form > .row:first-of-type {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .search-box-wrapper form > .row:first-of-type > [class*="col-"] {
    width: auto;
    padding: 0;
  }

  .search-box-wrapper form > .row:first-of-type > [class*="col-"]:first-child {
    grid-column: 1 / -1;
  }

  .price-slider-card {
    padding: 12px !important;
    border-radius: 14px !important;
  }

  .price-range-display {
    font-size: 10px !important;
    white-space: normal !important;
  }

  .search-box-wrapper button[type="submit"] {
    width: 100%;
  }

  .search-results > h5 {
    font-size: 14px;
  }

  /* Authentication and user surfaces */
  .mobile-auth-page {
    padding: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .mobile-auth-row {
    margin-top: 0 !important;
  }

  .mobile-auth-card {
    margin: 0 !important;
    border-radius: 22px !important;
  }

  .mobile-auth-card .card-body,
  .mobile-auth-card .card-footer {
    padding: 18px !important;
  }

  .mobile-auth-intro {
    margin-bottom: 20px;
    text-align: center;
  }

  .mobile-auth-icon {
    display: grid;
    width: 54px;
    height: 54px;
    margin: 0 auto 10px;
    place-items: center;
    border-radius: 18px;
    color: #9c6b2f;
    background: rgba(199, 148, 82, 0.13);
  }

  .mobile-auth-icon i {
    font-size: 27px;
  }

  .mobile-auth-intro h3 {
    margin-bottom: 3px;
    font-size: 18px;
    font-weight: 900;
  }

  .mobile-auth-intro p {
    margin: 0;
    color: var(--mobile-app-muted);
    font-size: 12px;
  }

  .mobile-auth-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    color: #9aa2b1;
    font-size: 11px;
  }

  .mobile-auth-separator::before,
  .mobile-auth-separator::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--mobile-app-border);
  }

  .my-ad-hero {
    padding: 18px !important;
    border-radius: 20px !important;
  }

  .my-ad-hero h2,
  .my-ad-hero h3 {
    font-size: 18px;
  }

  .my-ad-stat {
    min-height: 72px;
    padding: 10px !important;
    border-radius: 14px !important;
  }

  .my-ad-stat .label {
    font-size: 10px !important;
  }

  .my-ad-stat .value {
    font-size: 17px !important;
  }

  .my-ad-section {
    padding: 14px !important;
  }

  .my-ad-section-header {
    align-items: flex-start !important;
    margin-bottom: 14px !important;
  }

  .my-ad-section-header h4,
  .my-ad-section-header h5 {
    font-size: 15px;
  }

  .my-ad-empty {
    padding: 28px 16px !important;
  }

  .my-ad-empty h4,
  .my-ad-empty h5 {
    font-size: 16px;
  }

  .my-ad-empty .d-flex {
    flex-direction: column;
  }

  /* Create action selection */
  .mobile-create-option {
    width: 100%;
  }

  .mobile-create-option .card {
    margin-bottom: 0;
    text-align: right !important;
  }

  .mobile-create-option .card-body {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 18px !important;
  }

  .mobile-create-option .display-1 {
    grid-row: 1 / 4;
    width: 54px;
    height: 54px;
    font-size: 31px !important;
    line-height: 54px;
    text-align: center;
  }

  .mobile-create-option h3 {
    margin: 0 !important;
    font-size: 16px;
    line-height: 1.6;
  }

  .mobile-create-option p {
    margin: 2px 0 0 !important;
    font-size: 11px;
  }

  .mobile-create-option .btn {
    grid-column: 3;
    grid-row: 1 / 4;
    min-width: 78px;
    padding: 8px 10px;
  }

  .wizard-card,
  .request-card {
    padding: 16px !important;
  }

  .wizard-card .p-4,
  .request-card .p-4 {
    padding: 16px !important;
  }

  .choice-card span,
  .edit-ad-choice-card span {
    min-height: 48px;
    padding: 10px !important;
    border-radius: 13px !important;
    font-size: 12px;
  }

  /* Long help/support pages */
  .auth-flow-shell,
  .support-shell {
    padding-top: 0 !important;
  }

  .auth-flow-card {
    border-radius: 20px !important;
  }

  .auth-flow-card .card-body {
    padding: 18px !important;
  }

  .auth-flow-aside {
    padding: 20px !important;
  }

  .accordion-button {
    padding: 14px;
    font-size: 13px;
    line-height: 1.7;
  }

  .accordion-body {
    padding: 14px;
    font-size: 12px;
  }
}

@media screen and (max-width: 359px) {
  .property-card,
  .home-property-card {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .property-card .property-img,
  .home-property-card .property-img {
    width: 112px !important;
    min-width: 112px;
  }

  .mobile-create-option .card-body {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .mobile-create-option .display-1 {
    width: 44px;
    font-size: 26px !important;
  }

  .mobile-create-option .btn {
    grid-column: 1 / -1;
    grid-row: auto;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
