/* Buy and sell browse page */
/* Mobile layout and styling to match rentals page (2 per row, tightened spacing) */
@media (max-width: 576px) {
    .container-fluid { 
        padding-left: 2px !important; 
        padding-right: 2px !important; 
        box-sizing: border-box !important;
        margin-top: 10px !important;
    }
    
    .container { padding-left: 0.5rem; padding-right: 0.5rem; }
    
    /* Mobile: 2 items per row with proper spacing - match home section layout */
    #buysellContent {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 6px 6px !important; /* row-gap column-gap - minimal spacing */
        width: 100% !important;
        justify-content: flex-start !important;
        align-content: flex-start !important;
        overflow-x: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    #buysellContent .col-sm-6 {
        width: calc((100% - 6px) / 2) !important;
        max-width: calc((100% - 6px) / 2) !important;
        min-width: 0 !important;
        aspect-ratio: 3 / 4 !important; /* Force 3:4 ratio - height auto-calculated */
        height: auto !important; /* Let aspect-ratio calculate height */
        min-height: 0 !important;
        max-height: none !important;
        flex: 0 0 calc((100% - 6px) / 2) !important;
        margin: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        position: relative !important;
    }
    
    /* Cards: fill container, respect parent's 3:4 ratio - match home section */
    #buysellContent .listing-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 100% !important;
        min-height: 100% !important;
        max-height: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        padding: 0 !important; /* Remove padding, use specific element spacing */
        overflow: hidden !important; /* Hide overflow to maintain fixed size */
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
        aspect-ratio: 3 / 4 !important;
    }
    
    /* Card body: flexbox column layout with no padding - match home section */
    #buysellContent .listing-card .card-body {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Product Image: Scale the image itself, not a wrapper - make it larger */
    #buysellContent .card-img-top.buysell-product-image {
        height: 60% !important;
        max-height: 60% !important;
        min-height: 60% !important;
        width: 100% !important;
        max-width: 100% !important;
        object-fit: contain !important;
        margin: 0 !important;
        padding: 0.4rem 0.4rem 0.2rem 0.4rem !important;
        box-sizing: border-box !important;
        display: block !important;
        background: #fff !important;
        flex-shrink: 0 !important;
        /* Scale down the image (not the wrapper) slightly on mobile */
        transform: scale(0.95) !important;
        transform-origin: center center !important;
        image-rendering: auto !important;
    }
    
    /* Product Name: Fixed height for 2 lines max, then ellipsis - match home section */
    #buysellContent .card-title {
        height: auto !important;
        min-height: unset !important;
        max-height: 3.5em !important; /* Max 2 lines with padding */
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        line-height: 1.3 !important;
        margin: 0 !important;
        padding: 0.15rem 0.4rem 0.05rem 0.4rem !important;
        box-sizing: border-box !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        flex-shrink: 0 !important; /* Don't shrink, maintain space */
    }
    
    /* Vendor Name and Badge row - match home style */
    #buysellContent .listing-user-row {
        height: auto !important;
        min-height: unset !important;
        max-height: 2em !important; /* Prevent expansion */
        padding: 0.15rem 0.4rem !important;
        margin: 0 !important;
        font-size: 0.65rem !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
    
    /* Vendor name text */
    #buysellContent .listing-user-row span:not(.badge):not([class*="badge"]) {
        font-size: 0.65rem !important;
        line-height: 1.2 !important;
    }
    
    /* Avatar size */
    #buysellContent .listing-user-row .listing-avatar {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        min-height: 18px !important;
        border-radius: 50% !important;
        object-fit: cover !important;
        flex-shrink: 0 !important;
    }
    
    /* Verification badge scaling */
    #buysellContent .listing-user-row .badge,
    #buysellContent .listing-user-row span[class*="badge"],
    #buysellContent .listing-user-row .verification-badge {
        transform: scale(0.7) !important;
        transform-origin: left center !important;
        font-size: 0.6rem !important;
        padding: 0.15rem 0.3rem !important;
        line-height: 1 !important;
    }
    
    /* Vendor Name and Badge: Fixed height to prevent shifting - match home section */
    /* (Deprecated) */
    
    /* Price: Fixed height at bottom - match home section */
    #buysellContent .card-body > .card-text:not(.text-muted):not(.small) {
        height: auto !important;
        min-height: unset !important;
        max-height: 1.5em !important;
        font-size: 0.95rem !important;
        font-weight: 500 !important;
        margin: 0 !important;
        margin-top: 0 !important;
        padding: 0.2rem 0.4rem 0.25rem 0.4rem !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        overflow: hidden !important;
        color: #28a745 !important;
    }
    
    /* Hide View Details and Add to Cart buttons on mobile */
    #buysellContent .d-flex.gap-2 {
        display: none !important;
    }
    
    /* Hide description on mobile */
    #buysellContent .listing-description {
        display: none !important;
    }
    
}
