/**
 * Frontend Styles for Jef Smart Gallary
 */

.jef-gallery-container {
    width: 100%;
    margin: 20px 0;
    box-sizing: border-box;
}

.jef-gallery-container * {
    box-sizing: border-box;
}

/* Gallery Item Styling */
.jef-gallery-item {
    position: relative;
    border-radius: var(--jef-radius, 8px);
    overflow: hidden;
    background: #f9f9f9;
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    transform: translate3d(0,0,0); /* Performance optimization for hardware acceleration */
}

.jef-gallery-image {
    width: 100%;
    height: 100%;
    display: block;
    aspect-ratio: var(--jef-aspect, auto);
    object-fit: cover;
}

/* Shadow Styles */
.jef-shadow-none {
    box-shadow: none !important;
}
.jef-shadow-subtle {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
}
.jef-shadow-pronounced {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

/* Hover Animations */
/* Zoom image */
.jef-hover-zoom .jef-gallery-image,
.jef-hover-zoom-lift .jef-gallery-image {
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}
.jef-hover-zoom:hover .jef-gallery-image,
.jef-hover-zoom-lift:hover .jef-gallery-image {
    transform: scale(1.08);
}

/* Lift card */
.jef-hover-lift,
.jef-hover-zoom-lift {
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}
.jef-hover-lift:hover,
.jef-hover-zoom-lift:hover {
    transform: translateY(-6px);
}

/* Shadow enhancements on hover */
.jef-shadow-subtle.jef-hover-lift:hover,
.jef-shadow-subtle.jef-hover-zoom-lift:hover {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12) !important;
}
.jef-shadow-pronounced.jef-hover-lift:hover,
.jef-shadow-pronounced.jef-hover-zoom-lift:hover {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22) !important;
}

/* 1. Grid Layout */
.jef-grid-layout {
    display: grid;
    grid-template-columns: repeat(var(--jef-columns, 3), 1fr);
    gap: var(--jef-gap, 20px);
}

@media (max-width: 991px) {
    .jef-grid-layout {
        grid-template-columns: repeat(min(var(--jef-columns, 3), 3), 1fr);
    }
}

@media (max-width: 767px) {
    .jef-grid-layout {
        grid-template-columns: repeat(2, 1fr);
        gap: min(15px, var(--jef-gap, 20px));
    }
}

@media (max-width: 480px) {
    .jef-grid-layout {
        grid-template-columns: 1fr;
        gap: min(12px, var(--jef-gap, 20px));
    }
}

/* 2. Masonry Layout */
.jef-masonry-layout {
    column-count: var(--jef-columns, 3);
    column-gap: var(--jef-gap, 20px);
}

.jef-masonry-layout .jef-gallery-item {
    display: inline-block;
    width: 100%;
    margin-bottom: var(--jef-gap, 20px);
    break-inside: avoid;
}

@media (max-width: 767px) {
    .jef-masonry-layout {
        column-count: 2;
        column-gap: min(15px, var(--jef-gap, 20px));
    }
    .jef-masonry-layout .jef-gallery-item {
        margin-bottom: min(15px, var(--jef-gap, 20px));
    }
}

@media (max-width: 480px) {
    .jef-masonry-layout {
        column-count: 1;
        column-gap: min(12px, var(--jef-gap, 20px));
    }
    .jef-masonry-layout .jef-gallery-item {
        margin-bottom: min(12px, var(--jef-gap, 20px));
    }
}

/* 3. Carousel (Swiper.js Customization) */
.jef-carousel-container .swiper {
    width: 100%;
    padding: 10px 0 45px 0; /* Add bottom padding to prevent pagination overlap */
}

.jef-carousel-container .swiper-slide {
    height: auto;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.jef-carousel-container .jef-gallery-item {
    width: 100%;
    height: 100%;
}

.jef-carousel-container .jef-gallery-image {
    height: 100%;
    object-fit: cover;
}

/* Customize Swiper Navigation & Pagination styles */
.jef-carousel-container .swiper-button-next,
.jef-carousel-container .swiper-button-prev {
    color: #2271b1;
    background: rgba(255, 255, 255, 0.9);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: background 0.3s, color 0.3s, transform 0.2s;
    margin-top: -32px; /* Center alignment offset */
}

.jef-carousel-container .swiper-button-next:hover,
.jef-carousel-container .swiper-button-prev:hover {
    background: #2271b1;
    color: #fff;
    transform: scale(1.05);
}

.jef-carousel-container .swiper-button-next::after,
.jef-carousel-container .swiper-button-prev::after {
    font-size: 18px;
    font-weight: bold;
}

.jef-carousel-container .swiper-pagination-bullet-active {
    background: #2271b1;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    transition: width 0.3s ease;
}

/* 4. Lazy Loading & Skeleton Shimmer Placeholder */
.jef-lazy-wrapper {
    position: relative;
    background: #eaeaea;
    overflow: hidden;
}

/* Skeleton loader overlay */
.jef-lazy-wrapper.loading::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(
        90deg,
        rgba(234, 234, 234, 0) 0%,
        rgba(255, 255, 255, 0.5) 20%,
        rgba(255, 255, 255, 0.8) 60%,
        rgba(234, 234, 234, 0) 100%
    );
    background-size: 200% 100%;
    animation: jef-shimmer-animation 1.6s infinite linear;
    z-index: 2;
}

@keyframes jef-shimmer-animation {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

/* Blur & opacity styles for smooth image loading transitions */
.jef-lazy-wrapper.loading img {
    opacity: 0;
    filter: blur(10px);
}

.jef-lazy-wrapper img {
    opacity: 1;
    filter: blur(0);
    transition: opacity 0.5s ease-out, filter 0.5s ease-out;
}

/* Continuous Linear Carousel Scroll (Brand Ticker) */
.jef-swiper-slider[data-continuous="true"] .swiper-wrapper {
    transition-timing-function: linear !important;
}

/* 5. Custom Premium Lightbox Styles */
.jef-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.jef-lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.jef-lightbox-close {
    position: absolute;
    top: 25px;
    right: 30px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 44px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: color 0.25s, transform 0.2s;
    user-select: none;
    z-index: 1000001;
}

.jef-lightbox-close:hover {
    color: #fff;
    transform: scale(1.1);
}

.jef-lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 60px;
    cursor: pointer;
    user-select: none;
    transition: color 0.25s, transform 0.2s, background 0.25s;
    z-index: 1000001;
    width: 60px;
    height: 60px;
    line-height: 52px;
    text-align: center;
    border-radius: 50%;
}

.jef-lightbox-arrow:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.jef-lightbox-prev {
    left: 25px;
}

.jef-lightbox-next {
    right: 25px;
}

@media (max-width: 767px) {
    .jef-lightbox-arrow {
        width: 44px;
        height: 44px;
        line-height: 38px;
        font-size: 40px;
    }
    .jef-lightbox-prev { left: 10px; }
    .jef-lightbox-next { right: 10px; }
    .jef-lightbox-close { top: 15px; right: 20px; }
}

.jef-lightbox-content {
    position: relative;
    max-width: 85%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
}

.jef-lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.jef-lightbox-caption {
    margin-top: 15px;
    color: #eaeaea;
    font-size: 14px;
    font-family: sans-serif;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    max-width: 90%;
    word-wrap: break-word;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Lightbox Spinner Loader */
.jef-lightbox-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: jef-lightbox-spin 0.8s infinite linear;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -20px;
    margin-left: -20px;
    z-index: 999999;
}

@keyframes jef-lightbox-spin {
    to {
        transform: rotate(360deg);
    }
}

/* 6. Masonry Carousel (Moving) specific layout */
.jef-masonry-carousel-container .swiper {
    height: var(--jef-height, 400px) !important;
    padding-bottom: 50px;
}

.jef-masonry-carousel-slide {
    height: 100% !important;
    flex-shrink: 0;
    display: flex;
    align-items: stretch; /* Stretch columns to fill container height */
    justify-content: center;
}

.jef-masonry-carousel-column {
    display: flex;
    flex-direction: column;
    gap: var(--jef-gap, 10px);
    width: 100%;
    height: 100%; /* Columns fill full slide height */
}

.jef-masonry-carousel-row {
    display: flex;
    gap: var(--jef-gap, 10px);
    width: 100%;
    flex-shrink: 0;
}

.jef-masonry-carousel-row .jef-gallery-item {
    position: relative;
    height: 100%; /* Items fill full row height */
}

/* Stacking height split classes */
.jef-row-height-full {
    height: 100%;
}

.jef-row-height-split-half {
    height: calc(50% - (var(--jef-gap, 10px) / 2));
}

.jef-row-height-top-split-row-1 {
    height: calc(35% - (var(--jef-gap, 10px) / 2));
}

.jef-row-height-top-split-row-2 {
    height: calc(65% - (var(--jef-gap, 10px) / 2));
}

.jef-row-height-bottom-split-row-1 {
    height: calc(60% - (var(--jef-gap, 10px) / 2));
}

.jef-row-height-bottom-split-row-2 {
    height: calc(40% - (var(--jef-gap, 10px) / 2));
}

.jef-row-height-split-third {
    height: calc(33.33% - (var(--jef-gap, 10px) * 2 / 3));
}

/* Row of 2 items (splits width to 50%/50% minus half of the gap) */
.jef-row-items-2 .jef-gallery-item {
    width: calc(50% - (var(--jef-gap, 10px) / 2));
    flex: 0 0 calc(50% - (var(--jef-gap, 10px) / 2));
}

/* Row of 1 item (takes full column width) */
.jef-row-items-1 .jef-gallery-item {
    width: 100%;
    flex: 0 0 100%;
}

.jef-masonry-carousel-column .jef-gallery-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    aspect-ratio: auto !important; /* Force auto so height-splitting behaves dynamically */
}

@media (max-width: 767px) {
    .jef-masonry-carousel-container .swiper {
        height: auto !important; /* Allow auto height on mobile if responsive mode is checked */
    }
}

/* 7. Responsive Masonry Carousel Toggles */
@media (min-width: 768px) {
    .jef-masonry-mobile-slider-wrapper {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .jef-masonry-desktop-slider-wrapper {
        display: none !important;
    }
    .jef-masonry-mobile-slider-wrapper {
        display: block !important;
    }
}

/* 8. Jef Card Carousel styling */
.jef-card-carousel-container {
    width: 100%;
}

.jef-card-carousel-slide {
    height: auto !important;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.jef-card-carousel-link-wrapper {
    display: block;
    width: 100%;
    text-decoration: none !important;
    color: inherit !important;
}

.jef-card-carousel-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.jef-card-carousel-image-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
    /* aspect-ratio will be set dynamically via selectors */
}

.jef-card-carousel-image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.3s ease;
}

.jef-card-carousel-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.jef-card-carousel-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #1a202c;
    transition: color 0.3s ease;
}

.jef-card-carousel-subtitle {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.5;
}

