.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);

    /* Flexbox centering - key changes here */
    display: flex;
    justify-content: center;
    align-items: center;

    /* Ensure vertical and horizontal centering */
    place-items: center;
    place-content: center;
}

.modal-content {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;

    /* Ensure vertical centering */
    margin: 0;
    transform: none;
}

.charity-image-modal {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    object-position: center center;
}
.modal-body {
    padding: 20px;
    text-align: left;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
}

.close-modal:hover {
    color: #000;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .modal-content {
        width: 95%;
        margin: 0;
    }

    .charity-image-modal {
        height: 250px;
    }

    .charity-website {
        display: block;
        width: 100%;
        text-align: center;
    }
}

/* Additional centering fallback */
@supports not (place-items: center) {
    .modal {
        display: flex;
        justify-content: center;
        align-items: center;
    }
}