﻿/* File: wwwroot/css/content-media-gallery.css */

.content-media-gallery {
    width: 100%;
}

.content-media-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

    .content-media-gallery-header h3 {
        font-size: 1.15rem;
        font-weight: 700;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 0.45rem;
    }

.content-media-gallery-count {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

.content-media-gallery-grid {
    display: grid;
    gap: 0.75rem;
}

.content-media-gallery-cols-1 {
    grid-template-columns: 1fr;
}

.content-media-gallery-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-media-gallery-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-media-gallery-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.content-media-gallery-cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.content-media-gallery-cols-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.content-media-gallery-cols-7 {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.content-media-gallery-cols-8 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

@media (max-width: 992px) {
    .content-media-gallery-cols-5,
    .content-media-gallery-cols-6,
    .content-media-gallery-cols-7,
    .content-media-gallery-cols-8 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .content-media-gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 576px) {
    .content-media-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

.content-media-gallery-item {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.65rem;
    overflow: hidden;
    background: var(--bs-tertiary-bg, #f8f9fa);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

    .content-media-gallery-item:hover {
        transform: translateY(-1px);
        box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.12);
        border-color: rgba(var(--bs-primary-rgb), 0.35);
        text-decoration: none;
    }

    .content-media-gallery-item img {
        display: block;
        width: 100%;
        aspect-ratio: 4 / 3;
        object-fit: contain;
        background: var(--bs-tertiary-bg, #f8f9fa);
    }

.content-media-gallery-caption {
    display: block;
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    background: var(--bs-body-bg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Lightbox */

.content-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: none;
}

    .content-gallery-lightbox.is-open {
        display: block;
    }

.content-gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
}

.content-gallery-lightbox-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1280px, 94vw);
    height: min(88vh, 960px);
    margin: 5vh auto 0;
    background: #000;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.45);
}

.content-gallery-lightbox-toolbar {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.85rem;
    background: #111;
    color: #fff;
}

.content-gallery-lightbox-caption-wrap {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.content-gallery-lightbox-counter,
.content-gallery-lightbox-caption,
.content-gallery-lightbox-help {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.72);
}

.content-gallery-lightbox-caption {
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-gallery-lightbox-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.content-gallery-lightbox-body {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
    touch-action: none;
}

.content-gallery-lightbox-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    transform: translate(0, 0) scale(1);
    transform-origin: 50% 50%;
    will-change: transform;
}

.content-gallery-lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 46px;
    height: 68px;
    border: 0;
    border-radius: 0.65rem;
    background: rgba(0, 0, 0, 0.38);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .content-gallery-lightbox-nav:hover {
        background: rgba(0, 0, 0, 0.62);
    }

    .content-gallery-lightbox-nav.prev {
        left: 0.65rem;
    }

    .content-gallery-lightbox-nav.next {
        right: 0.65rem;
    }

.content-gallery-lightbox-strip {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.75rem;
    background: #0f0f10;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    scrollbar-width: thin;
}

.content-gallery-lightbox-strip-item {
    flex: 0 0 84px;
    width: 84px;
    min-width: 84px;
    max-width: 84px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    background: transparent;
    cursor: pointer;
}

    .content-gallery-lightbox-strip-item.is-active {
        border-color: var(--bs-primary);
    }

    .content-gallery-lightbox-strip-item img {
        display: block;
        width: 100%;
        height: 60px;
        object-fit: cover;
        border-radius: 0.35rem;
        opacity: 0.82;
    }

    .content-gallery-lightbox-strip-item:hover img,
    .content-gallery-lightbox-strip-item.is-active img {
        opacity: 1;
    }

.content-gallery-lightbox.is-fullscreen .content-gallery-lightbox-panel {
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    border-radius: 0;
}

@media (max-width: 767.98px) {
    .content-gallery-lightbox-panel {
        width: 100vw;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }

    .content-gallery-lightbox-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .content-gallery-lightbox-help {
        display: none;
    }

    .content-gallery-lightbox-actions {
        width: 100%;
        justify-content: center;
    }

    .content-gallery-lightbox-strip-item {
        flex-basis: 72px;
        width: 72px;
        min-width: 72px;
        max-width: 72px;
    }

        .content-gallery-lightbox-strip-item img {
            height: 52px;
        }
}
