/* === Gallery Lightbox === */

.ttfc-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ttfc-lightbox.ttfc-lightbox-active {
    opacity: 1;
    visibility: visible;
}

.ttfc-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
}

/* Close button */
.ttfc-lightbox-close {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    padding: 0;
}

.ttfc-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Counter */
.ttfc-lightbox-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-family: sans-serif;
    direction: ltr;
}

/* Main content area */
.ttfc-lightbox-content {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
    flex: 1;
    min-height: 0;
    padding: 60px 0 0;
}

/* Image wrapper */
.ttfc-lightbox-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    padding: 0 80px;
}

.ttfc-lightbox-img {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
    transition: opacity 0.25s ease;
    user-select: none;
    -webkit-user-drag: none;
}

/* Navigation arrows */
.ttfc-lightbox-nav {
    position: relative;
    z-index: 10;
    flex-shrink: 0;
    background: #fff;
    border: none;
    color: #222;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
    margin: 0 62px;
}

.ttfc-lightbox-nav:hover {
    background: #e0e0e0;
    transform: scale(1.08);
}

.ttfc-lightbox-nav:active {
    transform: scale(0.95);
}

/* Caption */
.ttfc-lightbox-caption {
    position: relative;
    z-index: 5;
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    text-align: center;
    padding: 14px 24px 20px;
    max-width: 700px;
    line-height: 1.6;
    direction: rtl;
}

/* Mobile */
@media screen and (max-width: 768px) {
    .ttfc-lightbox-img-wrap {
        padding: 0 12px;
    }

    .ttfc-lightbox-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 40px;
        height: 40px;
        margin: 0;
        background: rgba(0, 0, 0, 0.5);
        border: none;
    }

    .ttfc-lightbox-prev {
        right: 8px;
    }

    .ttfc-lightbox-next {
        left: 8px;
    }

    .ttfc-lightbox-nav:hover {
        transform: translateY(-50%) scale(1.05);
    }

    .ttfc-lightbox-img {
        max-height: calc(100vh - 120px);
    }

    .ttfc-lightbox-close {
        top: 8px;
        left: 8px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    .ttfc-lightbox-counter {
        top: 14px;
        right: 14px;
        font-size: 13px;
    }

    .ttfc-lightbox-caption {
        font-size: 13px;
        padding: 10px 16px 14px;
    }
}

/* Cursor on gallery images */
.entry-content .wp-block-gallery img {
    cursor: zoom-in;
}

.entry-content .wp-block-gallery .ttfc-gallery-banner-item,
.entry-content .wp-block-gallery .ttfc-gallery-banner-item img,
.entry-content .wp-block-gallery .ttfc-banner-wrapper,
.entry-content .wp-block-gallery .ttfc-banner-wrapper img {
    cursor: pointer;
}
