/**
 * Lightbox Styles
 * Simple, elegant lightbox for image galleries
 */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    animation: zoomIn 0.3s ease-out;
    transition: opacity 0.3s ease-in-out;
    display: block;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    padding: 10px;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
    z-index: 10001;
}

.lightbox-close:hover {
    color: #f0f0f0;
    transform: scale(1.1);
}

/* Navigation buttons */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 30px;
    padding: 20px 15px;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    z-index: 10001;
    border-radius: 4px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Caption */
.lightbox-caption {
    position: absolute;
    bottom: -50px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-size: 16px;
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

/* Counter */
.lightbox-counter {
    position: absolute;
    top: -50px;
    left: 0;
    color: #fff;
    font-size: 14px;
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .lightbox-content {
        max-width: 100%;
        max-height: 100%;
        width: 100%;
        height: 100%;
        padding: 0;
    }

    .lightbox-image {
        max-height: 80vh;
        max-width: 95vw;
        width: auto;
        height: auto;
        object-fit: contain;
        margin: auto;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        background-color: rgba(0, 0, 0, 0.8);
        border-radius: 50%;
        width: 45px;
        height: 45px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        line-height: 1;
        z-index: 10002;
    }

    .lightbox-prev,
    .lightbox-next {
        font-size: 22px;
        padding: 12px 8px;
        background-color: rgba(0, 0, 0, 0.6);
        top: 50%;
        transform: translateY(-50%);
    }

    .lightbox-prev {
        left: 5px;
    }

    .lightbox-next {
        right: 5px;
    }

    .lightbox-caption {
        bottom: 60px;
        left: 10px;
        right: 10px;
        font-size: 13px;
        padding: 8px 12px;
        background-color: rgba(0, 0, 0, 0.7);
        max-width: calc(100% - 20px);
    }

    .lightbox-counter {
        top: 10px;
        left: 10px;
        right: auto;
        font-size: 12px;
        padding: 8px 12px;
        background-color: rgba(0, 0, 0, 0.7);
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .lightbox-image {
        max-height: 75vh;
        max-width: 90vw;
    }

    .lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 28px;
    }

    .lightbox-prev,
    .lightbox-next {
        padding: 10px 6px;
        font-size: 20px;
    }

    .lightbox-caption {
        font-size: 12px;
        padding: 6px 10px;
        bottom: 50px;
    }

    .lightbox-counter {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Landscape mode on mobile */
@media (max-width: 896px) and (max-height: 414px) and (orientation: landscape) {
    .lightbox-image {
        max-height: 85vh;
        max-width: 60vw;
    }

    .lightbox-close {
        top: 5px;
        right: 5px;
    }

    .lightbox-caption {
        display: none;
    }

    .lightbox-counter {
        top: 5px;
        left: 5px;
    }
}

/* Prevent scrolling when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}

/* Loading spinner (optional enhancement) */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}
