body {
    padding-top: 20px;
    background-color: #f4f4f4; /* Light grey background */
    color: #333; /* Dark grey text */
}

.gallery-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    padding: 20px;
    margin-bottom: 20px;
    margin: 0 auto; /* Center container */
    max-width: 90%;
}

.gallery-title {
    text-align: center;
    margin-bottom: 30px;
    color: #4a4a4a;
}

.gallery-description {
    margin-bottom: 1rem;
    text-align: justify;
    color: #555;
}

/* Grid container for images */
.row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* Horizontally center items */
    gap: 10px; /* Spacing between grid items */
}

/* Grid item style */
.col-lg-3, .col-md-4, .col-sm-6 {
    display: flex;
    justify-content: center; /* Horizontally center image within grid item */
    align-items: center; /* Vertically center image within grid item */
}

/* Thumbnail styles */
.img-thumbnail {
    width: 100%; /* Make the image responsive within its container */
    height: auto; /* Ensures the height grows in proportion with the width while maintaining aspect ratio */
    object-fit: contain; /* Ensures the image scales correctly within its container */
    max-height: 200px; /* Sets the maximum height the image can have */
    border-radius: 8px; /* For rounded corners */
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* For smooth transitions */
}

/* Thumbnail container style */
.thumbnail-container {
    display: flex;
    justify-content: center; /* Horizontally center image within grid item */
    align-items: center; /* Vertically center image within grid item */
    margin: 5px; /* Spacing around the image */
}

.img-thumbnail:hover {
    transform: scale(1.1); /* Scale up image on hover */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Optional: add shadow for depth, on hover */
    z-index: 10; /* Make sure the scaled item is above others */
}

/* Fullscreen modal styles */
.modal-dialog {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
}

.modal-open .modal {
    display: flex !important; /* Ensure the modal uses flex display */
    align-items: center; /* Center modal vertically in window */
    justify-content: center; /* Center modal horizontally in window */
}

.modal-backdrop.show {
    opacity: 0.8; /* Darken the background */
}

.modal-content {
    background: transparent; /* Remove default modal background */
    border: 2px solid #333; /* Dark border for visibility */
    border-radius: 0.25rem; /* Match Bootstrap's default modal border radius */
}

.modal-body {
    position: relative; /* Needed for absolute positioning of the close button */
    display: flex; /* Use flexbox to center the image */
    justify-content: center; /* Center the image horizontally */
    align-items: center; /* Center the image vertically */
    height: 100%; /* Make sure the modal body stretches to the full height of the modal dialog */
    padding: 0; /* Remove padding to allow full use of the area for the image */
}

/* Adjust the modal image size */
#modalImage {
    display: block; /* Use block to center the image */
    max-width: 100%; /* Maximum width of the image is 100% of the modal body */
    max-height: 80vh; /* Maximum height of the image is 80% of the viewport height */
    object-fit: contain; /* Ensure the image's aspect ratio is preserved */
    margin: auto; /* Center the image in the available space */
    transition: transform 0.5s ease; /* Animation for the transform */
    border-radius: 10px; /* Optional: if you want rounded corners */
}

/* Close button styling */
#modalCloseButton {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1050; /* Above the modal content */
    background: #ffffff; /* White color background */
    border-radius: 0.25rem; /* Rounded border */
    padding: 0.5rem; /* Padding for the button area */
    opacity: 0.8; /* Slight transparency */
    border: none; /* No border */
    cursor: pointer; /* Show a pointer on hover */
    font-size: 1.5rem; /* Close button size */
}

#modalCloseButton span {
    font-size: 1.5rem; /* Size of the '×' character */
    color: #000; /* Black color text for visibility */
}

#modalCloseButton:hover {
    opacity: 1; /* Full visibility on hover */
}

@media screen and (max-width: 992px) {
    .modal-dialog,
    .modal-content,
    #modalImage {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        padding: 0;
        margin: 0;
    }

    .modal-body {
        padding: 0;
    }
}