/* Property Gallery Styles - Bootstrap Grid-Based Layout */

/* Main Gallery Container */
.property-gallery-section {
    margin-bottom: 30px;
    margin-top: 20px;
}

/* Main Image Container */
.property-main-image {
    position: relative;
    margin-bottom: 0;
    overflow: hidden;
    height: 400px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Main Image Styling */
.img-main-gallery {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.img-main-gallery:hover {
    transform: scale(1.02);
}

/* Thumbnails Container */
.property-thumbnails-container {
    height: 100%;
}

/* Individual Thumbnail Wrapper */
.thumbnail-wrapper {
    padding: 2px;
    margin-bottom: 4px;
    height: 120px;
    overflow: hidden;
}

/* Thumbnail Image Styling */
.thumbnail-gallery {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.thumbnail-gallery:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Show All Photos Button */
.show-all-photos-row {
    margin-top: 10px;
}

.show-all-photos {
    width: 100%;
    text-align: center;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    padding: 8px;
    transition: all 0.3s ease;
}

.show-all-photos:hover {
    background-color: #e9ecef;
    color: #333;
}

/* Gallery Modal Styling */
#propertyGalleryModal .modal-dialog {
    width: 90%;
    max-width: 1200px;
    margin: 30px auto;
}

#propertyGalleryModal .modal-content {
    background-color: #fff;
    border-radius: 6px;
    overflow: hidden;
}

#propertyGalleryModal .modal-header {
    padding: 15px;
    border-bottom: 1px solid #e5e5e5;
    background-color: #f8f9fa;
}

#propertyGalleryModal .modal-body {
    padding: 0;
}

/* Carousel Customization */
#galleryCarousel {
    background-color: #000;
}

#galleryCarousel .carousel-inner {
    height: 500px;
}

#galleryCarousel .item {
    text-align: center;
    height: 500px;
}

#galleryCarousel .item img {
    max-height: 500px;
    margin: 0 auto;
    object-fit: contain;
}

#galleryCarousel .carousel-control {
    background-image: none;
    width: 50px;
    color: #fff;
    opacity: 0.8;
}

#galleryCarousel .carousel-control:hover {
    opacity: 1;
}

/* Slide Counter */
.carousel-caption .slide-number {
    position: absolute;
    right: 20px;
    bottom: 20px;
    color: white;
    background-color: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 14px;
}

/* Thumbnails in Modal */
.carousel-thumbnails {
    background-color: #333;
    padding: 10px 0;
}

.carousel-thumbnails .thumbnail {
    margin-bottom: 0;
    height: 60px;
    overflow: hidden;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.carousel-thumbnails .thumbnail.active,
.carousel-thumbnails .thumbnail:hover {
    opacity: 1;
    border-color: #fff;
}

.carousel-thumbnails .thumbnail img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .property-main-image {
        height: 300px;
        margin-bottom: 10px;
    }
    
    .thumbnail-wrapper {
        height: 100px;
        margin-bottom: 10px;
    }
    
    #galleryCarousel .carousel-inner,
    #galleryCarousel .item {
        height: 400px;
    }
    
    #galleryCarousel .item img {
        max-height: 400px;
    }
}

@media (max-width: 767px) {
    .property-main-image {
        height: 250px;
    }
    
    .thumbnail-wrapper {
        height: 80px;
    }
    
    #galleryCarousel .carousel-inner,
    #galleryCarousel .item {
        height: 300px;
    }
    
    #galleryCarousel .item img {
        max-height: 300px;
    }
}

/* Gallery Fix for CI3 Layout Compatibility */

/* Main Gallery Container */
.gallery_container {
    width: 100%;
    margin: 0;
    padding: 20px 5px;
    background: transparent; /* base page remains as-is */
}

.gallery {
    display: flex;
    gap: 4px;
    height: 100%; /* fixed, predictable canvas */
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
}

/* Left Gallery - Main Image */
.left_gallery {
    flex: 1;
    height: 100%;
    position: relative;
}

.left_gallery .image_holder {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
}

.left_gallery .gallery_image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* show full image without cropping */
    background: #fff;
    transition: transform 0.3s ease;
}

.left_gallery .image_holder:hover .gallery_image {
    transform: scale(1.02);
}

/* Right Gallery - Thumbnails Grid */
.right_gallery {
    flex: 0 0 48%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.right_line_gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 4px;
    height: 100%;
    flex: 1;
}

.right_line_gallery .image_holder {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.right_line_gallery .image_holder:first-child {
    border-radius: 0 8px 0 0;
}

.right_line_gallery .image_holder:nth-child(2) {
    border-radius: 0 0 8px 0;
}

.right_line_gallery .image_holder:nth-child(3) {
    border-radius: 0 0 0 0;
}

.right_line_gallery .image_holder:nth-child(4) {
    border-radius: 0 0 8px 0;
    position: relative;
}

.right_line_gallery .gallery_image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* avoid cropping thumbs */
    background: #fff;
    transition: transform 0.3s ease;
}

.right_line_gallery .image_holder:hover .gallery_image {
    transform: scale(1.05);
}

/* Show All Photos Button */
.show_all {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #222;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(2px);
    z-index: 30; /* keep above images regardless of aspect ratio */
}

.show_all:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.show_all .left_icon {
    display: flex;
    align-items: center;
    width: 18px;
    height: 18px;
}

.show_all .left_icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.show_all .right_text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #222;
    font-size: 14px;
    font-weight: 600;
}

/* Dark Overlay */
.darkish_overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    transition: background 0.3s ease;
    pointer-events: none;
}

.image_holder:hover .darkish_overlay {
    background: rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 1299px) {
    .gallery_container {
        padding: 20px 0;
    }
}

@media (max-width: 1199px) {
    .gallery_container {
        padding: 15px 0;
    }
    
    .gallery {
        height: 450px;
        width: 98vw;
    }
}

@media (max-width: 991px) {
    .gallery_container {
        padding: 15px 0;
    }
    
    .gallery {
        height: auto;
        width: 96vw;
    }
    
    .right_gallery {
        flex: 0 0 45%;
    }
    
    .show_all {
        padding: 6px 10px;
        font-size: 13px;
    }
}

@media (max-width: 767px) {
    .gallery {
        flex-direction: column;
        height: auto;
        gap: 8px;
    }
    
    .left_gallery {
        height: 250px;
    }
    
    .left_gallery .image_holder {
        border-radius: 8px;
    }
    
    .right_gallery {
        flex: none;
        height: 200px;
    }
    
    .right_line_gallery {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: 1fr;
        gap: 4px;
        height: 100%;
    }
    
    .right_line_gallery .image_holder {
        border-radius: 4px !important;
    }
    
    .show_all {
        position: relative;
        bottom: auto;
        right: auto;
        margin-top: 8px;
        justify-content: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .gallery_container {
        padding: 0 10px;
    }
    
    .left_gallery {
        height: 200px;
    }
    
    .right_gallery {
        height: 150px;
    }
    
    .right_line_gallery {
        gap: 2px;
    }
}

/* Override any conflicting styles */
.gallery_container .gallery .left_gallery,
.gallery_container .gallery .right_gallery {
    margin: 0;
    padding: 0;
}

.gallery_container .gallery .image_holder {
    margin: 0;
    padding: 0;
    background: #f8f9fa;
}

/* Ensure proper image loading */
.gallery_image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Fix for any Bootstrap conflicts */
.gallery_container * {
    box-sizing: border-box;
}

.content-fixed-listing {
    margin-bottom: 40px;
    margin-top: 20px;
    width: 100%;
    padding-left: 20px !important;
    padding-right: 20px !important;
    box-sizing: border-box;
}

/* Additional fixes for the exact layout match */
.row.content-fixed-listing {
    margin: 20px 0 40px 0;
    width: 100%;
    padding: 0 20px;
    max-width: none;
    box-sizing: border-box;
}

.gallery_container .gallery {
    /* Styles already defined above */
}

.gallery_container .gallery .left_gallery .image_holder {
    border-radius: 0;
}

.gallery_container .gallery .right_line_gallery .image_holder {
    border-radius: 0;
}

/* Perfect positioning for show all button to match original */
.right_gallery .show_all {
    position: absolute;
    bottom: 40px;
    right: 8px;
    left: 8px; /* ensure equal inset from left so it doesn't hang outside */
    z-index: 15;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    color: #222;
    backdrop-filter: blur(2px);
    text-align: center;
}

.right_gallery .show_all:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.3);
}

/* Ensure content below gallery has proper padding */
.single-content.listing-content {
    padding: 0 20px;
    box-sizing: border-box;
}

.col-md-8, .col-md-4 {
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}

/* Override Bootstrap column gutters for better spacing */
.listing_wrapper.row .col-md-8,
.listing_wrapper.row .col-md-4 {
    padding-left: 20px;
    padding-right: 20px;
}

