/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background: #121212;
    --swiper-stack-max: 560px;
    --swiper-mobile-header-buffer: 0px;
    --swiper-footer-offset: 0px;
    --swiper-action-bar-h: 76px;
    --swiper-action-gap: 18px;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    overflow: hidden;
    overflow-x: hidden;
    max-width: 100%;
    margin: 0;
    /* Swiper includes `header.html`, which loads `static/header.css` and sets
       `body{ padding-top: var(--topbar-h); }`. On the Swiper page we manage
       the header offset inside `.app-container`, so force body padding to 0
       to avoid double-spacing above the card deck. */
    padding: 0 !important;
    padding-top: 0 !important;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    overscroll-behavior: none; /* Prevent overscroll bounce */
}

* {
    font-family: 'Inter', sans-serif;
}

/* In-app WebView: avoid `vh` reflow bugs when the native bottom bar is shown/hidden.
   Use percentage heights so layout tracks the actual WebView size. */
html.is-app-webview,
html.is-app-webview body{
    height: 100%;
    min-height: 100%;
}

html.is-app-webview body{
    height: 100% !important;
    min-height: 100% !important;
}

/* Swiper uses a global border-box reset; the shared header search relies on content-box. */
header.topbar.topbar--brand form.mast-search,
header.topbar.topbar--brand .mast-input{
    box-sizing: content-box !important;
}

/* Reserve enough space so the deck doesn't sit under the native app header. */
html.is-app-webview{
    --topbar-h: var(--ss-native-header-h, calc(93px + env(safe-area-inset-top)));
}

html.is-mobile-web{
    --swiper-footer-offset: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom));
}

.app-container {
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile browsers */
    background: #121212;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    overflow: visible; /* changed from hidden to allow auth menu to show */
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    /* Header is fixed (from global header.css). Reserve space so content isn't hidden behind it. */
    padding-top: calc(var(--topbar-h) + var(--swiper-mobile-header-buffer));
}

html.is-app-webview .app-container{
    height: 100% !important;
    min-height: 100% !important;
}

/* Header */
.header {
    background: #121212;
    padding: 12px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.favourites-btn {
    background: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: all 0.3s ease, border-width 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.favourites-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.auth-btn {
    background: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease, border-width 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.auth-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.auth-dropdown {
    position: relative;
    display: inline-block;
}

.auth-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #121212;
    border: 1px solid #757575;
    border-radius: 8px;
    padding: 8px 0;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease, border-width 0.3s ease;
    z-index: 1000;
}

.auth-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Global header dropdown uses `.open` (not `.show`) */
.auth-menu.open{
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.auth-menu-item {
    width: 100%;
    background: transparent;
    color: #ffffff;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s ease;
    font-family: 'Inter', sans-serif;
    text-align: left;
}

.auth-menu-item:hover {
    background: #2a2a2a;
}

.auth-menu-item i {
    width: 16px;
    color: #757575;
}

/* Auth Modal Styles */
.auth-modal {
    max-width: 400px !important;
    width: 70% !important;
    min-height: 500px !important;
}

/* Login Modal Specific Styles */
#loginModalOverlay .auth-modal {
    max-height: none !important;
    max-width: 350px !important;
    width: 60% !important;
    min-height: 400px !important;
}

#loginModalOverlay {
    padding: 100px !important;
}

#loginModalOverlay .auth-modal-body {
    padding: 30px 40px 60px 40px !important;
}

/* Signup Modal Specific Styles */
#signupModalOverlay .auth-modal {
    max-height: none !important;
    max-width: 450px !important;
    width: 80% !important;
    min-height: 600px !important;
}

#signupModalOverlay {
    padding: 100px !important;
}

#signupModalOverlay .auth-modal-body {
    padding: 30px 40px 60px 40px !important;
}

.auth-input-group {
    margin-bottom: 20px;
}

.auth-input-group label {
    display: block;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.auth-input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #757575;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    background: #121212;
    color: #ffffff;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.auth-input-group input:focus {
    border-color: #ffffff;
}

.auth-input-group input::placeholder {
    color: #757575;
}

.auth-submit-btn {
    width: 100%;
    background: #667eea;
    color: #fff;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 10px;
}

.auth-submit-btn:hover {
    background: #5a6fd8;
}


/* Search and Filters */
.search-filters-container {
    background: #121212;
    padding: 10px 20px;
    border-bottom: 1px solid #757575;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.search-bar i {
    color: #ffffff;
    font-size: 16px;
    transition: color 0.3s ease;
}

.search-bar input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ffffff;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    background: #121212;
    color: #ffffff;
    transition: all 0.3s ease, border-width 0.3s ease;
    height: 48px;
    -webkit-appearance: none; /* Remove iOS input styling */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
    touch-action: manipulation; /* Prevent double-tap zoom */
}

.search-bar input:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-bar input:focus {
    border-color: #ffffff;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.search-bar input::placeholder {
    color: #ffffff;
    transition: color 0.3s ease;
}

.search-bar input:focus::placeholder {
    color: #ffffff;
}

.search-bar:focus-within .search-icon {
    color: #ffffff;
}

.filter-toggle-btn {
    background: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease, border-width 0.3s ease;
    height: 48px;
}

.filter-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.filter-toggle-btn i {
    color: #ffffff !important;
    transition: all 0.3s ease, border-width 0.3s ease;
}

.filter-toggle-btn:hover i {
    color: #ffffff !important;
}


.filter-section {
    margin-bottom: 20px;
}

.filter-section h3 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-inputs input {
    width: 165px;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: #121212;
    color: #ffffff;
    transition: border-color 0.3s ease;
}

.range-inputs input:focus {
    border-color: #667eea;
}

.range-inputs span {
    color: #ffffff;
    font-weight: 500;
}

.filter-section input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: #121212;
    color: #ffffff;
    transition: border-color 0.3s ease;
}

.filter-section input[type="text"]:focus {
    border-color: #667eea;
}

.filter-section input[type="text"]::placeholder {
    color: #757575;
}

.select-inputs {
    display: flex;
    gap: 10px;
}

.select-inputs select {
    flex: 1;
    padding: 10px 30px 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: #121212;
    color: #ffffff;
    cursor: pointer;
    transition: border-color 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

.select-inputs select:focus {
    border-color: #667eea;
}

.amenities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.amenity-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #121212;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease, border-width 0.3s ease;
}

.amenity-checkbox:hover {
    border-color: #667eea;
}

.amenity-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.amenity-checkbox label {
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
}

.amenity-checkbox.checked {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.clear-filters-btn, .apply-filters-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease, border-width 0.3s ease;
}

.clear-filters-btn {
    background: #e0e0e0;
    color: #2c3e50;
}

.clear-filters-btn:hover {
    background: #d0d0d0;
}

.apply-filters-btn {
    background: #27ae60;
    color: #fff;
}

.apply-filters-btn:hover {
    background: #229954;
}

/* Swiper Container */
.swiper-container {
    flex: 1;
    padding: 10px 20px calc(var(--swiper-footer-offset) + var(--swiper-action-bar-h) + var(--swiper-action-gap)) 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
}

html.is-mobile-web .swiper-container {
    padding-bottom: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom) + var(--swiper-action-bar-h) + 32px);
}

.swiper-stack {
    position: relative;
    width: 100%;
    max-width: 350px;
    height: 500px;
    perspective: 1000px;
    margin-top: 0;
}

/* Property Card */
.property-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #121212;
    border-radius: 20px;
    /* Softer, deeper shadow (the "second card" you see is mostly the stacked card) */
    box-shadow:
      0 18px 50px rgba(0,0,0,.55),
      0 6px 18px rgba(0,0,0,.35);
    overflow: hidden;
    cursor: grab;
    transition: transform 180ms ease-out, opacity 180ms ease-out, box-shadow 180ms ease-out;
    transform-origin: center center;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    contain: layout paint;
    z-index: 1;
    touch-action: pan-y; /* Allow vertical scrolling but handle horizontal swipes */
    user-select: none; /* Prevent text selection during swipe */
    -webkit-user-select: none;
    -webkit-touch-callout: none; /* Disable iOS callout menu */
}

.property-card:active {
    cursor: grabbing;
}

/* Mobile device specific styles */
.mobile-device {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

.mobile-device .property-card {
    touch-action: pan-y;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.mobile-device button, .mobile-device .action-btn, .mobile-device .favourites-btn, .mobile-device .filter-toggle-btn, .mobile-device .auth-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Improve touch feedback on mobile */
@media (hover: none) and (pointer: coarse) {
    .property-card {
        cursor: default;
    }
    
    .property-card:active {
        cursor: default;
        transform: scale(0.98);
    }
    
    /* Improve button touch feedback */
    .action-btn:active {
        transform: scale(0.95);
    }
    
    .favourites-btn:active {
        transform: scale(0.95);
    }
    
    .filter-toggle-btn:active {
        transform: scale(0.95);
    }
    
    /* Improve modal touch interactions */
    .modal-close:active {
        transform: scale(0.9);
    }
    
    /* Improve auth button touch feedback */
    .auth-btn:active {
        transform: scale(0.95);
    }
    
    .auth-menu-item:active {
        background: #3a3a3a;
    }
}

.property-card.dragging {
    transition: none;
    z-index: 100 !important; /* Even higher z-index during drag */
}

.property-card.swipe-left {
    transition: transform 180ms ease-out, opacity 180ms ease-out;
    transform: translateX(-100%) rotate(-30deg);
    opacity: 0;
}

.property-card.swipe-right {
    transition: transform 180ms ease-out, opacity 180ms ease-out;
    transform: translateX(100%) rotate(30deg);
    opacity: 0;
}

.property-card.next {
    /* Hide the next deck card completely; showing a visible peek below the
       current card reads like a second card deck on mobile. */
    transform: scale(1) translateY(0);
    z-index: 1;
    pointer-events: none; /* Prevent background cards from receiving events */
    opacity: 0;
    box-shadow: none;
}

.property-card.current {
    z-index: 10 !important; /* Much higher z-index for current card */
    pointer-events: auto; /* Ensure current card can receive events */
}

.property-card.property-card--skeleton {
    background: linear-gradient(180deg, #1a1a1a, #151515);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    cursor: default;
    pointer-events: none;
    overflow: hidden;
}

.property-card.property-card--skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-100%);
    animation: swiperSkeletonShimmer 1.4s infinite;
}

@keyframes swiperSkeletonShimmer {
    to { transform: translateX(100%); }
}

.property-skeleton-image {
    width: 100%;
    height: 60%;
    background: rgba(255, 255, 255, 0.03);
}

.property-skeleton-body {
    padding: 18px 22px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.property-skeleton-line {
    height: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.property-skeleton-line--price {
    height: 22px;
    width: 52%;
}

.property-skeleton-line--meta {
    width: 62%;
}

.property-skeleton-line--meta.short {
    width: 42%;
}

.property-skeleton-line--address {
    width: 74%;
}

/* Property Image */
.property-image {
    width: 100%;
    height: 60%;
    position: relative;
    overflow: hidden;
    background: #121212;
}

.property-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}

.property-image img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
    transform: translateZ(0);
}

.property-image .ss-card-carousel,
.property-image .ss-card-carousel-view{
    width:100%;
    height:100%;
}

.property-image .ss-card-carousel{
    background:#121212;
}

.property-card.current .property-image .ss-card-carousel-arrow{
    display:flex;
}

.property-card.next .property-image .ss-card-carousel-arrow,
.property-card.next .property-image .ss-card-carousel-dots{
    display:none;
}

.property-image .ss-card-carousel-image{
    width:100%;
    height:100%;
    object-fit:cover;
}

.property-price {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 16px;
}

.property-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #121212;
    color: #fff;
    padding: 6px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
}

/* Property Info */
/* Match results-feed stack underneath the image */
.property-card .pad{
    padding:14px 18px 16px;
    display:flex;
    flex-direction:column;
    gap:10px;
    height:40%;
    overflow:hidden;
    min-height:0;
    background:transparent;
}
.property-card h4{
    margin:0;
    font-size:20px;
    font-weight:800;
    letter-spacing:-0.02em;
    color:#ffffff;
}
.property-card .result-meta{
    color:#d0d0d0;
    font-size:14px;
    line-height:1.45;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.property-card .result-meta i{
    color:#b0b0b0;
    margin-right:0;
    width:14px;
    text-align:center;
    flex:0 0 auto;
}
.property-card .result-meta.meta-icons{
    display:flex;
    gap:14px;
    align-items:center;
    white-space:nowrap;
    overflow:hidden;
}
.property-card .result-meta.meta-icons .mi{
    display:inline-flex;
    align-items:center;
    gap:6px;
    color:#d0d0d0;
    font-size:14px;
    flex:0 0 auto;
}
.property-card .result-meta.meta-addr{
    display:flex;
    align-items:center;
    gap:6px;
}
.property-card .result-meta:nth-of-type(1){
    font-weight:600;
    color:#f5f5f5;
}
.property-card .result-meta:nth-of-type(2){
    color:#c0c0c0;
}
.property-card .result-meta:nth-of-type(3){
    color:#aaaaaa;
}

/* Shared stat-row card inside the swiper deck */
.property-card.result-card.stat-row{
    display:flex;
    flex-direction:column;
    padding:0;
}
.property-card.result-card.stat-row .ss-card-carousel{
    flex:1 1 auto;
    min-height:190px;
    margin:8px 8px 0;
}
.property-card.result-card.stat-row .ss-card-carousel-view,
.property-card.result-card.stat-row .ss-card-carousel-view img{
    width:100%;
    height:100%;
    min-height:190px;
}
.property-card.result-card.stat-row .pad{
    flex:0 0 auto;
    height:auto;
    min-height:0;
    display:flex;
    flex-direction:column;
    gap:0;
}
.property-card.result-card.stat-row .pricerow{
    display:flex;
    align-items:baseline;
    justify-content:space-between;
    gap:8px;
    flex-wrap:wrap;
    row-gap:4px;
}
.property-card.result-card.stat-row .price-meta{
    display:inline-flex;
    flex-direction:column;
    align-items:flex-end;
    gap:2px;
    min-width:0;
    margin-left:auto;
}
.property-card.result-card.stat-row .source{
    display:inline-flex;
    align-items:center;
    max-width:140px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:#f4f4f4;
    font-size:11px;
    font-weight:800;
    letter-spacing:.01em;
    text-transform:lowercase;
}
.property-card.result-card.stat-row .title{
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
}
.property-card.result-card.stat-row .city{
    display:-webkit-box;
    -webkit-line-clamp:1;
    -webkit-box-orient:vertical;
    overflow:hidden;
}
.property-card.result-card.stat-row .d-actions{
    margin-top:12px;
}
.property-card.result-card.stat-row .stats,
.property-card.result-card.stat-row .d-actions{
    flex:0 0 auto;
}
.property-card.result-card.stat-row .stats{
    margin-bottom:12px;
}
.property-card.current.result-card.stat-row .ss-card-carousel-arrow{
    opacity:1;
}
.property-card.result-card.stat-row .ss-card-carousel-dots{
    left: 50% !important;
    right: auto !important;
    bottom: 10px;
    transform: translateX(-50%) !important;
    justify-content: center;
    width: max-content;
}
.property-card.next.result-card.stat-row .ss-card-carousel-arrow,
.property-card.next.result-card.stat-row .ss-card-carousel-dots{
    display:none;
}

.property-title {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
    line-height: 1.3;
}

.property-location {
    color: #b0b0b0;
    font-size: 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.property-details {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #b0b0b0;
    font-size: 14px;
}

.property-description {
    color: #d0d0d0;
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    max-height: 4.2em; /* 3 lines * 1.4 line-height */
    word-wrap: break-word;
    word-break: break-word;
}

/* Fallback for browsers that don't support -webkit-line-clamp */
@supports not (-webkit-line-clamp: 3) {
    .property-description {
        display: block;
        max-height: 4.2em;
        overflow: hidden;
        position: relative;
    }
    
    .property-description::after {
        content: '...';
        position: absolute;
        bottom: 0;
        right: 0;
        background: #121212;
        padding-left: 20px;
    }
}

/* Action Buttons */
.action-buttons {
    position: fixed;
    bottom: calc(var(--swiper-footer-offset) + 18px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    z-index: 980;
    width: 100%;
    max-width: 400px;
    padding: 0 20px;
}

html.is-mobile-web .action-buttons {
    bottom: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom) + 24px) !important;
    z-index: 1200;
}

.main-buttons {
    display: flex;
    gap: 0px;
    align-items: flex-end;
}

.favourites-btn {
    position: absolute;
    right: 0px;
    bottom: 15px;
}

.action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease, border-width 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    min-height: 44px; /* Minimum touch target size */
    min-width: 44px;
    touch-action: manipulation; /* Prevent double-tap zoom */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
}

.pass-btn {
    background: rgba(231, 76, 60, 0.45);
    color: #fff;
    border: 1px solid #ffffff;
}

.pass-btn:hover {
    background: #c0392b;
}

.like-btn {
    background: rgba(39, 174, 96, 0.45);
    color: #fff;
    border: 1px solid #ffffff;
}

.like-btn:hover {
    background: #229954;
}

.undo-btn {
    background: #5a5a5a;
    color: #fff;
    width: 35px;
    height: 35px;
    font-size: 14px;
    margin: 0 -10px;
    z-index: 10;
    position: relative;
    border: 1px solid #ffffff;
}

.undo-btn:hover {
    background: #757575;
}

.action-btn:active {
    transform: scale(0.95);
}

/* Empty State */
.empty-state {
    text-align: center;
    color: #b0b0b0;
}

.empty-state-content i {
    font-size: 64px;
    color: #bdc3c7;
    margin-bottom: 20px;
}

.empty-state-content h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #ffffff;
}

.empty-state-content p {
    margin-bottom: 30px;
    font-size: 16px;
    color: #b0b0b0;
}

.refresh-btn {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    transition: all 0.3s ease, border-width 0.3s ease;
}

.refresh-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* prevent intercepting clicks while hidden */
    transition: all 0.3s ease, border-width 0.3s ease;
    padding: 40px;
}

.property-image.modal-hero{
    height: 400px;
}
.property-image.modal-hero::after{
    /* avoid extra gradient that can make images look "zoomed/dark" */
    height: 0;
    background: transparent;
}
.property-image.modal-hero img{
    width: 100%;
    height: 100%;
    object-fit: contain; /* show full image without cropping */
    background: #121212;
}
@media (max-width: 720px){
    .property-image.modal-hero{ height: 320px; }
}

#modalOverlay {
    z-index: 2000;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* enable interaction when visible */
}

.modal-content {
    background: #121212;
    border-radius: 20px;
    max-width: 54%; /* Reduced from 90% by 40% */
    max-height: 90%;
    overflow: hidden;
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

/* Favourites modal specific width */
#favouritesModalOverlay .modal-content {
    max-width: 550px; /* Increased from 500px by 10% */
    width: 90%;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

.modal-body {
    padding: 0;
    max-height: 80vh;
    max-height: 80dvh; /* Dynamic viewport height for mobile */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

#filtersModalBody {
    padding: 20px;
}

#favouritesModalBody {
    padding: 20px;
}

.favourites-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 25px;
    padding: 0 5px;
}

.favourites-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.favourites-sort-select {
    background: #1a1a1a;
    color: #ffffff;
    border: 1px solid #757575;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 30px;
    min-width: 150px;
}

.favourites-sort-select:focus {
    border-color: #667eea;
    outline: none;
}

.favourites-sort-select:hover {
    border-color: #ffffff;
}

.remove-all-btn {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease, border-width 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.remove-all-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.favourite-item {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.favourite-item:hover {
    background: #2a2a2a;
}

.favourite-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.favourite-item-title {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.favourite-item-price {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.favourite-item-location {
    color: #b0b0b0;
    font-size: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.favourite-item-details {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
}

.favourite-item-detail {
    color: #b0b0b0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.favourite-item-description {
    color: #d0d0d0;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    max-height: 2.8em; /* 2 lines * 1.4 line-height */
    word-wrap: break-word;
    word-break: break-word;
}

/* Fallback for browsers that don't support -webkit-line-clamp */
@supports not (-webkit-line-clamp: 2) {
    .favourite-item-description {
        display: block;
        max-height: 2.8em;
        overflow: hidden;
        position: relative;
    }
    
    .favourite-item-description::after {
        content: '...';
        position: absolute;
        bottom: 0;
        right: 0;
        background: #1a1a1a;
        padding-left: 20px;
    }
}

.favourite-item-image {
    width: 100%;
    height: 150px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
    object-fit: cover;
}

.favourite-item-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #121212;
    color: #fff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
}

.remove-favourite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e74c3c;
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease, border-width 0.3s ease;
    opacity: 0.9;
}

.remove-favourite-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
    opacity: 1;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.toast {
    background: #2c3e50;
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #27ae60;
}

.toast.error {
    background: #e74c3c;
}

/* Minimal swipe indicator (heart/X) */
.swipe-indicator{
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    font-size: 56px;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    z-index: 3000;
    transition: transform .2s ease, opacity .2s ease;
    filter: drop-shadow(0 6px 18px rgba(0,0,0,.35));
    color: #cfcfcf; /* default neutral gray */
}
.swipe-indicator.show{
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.swipe-indicator i{
    color: #cfcfcf; /* force gray on icon glyphs */
    font-size: 56px;
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    body {
        --swiper-mobile-header-buffer: 12px;
        --swiper-action-bar-h: 72px;
        --swiper-action-gap: 16px;
    }

    .app-container {
        max-width: 100%;
        box-shadow: none;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
    }
    
    .header {
        padding: 10px 15px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .auth-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .search-filters-container {
        padding: 8px 15px;
    }
    
    .search-bar input {
        font-size: 16px; /* Prevents zoom on iOS */
        height: 44px; /* Minimum touch target size */
    }
    
    .filter-toggle-btn {
        padding: 10px 16px;
        font-size: 13px;
        height: 44px;
    }
    
    .swiper-container {
        padding: 6px 15px calc(var(--swiper-footer-offset) + var(--swiper-action-bar-h) + var(--swiper-action-gap)) 15px;
    }

    html.is-mobile-web .swiper-container {
        padding-bottom: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom) + var(--swiper-action-bar-h) + 28px);
    }
    
    .swiper-stack {
        max-width: 100%;
        margin-top: 8px;
        height: clamp(410px, calc(100dvh - var(--topbar-h) - var(--swiper-mobile-header-buffer) - var(--swiper-footer-offset) - var(--swiper-action-bar-h) - 118px), 620px);
    }
    
    .property-card {
        border-radius: 16px;
    }
    
    .property-info {
        padding: 15px;
    }
    
    .property-title {
        font-size: 18px;
        line-height: 1.3;
    }
    
    .property-location {
        font-size: 13px;
        margin-bottom: 10px;
    }
    
    .property-details {
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .detail-item {
        font-size: 13px;
    }
    
    .property-description {
        font-size: 13px;
        line-height: 1.4;
        -webkit-line-clamp: 2;
        max-height: 2.8em;
    }
    
    .action-buttons {
        bottom: calc(var(--swiper-footer-offset) + 16px);
        padding: 0 15px;
    }

    html.is-mobile-web .action-buttons {
        bottom: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom) + 20px) !important;
    }
    
    .action-btn {
        width: 56px;
        height: 56px;
        font-size: 22px;
        min-height: 44px; /* Minimum touch target */
    }
    
    .undo-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .favourites-btn {
        padding: 8px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    
    /* Modal improvements for mobile */
    .modal-overlay {
        padding: 20px;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 16px;
    }
    
    #favouritesModalOverlay .modal-content {
        max-width: 100%;
        width: 100%;
    }
    
    .favourite-item-image {
        height: 120px;
    }
    
    .favourites-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .favourites-controls {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }
    
    .favourites-sort-select {
        flex: 1;
        min-width: 0;
        font-size: 14px;
    }
    
    .remove-all-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    /* Filter modal mobile improvements */
    #filtersModalBody {
        padding: 15px;
        max-height: 80vh;
        max-height: 80dvh;
        overflow-y: auto;
    }
    
    .filter-section {
        margin-bottom: 18px;
    }
    
    .filter-section h3 {
        font-size: 15px;
        margin-bottom: 8px;
    }
    
    .range-inputs {
        flex-direction: column;
        gap: 8px;
    }
    
    .range-inputs input {
        width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
        height: 44px;
    }
    
    .range-inputs span {
        text-align: center;
        font-size: 14px;
    }
    
    .select-inputs {
        flex-direction: column;
        gap: 8px;
    }
    
    .select-inputs select {
        font-size: 16px; /* Prevents zoom on iOS */
        height: 44px;
        padding: 10px 12px;
    }
    
    .amenities-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .amenity-checkbox {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: 8px;
        margin-top: 15px;
    }
    
    .clear-filters-btn, .apply-filters-btn {
        height: 44px;
        font-size: 16px;
    }
    
    /* Auth modal mobile improvements */
    .auth-modal {
        max-width: 100% !important;
        width: 100% !important;
        min-height: auto !important;
    }
    
    #loginModalOverlay, #signupModalOverlay {
        padding: 20px !important;
    }
    
    #loginModalOverlay .auth-modal-body,
    #signupModalOverlay .auth-modal-body {
        padding: 20px !important;
    }
    
    .auth-input-group input {
        font-size: 16px; /* Prevents zoom on iOS */
        height: 44px;
    }
    
    .auth-submit-btn {
        height: 44px;
        font-size: 16px;
    }
    
    /* Toast notifications mobile positioning */
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        font-size: 14px;
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    body {
        --swiper-action-bar-h: 68px;
        --swiper-action-gap: 14px;
    }

    .swiper-stack {
        margin-top: 6px;
        height: clamp(395px, calc(100dvh - var(--topbar-h) - var(--swiper-mobile-header-buffer) - var(--swiper-footer-offset) - var(--swiper-action-bar-h) - 112px), 610px);
    }

    html.is-mobile-web .swiper-container {
        padding-bottom: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom) + var(--swiper-action-bar-h) + 24px);
    }

    html.is-mobile-web .action-buttons {
        bottom: calc(var(--ss-tabbar-h) + env(safe-area-inset-bottom) + 18px) !important;
    }
    
    .property-title {
        font-size: 16px;
    }
    
    .action-btn {
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
    
    .undo-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .favourites-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .modal-overlay {
        padding: 15px;
    }
    
    .favourite-item-image {
        height: 100px;
    }
    
    .favourite-item-title {
        font-size: 16px;
    }
    
    .favourite-item-price {
        font-size: 14px;
    }
}

@media (min-width: 768px) {
    .app-container {
        max-width: 100%;
    }
    
    .swiper-stack {
        --swiper-stack-max: 420px;
        height: clamp(500px, calc(100dvh - var(--topbar-h) - 220px), 640px);
    }
}

/* Animation Classes */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-50px);
    }
}

.property-card.animate-in {
    animation: slideIn 0.5s ease-out;
}

.property-card.animate-out {
    animation: slideOut 0.3s ease-in;
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #b0b0b0;
}

.loading i {
    font-size: 32px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Touch-specific optimizations for mobile devices */
@media (hover: none) and (pointer: coarse) {
    .property-card {
        touch-action: pan-y;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    .action-btn, .favourites-btn, .filter-toggle-btn, .auth-btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .search-bar input {
        -webkit-appearance: none;
        appearance: none;
    }
    
    .modal-body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
}

/* Mobile device class for additional touch optimizations */
.mobile-device .property-card {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.mobile-device .action-btn,
.mobile-device .favourites-btn,
.mobile-device .filter-toggle-btn,
.mobile-device .auth-btn {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
