/* ═══════════════════════════════════════════════════════════
   Public Listing Share — Mobile Pass 15 (#276–278)
   Critical customer-facing phone UX
   Scoped: max-width 767px only — Desktop unchanged
   Loads after listing-public-share.css
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    .ps-page {
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
        overflow-x: clip;
        width: 100%;
        max-width: 100%;
    }

  /* Atlas — موبایل‌فرست: بدون اسکرول افقی صفحه */
    .ps-page.ps-atlas .ps-atlas-shell,
    .ps-page.ps-atlas .ps-atlas-main,
    .ps-page.ps-atlas .ps-property-body {
        max-width: 100%;
        min-width: 0;
    }

    .ps-page.ps-atlas .ps-gallery-thumbs {
        max-width: 100%;
    }

    .ps-page.ps-atlas .ps-gallery-thumbs .swiper {
        max-width: 100%;
    }

    .ps-page.ps-atlas .ps-topbar-inner {
        flex-wrap: nowrap;
    }

    .ps-page.ps-atlas .ps-dock {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .ps-page.ps-atlas .ps-theme-premium .ps-overview .ps-specs {
        flex-wrap: wrap;
        overflow-x: visible;
        max-width: 100%;
    }

    /* Sticky topbar */
    .ps-topbar {
        padding-top: env(safe-area-inset-top, 0px);
    }

    .ps-topbar-inner {
        padding: 0.6rem 0.75rem;
        gap: 0.65rem;
    }

    .ps-brand-logo {
        width: 36px;
        height: 36px;
    }

    .ps-brand-text em {
        font-size: 0.88rem;
        line-height: 1.25;
    }

    /* Gallery — thumb-friendly */
    .ps-gallery-main {
        aspect-ratio: 4 / 3;
        max-height: min(52vh, 420px);
        border-radius: 0;
    }

    .ps-gallery-controls {
        top: 0.65rem;
        right: 0.65rem;
        left: auto;
        transform: none;
        gap: 0.35rem;
    }

    .ps-gallery-controls .ps-gallery-btn {
        min-width: 2.75rem;
        min-height: 2.75rem;
        border-radius: 12px;
    }

    .ps-gallery-thumbs {
        padding: 0.4rem 0.65rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .ps-gallery-thumbs::-webkit-scrollbar {
        display: none;
    }

    .ps-gallery-thumbs .swiper-slide {
        width: 56px;
        height: 42px;
    }

    /* Identity & pricing */
    .ps-container {
        padding: 0.85rem 0.75rem 0;
    }

    .ps-identity-title {
        font-size: 1.15rem;
        line-height: 1.35;
    }

    .ps-finance-primary {
        font-size: 1.1rem;
    }

    .ps-finance-grid {
        grid-template-columns: 1fr !important;
        gap: 0.45rem;
    }

    .ps-finance-item {
        border-radius: 12px;
        padding: 0.7rem 0.75rem;
    }

    /* Specs & amenities — readable stacks */
    .ps-specs {
        grid-template-columns: 1fr !important;
    }

    .ps-spec {
        border-left: none !important;
        border-bottom: 1px solid var(--ps-border-light);
        padding: 0.65rem 0.75rem;
    }

    .ps-amenities {
        padding: 0.85rem;
        border-radius: 14px;
    }

    .ps-amenity-grid {
        grid-template-columns: 1fr !important;
        gap: 0.45rem;
    }

    .ps-amenity {
        min-height: 2.65rem;
        padding: 0.55rem 0.65rem;
    }

    /* Agent card */
    .ps-agent {
        flex-direction: column;
        align-items: stretch;
        padding: 0.85rem;
        border-radius: 14px;
        gap: 0.65rem;
    }

    .ps-agent-btns {
        flex-direction: column;
        width: 100%;
        gap: 0.45rem;
    }

    .ps-agent-btns .ps-btn {
        width: 100%;
        min-height: 2.85rem;
        font-size: 0.82rem;
        justify-content: center;
    }

    .ps-agent-more summary,
    .ps-agent-more-btn {
        min-height: 2.75rem;
    }

    /* Map finale */
    .ps-map-finale-shell {
        max-width: calc(100% - 0.75rem);
        padding-top: 1.1rem;
    }

    .ps-map-finale-intro {
        grid-template-columns: 1fr !important;
    }

    .ps-map-finale-routes {
        grid-template-columns: 1fr !important;
    }

    .ps-map-finale .ws-ld-location-map {
        height: min(50vh, 380px) !important;
        min-height: 240px !important;
    }

    .ps-map-route {
        min-height: 2.85rem;
        padding: 0.65rem 0.75rem;
    }

    /* Sticky contact dock — primary CTA */
    .ps-dock {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        display: flex;
        align-items: center;
        gap: 0.55rem;
        padding: 0.6rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
        background: rgba(250, 248, 245, 0.94);
        backdrop-filter: blur(14px) saturate(1.15);
        -webkit-backdrop-filter: blur(14px) saturate(1.15);
        border-top: 1px solid var(--ps-border-light);
        box-shadow: 0 -10px 28px rgba(18, 20, 26, 0.1);
    }

    .ps-dock-price {
        flex: 0 0 auto;
        max-width: 38%;
        font-size: 0.72rem;
        font-weight: 800;
        line-height: 1.25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .ps-dock-actions {
        flex: 1;
        display: flex;
        gap: 0.45rem;
        min-width: 0;
    }

    .ps-dock-actions .ps-btn {
        flex: 1;
        min-height: 2.9rem;
        font-size: 0.78rem;
        font-weight: 800;
        justify-content: center;
        border-radius: 12px;
    }

    .ps-dock-actions .ps-btn--wa {
        flex: 1.15;
    }

    /* Lightbox touch targets */
    .ps-lightbox-nav {
        min-width: 2.75rem;
        min-height: 2.75rem;
    }

    .ps-lightbox-close {
        min-width: 2.75rem;
        min-height: 2.75rem;
        top: calc(0.65rem + env(safe-area-inset-top, 0px));
    }

    /* Inactive share state (#277) */
    .ps-inactive {
        padding: 1.25rem 0.85rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
        min-height: 100dvh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .ps-inactive-card {
        width: 100%;
        max-width: 24rem;
        border-radius: 16px;
        padding: 1.25rem 1rem;
        text-align: center;
    }

    .ps-inactive-card .ps-btn {
        width: 100%;
        min-height: 2.85rem;
        margin-top: 0.75rem;
    }

    /* Description readability */
    .ps-description {
        font-size: 0.9rem;
        line-height: 1.75;
    }

    .ps-features .ws-ld-features-core {
        grid-template-columns: 1fr !important;
    }

    .ps-page .ws-extra-item {
        grid-template-columns: 1fr !important;
        gap: 0.15rem;
    }

    .ps-footer {
        padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
    }

    /* Premium theme — mobile-first dock & hero */
    .ps-theme-premium .ps-dock-actions .ps-btn {
        border-radius: 14px;
        font-size: 0.78rem;
        font-weight: 800;
    }

    .ps-theme-premium .ps-dock-actions .ps-btn--primary {
        flex: 1.2;
    }

    .ps-theme-premium .ps-gallery-controls .ps-gallery-nav {
        min-width: 2.65rem;
        min-height: 2.65rem;
        border-radius: 14px;
        background: rgba(0, 0, 0, 0.38);
        backdrop-filter: blur(10px);
    }
}
