/* Ensure the main container doesn't get squished */
#mfg-gallery-container * {
    box-sizing: border-box;
}

/* Album Grid */
.mfg-album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 280px); /* Strict 280px columns */
    gap: 20px;
    justify-content: center; /* Center the grid if there's extra space */
}
.mfg-album-item {
    width: 280px;
    height: 280px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    text-decoration: none !important; /* Override theme styles */
    color: white;
    background-color: #222;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Align meta to the bottom */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}
.mfg-album-item:hover {
    transform: translateY(-5px);
}
.mfg-album-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* This is key for the image to fill the 280x280 box */
    z-index: 1;
    transition: opacity 0.3s ease;
}
.mfg-album-item:hover .mfg-album-cover {
    opacity: 0.8;
}
.mfg-album-meta {
    position: relative;
    z-index: 2;
    padding: 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}
.mfg-album-name {
    font-size: 1.1em;
    font-weight: bold;
    display: block;
    line-height: 1.2;
    margin: 0;
    padding: 0;
}
.mfg-album-stats {
    font-size: 0.9em;
    display: block;
    opacity: 0.9;
    margin-top: 4px;
}

/* Photo Grid */
.mfg-photo-grid-container {
    padding-top: 20px;
}
.mfg-photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}
.mfg-photo-item {
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
    aspect-ratio: 1 / 1; /* Make photos square */
}
.mfg-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.mfg-photo-item:hover img {
    transform: scale(1.1);
}

/* Pagination & Other elements from before */
.mfg-pagination { text-align: center; margin: 30px 0 10px; }
.mfg-pagination a { padding: 8px 12px; border: 1px solid #ddd; margin: 0 5px; text-decoration: none; color: #333; border-radius: 4px; }
.mfg-pagination a:hover { background-color: #f5f5f5; }
.mfg-lightbox-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.9); z-index: 99999; display: flex; align-items: center; justify-content: center; }
.mfg-lightbox-content { position: relative; max-width: 90vw; max-height: 90vh; }
.mfg-lightbox-image { max-width: 100%; max-height: 80vh; display: block; border-radius: 4px; }
.mfg-lightbox-info { color: white; text-align: center; padding: 10px; }
.mfg-lightbox-close, .mfg-lightbox-next, .mfg-lightbox-prev { position: absolute; color: white; font-size: 30px; cursor: pointer; text-decoration: none; user-select: none; }
.mfg-lightbox-close { top: 10px; right: 20px; }
.mfg-lightbox-next { top: 50%; right: 10px; transform: translateY(-50%); padding: 10px;}
.mfg-lightbox-prev { top: 50%; left: 10px; transform: translateY(-50%); padding: 10px; }
.mfg-loading { border: 5px solid #f3f3f3; border-top: 5px solid #3498db; border-radius: 50%; width: 50px; height: 50px; animation: mfg-spin 1s linear infinite; margin: 50px auto; }
@keyframes mfg-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.mfg-lightbox-info h3 {
    color: #ffffff; /* Makes the photo title white */
    font-size: 19px; /* Sets the font size as requested */
    font-weight: normal;
    margin: 0 0 8px 0;
}

.mfg-lightbox-info p {
    margin: 0 0 15px 0;
    font-size: 14px;
    opacity: 0.8;
}

.mfg-lightbox-info a {
    color: #ffffff; /* Makes the download link white */
    text-decoration: underline;
}

.mfg-lightbox-info a:hover {
    color: #dddddd;
}

/* ADD THIS to the end of your CSS file */

.mfg-lightbox-next, 
.mfg-lightbox-prev {
    z-index: 10; /* This brings the buttons in front of the image */
    background-color: rgba(0, 0, 0, 0.2); /* Adds a subtle background for visibility */
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.mfg-lightbox-next:hover, 
.mfg-lightbox-prev:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

/* Specific adjustments for mobile screens */
@media (max-width: 768px) {
    .mfg-lightbox-next {
        right: 5px; /* Moves the button in from the far edge */
    }

    .mfg-lightbox-prev {
        left: 5px; /* Moves the button in from the far edge */
    }
}