/* viewer_CSS.css ---pour Version_8 -- modifications pour agarndir la zone IMAGE */
/*
        mediaHTML = `
            <img src="${item.url}" 
                 style="max-width:90vw; max-height:90vh;
                        position:absolute;
                        top:50%; left:50%;
                        transform:translate(-50%,-50%);
                        box-shadow:0 0 30px white;">
        `;

👉 pour garder un code lisible :
1️⃣ #viewerContent (le conteneur)
2️⃣ #viewerContent img/video (le contenu)
3️⃣ .viewer-btn (UI)

block → comportement classique
flex  → active justify-content + align-items

backdrop-filter:blur(5px);    // 🔥 effet blur  SI ON VEUT 
border:5px solid green;
*/




/* =========================================================
   BASE
   ========================================================= */

body{
    position:relative;
    z-index:0;
}


/* =========================================================
   VIEWER : OVERLAY
   ========================================================= */

#viewer{
    position:fixed;
    inset:0;

    display:none;

    justify-content:center;
    align-items:center;

    background:rgba(0,0,0,0.7);
    backdrop-filter:blur(2px);

    z-index:9999;
}


/* =========================================================
   VIEWER : IMAGE / VIDEO
   ========================================================= */

#viewerContent{
    position:relative;

    height:100vh;
    max-width:100vw;
    max-height:95vh;

    display:flex;
    justify-content:center;
    align-items:center;
}

#viewerContent img,
#viewerContent video{
    max-width:100%;
    max-height:100vh;
    object-fit:contain;
}

.viewer-media{
    max-width:100%;
    max-height:100%;
    object-fit:contain;
}


/* =========================================================
   VIEWER : CAPTION
   ========================================================= */

#viewerCaption{
    position:absolute;

    bottom:5px;
    left:50%;
    transform:translateX(-50%);

    padding:4px 10px;

    font-size:14px;

    background:rgba(0,0,0,0.5);
    color:white;

    border-radius:6px;
    white-space:nowrap;

    opacity:1;
    transition:opacity 0.5s ease;
}

#viewerCaption.masque{
    display:none !important;
}

.caption-title{
    font-weight:500;
}

.caption-count{
    margin-left:8px;

    font-size:0.85em;
    opacity:0.6;
}


/* =========================================================
   VIEWER : NAVIGATION GAUCHE / DROITE
   ========================================================= */

.nav-left,
.nav-right{
    position:absolute;
    top:0;

    height:100%;
    width:10%;

    display:flex;
    align-items:center;

    z-index:5;
}

.nav-left{
    left:0;
    justify-content:flex-start;
    padding-left:10px;
}

.nav-right{
    right:0;
    justify-content:flex-end;
    padding-right:10px;
}

.nav-left:hover,
.nav-right:hover{
    color:#0d6efd;
}

.nav-left:hover{
    background:linear-gradient(
        to right,
        rgba(0,0,0,0.4),
        transparent
    );
}

.nav-right:hover{
    background:linear-gradient(
        to left,
        rgba(0,0,0,0.4),
        transparent
    );
}

.nav-left span,
.nav-right span{
    font-size:40px;
    color:white;

    background:rgba(0,0,0,0.5);

    padding:10px 15px;
    border-radius:50%;
}


/* =========================================================
   VIEWER : BOUTONS
   ========================================================= */

.viewer-btn{
    display:flex;
    align-items:center;
    justify-content:center;

    width:34px;
    height:34px;

    font-size:18px;
    color:white;

    background:rgba(0,0,0,0.5);
    border-radius:50%;

    cursor:pointer;

    transition:all 0.2s ease;

    user-select:none;
    opacity:0.7;

    backdrop-filter:blur(4px);
}

.viewer-btn:hover{
    background:#d76629;
    color:white;

    opacity:1;
    transform:scale(1.1);
}


/* =========================================================
   VIEWER : POSITION PLAY / CLOSE
   ========================================================= */

.viewer-play,
.viewer-close{
    position:absolute;
    z-index:20;
}

.viewer-play{
    bottom:10px;
    right:40px;
}

.viewer-close{
    top:5px;
    right:10px;
}


/* =========================================================
   VIGNETTES
   ========================================================= */

#thumbsContainer{
    column-width:180px;
    column-gap:10px;

    padding:10px;

    max-width:1600px;
    width:100%;

    margin:0 auto;
}

.videoBox{
    display:inline-block;

    width:100%;
    margin-bottom:10px;

    break-inside:avoid;

    position:relative;
    z-index:auto;
}

.thumb{
    width:100%;
    height:auto;

    display:block;

    border-radius:6px;
}


/* =========================================================
   PAGINATION
   ========================================================= */

#paginationTop,
#paginationBottom{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;

    gap:6px;

    margin-top:50px;
    padding:10px 0;
}

.page-btn{
    cursor:pointer;

    padding:5px 10px;

    background:#333;
    color:white;

    border-radius:6px;

    font-size:13px;

    transition:all 0.2s ease;
}

.page-btn:hover{
    background:#0d6efd;
    color:white;

    transform:scale(1.05);
}

.page-btn.active{
    background:#0d6efd;
    color:white;

    font-weight:bold;

    transform:scale(1.1);
}


/* =========================================================
   ICONE VIDEO
   ========================================================= */

.play{
    position:absolute;

    top:50%;
    left:50%;
    transform:translate(-50%, -50%);

    width:40px;
    height:40px;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:30px;
    color:white;

    background:rgba(0,0,0,0.5);
    border-radius:50%;

    pointer-events:none;
}

.videoBox:hover .play{
    transform:translate(-50%, -50%) scale(1.4);
    background:rgba(0,0,0,0.7);
}

.videoBox.is-video::after{
    content:"▶";

    position:absolute;

    top:50%;
    left:50%;
    transform:translate(-50%, -50%);

    width:40px;
    height:40px;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:30px;
    color:white;

    background:rgba(0,0,0,0.5);
    border-radius:50%;

    pointer-events:none;

    transition:all 0.2s ease;
    opacity:0.85;
}

.videoBox.is-video:hover::after{
    transform:translate(-50%, -50%) scale(1.4);

    background:rgba(0,0,0,0.7);
    opacity:1;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width:1200px){

    #thumbsContainer{
        column-count:6;
    }
}


@media (max-width:900px){

    #thumbsContainer{
        column-count:4;
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width:768px){

    /* Boutons de navigation du viewer */

    .viewer-btn{
        width:30px;
        height:30px;
        padding:8px;
        font-size:30px;
        opacity:0.9;
        background:rgba(0,0,0,0.6);
    }

    /* Flèches navigation plus discrètes */
       /* .nav-left .viewer-btn,
        .nav-right .viewer-btn{
            width:30px;
            height:30px;
            padding:5px;

            font-size:24px;

            background:rgba(0,0,0,0.4);
            opacity:0.7;
        }*/

    .nav-left .viewer-btn,
    .nav-right .viewer-btn{
        width:20px;
        height:20px;
        padding:5px;

        font-size:20px;

        background:rgba(0,0,0,0.4);
        opacity:0.5;
    }

    /* X et PLAY / PAUSE */

    .viewer-play,
    .viewer-close{
        width:40px;
        height:40px;
        font-size:30px;
    }

    .viewer-play{
        bottom:20px;
        right:20px;
    }

    .viewer-close{
        top:10px;
        right:10px;
    }


    /* Pagination < 1 2 3 > */

    /* Pagination MOBILE */
    .page-btn{
        min-width:40px;
        min-height:40px;

        padding:6px 8px;

        font-size:18px;
        border-radius:6px;

        display:inline-flex;
        align-items:center;
        justify-content:center;

        box-sizing:border-box;
    }

    #paginationTop,
    #paginationBottom{
        width:100%;
        display:flex;
        justify-content:center;
        align-items:center;

        gap:6px;
    }
}


/* =========================================================
   PETITS ECRANS
   ========================================================= */

@media (max-width:600px){

    #thumbsContainer{
        column-count:2;
    }
}


@media (max-width:400px){

    #thumbsContainer{
        column-count:1;
    }
}

