/* 1. ZUFALLSBILD ANSICHT */
.mlz-container {
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.mlz-item {
    display: block;
    width: 100%;
    cursor: pointer;
    overflow: hidden;
    box-sizing: border-box;
    transition: filter 0.2s ease-in-out;
}

.mlz-item img {
    display: block;
    width: 100% !important;
    height: auto !important;
}

.mlz-item:hover {
    filter: brightness(1.3);
}

/* 2. LIGHTBOX DIALOG & BACKDROP */
html:has(dialog.mlz-lightbox[open]),
body:has(dialog.mlz-lightbox[open]) {
    overflow: hidden !important;
}

.mlz-lightbox {
    border: none !important;
    background: transparent;
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    outline: none;
    overflow: hidden !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

.mlz-lightbox::backdrop {
    background: rgba(0, 0, 0, .85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.mlz-lightbox,
.mlz-img-wrapper,
.mlz-img-wrapper img {
    user-select: none !important;
}

.mlz-img-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex !important;

    /* Feste Allround-Zentrierung über Spalten-Layout */
    /*flex-direction: column !important;*/

    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    opacity: 0;
    transition: opacity .25s ease;
    padding: 2vh 2vw !important;
    box-sizing: border-box !important;
    touch-action: none !important;
}

.mlz-img-wrapper img {
    width: 400%;
    height: 400%;
    max-width: 900%;
    max-height: 900%;
    object-fit: contain !important;
    box-shadow: var(--mlz-box-shadow) !important;
    box-sizing: border-box !important;
    background: #000;
    border: calc(var(--mlz-border-width) * 2) solid var(--mlz-border-color) !important;
    border-radius: var(--mlz-border-radius) !important;

    /* Deine weiche Standard-Transition */
    transition: width 0.25s ease-out, height 0.25s ease-out, transform 0.25s ease-out;

    /* hardware-Beschleunigung aktivieren, um Mikroruckler beim Rendern zu verhindern */
    /* will-change: transform, width, height;*/
}

/* SMARTPHONE-OPTIMIERUNG (Aus Version 4.1): 
   Deaktiviert die Transition NUR während des aktiven Finger-Touch-Pannings,
   damit das Bild auf Mobilgeräten latenzfrei mitwandert. */
.mlz-img-wrapper img.mlz-touch-active {
    transition: none !important;
}


.mlz-lightbox:has(.mlz-reset-zoom-btn.mlz-visible) .mlz-img-wrapper img {
    cursor: grab;
}

.mlz-lightbox:has(.mlz-reset-zoom-btn.mlz-visible) .mlz-img-wrapper img:active {
    cursor: grabbing;
}

/* UNZERSTÖRBARER HINTERGRUND-SCHUTZ */
body.mlz-lightbox-active {
    overscroll-behavior: none !important;
    touch-action: none !important;
}



/* 3. CONTROLS & LOADER */
.mlz-control-btn,
.mlz-reset-zoom-btn {
    position: absolute;
    top: 10px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--mlz-border-color);
    color: #000;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
    opacity: 0;
    transition: opacity .2s ease;
}

.mlz-control-btn {
    z-index: 10003;
}

.mlz-fullscreen-btn {
    right: 50px;
    font: 18px/30px Arial, sans-serif;
}

.mlz-close-btn {
    right: 10px;
    font: 20px/30px Arial, sans-serif;
}

.mlz-reset-zoom-btn {
    right: 90px;
    z-index: 10004;
    pointer-events: none;
    font: 12px/30px Arial, sans-serif;
}

.mlz-reset-zoom-btn.mlz-visible {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.mlz-lightbox:hover .mlz-control-btn {
    opacity: 1 !important;
}

.mlz-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: var(--mlz-border-color);
    z-index: 10005;
    animation: mlzSpin 1s linear infinite;
    pointer-events: none;
}

@keyframes mlzSpin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* 4. VOLLBILDMODUS OVERRIDES */
.mlz-img-wrapper:fullscreen {
    padding: 0 !important;
}

.mlz-img-wrapper:fullscreen img {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.mlz-img-wrapper:fullscreen .mlz-control-btn {
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 2147483647 !important;
}

.mlz-img-wrapper img.mlz-touch-active {
    transition: none !important;
}