/* --- New Media Preview & Lightbox Styles --- */

.post-media.single-preview {
    border-radius: 8px;
    overflow: hidden;
    background-color: #000;
    /* Black background for letterboxing if needed */
    display: flex;
    justify-content: center;
    align-items: center;
}

.media-preview-container {
    width: 100%;
    position: relative;
    max-height: 500px;
    /* Limit height of preview */
    overflow: hidden;
    display: flex;
    justify-content: center;
    background: #f0f2f5;
}

.media-preview-container img,
.media-preview-container video {
    max-height: 500px;
    width: 100%;
    object-fit: cover;
    /* Crop to fill */
}

/* Video overlay icon */
.video-overlay-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 20px;
    pointer-events: none;
}

/* More Photos Overlay (+3) */
.more-media-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.more-media-overlay:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

.more-count {
    color: white;
    font-size: 3rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Lightbox Modal */
/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.95);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-modal.show {
    opacity: 1;
}

.lightbox-content-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    /* Add padding to prevent edge touching */
    box-sizing: border-box;
}

.lightbox-media {
    max-width: 100%;
    max-height: 90vh;
    /* Leave room for close button and counter */
    object-fit: contain;
    /* Ensure aspect ratio is preserved */
    border-radius: 4px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 30px;
    /* Smaller font on mobile */
    font-weight: bold;
    cursor: pointer;
    z-index: 10010;
    background: rgba(0, 0, 0, 0.3);
    width: 40px;
    /* Smaller touch target */
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev,
.lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: 40px;
    /* Smaller buttons on mobile */
    height: 40px;
    margin-top: -20px;
    padding: 0;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.3s ease;
    border-radius: 50%;
    user-select: none;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10005;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.lightbox-next {
    right: 10px;
    /* Closer to edge on mobile */
}

.lightbox-prev {
    left: 10px;
}

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 10010;
}

/* Animations */
@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 24px;
        background: rgba(0, 0, 0, 0.5);
        /* Higher contrast */
    }

    .lightbox-prev,
    .lightbox-next {
        width: 36px;
        height: 36px;
        font-size: 18px;
        background-color: rgba(0, 0, 0, 0.3);
        /* Easier to see */
    }

    .lightbox-prev {
        left: 5px;
    }

    .lightbox-next {
        right: 5px;
    }

    .lightbox-media {
        max-height: 80vh;
        /* More room on vertical screens */
        width: auto;
        max-width: 100%;
    }
}