:root {
    --color-primary: #1a221f;
}

#slideshow-app {
    position: relative;
    width: 100%;
    height: 80vh;
    background-color: var(--color-primary);
    display: flex;
    flex-direction: column;
    font-family: sans-serif;
    color: #fff;
    overflow: hidden;
}

#slideshow-app:fullscreen {
    height: 100vh;
    width: 100vw;
}

/* Barre unique compacte avec défilement tactile pour les petits écrans */
.slideshow-controls {
    padding: 8px 12px;
    background: rgba(26, 34, 31, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    z-index: 40;
    transition: opacity 0.4s ease;
}

#slideshow-app:fullscreen .slideshow-controls {
    opacity: 0.2;
}

#slideshow-app:fullscreen .slideshow-controls:hover {
    opacity: 1;
}

/* Conteneur de chips avec scroll horizontal fluide sur mobile */
.filters-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    padding-bottom: 2px;
}

.filters-chips::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
    flex-shrink: 0;
}

.chip.active {
    background: #fff;
    color: var(--color-primary);
    font-weight: 600;
    border-color: #fff;
}

/* Actions unifiées */
.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.slideshow-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.slideshow-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

select.slideshow-select {
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Conteneur principal */
.slideshow-viewport {
    position: relative;
    flex-grow: 1;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background-color: var(--color-primary);
}

/* Transition par pur fondu (sans zoom saccadé) */
.slide-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    pointer-events: none;
}

.slide-wrapper.active {
    opacity: 1;
    z-index: 1;
}

.slide-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Bouton Favori (Cœur) sur chaque vue */
.favorite-toggle-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(26, 34, 31, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 1.2rem;
    padding: 6px 10px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 35;
    transition: all 0.2s;
}

.favorite-toggle-btn.is-favorite {
    color: #ff4757;
    border-color: #ff4757;
    background: rgba(255, 255, 255, 0.9);
}

/* Boutons de navigation directionnelle */
.slide-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(26, 34, 31, 0.6);
    color: #fff;
    border: none;
    padding: 12px 16px;
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 30;
    transition: background 0.3s ease;
    border-radius: 4px;
}

.slide-nav-btn:hover {
    background: var(--color-primary);
}

.slide-prev {
    left: 10px;
}

.slide-next {
    right: 10px;
}

/* Légende */
.slide-caption {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 34, 31, 0.8);
    backdrop-filter: blur(4px);
    padding: 6px 14px;
    border-radius: 4px;
    z-index: 20;
    max-width: 80%;
    text-align: center;
    font-size: 0.9rem;
}

/* Mode Grille (Actif par défaut) */
.slideshow-viewport.grid-mode {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    padding: 12px;
    overflow-y: auto;
    align-content: start;
}

.slideshow-viewport.grid-mode .slide-wrapper {
    position: relative;
    opacity: 1;
    height: 130px;
    border-radius: 4px;
    cursor: pointer;
    pointer-events: auto;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.slideshow-viewport.grid-mode .slide-wrapper:hover {
    border-color: rgba(255, 255, 255, 0.6);
}

.slideshow-viewport.grid-mode .favorite-toggle-btn {
    top: 5px;
    right: 5px;
    padding: 4px 7px;
    font-size: 0.9rem;
}

.slideshow-viewport.grid-mode .slide-nav-btn,
.slideshow-viewport.grid-mode .slide-caption {
    display: none;
}
