/* Overlay Modal - Background hitam transparan */
.modal-overlay {
    display: none; /* Default hidden, akan di-show oleh JS */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

/* Konten Modal - Pembungkus gambar */
.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: zoomIn 0.3s ease;
}

/* Gambar di dalam modal */
#modalImage {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain; /* Menjaga aspek rasio gambar */
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* Tombol Close di pojok kanan atas */
.modal-close {
    position: absolute;
    top: -40px;
    right: -40px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    line-height: 1;
}

.modal-close:hover {
    color: #ff0000;
    transform: scale(1.1);
}

/* Animasi */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- RESPONSIVE UNTUK MOBILE --- */
@media only screen and (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }
    
    #modalImage {
        max-height: 80vh;
        width: 100%;
        border-radius: 4px;
    }
    
    /* Tombol close dipindah ke dalam gambar atau didekatkan */
    .modal-close {
        top: -35px;
        right: 0px;
        font-size: 35px;
        background: rgba(0,0,0,0.5);
        padding: 0 10px;
        border-radius: 5px;
    }
}

/* Untuk layar sangat kecil (HP) */
@media only screen and (max-width: 480px) {
    .modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        margin: 0;
        border-radius: 0;
        align-items: center;
    }
    
    #modalImage {
        max-height: 100vh;
        width: 100%;
        height: auto;
        max-width: 100%;
        object-fit: cover; /* Pada mobile, gambar memenuhi layar */
        border-radius: 0;
    }
    
    .modal-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
        z-index: 10000;
        color: #fff;
        text-shadow: 0 0 10px rgba(0,0,0,0.8);
        background: transparent;
        padding: 5px;
    }
}