/* Justified Grid Widget Styles */
.eafe-justified-grid-container {
    position: relative;
    width: 100%;
}

.eafe-justified-grid-filter {
    margin-bottom: 30px;
}

.eafe-justified-grid-filter button {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid #ddd;
    background: transparent;
    color: 333;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.eafe-justified-grid-filter button.active,
.eafe-justified-grid-filter button:hover {
    background: #6ec1e4;
    color: #fff;
    border-color: #6ec1e4;
}

.eafe-justified-grid {
    display: grid;
    width: 100%;
    gap: 15px;
}

/* Style 1 - Multi Category with Filter */
.eafe-justified-grid-style-1 .eafe-justified-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Style 2 - Justified Grid without Filter */
.eafe-justified-grid-style-2 .eafe-justified-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 300px;
}

/* Style 3 - Justified Grid without Gutter */
.eafe-justified-grid-style-3 .eafe-justified-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0;
}

/* Style 4 - Minimal Full Width */
.eafe-justified-grid-style-4 .eafe-justified-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 5px;
}

/* Style 5 - Full Width Images */
.eafe-justified-grid-style-5 .eafe-justified-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: 400px;
}

/* Style 6 - Masonry Grid */
.eafe-justified-grid-style-6 .eafe-justified-grid {
    display: block;
    column-count: 3;
    column-gap: 15px;
}

.eafe-masonry-columns-2 .eafe-justified-grid {
    column-count: 2;
}

.eafe-masonry-columns-3 .eafe-justified-grid {
    column-count: 3;
}

.eafe-masonry-columns-4 .eafe-justified-grid {
    column-count: 4;
}

.eafe-masonry-columns-5 .eafe-justified-grid {
    column-count: 5;
}

.eafe-justified-grid-style-6 .eafe-justified-grid-item {
    break-inside: avoid;
    margin-bottom: 15px;
}

/* Grid Item */
.eafe-justified-grid-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.eafe-justified-grid-style-3 .eafe-justified-grid-item {
    border-radius: 0;
}

.eafe-justified-grid-style-4 .eafe-justified-grid-item {
    border-radius: 4px;
}

.eafe-justified-grid-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: all 0.3s ease;
}

/* For non-masonry layouts with fixed height */
.eafe-justified-grid-style-2 .eafe-justified-grid-item img,
.eafe-justified-grid-style-3 .eafe-justified-grid-item img,
.eafe-justified-grid-style-4 .eafe-justified-grid-item img,
.eafe-justified-grid-style-5 .eafe-justified-grid-item img {
    height: 100%;
    object-fit: cover;
}

/* Hover Effects */
.eafe-hover-effect-zoom .eafe-justified-grid-item:hover img {
    transform: scale(1.1);
}

.eafe-hover-effect-rotate .eafe-justified-grid-item:hover img {
    transform: scale(1.1) rotate(2deg);
}

.eafe-hover-effect-grayscale .eafe-justified-grid-item:hover img {
    filter: grayscale(100%);
}

/* Default hover effect for all items */
.eafe-justified-grid-item:hover img {
    transform: scale(1.05);
    transition: all 0.3s ease;
}

/* Animation Enhancements */
.eafe-justified-grid-style-1 .eafe-justified-grid-item:hover,
.eafe-justified-grid-style-2 .eafe-justified-grid-item:hover,
.eafe-justified-grid-style-4 .eafe-justified-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.eafe-justified-grid-style-3 .eafe-justified-grid-item:hover {
    transform: scale(1.02);
    z-index: 2;
}

.eafe-justified-grid-style-6 .eafe-justified-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.12);
}

/* Caption */
.eafe-justified-grid-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.eafe-justified-grid-caption-always .eafe-justified-grid-caption {
    transform: translateY(0);
}

.eafe-justified-grid-item:hover .eafe-justified-grid-caption {
    transform: translateY(0);
}

.eafe-justified-grid-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.eafe-justified-grid-description {
    margin: 0;
    font-size: 14px;
    color: #f0f0f0;
    line-height: 1.4;
}

/* Style 4 - Minimal adjustments */
.eafe-justified-grid-style-4 .eafe-justified-grid-caption {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
}

.eafe-justified-grid-style-4 .eafe-justified-grid-title {
    font-size: 16px;
    margin-bottom: 5px;
}

.eafe-justified-grid-style-4 .eafe-justified-grid-description {
    font-size: 13px;
}

/* Animation Enhancements */
.eafe-justified-grid-style-1 .eafe-justified-grid-item:hover,
.eafe-justified-grid-style-2 .eafe-justified-grid-item:hover,
.eafe-justified-grid-style-4 .eafe-justified-grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.eafe-justified-grid-style-3 .eafe-justified-grid-item:hover {
    transform: scale(1.02);
    z-index: 2;
}

.eafe-justified-grid-style-6 .eafe-justified-grid-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.12);
}

/* Filtering animation */
.eafe-justified-grid-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.eafe-justified-grid-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    position: absolute;
    visibility: hidden;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .eafe-justified-grid-style-1 .eafe-justified-grid,
    .eafe-justified-grid-style-2 .eafe-justified-grid,
    .eafe-justified-grid-style-3 .eafe-justified-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .eafe-justified-grid-style-2 .eafe-justified-grid {
        grid-auto-rows: 250px;
    }

    .eafe-justified-grid-style-5 .eafe-justified-grid {
        grid-auto-rows: 300px;
    }

    /* Masonry responsive */
    .eafe-masonry-columns-4 .eafe-justified-grid,
    .eafe-masonry-columns-5 .eafe-justified-grid {
        column-count: 3;
    }
}

@media (max-width: 767px) {
    .eafe-justified-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        gap: 10px !important;
    }

    .eafe-justified-grid-style-3 .eafe-justified-grid {
        gap: 0 !important;
    }

    .eafe-justified-grid-style-4 .eafe-justified-grid {
        gap: 3px !important;
    }

    .eafe-justified-grid-style-2 .eafe-justified-grid,
    .eafe-justified-grid-style-5 .eafe-justified-grid {
        grid-template-columns: 1fr !important;
        grid-auto-rows: 250px !important;
    }

    /* Masonry mobile */
    .eafe-justified-grid-style-6 .eafe-justified-grid {
        column-count: 1 !important;
    }

    .eafe-justified-grid-filter {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .eafe-justified-grid-filter button {
        margin: 0 !important;
        padding: 6px 15px;
        font-size: 14px;
    }

    .eafe-justified-grid-caption {
        padding: 15px;
    }

    .eafe-justified-grid-title {
        font-size: 16px;
    }

    .eafe-justified-grid-description {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    /* Masonry extra small screens */
    .eafe-masonry-columns-2 .eafe-justified-grid,
    .eafe-masonry-columns-3 .eafe-justified-grid {
        column-count: 1 !important;
    }
}