/* MLK Alternative Lightbox - Frontend Stilleri */

/* ===== OVERLAY ===== */
.mlk-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

/* ===== LIGHTBOX ÇERÇEVE ===== */
.mlk-lightbox-modal {
    position: relative;
    z-index: 999999;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
    box-sizing: border-box;
}

/* İçeriğin köşe yuvarlaklığını ve taşmasını modal yerine bu sarmalayıcı yönetir,
   böylece kapatma butonu çerçevenin (modal) üstünde kalabilir. */
.mlk-lightbox-inner {
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: inherit;
    box-sizing: border-box;
}

/* ===== KAPATMA BUTONU ===== */
.mlk-lightbox-close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.mlk-lightbox-close:hover {
    background: #dc3232;
    transform: scale(1.1);
}

/* ===== İÇERİK ALANI ===== */
.mlk-lightbox-content {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Popup içerik */
.mlk-popup-title {
    margin: 0 0 16px;
    font-size: 1.4em;
    line-height: 1.3;
}

.mlk-popup-body img { max-width: 100%; height: auto; }

/* ===== GALERİ ===== */
.mlk-gallery-lightbox {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.mlk-gallery-slides {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mlk-gallery-slide {
    display: none;
    width: 100%;
    text-align: center;
}

.mlk-gallery-slide.active { display: flex; align-items: center; justify-content: center; }

.mlk-gallery-slide img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    margin: auto;
}

/* Navigasyon Butonları */
.mlk-gallery-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 0 6px;
    flex-shrink: 0;
}

.mlk-gallery-nav button {
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s;
    line-height: 1;
    color: inherit;
}

.mlk-gallery-nav button:hover { background: rgba(0, 0, 0, 0.18); }

.mlk-gallery-counter {
    font-size: 13px;
    color: #666;
    min-width: 50px;
    text-align: center;
}

/* Thumbnail Şeridi */
.mlk-gallery-thumbnails {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 4px 4px;
    flex-shrink: 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.mlk-gallery-thumb {
    flex-shrink: 0;
    width: 56px;
    height: 42px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    background: none;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
    scroll-snap-align: start;
}

.mlk-gallery-thumb.active,
.mlk-gallery-thumb:hover {
    border-color: #2271b1;
    opacity: 1;
}

.mlk-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== SAYFA / HARİCİ IFRAME ===== */
.mlk-page-iframe,
.mlk-external-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    min-height: 300px;
}

/* ===== YÜKLENİYOR ===== */
.mlk-lightbox-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
    font-size: 14px;
    gap: 10px;
}

.mlk-lightbox-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(0,0,0,0.15);
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: mlk-spin 0.7s linear infinite;
}

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

/* ===== ANİMASYONLAR ===== */

/* Fade */
.mlk-anim-fade-in  { animation: mlkFadeIn  var(--mlk-anim-speed, 300ms) ease forwards; }
.mlk-anim-fade-out { animation: mlkFadeOut var(--mlk-anim-speed, 300ms) ease forwards; }

@keyframes mlkFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes mlkFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Zoom */
.mlk-anim-zoom-in  { animation: mlkZoomIn  var(--mlk-anim-speed, 300ms) cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.mlk-anim-zoom-out { animation: mlkZoomOut var(--mlk-anim-speed, 300ms) ease forwards; }

@keyframes mlkZoomIn  { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }
@keyframes mlkZoomOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.7); } }

/* Slide Down (yukarıdan aşağı) */
.mlk-anim-slide-down-in  { animation: mlkSlideDownIn  var(--mlk-anim-speed, 300ms) ease forwards; }
.mlk-anim-slide-down-out { animation: mlkSlideDownOut var(--mlk-anim-speed, 300ms) ease forwards; }

@keyframes mlkSlideDownIn  { from { opacity: 0; transform: translateY(-60px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mlkSlideDownOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-60px); } }

/* Slide Up (aşağıdan yukarı) */
.mlk-anim-slide-up-in  { animation: mlkSlideUpIn  var(--mlk-anim-speed, 300ms) ease forwards; }
.mlk-anim-slide-up-out { animation: mlkSlideUpOut var(--mlk-anim-speed, 300ms) ease forwards; }

@keyframes mlkSlideUpIn  { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mlkSlideUpOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(60px); } }

/* Flip */
.mlk-anim-flip-in  { animation: mlkFlipIn  var(--mlk-anim-speed, 300ms) ease forwards; }
.mlk-anim-flip-out { animation: mlkFlipOut var(--mlk-anim-speed, 300ms) ease forwards; }

@keyframes mlkFlipIn  { from { opacity: 0; transform: perspective(600px) rotateX(-30deg); } to { opacity: 1; transform: perspective(600px) rotateX(0); } }
@keyframes mlkFlipOut { from { opacity: 1; transform: perspective(600px) rotateX(0); } to { opacity: 0; transform: perspective(600px) rotateX(-30deg); } }

/* Overlay animasyonu */
.mlk-overlay-in  { animation: mlkFadeIn  var(--mlk-anim-speed, 300ms) ease forwards; }
.mlk-overlay-out { animation: mlkFadeOut var(--mlk-anim-speed, 300ms) ease forwards; }

/* ===== TETİKLEYİCİ BUTON ===== */
.mlk-lightbox-trigger {
    cursor: pointer;
}

/* ===== MOBİL UYUM ===== */
@media (max-width: 600px) {
    .mlk-lightbox-overlay { padding: 8px; align-items: flex-end; }

    .mlk-lightbox-modal {
        width: 100% !important;
        max-height: 90vh !important;
        border-radius: 16px 16px 0 0 !important;
    }

    .mlk-lightbox-close { top: 8px; right: 8px; position: fixed; }

    .mlk-gallery-slide img { max-height: 45vh; }

    .mlk-gallery-thumb { width: 44px; height: 34px; }
}

@media (max-width: 480px) {
    .mlk-lightbox-overlay { padding: 0; }

    .mlk-gallery-lightbox { padding: 8px; }
}

/* ===== scroll kilidi ===== */
body.mlk-lightbox-open { overflow: hidden; }
