/* Gallery Specific Styles */
.gallery-main {
    margin-top: 90px;
    min-height: calc(100vh - 90px);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 40px 20px;
}

.gallery-header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInDown 0.8s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-title {
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
}

.gallery-title .chinese {
    display: block;
    font-size: 36px;
    color: #347f3e;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 3px;
}

.gallery-title .english {
    display: block;
    font-size: 42px;
    background: linear-gradient(90deg, #347f3e, #4CAF50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: bold;
}

.gallery-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #347f3e, #4CAF50);
    border-radius: 2px;
}

/* Filter Buttons */
.filter-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.filter-btn {
    padding: 12px 25px;
    border: 2px solid #347f3e;
    background: white;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.filter-btn .chinese {
    display: block;
    font-size: 13px;
    margin-bottom: 2px;
    color: #347f3e;
}

.filter-btn .english {
    display: block;
    font-size: 14px;
    color: #347f3e;
    font-weight: 500;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #347f3e, #4CAF50);
    transition: left 0.3s ease;
    z-index: -1;
}

.filter-btn:hover::before,
.filter-btn.active::before {
    left: 0;
}

.filter-btn:hover .chinese,
.filter-btn:hover .english,
.filter-btn.active .chinese,
.filter-btn.active .english {
    color: white;
}

.filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 127, 62, 0.3);
}

.filter-btn.active {
    background: linear-gradient(90deg, #347f3e, #4CAF50);
    border-color: transparent;
}

/* Gallery Grid - Masonry Layout */
.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    columns: 4;
    column-gap: 20px;
    padding: 20px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fadeInUp 0.6s ease backwards;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    break-inside: avoid;
    margin-bottom: 20px;
    width: 100%;
    display: inline-block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }
.gallery-item:nth-child(7) { animation-delay: 0.7s; }
.gallery-item:nth-child(8) { animation-delay: 0.8s; }

.gallery-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.6s ease;
    display: block;
    vertical-align: top;
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(52, 127, 62, 0.25);
    z-index: 10;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Overlay for Gallery Items */
.gallery-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    align-items: flex-end;
    padding: 25px;
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.overlay-content {
    transform: translateY(20px);
    transition: transform 0.4s ease;
    color: white;
}

.gallery-item:hover .overlay-content {
    transform: translateY(0);
}

.overlay-content h3 {
    margin-bottom: 10px;
}

.overlay-content h3 .chinese {
    display: block;
    font-size: 18px;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.overlay-content h3 .english {
    display: block;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.overlay-content .caption {
    opacity: 0.9;
}

.overlay-content .caption .chinese {
    display: block;
    font-size: 14px;
    margin-bottom: 3px;
}

.overlay-content .caption .english {
    display: block;
    font-size: 15px;
}

/* Lightbox Modal */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.lightbox.active {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.close-lightbox {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2001;
}

.close-lightbox:hover {
    color: #4CAF50;
    transform: rotate(90deg);
}

.lightbox-image {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
    animation: zoomIn 0.4s ease;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-caption {
    text-align: center;
    color: white;
    margin-top: 20px;
    max-width: 600px;
}

.lightbox-caption h3 {
    display: none;
}

.lightbox-caption p {
    font-size: 20px;
    opacity: 1;
    line-height: 1.5;
}

.lightbox-caption p .chinese {
    font-size: 19px;
    display: block;
    margin-bottom: 8px;
}

.lightbox-caption p .english {
    font-size: 21px;
    display: block;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
}

.lightbox-prev,
.lightbox-next {
    background: rgba(255,255,255,0.1);
    border: 2px solid white;
    color: white;
    font-size: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(76, 175, 80, 0.5);
    transform: scale(1.1);
}

/* Hide/Show Animation for Filtering */
.gallery-item.hide {
    animation: fadeOut 0.3s ease forwards;
    pointer-events: none;
}

.gallery-item.show {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-container {
        columns: 2;
        column-gap: 15px;
    }

    .filter-btn {
        padding: 8px 15px;
        font-size: 12px;
    }

    .gallery-title .chinese {
        font-size: 28px;
    }

    .gallery-title .english {
        font-size: 32px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}

/* Fun Floating Animation for Active Items */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.gallery-item.floating {
    animation: float 3s ease-in-out infinite;
}