/**
 * Custom Gallery Styles
 * Rounded corners, animations, and visual enhancements for all galleries
 */

/* Gallery Grid Styles */
.auction-gallery-grid,
.single-property-gallery .row {
    margin-top: 20px;
}

.auction-gallery-item,
.single-property-gallery a[data-fancybox] {
    display: block;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.auction-gallery-wrapper,
.single-property-gallery a[data-fancybox] > div,
.single-property-gallery .box-img {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.auction-gallery-wrapper:hover,
.single-property-gallery a[data-fancybox]:hover > div,
.single-property-gallery .box-img:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.auction-gallery-wrapper img,
.single-property-gallery a[data-fancybox] img,
.single-property-gallery .box-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
    display: block;
    transition: transform 0.3s ease;
}

/* First image (full width) in auction gallery */
.auction-gallery-grid .col-md-12 .auction-gallery-wrapper {
    height: 450px;
}

/* Other images (half width) in auction gallery */
.auction-gallery-grid .col-md-6 .auction-gallery-wrapper {
    height: 280px;
}

/* Property detail gallery images */
.single-property-gallery .box-img {
    height: 100%;
    min-height: 400px;
}

.auction-gallery-wrapper:hover img,
.single-property-gallery a[data-fancybox]:hover img,
.single-property-gallery .box-img:hover img {
    transform: scale(1.05);
}

.gallery-overlay,
.single-property-gallery a[data-fancybox] .gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 16px;
}

.gallery-overlay i,
.single-property-gallery a[data-fancybox] .gallery-overlay i {
    color: #fff;
    font-size: 48px;
}

.auction-gallery-wrapper:hover .gallery-overlay,
.single-property-gallery a[data-fancybox]:hover .gallery-overlay {
    opacity: 1;
}

/* Property listing cards */
.box-dream .box-img,
.property-item .box-img,
.homeya-box .box-img {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
}

.box-dream .box-img img,
.property-item .box-img img,
.homeya-box .box-img img {
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.box-dream:hover .box-img img,
.property-item:hover .box-img img,
.homeya-box:hover .box-img img {
    transform: scale(1.05);
}

/* Property detail gallery (flat-gallery-single) */
.flat-gallery-single .box-img {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.flat-gallery-single .box-img:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.flat-gallery-single .box-img img {
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.flat-gallery-single .box-img:hover img {
    transform: scale(1.05);
}

/* Add overlay to flat-gallery-single */
.flat-gallery-single .box-img::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 16px;
    pointer-events: none;
}

.flat-gallery-single .box-img:hover::after {
    opacity: 1;
}

/* View All Photos button styling */
.flat-gallery-single .box-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 2;
}

.flat-gallery-single .box-btn .tf-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #161e2d;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.flat-gallery-single .box-btn .tf-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .auction-gallery-grid .col-md-12 .auction-gallery-wrapper,
    .auction-gallery-grid .col-md-6 .auction-gallery-wrapper {
        height: 250px;
    }

    .single-property-gallery .box-img {
        min-height: 250px;
    }
}

/* Fancybox Custom Styles - Rounded Corners and Animations */
/* Fancybox v3 */
.fancybox-container {
    z-index: 99992 !important;
}

.fancybox-bg {
    background: rgba(0, 0, 0, 0.92) !important;
}

.fancybox-slide--image {
    padding: 44px 0 !important;
}

/* Critical: Image wrapper must have overflow hidden and rounded corners */
.fancybox-image-wrap {
    border-radius: 20px !important;
    overflow: hidden !important;
}

.fancybox-content {
    border-radius: 20px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    background: transparent !important;
}

.fancybox-image,
.fancybox-content img {
    border-radius: 20px !important;
}

/* Fancybox animation on open */
.fancybox-slide.fancybox-animated {
    animation: fancyboxZoomIn 0.4s ease-in-out !important;
}

@keyframes fancyboxZoomIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Fancybox toolbar and buttons */
.fancybox-toolbar {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%) !important;
    padding: 20px !important;
}

.fancybox-button {
    background: rgba(30, 30, 30, 0.8) !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
}

.fancybox-button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.1) !important;
}

.fancybox-button svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) !important;
}

/* Fancybox navigation arrows */
.fancybox-navigation .fancybox-button {
    width: 60px !important;
    height: 60px !important;
    background: rgba(30, 30, 30, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 50% !important;
}

.fancybox-navigation .fancybox-button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.15) !important;
}

/* Remove the square background behind the navigation buttons */
.fancybox-navigation button:before,
.fancybox-navigation .fancybox-button:before,
.fancybox-navigation .fancybox-button--arrow_left:before,
.fancybox-navigation .fancybox-button--arrow_right:before {
    display: none !important;
    background: none !important;
    content: none !important;
}

/* Fancybox counter/caption */
.fancybox-caption {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%) !important;
    padding: 30px 44px 20px !important;
    color: #fff !important;
    font-size: 14px !important;
}

/* Loading spinner */
.fancybox-loading {
    border: 4px solid rgba(255, 255, 255, 0.2) !important;
    border-top-color: #fff !important;
    border-radius: 50% !important;
}

/* New Fancybox (v4/v5) - Classes with __ notation */
.fancybox__container {
    z-index: 99992 !important;
}

.fancybox__backdrop {
    background: rgba(0, 0, 0, 0.92) !important;
}

.fancybox__slide {
    padding: 44px 20px !important;
}

.fancybox__content {
    border-radius: 20px !important;
    overflow: hidden !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    background: transparent !important;
    padding: 0 !important;
}

.fancybox__content > .f-carousel__slide,
.fancybox__content > .f-carousel__slide > *,
.fancybox__image,
.fancybox__content img,
.fancybox__content .fancybox__image {
    border-radius: 20px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
}

/* Force rounded corners on all possible image containers */
.fancybox__container img,
.fancybox__container .fancybox__image,
.fancybox__slide img,
.f-carousel__slide img {
    border-radius: 20px !important;
}

/* Fancybox v4/v5 animation */
.fancybox__slide.is-selected {
    animation: fancyboxZoomIn 0.4s ease-in-out !important;
}

/* Fancybox v4/v5 toolbar */
.fancybox__toolbar {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%) !important;
    padding: 20px !important;
}

/* Fancybox v4/v5 buttons */
.fancybox__button {
    background: rgba(30, 30, 30, 0.8) !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(10px) !important;
}

.fancybox__button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.1) !important;
}

.fancybox__button svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) !important;
}

/* Fancybox v4/v5 navigation arrows */
.fancybox__nav .fancybox__button {
    width: 60px !important;
    height: 60px !important;
    background: rgba(30, 30, 30, 0.8) !important;
    backdrop-filter: blur(10px) !important;
}

.fancybox__nav .fancybox__button:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.15) !important;
}

/* Fancybox v4/v5 counter/caption */
.fancybox__caption {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%) !important;
    padding: 30px 44px 20px !important;
    color: #fff !important;
    font-size: 14px !important;
}

/* Fancybox v4/v5 loading spinner */
.fancybox__spinner {
    border: 4px solid rgba(255, 255, 255, 0.2) !important;
    border-top-color: #fff !important;
    border-radius: 50% !important;
}

/* Property detail page specific styles */
.flat-property-detail .single-property-gallery .box-img {
    height: 100%;
}

.flat-property-detail .single-property-gallery .row.gap-20 > div {
    margin-bottom: 20px;
}
