/**
 * BBF Gallery - Lightbox Extensions CSS
 * Styles for zoom, rotation, thumbnails and share in lightbox
 * 
 * @author BBFDesign
 * @version 1.0.0
 */

/* Lightbox Body-Shift verhindern — reserviert Scrollbar-Platz nur wenn nötig.
   Fallback: overflow-y:scroll für ältere Browser (layout shift vermeiden). */
@supports (scrollbar-gutter: stable) {
    html {
        scrollbar-gutter: stable;
    }
}
@supports not (scrollbar-gutter: stable) {
    html {
        overflow-y: scroll;
    }
}

/* Scroll-Lock wird per JS gesetzt (siehe lightbox-extensions.js).
   Body bekommt inline `position:fixed; top:-<Y>px; overflow:hidden`.
   Nach Close wird alles inklusive Scroll-Position wiederhergestellt. */
html.bbf-scroll-locked {
    overflow: hidden !important;
    overscroll-behavior: none;
}

/* ===================================
   LIGHTBOX TOOLBAR
   =================================== */

.bbf-lightbox-toolbar {
    position: absolute;
    top: 20px;
    right: 80px;
    z-index: 9999;
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.bbf-lb-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bbf-lb-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.bbf-lb-btn:active {
    transform: scale(0.95);
}

.bbf-lb-btn i {
    pointer-events: none;
}
.bbf-thumbnail {
    border: none!important;
	box-shadow:0 0 0 transparent!important;
}
/* Mobile adjustments */
@media (max-width: 768px) {
    .bbf-lightbox-toolbar {
        top: 10px;
        right: 10px;
        padding: 8px;
        gap: 8px;
    }

    .bbf-lb-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* ===================================
   LIGHTBOX THUMBNAILS
   =================================== */

.bbf-lightbox-thumbnails {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    max-width: 90%;
}

.bbf-thumbs-container {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
    max-width: 600px;
}

.bbf-thumbs-container::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

.bbf-thumbs-wrapper {
    display: flex;
    gap: 8px;
    padding: 5px 0;
}

.bbf-thumbs-wrapper .bbf-thumbnail {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.bbf-thumbs-wrapper .bbf-thumbnail:hover {
    opacity: 1;
    transform: scale(1.1);
}

.bbf-thumbs-wrapper .bbf-thumbnail.active {
    border-color: var(--bbf-accent-color, #007bff);
    box-shadow: 0 0 0 2px var(--bbf-accent-color, #007bff);
    opacity: 1;
}

.bbf-thumb-prev,
.bbf-thumb-next {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bbf-thumb-prev:hover,
.bbf-thumb-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Position: Top */
.bbf-lightbox-thumbnails.position-top {
    top: 80px;
    bottom: auto;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .bbf-lightbox-thumbnails {
        bottom: 10px;
        padding: 8px;
        gap: 8px;
    }

    .bbf-thumbs-wrapper .bbf-thumbnail {
        flex: 0 0 50px;
        width: 50px;
        height: 50px;
    }

    .bbf-thumbs-container {
        max-width: 400px;
    }
}

/* ===================================
   ZOOM & ROTATION EFFECTS
   =================================== */

/* Clip zoomed/panned image to its media box — prevents image from
   visually escaping the lightbox while zoomed */
.gslide-media {
    overflow: hidden;
    position: relative;
}

.gslide-media img {
    transition: transform 0.3s ease;
    cursor: grab;
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
}

.gslide-media img.zoomed {
    cursor: move;
}

.gslide-media.dragging img {
    cursor: grabbing;
}

/* ===================================
   LIGHTBOX CAPTION (Bildname)
   Caption läuft als echter Balken am Viewport-Rand — NICHT über dem Bild.
   Das Bild wird entsprechend in der Höhe begrenzt.
   =================================== */

:root {
    --bbf-lb-caption-height: 56px;
    --bbf-lb-thumbs-height: 96px;
}

/* Original Caption (liegt im Slide und wandert mit Swipe-Transforms)
   komplett verbergen — wir nutzen stattdessen `.bbf-lb-caption`
   direkt auf Container-Ebene. */
.glightbox-container .gslide-description {
    display: none !important;
}

/* Eigener Caption-Balken — Kind von .gcontainer (nicht vom Slide),
   dadurch immun gegen Slide-Transforms und Swipe-Animationen.
   Position (left/width/top/bottom) wird per JS an .gslide-media ausgerichtet,
   damit die Caption unter dem Bild klebt und nicht am Viewport-Rand. */
.gcontainer .bbf-lb-caption,
.glightbox-container .bbf-lb-caption {
    position: absolute;
    /* Fallback (JS setzt left/width/top/bottom per inline-style). */
    left: 50%;
    max-width: 90vw;
    min-width: 240px;
    bottom: 24px;
    z-index: 1200;
    padding: 10px 24px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    text-align: center;
    pointer-events: none;
    box-sizing: border-box;
    min-height: var(--bbf-lb-caption-height);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    backdrop-filter: blur(6px);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.3;
    word-break: break-word;
    border-radius: 4px;
    transition: none !important;
}

/* Solange JS noch nicht positioniert hat → Fallback-Zentrierung. */
.gcontainer .bbf-lb-caption:not([data-bbf-positioned]),
.glightbox-container .bbf-lb-caption:not([data-bbf-positioned]) {
    transform: translateX(-50%);
}

/* Sobald JS positioniert hat → exakte Pixelwerte statt 50%-Zentrierung. */
.gcontainer .bbf-lb-caption[data-bbf-positioned],
.glightbox-container .bbf-lb-caption[data-bbf-positioned] {
    transform: none;
}

/* Bild-Höhe reservieren, damit Caption niemals überlagert */
.gcontainer.bbf-lb-caption-bottom .gslide-media img,
.gcontainer.bbf-lb-caption-bottom .gslide-media video,
.gcontainer.bbf-lb-caption-bottom .gslide-media iframe {
    max-height: calc(100vh - var(--bbf-lb-caption-height) - 16px) !important;
}

/* Caption-Position: TOP */
.gcontainer.bbf-lb-caption-top .bbf-lb-caption {
    top: 0;
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.gcontainer.bbf-lb-caption-top .gslide-media img,
.gcontainer.bbf-lb-caption-top .gslide-media video,
.gcontainer.bbf-lb-caption-top .gslide-media iframe {
    max-height: calc(100vh - var(--bbf-lb-caption-height) - 16px) !important;
}

/* Wenn zusätzlich Thumbnails unten → Caption darüber stapeln */
.gcontainer.bbf-lb-caption-bottom.bbf-lb-thumbs-bottom .bbf-lb-caption {
    bottom: var(--bbf-lb-thumbs-height);
}
.gcontainer.bbf-lb-caption-bottom.bbf-lb-thumbs-bottom .gslide-media img,
.gcontainer.bbf-lb-caption-bottom.bbf-lb-thumbs-bottom .gslide-media video,
.gcontainer.bbf-lb-caption-bottom.bbf-lb-thumbs-bottom .gslide-media iframe {
    max-height: calc(100vh - var(--bbf-lb-caption-height) - var(--bbf-lb-thumbs-height) - 16px) !important;
}
.gcontainer.bbf-lb-caption-top.bbf-lb-thumbs-top .bbf-lb-caption {
    top: var(--bbf-lb-thumbs-height);
}

/* Caption-Position: OFF */
.gcontainer.bbf-lb-caption-off .bbf-lb-caption {
    display: none !important;
}

/* Mobile: kleineres Padding */
@media (max-width: 768px) {
    .gcontainer .bbf-lb-caption,
    .glightbox-container .bbf-lb-caption {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

/* ===================================
   VIDEO PLAYER IN LIGHTBOX
   =================================== */

.gslide-media .bbf-video-player {
    width: 100%;
    height: 100%;
    max-width: 1200px;
    max-height: 675px;
    /* 16:9 aspect ratio */
    margin: 0 auto;
}

/* ===================================
   ANIMATIONS
   =================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bbf-lightbox-toolbar,
.bbf-lightbox-thumbnails {
    animation: fadeIn 0.3s ease;
}

/* ===================================
   ACCESSIBILITY
   =================================== */

.bbf-lb-btn:focus,
.bbf-thumb-prev:focus,
.bbf-thumb-next:focus,
.bbf-thumbs-wrapper .bbf-thumbnail:focus {
    outline: 2px solid var(--bbf-accent-color, #007bff);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {

    .bbf-lightbox-toolbar,
    .bbf-lightbox-thumbnails {
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid #fff;
    }

    .bbf-lb-btn,
    .bbf-thumb-prev,
    .bbf-thumb-next {
        border-color: #fff;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    .bbf-lb-btn,
    .bbf-thumbs-wrapper .bbf-thumbnail,
    .gslide-media img {
        transition: none;
    }

    .bbf-lightbox-toolbar,
    .bbf-lightbox-thumbnails {
        animation: none;
    }
}

/* ===================================
   GALLERY LAYOUT (Merged from gallery.css)
   =================================== */

/* Gallery Layout */
.bbf-gallery-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    position: relative;
}

/* Positions */
.bbf-gallery-container.pos-below {
    flex-direction: column;
}

.bbf-gallery-container.pos-above {
    flex-direction: column-reverse;
}

.bbf-gallery-container.pos-left {
    flex-direction: row-reverse;
}

.bbf-gallery-container.pos-right {
    flex-direction: row;
}

/* Main Image */
.bbf-main-image-wrapper {
    flex: 1;
    position: relative;
    background: #fdfdfd;
    border: 1px solid #eee;
    overflow: hidden;
    cursor: zoom-in;
}

.bbf-main-image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

/* Slider Layout */
.bbf-main-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
    scroll-behavior: smooth;
    cursor: zoom-in;
}

.bbf-main-slider::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

.bbf-main-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.bbf-main-slide a {
    display: block;
    width: 100%;
}

/* Thumbnails */
.bbf-thumbnails-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    user-select: none;
}

.pos-above .bbf-thumbnails-container,
.pos-below .bbf-thumbnails-container {
    flex-direction: row;
    width: 100%;
}

.bbf-nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #030304;
    font-size: 25px;
    transition: all 0.2s ease;
    border-radius: 50%;
    z-index: 10;
    opacity: 1;
    visibility: visible;
    background: transparent;
    border-color: transparent;
    outline: none;
    border: none;
    padding: 0;
    line-height: 1;
    -webkit-appearance: none;
    appearance: none;
}

.bbf-nav-arrow.disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.bbf-nav-arrow.hidden {
    display: none !important;
}

.pos-above .bbf-nav-arrow,
.pos-below .bbf-nav-arrow {
    margin: 0 5px;
}

.pos-left .bbf-nav-arrow,
.pos-right .bbf-nav-arrow {
    margin: 0px 0;
    width: 100%;
    height: auto;
    padding: 0px 0;
    border-radius: 0;
}

.bbf-nav-arrow:hover, .bbf-nav-arrow:focus {
    background: transparent;
    color: #030304;
    border-color: transparent;
    outline: none;
    border: none;
}

.bbf-nav-arrow:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
}

.bbf-thumbnails-wrapper {
    display: flex;
    overflow: hidden;
    position: relative;
    max-height: 100%;
    /* Exactly 4 thumbnails (80*4 + 10*3) */
    flex: 1;
}

.pos-above .bbf-thumbnails-wrapper {
    display: flex;
    overflow: hidden;
    position: relative;
    max-height: 350px;
    /* Exactly 4 thumbnails (80*4 + 10*3) */
    flex: 1;
}

.pos-below .bbf-thumbnails-wrapper {
    max-height: none;
    max-width: 100%;
}

.bbf-thumbnails-inner {
    display: flex;
    gap: var(--bbf-thumbnail-gap);
    transition: transform 0.3s ease;
}

.pos-left .bbf-thumbnails-inner,
.pos-right .bbf-thumbnails-inner {
    flex-direction: column;
}

.pos-left .bbf-thumbnails-container,
.pos-right .bbf-thumbnails-container {
    width: 80px;
}

.bbf-thumbnail {
    flex: 0 0 calc((100% / var(--bbf-thumb-count-xs, 4)) - (10px * (var(--bbf-thumb-count-xs, 4) - 1) / var(--bbf-thumb-count-xs, 4)));
    position: relative;
    width: 80px;
    height: 80px;
    aspect-ratio: 1 / 1;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bbf-share-product-wrapper.pos-top-left span.d-none.d-md-inline-block.ml-1 {
    display: none!important;
}
.bbf-share-product-wrapper.pos-top-left  button.bbf-share-product-btn {
    border: none;
    background: transparent;
    box-shadow: 0 0 0 0 transparent;
    right: 0;
	font-size: 21px;
}
.bbf-share-product-wrapper.pos-top-left button.bbf-share-product-btn i.fa.fa-share-alt{
	width: 22px;
	height:22px;
}
@media (min-width: 576px) {
    .bbf-thumbnail {
        flex: 0 0 calc((100% / var(--bbf-thumb-count-sm, 4)) - (10px * (var(--bbf-thumb-count-sm, 4) - 1) / var(--bbf-thumb-count-sm, 4)));
    }
}

@media (min-width: 768px) {
    .bbf-thumbnail {
        flex: 0 0 calc((100% / var(--bbf-thumb-count-md, 4)) - (10px * (var(--bbf-thumb-count-md, 4) - 1) / var(--bbf-thumb-count-md, 4)));
    }

    .pos-left .bbf-thumbnail,
    .pos-right .bbf-thumbnail {
        flex: 0 0 80px;
        width: 80px;
        height: 80px;
    }
}

@media (min-width: 992px) {
    .bbf-thumbnail {
        flex: 0 0 calc((100% / var(--bbf-thumb-count-lg, 4)) - (10px * (var(--bbf-thumb-count-lg, 4) - 1) / var(--bbf-thumb-count-lg, 4)));
    }
}

@media (min-width: 1200px) {
    .bbf-thumbnail {
        flex: 0 0 calc((100% / var(--bbf-thumb-count-xl, 4)) - (10px * (var(--bbf-thumb-count-xl, 4) - 1) / var(--bbf-thumb-count-xl, 4)));
    }
}

.bbf-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0px;
    transition: transform 0.3s ease;
}

.bbf-thumbnail:hover img {
    transform: scale(1.05);
}

.bbf-thumbnail.active {
    border-color: var(--bbf-accent-color, #007bff);
    box-shadow: 0 0 0 1px var(--bbf-accent-color, #007bff);
}

.bbf-thumbnail:focus {
    outline: none;
}

.bbf-thumbnail:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.5);
    z-index: 11;
}

.bbf-thumbnail .video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 20px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Responsiveness */
@media (max-width: 768px) {
    .bbf-gallery-container {
        flex-direction: column !important;
    }

    .bbf-thumbnails-container {
        flex-direction: row !important;
        width: 100% !important;
    }

    .bbf-thumbnails-inner {
        flex-direction: row !important;
    }

    .bbf-nav-arrow {
        width: auto !important;
        padding: 0 10px !important;
    }
}

/* ===================================
   LIGHTBOX IMAGE FIT MODES
   =================================== */

.bbf-lb-fit-contain .gslide-media img {
    object-fit: contain;
    max-width: 100%;
    max-height: 80vh;
}

.bbf-lb-fit-cover .gslide-media img {
    object-fit: cover;
    width: 100%;
    height: 80vh;
}

.bbf-lb-fit-actual .gslide-media img {
    object-fit: none;
    max-width: none;
    max-height: none;
}

/* ===================================
   LIGHTBOX THUMBNAIL POSITIONS
   =================================== */

.bbf-lb-thumbs-top .bbf-lightbox-thumbnails {
    top: 10px;
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
}

.bbf-lb-thumbs-bottom .bbf-lightbox-thumbnails {
    bottom: 10px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
}

.bbf-lb-thumbs-left .bbf-lightbox-thumbnails {
    left: 10px;
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    flex-direction: column;
    width: auto;
    max-height: 80vh;
}

.bbf-lb-thumbs-left .bbf-thumbs-container {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 60vh;
}

.bbf-lb-thumbs-left .bbf-thumbs-wrapper {
    flex-direction: column;
}

.bbf-lb-thumbs-left .bbf-thumb-prev,
.bbf-lb-thumbs-left .bbf-thumb-next {
    width: 100%;
    height: 30px;
}

.bbf-lb-thumbs-right .bbf-lightbox-thumbnails {
    right: 10px;
    left: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    flex-direction: column;
    width: auto;
    max-height: 80vh;
}

.bbf-lb-thumbs-right .bbf-thumbs-container {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 60vh;
}

.bbf-lb-thumbs-right .bbf-thumbs-wrapper {
    flex-direction: column;
}

.bbf-lb-thumbs-right .bbf-thumb-prev,
.bbf-lb-thumbs-right .bbf-thumb-next {
    width: 100%;
    height: 30px;
}

/* Lightbox thumbnail size via CSS variable */
.bbf-lightbox-thumbnails .bbf-thumbnail {
    width: var(--bbf-lb-thumb-size, 60px);
    height: var(--bbf-lb-thumb-size, 60px);
    min-width: var(--bbf-lb-thumb-size, 60px);
    min-height: var(--bbf-lb-thumb-size, 60px);
}

/* ===================================
   DRAG-TO-PAN CURSOR
   =================================== */

.gslide-media img[style*="grab"] {
    cursor: grab;
}

.gslide-media img[style*="grabbing"] {
    cursor: grabbing;
}

/* ── Lightbox Accessibility ── */

.bbf-lb-btn:focus-visible,
.bbf-lightbox-thumbnails .bbf-thumbnail:focus-visible {
    outline: 2px solid #0891b2;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .glightbox-container *,
    .glightbox-container *::before,
    .glightbox-container *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
