/* ============================================
   Lightbox Styles
   ============================================ */

.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-caption {
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 14px;
    margin-top: 10px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.3s, transform 0.3s;
    line-height: 1;
    background: none;
    border: none;
    padding: 5px 10px;
}

.lightbox-close:hover {
    color: #ffc107;
    transform: rotate(90deg);
}

/* Navigation buttons */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 30px;
    padding: 5px 20px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s, transform 0.3s;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Disabled state */
.lightbox-prev.disabled,
.lightbox-next.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Clickable image in search results */
.lightbox-trigger {
    cursor: zoom-in;
    transition: transform 0.2s, box-shadow 0.2s;
}

.lightbox-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Gallery container support */
.images-container .lightbox-trigger,
.gallery .lightbox-trigger {
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
    .lightbox-prev,
    .lightbox-next {
        padding: 10px 15px;
        font-size: 24px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-close {
        top: 10px;
        right: 15px;
        font-size: 30px;
    }

    .lightbox-content {
        max-width: 95%;
    }

    .lightbox-image {
        max-height: 70vh;
    }
}

/* Loading state */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
}

.lightbox-loading::after {
    content: '';
    display: block;
    width: 40px;
    height: 40px;
    margin: 10px auto;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: lightbox-spin 1s ease-in-out infinite;
}

@keyframes lightbox-spin {
    to { transform: rotate(360deg); }
}
