/* Custom Gallery Styles */
.gallery-container {
    position: relative;
    overflow: hidden; /* Contain the absolute positioned nav buttons */
}

.custom-gallery {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 15px; /* For scrollbar space */
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

.custom-gallery::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}

.gallery-item {
    flex: 0 0 250px; /* Do not grow, do not shrink, base width 250px */
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* New Gallery Navigation Buttons */
.gallery-nav {
    cursor: pointer;
    position: absolute;
    top: 50%; /* Better vertical centering */
    transform: translateY(-50%);
    width: auto;
    padding: 10px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.5s ease;
    user-select: none;
    background-color: rgba(0,0,0,0.4);
    z-index: 10;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Hidden by default */
}

.gallery-container:hover .gallery-nav {
    opacity: 1; /* Show on hover */
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

.gallery-nav:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
    .gallery-nav {
        /* Make buttons always visible on touch devices */
        opacity: 1;

        /* Reduce button size for smaller screens */
        width: 35px;
        height: 35px;
        padding: 8px;
        font-size: 18px;
    }

    .gallery-prev {
        left: 5px;
    }

    .gallery-next {
        right: 5px;
    }
}

/* Styles for even smaller screens */
@media (max-width: 480px) {
    .gallery-nav {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.gallery-item img {
    width: 100%;
    height: 200px; /* Fixed height */
    object-fit: cover; /* Crop image to fit */
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.gallery-item:hover img {
    opacity: 0.85;
}

.gallery-caption {
    padding: 15px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    background: #f9f9f9;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease, background-color 0.3s ease;
}

a.gallery-caption:hover {
    background-color: #efefef;
    color: #000;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
}

.modal-content {
    margin: auto;
    display: block;
    width: auto;
    height: 80%;
    max-width: 900px;
    max-height: 80vh;
    border-radius: 5px;
}

#caption {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 20px 0;
    font-size: 18px;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.6s ease;
    user-select: none;
    background-color: rgba(0,0,0,0.5);
    z-index: 1002; /* Increased z-index */
}

.prev {
    left: 15px;
    border-radius: 5px 0 0 5px;
}

.next {
    right: 15px;
    border-radius: 0 5px 5px 0;
}

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