/* Mobile Responsiveness Improvements */
@media screen and (max-width: 768px) {
    .listings-grid {
        display: block;
        padding: 0;
    }
    
    .listing-banner {
        margin-bottom: 2rem;
        position: relative;
    }
    
    .listing-content {
        flex-direction: column;
    }
    
    /* Mobile Banner Image Slideshow */
    .listing-images {
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
        position: relative;
        height: 250px;
        overflow: hidden;
    }
    
    .listing-image {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        transition: opacity 1s ease;
        z-index: 1;
    }
    
    .listing-image.active {
        opacity: 1;
        z-index: 2;
    }
    
    .listing-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Image navigation controls */
    .image-nav {
        position: absolute;
        bottom: 10px;
        left: 0;
        right: 0;
        display: flex;
        justify-content: center;
        z-index: 3;
    }
    
    .image-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.5);
        margin: 0 4px;
        cursor: pointer;
        transition: background-color 0.3s ease;
    }
    
    .image-dot.active {
        background-color: #fff;
    }
    
    .listing-info {
        width: 100%;
        padding: 1rem;
    }
    
    .listing-quick-specs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .quick-spec {
        margin-right: 0;
    }
    
    .listing-title {
        font-size: 1.3rem;
        margin-bottom: 0.5rem;
    }
    
    .listing-description {
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    .listing-description p {
        margin-bottom: 0.75rem;
    }
    
    .listing-description ul {
        padding-left: 1rem;
    }
    
    .listing-price {
        font-size: 1.1rem;
        margin-top: 0.5rem;
    }
    
    /* Improve touch targets */
    .nav-link, .btn-get-started, .mobile-menu-link {
        padding: 0.75rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Popup Modal for Mobile */
    .listing-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.95);
        z-index: 1000;
        display: none;
        flex-direction: column;
        animation: modalFadeIn 0.3s ease forwards;
    }
    
    @keyframes modalFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
    
    .listing-modal.active {
        display: flex;
    }
    
    .modal-header {
        padding: 0.75rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        color: white;
        background-color: rgba(0, 0, 0, 0.8);
        z-index: 10;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .modal-title {
        font-size: 1.2rem;
        margin: 0;
    }
    
    .modal-close-btn {
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.25rem;
    }
    
    .modal-carousel {
        flex: 1;
        position: relative;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    /* Main image container */
    .main-image-container {
        flex: 1;
        position: relative;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
    }
    
    .modal-slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        transition: opacity 0.25s ease;
        padding: 0.5rem;
    }
    
    .modal-slide.active {
        opacity: 1;
        z-index: 1;
    }
    
    .main-image {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        object-position: center;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    /* Thumbnail container */
    .thumbnail-container {
        height: 65px;
        min-height: 65px;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        background-color: rgba(0, 0, 0, 0.8);
        padding: 5px;
        gap: 5px;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
        -webkit-overflow-scrolling: touch;
        margin-top: auto;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        justify-content: flex-start;
        align-items: center;
    }
    
    .thumbnail-container::-webkit-scrollbar {
        height: 4px;
    }
    
    .thumbnail-container::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .thumbnail-container::-webkit-scrollbar-thumb {
        background-color: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }
    
    .image-thumbnail {
        flex: 0 0 55px;
        height: 55px;
        border: 2px solid transparent;
        border-radius: 4px;
        overflow: hidden;
        opacity: 0.7;
        transition: all 0.2s ease;
    }
    
    .image-thumbnail.active {
        border-color: #ffffff;
        opacity: 1;
    }
    
    .image-thumbnail.pulse {
        animation: thumbnailPulse 0.3s ease;
    }
    
    @keyframes thumbnailPulse {
        0% { transform: scale(1); }
        50% { transform: scale(1.1); }
        100% { transform: scale(1); }
    }
    
    .image-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    /* Hide dots on mobile since we have thumbnails */
    .modal-nav {
        display: none;
    }
    
    /* Improve arrow visibility */
    .modal-arrows {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        display: flex;
        justify-content: space-between;
        padding: 0 10px;
        transform: translateY(-50%);
        z-index: 5;
        pointer-events: none;
    }
    
    .modal-arrow {
        width: 36px;
        height: 36px;
        background-color: rgba(0, 0, 0, 0.6);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 1.2rem;
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        pointer-events: auto;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    }
}

/* Small screen adjustments */
@media screen and (max-width: 480px) {
    .listing-quick-specs {
        grid-template-columns: 1fr;
    }
    
    .section-title {
        font-size: 1.6rem;
        margin-top: 1rem !important;
    }
    
    .listings-container {
        padding: 0 0.5rem !important;
    }
    
    .listing-images {
        height: 200px;
    }

    /* Further reduce sizes for the smallest screens */
    .modal-title {
        font-size: 0.95rem;
    }
    
    .thumbnail-container {
        height: 55px;
        min-height: 55px;
    }
    
    .image-thumbnail {
        flex: 0 0 45px;
        height: 45px;
    }
    
    .modal-arrow {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    
    .listing-description {
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    .listing-title {
        font-size: 1.2rem;
    }
    
    .quick-spec-label {
        font-size: 0.75rem;
    }
    
    .quick-spec-value {
        font-size: 0.85rem;
    }
}

/* Content scaling system */
html {
    font-size: 16px;
}

@media screen and (max-width: 1200px) {
    html {
        font-size: 15px;
    }
}

@media screen and (max-width: 992px) {
    html {
        font-size: 14px;
    }
}

@media screen and (max-width: 768px) {
    html {
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    html {
        font-size: 12px;
    }
} 