/* Lightbox Styles */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Close Button */
.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

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

/* Navigation Buttons */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lightbox-prev {
    left: 1rem;
}

.lightbox-next {
    right: 1rem;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev:disabled,
.lightbox-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Content Area */
.lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-image.loaded {
    opacity: 1;
}

/* Info Bar */
.lightbox-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 2rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.lightbox-title {
    font-size: 1.1rem;
    font-weight: 500;
}

.lightbox-species {
    font-size: 0.95rem;
    color: #86efac;
    font-weight: 500;
}

.lightbox-location {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* EXIF Info in Lightbox */
.lightbox-exif {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.lightbox-exif-item {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    white-space: nowrap;
}

.lightbox-counter {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    margin-left: auto;
}

.lightbox-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius);
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.lightbox-download:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* Loading Spinner */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Touch-friendly on mobile */
@media (max-width: 768px) {
    .lightbox-prev,
    .lightbox-next {
        width: 48px;
        height: 48px;
        font-size: 2rem;
    }

    .lightbox-prev {
        left: 0.5rem;
    }

    .lightbox-next {
        right: 0.5rem;
    }

    .lightbox-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }

    .lightbox-exif {
        order: 3;
    }

    .lightbox-exif-item {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    .lightbox-counter {
        margin-left: 0;
    }

    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
        width: 40px;
        height: 40px;
    }
}

/* Swipe hint for touch devices */
@media (hover: none) and (pointer: coarse) {
    .lightbox-prev,
    .lightbox-next {
        opacity: 0.5;
    }
}
