/* ========================================
   LIGHTBOX & GALLERY
   ======================================== */

/* Lightbox Overlay */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: var(--z-lightbox);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Lightbox Content */
.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-radius: var(--border-radius-large);
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: scaleIn 0.3s ease;
}

.lightbox:not(.active) .lightbox-content {
    animation: scaleOut 0.3s ease;
}

/* Lightbox Image */
.lightbox-image {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-large);
}

/* Lightbox Info */
.lightbox-info {
    text-align: center;
    color: white;
    max-width: 600px;
}

.lightbox-info h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: white;
}

.lightbox-info p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.lightbox-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.lightbox-category {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.lightbox-counter {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Lightbox Controls */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1.2rem;
}

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

.lightbox-close {
    top: 1rem;
    right: 1rem;
}

.lightbox-prev {
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
}

.lightbox-next {
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Lightbox Navigation Hints */
.lightbox-nav-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-align: center;
    pointer-events: none;
}

.lightbox-nav-hint kbd {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    margin: 0 0.25rem;
}

/* Gallery Loading States */
.portfolio-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.portfolio-loading .loading-spinner {
    margin-bottom: 1rem;
}

/* Gallery Error States */
.portfolio-error {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.portfolio-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #e53e3e;
}

.portfolio-error h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.portfolio-error button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-fast);
}

.portfolio-error button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Gallery Filters Active State */
.portfolio-filters {
    position: relative;
}

.filter-btn {
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.filter-btn:hover::before {
    left: 100%;
}

/* Portfolio Masonry Layout */
.portfolio-masonry {
    column-count: 3;
    column-gap: 2rem;
    column-fill: balance;
}

.portfolio-masonry .portfolio-item {
    break-inside: avoid;
    margin-bottom: 2rem;
    display: inline-block;
    width: 100%;
}

/* Zoom Effect for Images */
.portfolio-item img {
    transition: var(--transition-smooth);
}

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

/* Gallery Infinite Scroll Indicator */
.infinite-scroll-indicator {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.infinite-scroll-indicator.loading {
    animation: pulse 2s infinite;
}

/* Gallery Search */
.gallery-search {
    position: relative;
    margin-bottom: 2rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-search input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-large);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition-fast);
}

.gallery-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.gallery-search i {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* Gallery Statistics */
.gallery-stats {
    text-align: center;
    margin: 2rem 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

.gallery-stats strong {
    color: var(--primary-color);
}

/* Lightbox Touch Gestures */
.lightbox-content {
    touch-action: manipulation;
}

/* Lightbox Fullscreen Mode */
.lightbox.fullscreen {
    background: rgba(0, 0, 0, 0.98);
}

.lightbox.fullscreen .lightbox-content {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    padding: 1rem;
}

.lightbox.fullscreen .lightbox-image {
    max-height: 80vh;
}

/* Gallery Thumbnail Grid */
.gallery-thumbnails {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.gallery-thumbnail {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition-fast);
    border: 2px solid transparent;
}

.gallery-thumbnail:hover,
.gallery-thumbnail.active {
    opacity: 1;
    border-color: var(--primary-color);
}

/* Gallery Download Button */
.lightbox-download {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: var(--border-radius);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.9rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lightbox-download:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}
