/**
 * YTrip Lightbox — Premium lightbox styles
 *
 * @package YTrip
 * @since   2.2.0
 */

/* ================================================================
 * Overlay
 * ================================================================ */
.ytrip-lb {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ytrip-lb--open {
    opacity: 1;
    visibility: visible;
}

/* Backdrop */
.ytrip-lb__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ================================================================
 * Spinner
 * ================================================================ */
.ytrip-lb__spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.ytrip-lb__spinner--visible {
    opacity: 1;
}

.ytrip-lb__spin-ring {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ytrip-lb-spin 0.8s linear infinite;
}

@keyframes ytrip-lb-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================================================
 * Image wrapper & image
 * ================================================================ */
.ytrip-lb__img-wrap {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 60px 24px 80px;
    box-sizing: border-box;
}

.ytrip-lb__img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
}

.ytrip-lb__img--loaded {
    opacity: 1;
    transform: scale(1);
}

/* Zoomed */
.ytrip-lb--zoomed .ytrip-lb__img-wrap {
    overflow: auto;
    cursor: zoom-out;
}

.ytrip-lb--zoomed .ytrip-lb__img {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}

.ytrip-lb:not(.ytrip-lb--zoomed) .ytrip-lb__img {
    cursor: zoom-in;
}

/* ================================================================
 * Controls
 * ================================================================ */
.ytrip-lb__close,
.ytrip-lb__prev,
.ytrip-lb__next,
.ytrip-lb__zoom {
    position: absolute;
    z-index: 10;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s, transform 0.15s;
}

.ytrip-lb__close:hover,
.ytrip-lb__prev:hover,
.ytrip-lb__next:hover,
.ytrip-lb__zoom:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.08);
}

/* Close */
.ytrip-lb__close {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 28px;
    line-height: 1;
}

/* Prev / Next */
.ytrip-lb__prev,
.ytrip-lb__next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.ytrip-lb__prev:hover,
.ytrip-lb__next:hover {
    transform: translateY(-50%) scale(1.08);
}

.ytrip-lb__prev {
    left: 16px;
}

.ytrip-lb__next {
    right: 16px;
}

/* ================================================================
 * Bottom bar (counter + zoom)
 * ================================================================ */
.ytrip-lb__bottom {
    position: absolute;
    z-index: 10;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 18px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ytrip-lb__counter {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}

.ytrip-lb__zoom {
    position: static;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    background: transparent;
    border: none;
}

/* ================================================================
 * Gallery grid (inside templates)
 * ================================================================ */
.ytrip-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.ytrip-gallery-grid__item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    aspect-ratio: 4 / 3;
    cursor: pointer;
}

.ytrip-gallery-grid__item:first-child {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: auto;
}

.ytrip-gallery-grid__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ytrip-gallery-grid__item:hover img {
    transform: scale(1.06);
}

/* Hover overlay */
.ytrip-gallery-grid__item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.35) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.ytrip-gallery-grid__item:hover::after {
    opacity: 1;
}

/* Zoom icon on hover */
.ytrip-gallery-grid__item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    z-index: 2;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3Cline x1='11' y1='8' x2='11' y2='14'/%3E%3Cline x1='8' y1='11' x2='14' y2='11'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px 24px;
}

.ytrip-gallery-grid__item:hover::before {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* ================================================================
 * Responsive
 * ================================================================ */
@media (max-width: 768px) {

    .ytrip-lb__prev,
    .ytrip-lb__next {
        width: 40px;
        height: 40px;
    }

    .ytrip-lb__prev {
        left: 8px;
    }

    .ytrip-lb__next {
        right: 8px;
    }

    .ytrip-lb__close {
        top: 8px;
        right: 8px;
        width: 38px;
        height: 38px;
        font-size: 24px;
    }

    .ytrip-lb__img-wrap {
        padding: 50px 8px 70px;
    }

    .ytrip-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .ytrip-gallery-grid__item:first-child {
        grid-column: span 2;
        grid-row: span 1;
        aspect-ratio: 16 / 9;
    }
}

@media (max-width: 480px) {
    .ytrip-gallery-grid {
        grid-template-columns: 1fr;
    }

    .ytrip-gallery-grid__item:first-child {
        grid-column: span 1;
    }
}