/* Gallery-specific styles for category pages */

/* Breadcrumb */
.breadcrumb {
    margin: 40px 0 20px 0;
    color: #888888;
    font-size: 14px;
    letter-spacing: 1px;
    text-align: center;
}

.breadcrumb a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: #cccccc;
}

/* Category Description */
.category-description {
    max-width: 800px;
    margin: 0 auto 60px auto;
    padding: 0 40px;
    text-align: center;
}

.category-description p {
    color: #cccccc;
    font-size: 16px;
    line-height: 1.8;
    letter-spacing: 0.5px;
    font-weight: 300;
}

/* Gallery Section */
.category-gallery {
    padding: 40px 0 80px;
    min-height: 100vh;
}

/* Masonry Gallery */
.gallery-masonry {
    columns: 5;
    column-gap: 25px;
    margin: 0 auto;
    max-width: 1400px;
    padding: 0 40px;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 25px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(30px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.masonry-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.masonry-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.masonry-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.masonry-item:hover img {
    transform: scale(1.05);
}

/* UPDATED LIGHTBOX STYLES - More contained sizing like Flickr gallery */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    padding: 40px;
    box-sizing: border-box;
}

.lightbox.active {
    display: flex !important;
}

.lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: 100%;
}

/* IMPROVED: Better lightbox image sizing similar to Flickr gallery */
.lightbox img,
.lightbox-image,
#lightbox-image {
    max-width: 80vw !important;
    max-height: 75vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
    display: block !important;
    margin: 0 auto !important;
    image-orientation: from-image !important;
    transform: none !important;
}

/* For portrait images, limit the height more */
.lightbox img[style*="height"],
.lightbox-image[style*="height"],
#lightbox-image[style*="height"] {
    max-height: 70vh !important;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    z-index: 10001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-weight: normal;
    line-height: 1;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    font-size: 30px;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10001;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: normal;
    line-height: 1;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    letter-spacing: 1px;
    z-index: 10001;
}

/* Gallery Navigation */
.gallery-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 60px auto 0;
    max-width: 800px;
    padding: 0 40px;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    padding: 12px 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: all 0.3s ease;
    letter-spacing: 1px;
    font-weight: 300;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(10px);
}

.nav-link:hover {
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.1);
}

.nav-link.home {
    background: linear-gradient(45deg, rgba(100, 150, 255, 0.2), rgba(100, 150, 255, 0.1));
    border-color: rgba(100, 150, 255, 0.3);
}

.nav-link.home:hover {
    background: linear-gradient(45deg, rgba(100, 150, 255, 0.3), rgba(100, 150, 255, 0.2));
    box-shadow: 0 10px 30px rgba(100, 150, 255, 0.2);
}

/* Loading State Styles */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #cccccc;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */

/* Large screens */
@media (min-width: 1200px) {
    .gallery-masonry {
        columns: 5;
        max-width: 1600px;
    }
}

/* Medium-large screens */
@media (max-width: 1199px) and (min-width: 900px) {
    .gallery-masonry {
        columns: 4;
        max-width: 1200px;
        padding: 0 30px;
    }
}

/* Medium screens */
@media (max-width: 899px) and (min-width: 600px) {
    .gallery-masonry {
        columns: 3;
        column-gap: 20px;
        padding: 0 30px;
    }

    .masonry-item {
        margin-bottom: 20px;
    }

    .category-description {
        padding: 0 30px;
    }

    .gallery-navigation {
        padding: 0 30px;
        flex-direction: column;
        gap: 20px;
    }
}

/* Small screens */
@media (max-width: 599px) {
    .gallery-masonry {
        columns: 2;
        column-gap: 15px;
        padding: 0 20px;
    }

    .masonry-item {
        margin-bottom: 15px;
    }

    .category-description {
        padding: 0 20px;
        margin-bottom: 40px;
    }

    .category-description p {
        font-size: 14px;
        line-height: 1.6;
    }

    .gallery-navigation {
        padding: 0 20px;
        flex-direction: column;
        gap: 15px;
        margin-top: 40px;
    }

    .nav-link {
        padding: 10px 20px;
        font-size: 14px;
        text-align: center;
        width: 100%;
        max-width: 300px;
    }

    /* Mobile lightbox optimizations */
    .lightbox {
        padding: 20px;
    }

    .lightbox img,
    .lightbox-image,
    #lightbox-image {
        max-width: 90vw !important;
        max-height: 70vh !important;
    }

    .lightbox-close {
        top: 15px;
        right: 20px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    .lightbox-nav {
        font-size: 24px;
        padding: 12px 15px;
        width: 50px;
        height: 50px;
    }

    .lightbox-prev {
        left: 20px;
    }

    .lightbox-next {
        right: 20px;
    }

    .lightbox-counter {
        bottom: 15px;
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Very small mobile screens */
@media (max-width: 400px) {
    .gallery-masonry {
        columns: 1;
        padding: 0 15px;
    }

    .category-description {
        padding: 0 15px;
    }

    .gallery-navigation {
        padding: 0 15px;
    }

    /* Very small mobile lightbox */
    .lightbox {
        padding: 15px;
    }

    .lightbox img,
    .lightbox-image,
    #lightbox-image {
        max-width: 95vw !important;
        max-height: 65vh !important;
    }

    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 24px;
        width: 35px;
        height: 35px;
    }

    .lightbox-nav {
        font-size: 20px;
        padding: 10px;
        width: 40px;
        height: 40px;
    }

    .lightbox-prev {
        left: 15px;
    }

    .lightbox-next {
        right: 15px;
    }
}