/* ============================================
   LIGHTBOX IMAGE VIEWER CSS
   Professional Image Preview System
   ============================================ */

/* Lightbox Container */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.96);
    z-index: 99999;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lightbox.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

/* Overlay Background */
.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: zoom-out;
    z-index: 1;
}

/* Image Container */
.lightbox-container {
    position: relative;
    max-width: 90%;
    max-height: 85vh;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Main Image */
.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
    cursor: grab;
}

.lightbox-img:active {
    cursor: grabbing;
}

.lightbox-img.zoomed {
    cursor: move;
}

/* Image Animation */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInSlideLeft {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInSlideRight {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.lightbox-img.animate-in {
    animation: fadeInScale 0.4s ease forwards;
}

.lightbox-img.slide-left {
    animation: fadeInSlideLeft 0.4s ease forwards;
}

.lightbox-img.slide-right {
    animation: fadeInSlideRight 0.4s ease forwards;
}

/* Close Button */
.lightbox-close {
    position: fixed;
    top: 25px;
    right: 25px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: rgba(255, 0, 0, 0.3);
    border-color: rgba(255, 0, 0, 0.5);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
}

/* Navigation Buttons */
.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

.lightbox-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

/* Image Info Bar */
.lightbox-info {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    padding: 12px 25px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.lightbox-info h5 {
    margin: 0 0 3px 0;
    font-size: 1rem;
    font-weight: 600;
}

.lightbox-info p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Controls Bar */
.lightbox-controls {
    position: fixed;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 10px 20px;
    z-index: 100;
}

.lightbox-controls button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-controls button:active {
    transform: scale(0.95);
}

/* Tooltip for control buttons */
.lightbox-controls button::after {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox-controls button:hover::after {
    opacity: 1;
}

/* Loading Spinner */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.lightbox-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Gallery Thumbnails */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.gallery-thumb {
    width: 100%;
    height: 280px;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}

.gallery-item:hover .gallery-thumb {
    transform: scale(1.12);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.5) 40%,
        rgba(0, 0, 0, 0.1) 100%
    );
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: all 0.4s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.overlay-content {
    text-align: center;
    color: white;
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.gallery-item:hover .overlay-content {
    transform: translateY(0);
}

.overlay-content i {
    display: block;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.overlay-content h6 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Fullscreen Mode */
.lightbox.fullscreen .lightbox-container {
    max-width: 100%;
    max-height: 100vh;
}

.lightbox.fullscreen .lightbox-img {
    max-height: 100vh;
    max-width: 100vw;
    border-radius: 0;
}

.lightbox.fullscreen .lightbox-controls {
    bottom: 20px;
    opacity: 0.7;
}

.lightbox.fullscreen .lightbox-controls:hover {
    opacity: 1;
}

/* Thumbnail Strip (Optional) */
.lightbox-thumbnails {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 100;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow-x: auto;
    max-width: 80%;
}

.lightbox-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    opacity: 0.6;
}

.lightbox-thumbnail:hover,
.lightbox-thumbnail.active {
    border-color: white;
    opacity: 1;
    transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .lightbox-container {
        max-width: 95%;
    }
    
    .gallery-thumb {
        height: 250px;
    }
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
    
    .lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-controls {
        bottom: 20px;
        padding: 8px 15px;
        gap: 5px;
    }
    
    .lightbox-controls button {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .lightbox-info {
        bottom: -45px;
        padding: 8px 18px;
    }
    
    .lightbox-info h5 {
        font-size: 0.9rem;
    }
    
    .lightbox-info p {
        font-size: 0.75rem;
    }
    
    .gallery-thumb {
        height: 200px;
    }
    
    .lightbox-img {
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .lightbox-prev {
        left: 5px;
    }
    
    .lightbox-next {
        right: 5px;
    }
    
    .lightbox-controls button {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .gallery-thumb {
        height: 180px;
    }
}

/* Dark Mode Support */
.dark-theme .lightbox {
    background: rgba(0, 0, 0, 0.98);
}

.dark-theme .gallery-item {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Print Styles */
@media print {
    .lightbox {
        position: relative;
        background: white;
    }
    
    .lightbox-img {
        max-height: none;
        box-shadow: none;
    }
    
    .lightbox-nav,
    .lightbox-close,
    .lightbox-controls {
        display: none;
    }
}