/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgb(0, 0, 0);
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #1a1a1a;
    color: #eee;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #333;
    width: 80%;
    max-width: 1000px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideIn 0.3s;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover,
.close-modal:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

/* Modal Body Content Styling */
#modal-body h2 {
    margin-top: 0;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    text-transform: none;
}

#modal-body p {
    font-size: 1.1em;
    line-height: 1.6;
    color: #ccc;
}

/* Gallery Styling within Modal */
.modal-gallery {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding: 10px 0;
    margin-bottom: 20px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.modal-gallery img,
.modal-gallery video {
    flex: 0 0 auto;
    height: 300px;
    /* Fixed height for consistency */
    width: auto;
    border-radius: 4px;
    scroll-snap-align: start;
    object-fit: contain;
    /* Ensures aspect ratio is maintained */
    background: #000;
}

/* Custom Scrollbar for Gallery */
.modal-gallery::-webkit-scrollbar {
    height: 8px;
}

.modal-gallery::-webkit-scrollbar-track {
    background: #333;
}

.modal-gallery::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.modal-gallery::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Tags in Modal */
.modal-tags {
    margin-top: 15px;
}

.modal-tags .tag {
    display: inline-block;
    background: #333;
    color: #fff;
    padding: 5px 10px;
    margin-right: 5px;
    margin-bottom: 5px;
    border-radius: 4px;
    font-size: 0.9em;
}

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

    to {
        opacity: 1
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {

    .modal-gallery img,
    .modal-gallery video {
        height: 200px;
    }
}

/* Lightbox Styles */
.lightbox-modal {
    background-color: rgba(0, 0, 0, 0.85);
    /* Slightly less opaque for better backdrop blur effect */
    backdrop-filter: blur(15px);
    /* Stronger blur for premium feel */
    -webkit-backdrop-filter: blur(15px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 0;
    transition: opacity 0.3s ease;
}

#lightbox-content {
    max-width: 85%;
    max-height: 85vh;
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    position: relative;
    user-select: none;
}

#lightbox-content img,
#lightbox-content video {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    width: auto;
    height: auto;
    display: block;
    animation: zoomIn 0.3s ease-out;
}

#lightbox-content iframe {
    width: 85vw;
    max-width: calc(85vh * 16 / 9);
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.close-lightbox {
    position: absolute;
    top: 30px;
    right: 30px;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
    cursor: pointer;
    z-index: 10005;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
}

.close-lightbox:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

/* Navigation Arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 50px;
    padding: 20px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    z-index: 10003;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    height: 100px;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-nav:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.lightbox-nav:active {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile Adjustments */
@media screen and (max-width: 768px) {

    .modal-gallery img,
    .modal-gallery video {
        height: 200px;
    }

    #lightbox-content {
        max-width: 95%;
    }

    .lightbox-nav {
        font-size: 30px;
        height: 60px;
        padding: 10px;
        background: rgba(0, 0, 0, 0.3);
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .close-lightbox {
        top: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }

    .close-lightbox svg {
        width: 20px;
        height: 20px;
    }
}