/* ==========================================================================
   Mazmo Gallery Final CSS (v9.3 - Smart Fit Fixed)
   ========================================================================== */

:root {
    --mazmo-gallery-gap: 15px;
    --gallery-columns: 4;
    --gallery-columns-tablet: 3;
    --gallery-columns-mobile: 2;
    --gallery-aspect-ratio: 4/3;
}

/* === TAB STYLES === */
.mazmo-gallery-container-tabs .mazmo-tabs-nav {
    list-style: none;
    padding: 0;
    margin: 0 0 -1px 0;
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #dee2e6;
    position: relative;
    z-index: 2;
}
.mazmo-gallery-container-tabs .mazmo-tabs-nav li {
    margin: 0 4px 4px 0;
    padding: 0;
    display: flex;
}
.mazmo-gallery-container-tabs .mazmo-tabs-nav a {
    display: block;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: #495057;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px 4px 0 0;
    transition: color .15s, background-color .15s, border-color .15s;
}
.mazmo-gallery-container-tabs .mazmo-tabs-nav a:not(.active):hover {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #0056b3;
}
.mazmo-gallery-container-tabs .mazmo-tabs-nav a.active {
    font-weight: bold;
    color: #0056b3;
    background-color: #fff;
    border-color: #dee2e6 #dee2e6 #fff;
    border-bottom: 1px solid #fff;
    cursor: default;
}
.mazmo-gallery-container-tabs .mazmo-tabs-content {
    padding: 20px;
    border: 1px solid #dee2e6;
    border-top: none;
    position: relative;
    z-index: 1;
}

/* === GALLERY GRID === */
.mazmo-gallery-wrapper { position: relative; }

.mazmo-gallery-grid {
    display: grid;
    gap: var(--mazmo-gallery-gap);
    grid-template-columns: repeat(var(--gallery-columns, 4), 1fr);
}
/* === FINAL GALLERY HEIGHT FIX (v9.4 Smart Fit Full Frame) === */

/* Pastikan setiap item benar-benar punya frame tetap */
.mazmo-gallery-wrapper.layout-grid .mazmo-gallery-item {
    aspect-ratio: var(--gallery-aspect-ratio, 4/3);
    overflow: hidden;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

/* Hapus aspect-ratio di <a> agar tidak dobel */
.mazmo-gallery-wrapper.layout-grid .mazmo-gallery-item a {
    aspect-ratio: unset !important;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}




/* === ITEM === */
.mazmo-gallery-item {
    position: relative;
    line-height: 0;
}
.mazmo-gallery-item a {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 5px;
}
.mazmo-gallery-wrapper.layout-grid .mazmo-gallery-item a {
    aspect-ratio: var(--gallery-aspect-ratio, 4/3);
}

/* === SMART IMAGE FIT === */
/* Gambar selalu penuh */
.mazmo-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    flex: 1;
}

/* Untuk gambar portrait tetap tampil penuh tanpa ruang kosong */
.mazmo-gallery-item img.portrait {
    object-fit: cover !important;
    object-position: center;
}

/* Overlay efek hover */
.mazmo-gallery-item a::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba(0,0,0,.3);
    opacity: 0;
    transition: opacity .3s ease;
    z-index: 1;
    border-radius: inherit;
    pointer-events: none;
}
.mazmo-gallery-item:hover a::before { opacity: 1; }
.mazmo-gallery-item:hover img { transform: scale(1.05); }

/* === PLAY ICON FIX === */
.mazmo-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 30px;
    color: #fff;
    background-color: rgba(0, 0, 0, .5);
    border-radius: 50%;
    padding: .5em;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;

    /* ini yang membuat icon selalu terlihat */
    opacity: 1;
    transition: transform .3s ease;
}

/* Hapus efek fade in pada hover */
.mazmo-gallery-item:hover .mazmo-play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05); /* opsional, biar tetap ada efek */
}


/* === LOAD MORE BUTTON === */
.mazmo-loadmore-wrapper { text-align: center; margin-top: 20px; }
.mazmo-gallery-button {
    display: inline-block; padding: 10px 20px;
    background-color: #007bff; color: #fff;
    border: none; border-radius: 5px; cursor: pointer; font-size: 16px;
    transition: background-color .3s ease;
}
.mazmo-gallery-button:hover { background-color: #0056b3; }
.mazmo-gallery-button.loading { opacity: .7; cursor: wait; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .mazmo-gallery-grid {
        grid-template-columns: repeat(var(--gallery-columns-tablet, var(--gallery-columns)), 1fr);
    }
}
@media (max-width: 768px) {
    .mazmo-gallery-container-tabs .mazmo-tabs-nav { justify-content: center; }
    .mazmo-gallery-container-tabs .mazmo-tabs-nav a { padding: .5rem .75rem; }
    .mazmo-gallery-container-tabs .mazmo-tabs-content { padding: 15px; }
    .mazmo-gallery-grid {
        grid-template-columns: repeat(var(--gallery-columns-mobile, 2), 1fr) !important;
    }
}

/* === FORCE ONE COLUMN (video dsb) === */
@media (max-width: 768px) {
    .mazmo-gallery-item.force-one-col-mobile {
        width: 100% !important;
        grid-column: 1 / -1 !important;
        position: static !important;
        top: auto !important;
        left: auto !important;
        margin-bottom: 20px !important;
    }
}

/* === ACCESSIBILITY FIX === */
.mazmo-gallery-item:focus-within a::before { opacity: 1; }
