/*
 * Best Property Plug V15.1 — mobile property detail stabilization
 * Desktop styles remain unchanged.
 */

.rpg-mobile-section-toggle,
.rpg-mobile-enquiry-toggle,
.rpg-mobile-text-toggle,
.rpg-mobile-mortgage-toggle,
.rpg-mobile-footer-toggle {
    display: none;
}

@media (max-width: 991px) {
    .rpg-property-detail-page {
        overflow-x: hidden;
    }

    .rpg-property-detail-page .wrapper-sidebar-right {
        margin-top: 24px;
    }

    .rpg-property-detail-page .single-property-contact {
        position: static !important;
    }
}

@media (max-width: 767px) {
    html {
        scroll-padding-bottom: 84px;
    }

    .rpg-property-detail-page {
        padding-bottom: calc(74px + env(safe-area-inset-bottom)) !important;
    }

    .rpg-property-detail-page .container,
    .rpg-property-detail-page .container-fluid {
        padding-right: 14px;
        padding-left: 14px;
    }

    .rpg-property-detail-page .flat-categories-single {
        display: none !important;
    }

    .rpg-property-detail-page .flat-gallery-single {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 6px !important;
        padding: 10px 14px 12px !important;
        margin: 0 !important;
    }

    .rpg-property-detail-page .flat-gallery-single .box-img {
        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
        border-radius: 8px !important;
        overflow: hidden;
    }

    .rpg-property-detail-page .flat-gallery-single .item1 {
        grid-column: 1 / -1;
        aspect-ratio: 16 / 10;
        max-height: none !important;
    }

    .rpg-property-detail-page .flat-gallery-single .box-img img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .rpg-property-detail-page .flat-gallery-single .box-btn {
        right: 10px !important;
        bottom: 10px !important;
        left: auto !important;
    }

    .rpg-property-detail-page .flat-gallery-single .box-btn .tf-btn {
        min-height: 36px;
        padding: 6px 10px !important;
        font-size: 11px !important;
    }

    .rpg-property-detail-page .flat-section-v6,
    .rpg-property-detail-page .flat-property-detail-v2 {
        padding-top: 10px !important;
        padding-bottom: 22px !important;
    }

    .rpg-property-detail-page .flat-property-detail-v2 > .container > .row {
        --bs-gutter-x: 0;
    }

    .rpg-property-detail-page .header-property-detail {
        padding: 16px !important;
        margin-bottom: 14px !important;
        border-radius: 12px !important;
        box-shadow: 0 5px 18px rgba(22, 30, 45, .06) !important;
    }

    .rpg-property-detail-page .header-property-detail .content-top {
        gap: 12px;
    }

    .rpg-property-detail-page .header-property-detail .title {
        margin-top: 8px !important;
        font-size: clamp(22px, 7vw, 27px) !important;
        line-height: 1.22 !important;
        overflow-wrap: anywhere;
    }

    .rpg-property-detail-page .header-property-detail .box-price {
        width: 100%;
        padding: 9px 11px !important;
        border-radius: 9px !important;
        white-space: normal !important;
    }

    .rpg-property-detail-page .header-property-detail .box-price .h4 {
        font-size: 22px !important;
        line-height: 1.25 !important;
    }

    .rpg-property-detail-page .header-property-detail .content-bottom {
        display: block !important;
        margin-top: 14px;
    }

    .rpg-property-detail-page .header-property-detail .info-box .meta {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .rpg-property-detail-page .header-property-detail .info-box .meta-item {
        min-width: 0;
        min-height: 58px;
        display: flex !important;
        flex-direction: column;
        align-items: flex-start !important;
        justify-content: center;
        gap: 4px !important;
        padding: 8px;
        border: 1px solid #e7eaec;
        border-radius: 9px;
        background: #fafbfb;
        font-size: 12px !important;
        line-height: 1.3 !important;
        overflow-wrap: anywhere;
    }

    .rpg-property-detail-page .header-property-detail .info-box .meta-item svg {
        width: 18px !important;
        height: 18px !important;
    }

    .rpg-property-detail-page .rpg-property-actions {
        margin-top: 10px;
    }

    .rpg-property-detail-page .widget-box-header-single,
    .rpg-property-detail-page .widget-box-single,
    .rpg-property-detail-page .single-property-element {
        padding: 16px !important;
        margin-bottom: 14px !important;
        border-radius: 12px !important;
    }

    .rpg-property-detail-page .single-property-desc .title,
    .rpg-property-detail-page .single-property-overview .title,
    .rpg-property-detail-page .single-property-feature .title,
    .rpg-property-detail-page .single-property-nearby .title,
    .rpg-property-detail-page .single-property-map .title,
    .rpg-property-detail-page .single-wrapper-review .h7 {
        font-size: 19px !important;
        line-height: 1.35 !important;
    }

    .rpg-property-detail-page .single-property-desc .ck-content,
    .rpg-property-detail-page .single-property-desc .ck-content p {
        font-size: 15px !important;
        line-height: 1.7 !important;
        overflow-wrap: anywhere;
    }

    .rpg-property-detail-page .single-property-desc:not(.is-expanded) .ck-content {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 7;
    }

    .rpg-property-detail-page .property-disclaimer:not(.is-expanded) .property-disclaimer-body {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 6;
    }

    .rpg-property-detail-page .rpg-mobile-text-toggle,
    .rpg-property-detail-page .rpg-mobile-mortgage-toggle {
        width: 100%;
        min-height: 46px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 0;
        margin-top: 10px;
        border: 0;
        border-top: 1px solid #e6e9eb;
        background: transparent;
        color: var(--primary-color, #db1d23);
        font-size: 14px;
        font-weight: 700;
        text-align: left;
    }

    .rpg-property-detail-page .rpg-mobile-text-toggle svg,
    .rpg-property-detail-page .rpg-mobile-mortgage-toggle svg,
    .rpg-property-detail-page .rpg-mobile-footer-toggle svg {
        width: 18px;
        height: 18px;
        flex: 0 0 auto;
        transition: transform .2s ease;
    }

    .rpg-property-detail-page .rpg-mobile-text-toggle[aria-expanded="true"] svg,
    .rpg-property-detail-page .rpg-mobile-mortgage-toggle[aria-expanded="true"] svg,
    .rpg-property-detail-page .rpg-mobile-footer-toggle[aria-expanded="true"] svg {
        transform: rotate(180deg);
    }

    .rpg-property-detail-page .single-property-overview .info-box {
        --bs-gutter-x: 8px;
        --bs-gutter-y: 8px;
    }

    .rpg-property-detail-page .single-property-overview .info-box > [class*="col"] {
        width: 50%;
    }

    .rpg-property-detail-page .single-property-overview .info-box .item {
        min-height: 72px !important;
        padding: 10px !important;
    }

    .rpg-property-detail-page .single-property-overview .info-box .content,
    .rpg-property-detail-page .single-property-overview .info-box .content span,
    .rpg-property-detail-page .single-property-overview .info-box .content a {
        font-size: 13px !important;
        line-height: 1.35 !important;
    }

    .rpg-property-detail-page .wrapper-onepage {
        scroll-margin-top: 72px;
    }

    .rpg-property-detail-page .rpg-mobile-section-toggle {
        width: 100%;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 0 14px;
        margin-bottom: 12px;
        border: 1px solid #e3e7e9;
        border-radius: 10px;
        background: #fff;
        color: #161e2d;
        font-size: 16px;
        font-weight: 700;
        text-align: left;
    }

    .rpg-property-detail-page .rpg-mobile-section-toggle svg {
        width: 19px;
        height: 19px;
        transition: transform .2s ease;
    }

    .rpg-property-detail-page .rpg-mobile-section-toggle[aria-expanded="true"] svg {
        transform: rotate(180deg);
    }

    .rpg-property-detail-page .rpg-mobile-section-toggle[aria-expanded="false"] ~ * {
        display: none !important;
    }

    .rpg-property-detail-page .single-property-map [data-bb-toggle="detail-map"],
    .rpg-property-detail-page .single-property-map iframe {
        width: 100% !important;
        min-height: 280px !important;
        border-radius: 10px;
        overflow: hidden;
    }

    .rpg-property-detail-page .single-property-map .info-map {
        margin-top: 12px;
    }

    .rpg-property-detail-page .single-property-map .info-map a {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
        overflow-wrap: anywhere;
    }

    .rpg-property-detail-page .single-property-contact {
        padding: 16px !important;
        border-radius: 12px !important;
        box-shadow: 0 5px 18px rgba(22, 30, 45, .07) !important;
    }

    .rpg-property-detail-page .single-property-contact .box-avatar {
        align-items: center;
        gap: 12px !important;
    }

    .rpg-property-detail-page .single-property-contact .avatar {
        width: 62px !important;
        height: 62px !important;
        flex: 0 0 62px;
    }

    .rpg-property-detail-page .single-property-contact .info {
        min-width: 0;
    }

    .rpg-property-detail-page .single-property-contact .info a {
        overflow-wrap: anywhere;
    }

    .rpg-property-detail-page .rpg-mobile-enquiry-toggle {
        width: 100%;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 0 14px;
        margin-top: 16px;
        border: 1px solid #e3e7e9;
        border-radius: 10px;
        background: #fff;
        color: #161e2d;
        font-size: 16px;
        font-weight: 700;
    }

    .rpg-property-detail-page .rpg-mobile-enquiry-toggle svg {
        width: 19px;
        height: 19px;
        transition: transform .2s ease;
    }

    .rpg-property-detail-page .rpg-mobile-enquiry-toggle[aria-expanded="true"] svg {
        transform: rotate(180deg);
    }

    .rpg-property-detail-page .rpg-property-enquiry-panel {
        display: none;
        scroll-margin-top: 80px;
    }

    .rpg-property-detail-page .rpg-property-enquiry-panel.is-open,
    .rpg-property-detail-page .rpg-mobile-enquiry-toggle[aria-expanded="true"] + .rpg-property-enquiry-panel {
        display: block;
    }

    .rpg-property-detail-page .contact-form {
        margin-top: 16px !important;
    }

    .rpg-property-detail-page .contact-form .form-control,
    .rpg-property-detail-page .contact-form .nice-select,
    .rpg-property-detail-page .contact-form .tf-btn {
        min-height: 48px !important;
        font-size: 16px !important;
    }

    .rpg-property-detail-page .contact-form textarea.form-control {
        min-height: 120px !important;
    }

    .rpg-property-detail-page .property-contact-actions--detail {
        display: none !important;
    }

    .rpg-property-detail-page .rpg-mobile-mortgage-toggle {
        min-height: 52px;
        padding: 0 14px;
        margin: 14px 0 0;
        border: 1px solid #e3e7e9;
        border-radius: 10px;
        background: #fff;
        color: #161e2d;
        font-size: 16px;
    }

    .rpg-property-detail-page .mortgage-calculator.rpg-mobile-mortgage-panel:not(.is-open) {
        display: none !important;
    }

    .rpg-property-detail-page .mortgage-calculator {
        margin: 14px 0 !important;
        border-radius: 12px !important;
    }

    .rpg-property-detail-page .mortgage-calculator__body,
    .rpg-property-detail-page .mortgage-calculator__form,
    .rpg-property-detail-page .mortgage-calculator__fields {
        grid-template-columns: 1fr !important;
    }

    .rpg-property-detail-page .mortgage-calculator input,
    .rpg-property-detail-page .mortgage-calculator select,
    .rpg-property-detail-page .mortgage-calculator button {
        min-height: 46px;
        font-size: 16px;
    }

    .rpg-property-detail-page .single-wrapper-review .wrap-form-comment,
    .rpg-property-detail-page .single-wrapper-review .box-title-review {
        padding: 14px !important;
        border-radius: 10px !important;
    }

    .rpg-property-detail-page .single-wrapper-review input,
    .rpg-property-detail-page .single-wrapper-review textarea,
    .rpg-property-detail-page .single-wrapper-review button {
        min-height: 46px;
        font-size: 16px;
    }

    .rpg-property-detail-page .property-share-social {
        flex-wrap: wrap;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    .rpg-property-detail-page .flat-latest-property {
        padding: 22px 0 24px !important;
    }

    .rpg-property-detail-page .flat-latest-property .box-title {
        margin-bottom: 14px !important;
    }

    .rpg-property-detail-page .flat-latest-property .section-title {
        margin-top: 4px !important;
        font-size: 25px !important;
        line-height: 1.25 !important;
    }

    .rpg-property-detail-page .tf-latest-property .swiper-slide {
        width: 88% !important;
        min-width: 88% !important;
        flex: 0 0 88% !important;
    }

    .rpg-mobile-contact-bar {
        position: fixed !important;
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        z-index: 1050 !important;
        transform: none !important;
        grid-template-columns: 1fr !important;
        padding: 9px 10px calc(9px + env(safe-area-inset-bottom)) !important;
    }

    .rpg-mobile-contact-bar__price {
        display: none !important;
    }

    .rpg-mobile-contact-bar__actions {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 7px !important;
    }

    .rpg-mobile-contact-bar__button {
        min-width: 0;
        min-height: 46px !important;
        padding: 6px 4px !important;
        border-radius: 9px !important;
        font-size: 12px !important;
    }

    .rpg-mobile-contact-bar__button--enquire {
        border: 1px solid #d9dee1;
        background: #fff;
        color: #161e2d !important;
    }

    .rpg-property-detail-page .footer {
        padding-bottom: 70px;
    }

    .footer .inner-footer .row > [class*="col"] {
        width: 100%;
        margin-bottom: 20px;
    }

    .footer .inner-footer {
        padding-top: 30px;
        padding-bottom: 10px;
    }

    .rpg-property-detail-page .footer .rpg-mobile-footer-section {
        margin-bottom: 0 !important;
        border-top: 1px solid rgba(255, 255, 255, .13);
    }

    .rpg-property-detail-page .footer .rpg-mobile-footer-toggle {
        width: 100%;
        min-height: 52px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        border: 0;
        background: transparent;
        color: #fff;
        font-size: 15px;
        font-weight: 700;
        text-align: left;
    }

    .rpg-property-detail-page .footer .rpg-mobile-footer-section:not(.is-open) > :not(.rpg-mobile-footer-toggle) {
        display: none !important;
    }

    .rpg-property-detail-page .footer .rpg-mobile-footer-section.is-open > :not(.rpg-mobile-footer-toggle) {
        padding-bottom: 16px;
    }
}

@media (max-width: 380px) {
    .rpg-property-detail-page .header-property-detail .info-box .meta {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .rpg-mobile-contact-bar__button span {
        font-size: 11px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .rpg-property-detail-page .flat-gallery-single {
        padding: 16px;
        gap: 10px;
    }

    .rpg-property-detail-page .single-property-contact {
        max-width: 720px;
        margin-right: auto;
        margin-left: auto;
    }

    .rpg-property-detail-page .flat-latest-property .swiper-slide {
        width: calc(50% - 8px) !important;
        min-width: calc(50% - 8px) !important;
        flex: 0 0 calc(50% - 8px) !important;
    }
}
