/* --- STABILE GALERIE MIT SLIDE-EFFEKT (FINALE VERSION) --- */

/* 1. DER HINTERGRUND: Tiefschwarz und Blur für maximalen Fokus */
.modal-backdrop.show {
    background-color: #000 !important;
    opacity: 0.90 !important;
    backdrop-filter: blur(8px) !important;
}

/* 2. MODAL-CONTAINER: Komplett unsichtbar (nur das Polaroid soll wirken) */
#galleryLightbox .modal-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* 3. CAROUSEL-INNER: Ermöglicht das Nebeneinander-Sliden bei fester Höhe */
#galleryLightbox .carousel-inner {
    height: 85vh;
    display: flex; /* Wichtig für die horizontale Anordnung beim Sliden */
    align-items: center;
    background: transparent !important;
}

/* 4. CAROUSEL-ITEM: Flex-Zentrierung für das Bild im Slide-Container */
#galleryLightbox .carousel-item {
    height: 85vh;
    width: 100%;
    display: none; /* Bootstrap Steuerung */
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 0 0 100%; /* Fixiert die Breite auf exakt 100% während des Slidens */
    backface-visibility: hidden;
    /* Geschmeidige Slide-Animation */
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* WICHTIG: Flex-Layout während der Transitionen erzwingen */
#galleryLightbox .carousel-item.active,
#galleryLightbox .carousel-item-next,
#galleryLightbox .carousel-item-prev {
    display: flex !important;
}

/* 5. DAS POLAROID-BILD: Absolute Größenstabilität */
#galleryLightbox .carousel-item img {
    /* Box-Sizing: Padding (Rahmen) ist Teil der berechneten Größe */
    box-sizing: border-box !important;
    
    /* Der weiße Rahmen: unten breiter für den Polaroid-Look */
    padding: 12px 12px 45px 12px !important; 
    background-color: #fff !important;
    
    /* Design-Details aus deinen Produkt-Cards */
    border-radius: 10px !important; 
    box-shadow: 0 30px 80px rgba(0,0,0,0.9) !important;
    
    /* Starr fixierte Maximalwerte gegen das "Aufblähen" beim Schieben */
    max-height: 80vh !important;
    max-width: 85% !important;
    width: auto !important;
    height: auto !important;
    
    object-fit: contain;
    display: inline-block;
    border: none !important;
    
    /* Hardware-Beschleunigung für ruckelfreies Sliden */
    transform: translate3d(0, 0, 0);
}

/* --- NAVIGATION & SCHLIESSEN: FIXIERT AM BILDSCHIRMRAND --- */

/* Schließen-Button oben rechts */
#galleryLightbox .btn-close {
    position: fixed !important;
    top: 25px;
    right: 25px;
    width: 40px !important;
    height: 40px !important;
    background-color: #ffffff !important;
    border-radius: 50% !important;
    opacity: 1 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3) !important;
    background-image: none !important; /* Bootstrap X entfernen */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10050;
    border: none;
    cursor: pointer;
    transform: translateZ(0);
}

/* Custom X Linien */
#galleryLightbox .btn-close::before,
#galleryLightbox .btn-close::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: #2c5157;
}
#galleryLightbox .btn-close::before { transform: rotate(45deg); }
#galleryLightbox .btn-close::after { transform: rotate(-45deg); }

/* Pfeile Links/Rechts fixiert */
.carousel-control-prev, 
.carousel-control-next {
    position: fixed !important;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    height: 80px;
    opacity: 1 !important;
    z-index: 10040;
}

.carousel-control-prev { left: 40px; }
.carousel-control-next { right: 40px; }

/* Die Kreise für die Pfeile (60px) */
.carousel-control-prev-icon, 
.carousel-control-next-icon {
    background-image: none !important;
    background-color: #ffffff !important;
    width: 60px !important; 
    height: 60px !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Präzise Pfeil-Linien */
.carousel-control-prev-icon::before, .carousel-control-prev-icon::after,
.carousel-control-next-icon::before, .carousel-control-next-icon::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 3px;
    background-color: #2c5157;
    border-radius: 2px;
}

.carousel-control-prev-icon::before { transform: rotate(-45deg); transform-origin: left center; left: 22px; top: 30px; }
.carousel-control-prev-icon::after { transform: rotate(45deg); transform-origin: left center; left: 22px; top: 30px; }
.carousel-control-next-icon::before { transform: rotate(45deg); transform-origin: right center; right: 22px; top: 30px; }
.carousel-control-next-icon::after { transform: rotate(-45deg); transform-origin: right center; right: 22px; top: 30px; }

/* Hover-Effekte */
#galleryLightbox .btn-close:hover,
.carousel-control-prev:hover, 
.carousel-control-next:hover {
    transform: translateY(-50%) scale(1.1) !important;
}
#galleryLightbox .btn-close:hover {
    transform: scale(1.1) !important;
}

/* Mobile Anpassung */
@media (max-width: 992px) {
    .carousel-control-prev { left: 10px; }
    .carousel-control-next { right: 10px; }
    .carousel-control-prev-icon, .carousel-control-next-icon {
        width: 45px !important;
        height: 45px !important;
    }
    /* Pfeil-Linien an den kleineren 45px-Kreis anpassen (Basis war auf 60px berechnet) */
    .carousel-control-prev-icon::before,
    .carousel-control-prev-icon::after { left: 15px; top: 21px; }
    .carousel-control-next-icon::before,
    .carousel-control-next-icon::after { right: 15px; top: 21px; }
}