/* Frontend Gallery Styles */

:root {
    --ivg-gap: 20px;
}

/* Gallery Container */
.ivg-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--ivg-gap);
    padding: 20px 0;
    max-width: 100%;
}

.ivg-gallery[data-columns="2"] {
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.ivg-gallery[data-columns="3"] {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.ivg-gallery[data-columns="4"] {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.ivg-gallery[data-columns="5"] {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* Gallery Item */
.ivg-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.ivg-gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* Video Wrapper */
.ivg-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
}

.ivg-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Play Overlay */
.ivg-video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0.3) 50%,
            rgba(0, 0, 0, 0.6) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ivg-gallery-item:hover .ivg-video-play-overlay {
    opacity: 1;
}

.ivg-play-button {
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ivg-gallery-item:hover .ivg-play-button {
    transform: scale(1);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Video Title */
.ivg-video-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.ivg-gallery-item:hover .ivg-video-title {
    transform: translateY(0);
}

.ivg-video-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Lightbox */
.ivg-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ivg-lightbox.active {
    display: flex;
    opacity: 1;
}

.ivg-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.ivg-lightbox-content {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
}

.ivg-lightbox-video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.ivg-lightbox-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Lightbox Close Button */
.ivg-lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.ivg-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Lightbox Navigation */
.ivg-lightbox-nav {
    position: absolute;
    top: 50%;
    left: -60px;
    right: -60px;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.ivg-lightbox-prev,
.ivg-lightbox-next {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    pointer-events: all;
    backdrop-filter: blur(10px);
}

.ivg-lightbox-prev:hover,
.ivg-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.ivg-lightbox-prev:disabled,
.ivg-lightbox-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* No Videos Message */
.ivg-no-videos {
    text-align: center;
    padding: 60px 20px;
    color: #646970;
}

.ivg-no-videos p {
    margin: 0;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 1024px) {

    .ivg-gallery[data-columns="4"],
    .ivg-gallery[data-columns="5"] {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .ivg-gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    .ivg-gallery[data-columns="2"],
    .ivg-gallery[data-columns="3"],
    .ivg-gallery[data-columns="4"],
    .ivg-gallery[data-columns="5"] {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .ivg-video-title h3 {
        font-size: 14px;
    }

    .ivg-lightbox-content {
        max-width: 95%;
    }

    .ivg-lightbox-nav {
        left: -10px;
        right: -10px;
    }

    .ivg-lightbox-prev,
    .ivg-lightbox-next {
        width: 40px;
        height: 40px;
    }

    .ivg-lightbox-close {
        top: -45px;
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .ivg-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .ivg-gallery-item {
        border-radius: 12px;
    }

    .ivg-gallery-item:hover {
        transform: translateY(-4px) scale(1.01);
    }

    .ivg-video-title {
        padding: 15px;
    }

    .ivg-play-button svg {
        width: 50px;
        height: 50px;
    }
}

/* Loading Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ivg-gallery-item {
    animation: fadeIn 0.5s ease backwards;
}

.ivg-gallery-item:nth-child(1) {
    animation-delay: 0.05s;
}

.ivg-gallery-item:nth-child(2) {
    animation-delay: 0.1s;
}

.ivg-gallery-item:nth-child(3) {
    animation-delay: 0.15s;
}

.ivg-gallery-item:nth-child(4) {
    animation-delay: 0.2s;
}

.ivg-gallery-item:nth-child(5) {
    animation-delay: 0.25s;
}

.ivg-gallery-item:nth-child(6) {
    animation-delay: 0.3s;
}

.ivg-gallery-item:nth-child(n+7) {
    animation-delay: 0.35s;
}