/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s;
}

.lightbox-content {
    position: relative;
    margin: auto;
    padding: 0;
    width: 90%;
    max-width: 1200px;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s ease;
    background: rgba(139, 107, 71, 0.8);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.lightbox-close:hover {
    background: var(--primary-brown);
    transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    margin-top: -22px;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    background: rgba(139, 107, 71, 0.8);
    border: none;
    border-radius: 50%;
    user-select: none;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: var(--primary-brown);
    transform: scale(1.1);
}

.lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 5px;
    max-width: 80%;
}

/* Animation keyframes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.lightbox.fade-out {
    animation: fadeOut 0.3s;
}

/* Responsive lightbox */
@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    .lightbox-prev,
    .lightbox-next {
        padding: 12px;
        font-size: 20px;
        margin-top: -20px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-caption {
        bottom: 10px;
        font-size: 14px;
        padding: 8px 16px;
        max-width: 90%;
    }

    .lightbox-image {
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .lightbox-content {
        width: 95%;
    }

    .lightbox-close {
        top: 5px;
        right: 5px;
        font-size: 24px;
        width: 35px;
        height: 35px;
    }

    .lightbox-prev,
    .lightbox-next {
        padding: 10px;
        font-size: 18px;
    }

    .lightbox-caption {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Loading spinner for images */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
}

.lightbox-loading::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translateX(-50%) rotate(0deg); }
    100% { transform: translateX(-50%) rotate(360deg); }
}

/* Prevent body scroll when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}

/* Touch gestures for mobile */
.lightbox-content {
    touch-action: pan-y;
}

/* Accessibility improvements */
.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus {
    outline: 2px solid var(--primary-brown);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lightbox {
        background-color: black;
    }
    
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        background: #000000;
        border: 2px solid white;
    }
    
    .lightbox-caption {
        background: black;
        border: 1px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .lightbox {
        animation: none;
    }
    
    .lightbox.fade-out {
        animation: none;
    }
    
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        transition: none;
    }
}
