/* =================================================================
   06-6. PROJECT WALLPAPERS (Slideshow + Lightbox 0.8)
   ================================================================= */

/* --- CONTENEUR PRINCIPAL --- */
.wallpapers-list {
    width: 100%;
    max-width: 1600px; 
    margin: 0 auto 100px;
    padding: 0 40px;
}

.wallpaper-group { 
    margin-bottom: 100px; 
}

.group-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #000;
}

/* --- VIEWER --- */
.wallpaper-viewer {
    position: relative;
    width: 100%;
    background-color: transparent;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 15px;
    display: block; 
    transition: height 0.3s ease;
    cursor: zoom-in; 
    touch-action: pan-y; /* Permet le swipe sans bloquer le scroll vertical */
}

.wallpaper-viewer img {
    width: 100%;
    height: auto;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    z-index: 1;
    will-change: opacity;
}

.wallpaper-viewer img.active {
    opacity: 1;
    z-index: 2;
    position: relative; 
}

/* --- CONTRÔLES (Page Normale) --- */
.wallpaper-controls {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
    height: 30px; 
}

/* --- BOUTONS GÉNÉRIQUES --- */
.control-icon-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #DDD;
    font-size: 16px;
    transition: color 0.3s ease;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-icon-btn:hover { color: #333333; }
.control-icon-btn i { font-size: 16px; }

.lightbox-trigger-btn { 
    left: 0; 
    text-transform: uppercase;
    font-size: 10px;
    color: #999;
    font-weight: 300;
    letter-spacing: 1px;
}

.play-pause-btn { right: 0; }F

/* --- DOTS --- */
.wallpaper-dots { 
   display: flex;
   gap: 10px;
   align-items: center;
}

.wall-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background-color: #ddd;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    
}

.wallpaper-dots, .lb-dots-container { 
   display: flex;
   gap: 10px; /* ✅ Espace garanti entre les boutons */
   align-items: center;
}

.wall-dot:hover { background-color: #bbb; }

.wall-dot.active {
    background-color: #474747;
    transform: scale(1);
}

.wall-dot.active.timer-running {
    width: 30px;
    border-radius: 10px;
    background-color: #ddd;
    transform: scale(1);
}

.wall-dot.active.timer-running::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background-color: #222;
    border-radius: 10px;
    animation: progressFill 3s linear forwards;
}

/* --- VARIANTES : LIGHTBOX vs NO-LIGHTBOX --- */

/* Quand la lightbox est activée ou désactivée, on aligne les contrôles au centre */
.wallpaper-group.lightbox .wallpaper-controls,
.wallpaper-group.no-lightbox .wallpaper-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    position: relative;
    padding-top: 20px;
}

.wallpaper-group.lightbox .play-pause-btn,
.wallpaper-group.no-lightbox .play-pause-btn {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    padding: 0;
    width: auto;
}

.wallpaper-group.no-lightbox .wallpaper-viewer {
    cursor: default;
}

/* Masquer le bouton play-pause si une seule image */
.wallpaper-group.no-lightbox .wallpaper-viewer img:only-child + .wallpaper-controls {
    display: none;
}

/* --- LIGHTBOX (Fond 0.8) --- */
.lb-overlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    background-color: rgba(0,0,0,0.95); /* Un peu plus opaque pour le focus */
    z-index: 99999;
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center;
    opacity: 0; 
    visibility: hidden; /* EMPECHE DE BLOQUER LE CLIC QUAND INVISIBLE */
    pointer-events: none; 
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lb-overlay.visible {
   opacity: 1;
   visibility: visible;
   pointer-events: auto;
}

/* On s'assure que les boutons dans la lightbox sont bien cliquables */
.lb-controls-wrapper, .lb-close {
    pointer-events: auto;
    z-index: 100000;
}
.lb-controls-wrapper {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    z-index: 100; /* ✅ Assure la priorité sur l'image */
    cursor: default; /* ✅ Annule le curseur loupe sur les boutons */
    pointer-events: auto; /* ✅ Garantit l'interactivité */
}

/* On force le curseur pointeur sur les éléments cliquables */
.lb-dots-container .wall-dot,
.lb-play-btn {
    cursor: pointer !important;
}


.lb-image {
    max-width: 100vw;
    max-height: 85vh; 
    object-fit: contain;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease;
    cursor: default;
    pointer-events: auto;
    z-index: 10;
}

.lb-controls-wrapper {
    margin-top: 20px;
    width: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.lb-dots-container { display: flex; gap: 10px; }
.lb-dots-container .wall-dot { background-color: #555; }
.lb-dots-container .wall-dot.active { background-color: #fff; }
.lb-dots-container .wall-dot:hover { background-color: #888; }

.lb-dots-container .wall-dot.active.timer-running {
    width: 30px; 
    border-radius: 10px; 
    background-color: #555; 
    transform: scale(1);
}
.lb-dots-container .wall-dot.active.timer-running::after {
    background-color: #fff;
}

.lb-play-btn {
    position: relative;
    background: none; 
    border: none;
    cursor: pointer; 
    color: #999;
    font-size: 14px; 
    padding: 10px;
    transition: color 0.3s ease;
    display: flex; 
    align-items: center;
}

.lb-play-btn:hover { color: #fff; }
.lb-play-btn i { font-size: 16px; }

.lb-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 30px;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}
.lb-close:hover { opacity: 1; }

/* --- FORMAT PORTRAIT --- */
.wallpaper-group.is-portrait {
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.wallpaper-group.is-portrait .wallpaper-viewer {
    aspect-ratio: 9 / 16;
    background-color: #000;
    border-radius: 5px; 
}

.wallpaper-group.is-portrait .wallpaper-viewer img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.wallpaper-group.is-portrait .wallpaper-controls {
    padding: 10px 0;
}

/* --- ANIMATIONS --- */
@keyframes progressFill { 
    from { width: 0%; } 
    to { width: 100%; } 
}

/* =================================================================
   RESPONSIVE MOBILE (≤ 900px)
   ================================================================= */
@media (max-width: 900px) {
    .wallpapers-list { padding: 0 20px; }
    .group-title { font-size: 20px; }
    
    .lightbox-trigger-btn { display: none !important; }
    .lb-overlay { display: none !important; }
    .wallpaper-viewer { cursor: default !important; }
    
    .wallpaper-controls { 
        justify-content: center;
        position: relative;
    }
    
    .play-pause-btn {
        position: absolute; 
        right: 0; 
        top: 50%; 
        transform: translateY(-50%);
    }

    .wallpaper-group.is-portrait {
        max-width: 280px;
    }
}

/* --- DARK MODE --- */
html.dark-theme .group-title { color: #fff; }
html.dark-theme .control-icon-btn { color: #666; }
html.dark-theme .control-icon-btn:hover { color: #fff; }

html.dark-theme .wall-dot { background-color: #333; }
html.dark-theme .wall-dot.active { background-color: #fff; } 
html.dark-theme .wall-dot.active.timer-running { background-color: #333; } 
html.dark-theme .wall-dot.active.timer-running::after { background-color: #fff; }