/* Gallery Styles */

/* Gallery Controls */
.gallery-controls {
    margin-bottom: 3rem;
    text-align: center;
}

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.gallery-item {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
    opacity: 1;
    transform: scale(1);
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.gallery-item.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
}

.gallery-image {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.gallery-item:hover .gallery-image img {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 2rem 1.5rem 1rem;
    transform: translateY(100%);
    transition: transform var(--transition-normal);
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.gallery-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.gallery-description {
    font-size: 0.9rem;
    opacity: 0.9;
}

.gallery-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.lightbox.show {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    margin-bottom: 1rem;
}

.lightbox-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-xl);
}

.lightbox-info {
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 1rem 2rem;
    border-radius: 1rem;
    text-align: center;
    backdrop-filter: blur(10px);
}

.lightbox-info h3 {
    margin-bottom: 0.5rem;
    color: white;
}

.lightbox-info p {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.lightbox-counter {
    font-size: 0.9rem;
    opacity: 0.8;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 2rem;
    transform: translateY(-50%);
}

.lightbox-nav-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}

.lightbox-nav-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* Gallery Actions */
.gallery-actions {
    text-align: center;
}

#load-more-gallery {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
}

#load-more-gallery:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Loading Animation */
.loading-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .filter-buttons {
        flex-direction: column;
        align-items: center;
    }

    .filter-btn {
        width: 200px;
        text-align: center;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1rem;
    }

    .gallery-image {
        height: 200px;
    }

    .lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }

    .lightbox-nav {
        padding: 0 1rem;
    }

    .lightbox-close {
        top: -40px;
        right: -10px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-image {
        height: 180px;
    }

    .lightbox-image {
        max-height: 60vh;
    }

    .lightbox-info {
        padding: 0.75rem 1rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.slide-up {
    animation: slideUp 0.5s ease forwards;
}

.scale-in {
    animation: scaleIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .lightbox,
    .filter-btn {
        transition: none;
    }

    .gallery-item:hover {
        transform: none;
    }

    @keyframes spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }
}

/* Print Styles */
@media print {
    .gallery-controls,
    .gallery-actions,
    .lightbox {
        display: none !important;
    }

    .gallery-grid {
        display: block;
    }

    .gallery-item {
        margin-bottom: 1rem;
        break-inside: avoid;
    }
}