/* Image Lightbox Modal Styles */

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

.lightbox-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.lightbox-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-image {
    max-width: 85vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    animation: zoomIn 0.3s ease;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 18px;
    cursor: pointer;
    font-size: 24px;
    font-weight: normal;
    color: #333;
    transition: all 0.2s ease;
    z-index: 10000;
    
    /* Perfect centering with flexbox */
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* Reset all text formatting */
    line-height: 1;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    text-align: center;
    vertical-align: middle;
    
    /* Use a consistent font for the × symbol */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Fine-tune the × symbol position */
.lightbox-close span {
    display: block;
    transform: translate(0.5px, -1px); /* Move × slightly right and up */
}



.lightbox-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

/* Loading spinner */
.lightbox-loading {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Make images in question content clickable */
.question-text img,
.answer-content img {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 4px;
}

.question-text img:hover,
.answer-content img:hover {
    transform: scale(1.005);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* Mobile responsiveness */
@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .lightbox-container {
        max-width: 95vw;
        max-height: 95vh;
        padding: 20px;
    }
    
    .lightbox-image {
        max-width: 90vw;
        max-height: 80vh;
    }
}

/* Dark mode compatibility */
[data-bs-theme="dark"] .lightbox-close {
    background: rgba(40, 40, 40, 0.9);
    color: #fff;
}

[data-bs-theme="dark"] .lightbox-close:hover {
    background: rgba(40, 40, 40, 1);
}
