:root {
    --mobile-header-height: 60px;
    --mobile-footer-height: 60px;
    & .mobile-filters-content {
        padding: 16px 16px 60px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    & .mobile-filters-done-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        border-radius: 50%;
        background: var(--accent);
        color: var(--text-secondary);
        border: none;
        font-weight: 600;
        font-size: 18px;
        cursor: pointer;
        box-shadow: var(--shadow-sm);
        z-index: 10001;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: 0.3s linear;
        opacity: 1;
        animation: 0.6s ease 0s 1 normal none running fadeIn;
        transform: scale(1);
    }

    & .mobile-filters-done-btn:active {
        transform: scale(0.95);
        box-shadow: rgba(79, 70, 229, 0.2) 0px 2px 8px;
    }

    & .mobile-filters-done-btn.hidden {
        opacity: 0;
        transform: scale(0);
        pointer-events: none;
        transition: 0.3s linear;
    }

    & .mobile-filters-content .filter-dropdown {
        width: 100%;
        border-bottom: 1px solid rgb(241, 245, 249);
        padding-bottom: 8px;
    }

    & .mobile-filters-content .pill {
        width: 100%;
        justify-content: space-between;
        border: none;
        background: rgb(248, 250, 252);
        padding: 12px;
        font-size: 15px;
    }

    & .mobile-filters-content .filter-popup {
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid rgb(238, 238, 238);
        margin-top: 8px;
        max-height: none;
    }
}

@media (max-width: 768px) {
    body {
        overflow: hidden auto;
        height: auto;
        min-height: 100vh;
        padding-bottom: 140px;
        background: var(--bg-panel);
        display: block;
    }

    .legal-footer {
        border: none;
    }

    .modal-window {
        height: 100%;
        max-height: 100%;
        width: 100%;
        border-radius: 0px;
        padding: 7px 15px 15px;
    }

    .modal-window h2 {
        font-size: 18px;
    }

    .page {
        height: auto;
        overflow: visible;
        padding: 0px;
    }

    .cockpit {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .topbar {
        position: fixed;
        top: 0px;
        z-index: 1100;
        background: var(--bg-panel);
        height: var(--mobile-header-height);
        padding: 8px 16px;
        display: flex;
        align-items: center;
        gap: 12px;
        border: none;
        box-shadow: rgba(0, 0, 0, 0.08) -6px -16px 20px 20px;
    }

    .topbar .brand {
        display: flex;
        width: fit-content;
        max-width: 140px;
    }

    .topbar .brand img.mobile-logo-img {
        height: 60px;
        width: 60px;
        object-fit: contain;
        object-position: center center;
    }

    .topbar .main-nav {
        display: none;
    }

    .search-box {
        flex: 1 1 0%;
        max-width: none;
        display: flex;
        gap: 8px;
    }

    .search-box input {
        width: 100%;
        height: 40px;
        border-radius: 26px;
        border: 1px solid var(--border);
        padding: 0px 12px;
        background: var(--bg-lighter);
        font-size: 16px;
        outline: none;
    }

    .mobile-filter-btn {
        height: 40px;
        width: 40px;
        border-radius: 26px;
        border: solid 1px var(--border);
        background: var(--bg-panel);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-main);
        cursor: pointer;
        flex-shrink: 0;
    }

    .mobile-filter-btn:active {
        background: rgb(241, 245, 249);
    }

    .left-column {
        width: 100%;
        height: auto;
        overflow: visible;
        border-right: none;
        padding-bottom: 0px;
        padding-top: 60px;
    }

    .list-panel {
        width: 100%;
        border: none;
        height: -webkit-fill-available;
    }

    .list-header {
        padding: 12px 16px 0px;
        background: transparent;
        font-size: 12px;
    }

    .filters-bar {
        display: none;
    }

    .cards {
        display: flex;
        flex-direction: column;
        gap: 0px;
        padding: 15px 15px 0px;
        min-height: fit-content;
        height: -webkit-fill-available;
    }

    .property-card {
        background: var(--bg-panel);
        border-radius: 12px;
        overflow: hidden;
        box-shadow: rgba(0, 0, 0, 0.08) 0px 2px 8px;
        border: none;
        display: flex;
        flex-direction: column;
        margin-bottom: 16px;
        padding: 0px;
    }

    .card-top-row {
        display: flex;
        flex-direction: column;
    }

    .card-thumb {
        width: 100%;
        height: 220px;
        object-fit: cover;
        border-radius: 0px;
    }

    .card-content {
        padding: 16px;
        width: 100%;
    }

    .card-price {
        font-size: 20px;
        font-weight: 700;
        color: var(--text-main);
        margin-bottom: 4px;
    }

    .card-title {
        font-size: 16px;
        font-weight: 500;
        color: var(--text-main);
        margin-bottom: 8px;
        line-height: 1.4;
    }

    .card-meta {
        font-size: 14px;
        color: var(--text-muted);
        margin-bottom: 12px;
    }

    .card-features {
        display: flex;
        gap: 12px;
        color: var(--text-muted);
        font-size: 14px;
        padding: 0px 16px 16px;
        border-top: none;
        flex-wrap: wrap;
    }

    .feature-item {
        display: flex;
        align-items: center;
        gap: 4px;
        background: var(--bg-dark);
        padding: 4px 8px;
        border-radius: 16px;
    }

    .right-column {
        position: fixed;
        top: var(--mobile-header-height);
        left: 0px;
        width: 100%;
        height: calc(100vh - var(--mobile-header-height) - var(--mobile-footer-height));
        z-index: 1000;
        display: none;
    }

    .right-column.active {
        display: block;
    }

    .map-panel {
        height: 100%;
        width: 100%;
        border-radius: 0px;
        border: none;
    }

    .map-filters {
        display: none;
    }

    .draw-banner {
        bottom: 75px;
        max-width: calc(100% - 40px);
        white-space: normal;
        width: 100%;
    }

    .mobile-only {
        display: flex !important;
    }

    .bottom-nav {
        position: fixed;
        bottom: 0px;
        left: 0px;
        width: 100%;
        height: var(--mobile-footer-height);
        background: rgb(255, 255, 255);
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 1100;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: rgba(0, 0, 0, 0.08) -20px -2px 9px 4px;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 10px;
        gap: 4px;
        flex: 1 1 0%;
        height: 100%;
    }

    .bottom-nav-item[data-nav-target="chat-ai"] span{
        transform: translate(0,13px);
        transition: all ease 0.25s;
    }
    .bottom-nav-item.active[data-nav-target="chat-ai"] span{
        transform: translate(0,0);
    }

    .bottom-nav-item.active {
        color: var(--color-accent);
    }

    .bottom-nav-item.active i.fa-sami{
        padding:0;
    }

    .bottom-nav-item i {
        font-size: 20px;
    }

     .bottom-nav-item i.fa-sami{
         padding: 16px;
         background-size: 50px;
         background-position: center 2px;
         border-radius: 50%;
         background-repeat: no-repeat;
         background-image: url('https://mcfrancis.com/assets/css/img/ai-human-animation.webp');
         position: absolute;
         transform: translate(0, -10px);
         border-top-color: transparent;
         transition:all ease .5s;
     }

    .bottom-nav-item i.fa-sami:before{
        content:'';
        position: absolute;
        padding: 14px;
        background: transparent;
        top:0;
        left: 0;
        border-radius:50%;
        z-index: -1000;
        display: block;
        border: solid 2px var(--accent-dim-2);
        border-bottom-color: transparent;
        animation: loading 4s ease infinite;
        transition:all ease .3s;
      
    }

    .bottom-nav-item.active i.fa-sami:before{
        padding:0;
        border: solid 0px transparent;
        background: var(--accent); 
    }

    .map-toggle-btn {
        position: fixed;
        bottom: calc(var(--mobile-footer-height) + 20px);
        left: 50%;
        transform: translateX(-50%);
        background: var(--color-accent);
        color: rgb(255, 255, 255);
        border: none;
        padding: 10px 24px;
        border-radius: 24px;
        font-weight: 600;
        font-size: 14px;
        box-shadow: rgba(0, 81, 255, 0.3) 0px 4px 12px;
        z-index: 1050;
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
        transition: transform 0.2s;
    }

    .map-toggle-btn:active {
        transform: translateX(-50%) scale(0.95);
    }

    .draw-controls {
        bottom: unset;
        top: 10px;
    }

    .pill-draw {
        font-size: 11px;
    }

    .mobile-cta-bar {
        position: fixed;
        bottom: var(--mobile-footer-height);
        left: 0px;
        width: 100%;
        padding: 12px 16px;
        z-index: 1090;
        display: flex;
    }

    .cta-interest {
        background-color: rgb(239, 68, 68);
        position: fixed;
        bottom: calc(var(--mobile-footer-height) + 20px);
        left: 50%;
        transform: translateX(-50%);
        color: rgb(255, 255, 255);
        border: none;
        padding: 10px 24px;
        border-radius: 24px;
        font-weight: 600;
        font-size: 14px;
        box-shadow: rgba(255, 0, 0, 0.3) 0px 4px 12px;
        z-index: 1050;
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
        transition: transform 0.2s;
        text-transform: capitalize;
    }

    .cta-interest:active {
        background-color: rgb(220, 38, 38);
    }

    .modal-overlay {
        align-items: center;
        padding: 0px;
        z-index: 1200;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0px;
        display: flex;
        flex-direction: column;
        max-height: none;
    }

    .modal-body {
        flex: 1 1 0%;
        overflow-y: auto;
        max-height: calc(-120px + 100vh);
    }

    .agent-avatar {
        width: 50px;
        height: 50px;
    }

    .detail-grid {
        display: flex;
        flex-direction: column;
    }

    .detail-grid .right-column {
        order: -1;
        width: 100%;
        height: 40vh;
        border-left: none;
        border-bottom: 1px solid var(--border);
    }

    .detail-left .gallery-container {
        width: 100%;
        min-height: fit-content;
        height: auto;
        margin-bottom: 16px;
        display: block !important;
    }

    .detail-grid .right-column .detail-right {
        display: none;
    }

    .detail-grid .right-column .bottom-panels {
        display: flex;
    }

    #mobilePlanSection {
        display: none !important;
    }

    #mobilePlanSection .main-image-area {
        overflow-x: visible;
        gap: 16px;
        padding-bottom: 16px;
        flex-direction: column !important;
        height: auto !important;
    }

    #mobilePlanSection .gallery-image {
        width: 100%;
        min-width: 0px;
        object-fit: contain;
        border: 1px solid var(--border);
        background: rgb(248, 250, 252);
        height: auto !important;
        border-radius: 8px !important;
    }

    .detail-grid .left-column {
        order: 2;
        width: 100%;
        overflow: visible;
    }

    .detail-right {
        height: 100%;
        padding: 0px;
    }

    .gallery-container {
        height: 100%;
        border-radius: 0px;
    }

    .main-image-area {
        height: 100%;
        border-radius: 0px;
        background: transparent;
    }

    .main-image-area img {
        object-fit: cover;
    }

    .gallery-tabs, .thumbs-scroll-container {
        display: none;
    }

    #mobilePlanSection {
        margin-top: 24px;
        padding-top: 24px;
        border-top: 1px solid var(--border);
    }

    #mobilePlanSection img {
        width: 100%;
        height: auto;
        border-radius: 8px;
        border: 1px solid var(--border);
    }

    #mobileTabContent {
        display: none;
        padding: 20px 0px;
    }

    #mobileTabContent.active {
        display: block;
    }

    .detail-left {
        border: none;
        border-radius: 0px;
        background: transparent;
    }

    .detail-header {
        border-bottom: none;
        padding-bottom: 8px;
    }

    .detail-box {
        padding-bottom: 0px;
    }

    .feature-row {
        padding: 0px 0px 8px;
    }

    .detail-scroll-content.hidden {
        display: none;
    }

    body.mobile-chat-view-active {
        overflow: hidden !important;
    }

    body.mobile-chat-view-active .right-column {
        z-index: 1150;
        pointer-events: none;
        display: block !important;
        background: transparent !important;
        top: 0px !important;
        height: 100% !important;
        left: 0px !important;
        width: 100% !important;
        position: fixed !important;
    }

    body.mobile-chat-view-active .bottom-panels {
        pointer-events: none;
        height: 100%;
        width: 100%;
        margin-top: 50%;
        display: block !important;
    }

    body.mobile-chat-view-active .map-panel, body.mobile-chat-view-active .detail-right {
        display: none !important;
    }

    body.mobile-chat-view-active .avatar-panel {
        top: 0px;
        left: 0px;
        width: 100%;
        height: 35%;
        z-index: 1200;
        background: rgb(239, 241, 245);
        align-items: flex-end;
        justify-content: center;
        border: none;
        border-radius: 0px;
        pointer-events: auto;
        max-width: -webkit-fill-available;
        position: fixed !important;
        display: flex !important;
    }

    .avatar-panel img, .avatar-panel canvas {
        min-height: -webkit-fill-available;
        height: 100% !important;
        margin-top: 0px !important;
    }

    body.mobile-chat-view-active .avatar-panel img.avatar-image {
        height: 100%;
        width: 100%;
        object-fit: contain;
    }

    body.mobile-chat-view-active .cta-panel, body.mobile-chat-view-active .chat-panel {
        bottom: var(--mobile-footer-height);
        left: 0px;
        width: 100%;
        height: calc(65% - 58px);
        z-index: 1200;
        background: rgb(255, 255, 255);
        border-right: none;
        border-bottom: none;
        border-left: none;
        border-image: initial;
        border-radius: 0px;
        border-top: 1px solid var(--border);
        padding: 0px;
        pointer-events: auto;
        justify-content: space-between;
        position: fixed !important;
        display: flex !important;
    }

    body.mobile-chat-view-active .map-toggle-btn {
        display: none !important;
    }

    body.mobile-chat-view-active .mobile-cta-bar {
        display: none !important;
    }

    .mobile-detail-tabs {
        flex: 1 1 0%;
        display: flex;
        align-items: center;
        justify-content: space-around;
        height: 100%;
    }

    .mobile-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: var(--text-muted);
        cursor: pointer;
        font-size: 10px;
        padding: 0px 4px;
    }

    .mobile-tab i {
        font-size: 16px;
    }

    .mobile-tab.active {
        color: var(--color-accent);
        font-weight: 600;
    }

    .avatar-overlay {
        position: fixed;
        top: 0px;
        left: 0px;
        width: 100%;
        height: 100%;
        background: rgb(239, 241, 245);
        z-index: 2000;
        display: flex;
        flex-direction: column;
    }

    .avatar-overlay.hidden {
        display: none !important;
    }

    .overlay-header {
        position: fixed;
        top: 0px;
        left: 0px;
        width: 100%;
        padding: 10px 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 2010;
        background: transparent;
        border: none;
    }

    .overlay-content {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .avatar-full-box {
        width: 100%;
        height: 35%;
        max-height: calc(35% - 64px);
        min-height: 264px;
        background: rgb(239, 241, 245);
        display: flex;
        align-items: center;
        justify-content: center;
        transition: height 0.5s;
    }

    .onboarding-box {
        width: 100%;
        height: 65%;
        background: rgb(255, 255, 255);
        padding: 0px;
        overflow-y: auto;
        transition: height 0.5s, opacity 0.3s;
        display: flex;
        flex-direction: column;
    }

    .onboarding-widget-container {
        margin: 0px;
        border-radius: 0px;
        padding: 10px 10px 0px;
    }

    .avatar-overlay.full-mode .avatar-full-box {
        height: 100%;
    }

    .avatar-overlay.full-mode .onboarding-box {
        height: 0px;
        padding: 0px;
        overflow: hidden;
        opacity: 0;
    }

    .mortgage-container .mortgage-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .mortgage-result {
        grid-column: 1 / -1;
    }

    .legal-page {
        display: block !important;
        height: auto !important;
        overflow-y: auto !important;
    }

    .legal-page .legal-container {
        padding: 16px;
        gap: 0px;
        display: block !important;
    }

    .legal-page .legal-sidebar {
        width: 100%;
        margin-bottom: 24px;
        border: none;
        background: transparent;
        padding: 0px;
        position: static !important;
        max-height: none !important;
        min-height: auto !important;
    }

    .legal-page .legal-nav-title {
        margin-bottom: 12px;
        border-bottom: 1px solid var(--border);
        padding-bottom: 8px;
        margin-top: 60px;
    }

    .legal-page .legal-content-wrapper {
        width: 100%;
        border: none;
        background: transparent;
        padding: 0px;
        min-height: auto;
        max-height: none !important;
        overflow: visible !important;
    }

    .legal-page .legal-header h1 {
        font-size: 24px;
    }
}
