/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOutScale {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* ============================================
   FILTRES - STYLES GÉNÉRAUX
   ============================================ */

.gallery-filters {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 1rem;
    border: 0px solid #ddd;
    background: none;
    color: #FFF;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-btn.active,
.filter-btn:hover {
    background: none;
    color: #84CDF3;
    border-color: none;
    text-decoration: underline;
}

/* Business Units - Couleurs spécifiques */
.euclide-care .filter-btn,
.euclide-solution .filter-btn,
.euclide-vaillant .filter-btn {
    text-transform: uppercase;
    color: #8C8C8C;
}

.euclide-care .filter-btn.active,
.euclide-solution .filter-btn.active,
.euclide-vaillant .filter-btn.active {
    color: #000;
    text-decoration: underline;
}

.euclide-care .filter-btn:hover,
.euclide-solution .filter-btn:hover,
.euclide-vaillant .filter-btn:hover {
    background: rgba(52, 160, 159, 0.40);
    background-blend-mode: darken;
    color: #8C8C8C;
}

/* ============================================
   CAROUSEL DE FILTRES
   ============================================ */

.gallery-filters-carousel {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
}

.gallery-filters-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Flèches du carousel */
.carousel-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.carousel-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 0px solid #84CDF3;
    background: var(--white);
    color: #84CDF3;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    border-radius: 4px;
    padding: 0;
}

.carousel-arrow:hover:not(:disabled) {
    background: var(--primary-100);
    transform: scale(1.08);
}

.carousel-arrow:active:not(:disabled) {
    transform: scale(0.95);
}

.carousel-arrow:disabled {
    opacity: 0;
    cursor: not-allowed;
    pointer-events: none;
}

.carousel-arrow svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
}

.carousel-arrow path {
    stroke: var(--primary-500);
}

/* ============================================
   GALERIES - STYLES COMMUNS
   ============================================ */

.galerie-filtre .container-filtres,
.horizontal-filtre .container-filtres {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem auto;
}

.galerie-filtre .gallery-filters-carousel,
.horizontal-filtre .gallery-filters-carousel {
    width: 45%;
}

.galerie-filtre .carousel-buttons .carousel-arrow,
.horizontal-filtre .carousel-buttons .carousel-arrow {
    display: flex;
}

/* ============================================
   GALERIE FILTRÉE (GRILLE)
   ============================================ */

.galerie-filtre .gallery-container,
.galerie-nofiltre .gallery-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
}

.galerie-filtre .gallery-item,
.galerie-nofiltre .gallery-item {
    position: relative;
    overflow: hidden;
      flex-wrap: wrap;
   aspect-ratio: 1/1;
    cursor: pointer;
    perspective: 1000px;
    transition: all 0.3s ease;
}

/* Items visibles - Animation d'apparition */
.galerie-filtre .gallery-item:not(.hidden),
.galerie-nofiltre .gallery-item:not(.hidden) {
    animation: fadeInScale 0.5s ease-out;
}

/* Items cachés avec animation et display:none */
.galerie-filtre .gallery-item.hidden,
.galerie-nofiltre .gallery-item.hidden {
    animation: fadeOutScale 0.3s ease-out forwards;
    display: none;
}

/* Overlay semi-transparent */
.galerie-filtre .gallery-item::before,
.galerie-nofiltre .gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 24, 55, 0.40);
    transition: opacity 0.3s ease;
    z-index: 1;
}

.galerie-filtre .gallery-item:hover::before,
.galerie-nofiltre .gallery-item:hover::before {
    opacity: 0;
}

/* Images */
.galerie-filtre .gallery-item img,
.galerie-nofiltre .gallery-item img {
    display: block;
      height: 300px;
   aspect-ratio: 1/1;
    object-fit: cover;
    transition: transform 0.3s ease;
    will-change: transform;
    backface-visibility: hidden;
}

.galerie-filtre .gallery-item:hover img,
.galerie-nofiltre .gallery-item:hover img {
    transform: scale(1.02);
}

/* Titre au hover */
.galerie-filtre .gallery-item .hover-title,
.galerie-nofiltre .gallery-item .hover-title {
    position: absolute;
    bottom: 0;
    left: 0;
    padding: .5rem;
    transform: translateX(-150%);
    transition: transform 0.3s ease;
    font-size: 1.25rem;
    font-weight: bold;
    width: 50%;
    box-sizing: border-box;
}

.galerie-filtre .gallery-item .hover-title h3,
.galerie-nofiltre .gallery-item .hover-title h3 {
    margin: 0;
    line-height: 1.5rem;
}

.galerie-filtre .gallery-item:hover .hover-title,
.galerie-nofiltre .gallery-item:hover .hover-title {
    transform: translateX(0);
}

/* Border overlay au hover */
.galerie-filtre .gallery-item .overlay,
.galerie-nofiltre .gallery-item .overlay {
    position: absolute;
    top: .5rem;
    left: .5rem;
    right: .5rem;
    bottom: .5rem;
    border-top: 1px solid white;
    border-right: 1px solid white;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

.galerie-filtre .gallery-item .overlay::before,
.galerie-nofiltre .gallery-item .overlay::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 0;
    background-color: #FFF;
    z-index: 2;
    transition: height 0.3s ease;
}

.galerie-filtre .gallery-item .overlay::after,
.galerie-nofiltre .gallery-item .overlay::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    height: 1px;
    width: 0;
    background-color: #FFF;
    z-index: 2;
    transition: width 0.3s ease;
}

.galerie-filtre .gallery-item:hover .overlay,
.galerie-nofiltre .gallery-item:hover .overlay {
    opacity: 1;
}

.galerie-filtre .gallery-item:hover .overlay::before,
.galerie-nofiltre .gallery-item:hover .overlay::before {
    height: 70%;
}

.galerie-filtre .gallery-item:hover .overlay::after,
.galerie-nofiltre .gallery-item:hover .overlay::after {
    width: calc(50% - 20px);
}

/* ============================================
   GALERIE HORIZONTALE (SCROLL)
   ============================================ */

.horizontal-nofiltre,
.horizontal-filtre {
    width: 100%;
    overflow: hidden;
}

.horizontal-nofiltre .gallery-container,
.horizontal-filtre .gallery-container {
    display: flex;
    gap: 4.38rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1rem 0;
    scroll-behavior: smooth;
    cursor: grab;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.horizontal-nofiltre .gallery-container::-webkit-scrollbar,
.horizontal-filtre .gallery-container::-webkit-scrollbar {
    display: none;
}

.horizontal-nofiltre .gallery-container.dragging,
.horizontal-filtre .gallery-container.dragging {
    cursor: grabbing;
    scroll-behavior: auto;
}

/* Items horizontaux */
.horizontal-nofiltre .gallery-item,
.horizontal-filtre .gallery-item {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

/* Items horizontaux visibles - Animation */
.horizontal-filtre .gallery-item:not(.hidden) {
    animation: fadeInScale 0.5s ease-out;
}

/* Items horizontaux cachés */
.horizontal-filtre .gallery-item.hidden {
    animation: fadeOutScale 0.3s ease-out forwards;
    width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    display: none;
}

/* Images horizontales */
.horizontal-nofiltre .gallery-item img,
.horizontal-filtre .gallery-item img {
    display: block;
    width: 100%;
    height: 300px;
    aspect-ratio: 1/1;
    object-fit: cover;
    object-position: center;
    will-change: transform;
    backface-visibility: hidden;
    flex-shrink: 0;
}

/* Lien dans la galerie */
.horizontal-nofiltre .gallery-container_link,
.horizontal-filtre .gallery-container_link {
    position: absolute;
    top: 0;
    right: 0;
    display: block;
    flex-shrink: 0;
    background-color: var(--primary-500);
    padding: 0.5rem 1rem;
    color: #D3D2D2;
    font-size: 1.5rem;
    font-style: normal;
    font-weight: 700;
    line-height: normal;
    text-decoration: none;
    transition: all 0.3s ease;
}

.horizontal-nofiltre .gallery-container_link:hover,
.horizontal-filtre .gallery-container_link:hover {
    background-color: var(--primary-200);
    color: var(--primary-500);
}

/* Titre horizontaux */
.horizontal-nofiltre .gallery-item .hover-title,
.horizontal-filtre .gallery-item .hover-title {
    position: relative;
    text-align: left;
    line-height: 1.75rem;
    align-self: flex-start;
}

.horizontal-nofiltre .gallery-item .hover-title h3,
.horizontal-filtre .gallery-item .hover-title h3 {
    font-size: 1rem;
    font-style: normal;
    font-weight: 700;
    padding: 0;
    margin: 0;
}

.horizontal-nofiltre .gallery-item .hover-title p,
.horizontal-filtre .gallery-item .hover-title p {
    font-size: 1rem;
    font-style: normal;
    font-weight: 400;
}

/* ============================================
   RESPONSIVE - TABLET (MAX 768PX)
   ============================================ */

@media (max-width: 768px) {
    /* Carousel */
    .gallery-filters-carousel {
        gap: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .carousel-buttons {
        gap: 0.3rem;
    }

    .carousel-arrow {
        width: 40px;
        height: 40px;
    }

    .carousel-arrow svg {
        width: 18px;
        height: 18px;
    }

    .filter-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    /* Conteneur filtres */
    .horizontal-filtre .container-filtres,
    .galerie-filtre .container-filtres {
        display: block;
    }

    .horizontal-filtre .gallery-filters-carousel,
    .galerie-filtre .gallery-filters-carousel {
        width: 100%;
        margin: 0;
    }

    /* Galerie horizontale - Responsive */
    .horizontal-nofiltre .gallery-item,
    .horizontal-filtre .gallery-item {
        width: 12rem;
        height: auto;
    }

    .horizontal-nofiltre .gallery-item img,
    .horizontal-filtre .gallery-item img {
        width: 12rem;
        height: 18rem;
    }

    /* Galerie grille - Responsive */
    .galerie-filtre .gallery-container,
    .galerie-nofiltre .gallery-container {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0;
        padding: 0;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .galerie-filtre .gallery-container::-webkit-scrollbar,
    .galerie-nofiltre .gallery-container::-webkit-scrollbar {
        height: 8px;
    }

    .galerie-filtre .gallery-container::-webkit-scrollbar-track,
    .galerie-nofiltre .gallery-container::-webkit-scrollbar-track {
        background: rgba(0, 24, 55, 0.1);
        border-radius: 10px;
    }

    .galerie-filtre .gallery-container::-webkit-scrollbar-thumb,
    .galerie-nofiltre .gallery-container::-webkit-scrollbar-thumb {
        background: rgba(0, 24, 55, 0.5);
        border-radius: 10px;
    }

    .galerie-filtre .gallery-item,
    .galerie-nofiltre .gallery-item {
        scroll-snap-align: start;
    }

    .galerie-filtre .gallery-item img,
    .galerie-nofiltre .gallery-item img {
        width: 100%;
    }

    /* Désactiver les effets hover sur mobile */
    .galerie-filtre .gallery-item::before,
    .galerie-nofiltre .gallery-item::before {
        opacity: 1;
    }

    .galerie-filtre .gallery-item .overlay,
    .galerie-nofiltre .gallery-item .overlay {
        opacity: 1;

    }

     .galerie-filtre .gallery-item .overlay::before,
    .galerie-nofiltre .gallery-item .overlay::before {
        
        width: 1px;
   height: 70%;
    }

       .galerie-filtre .gallery-item .overlay::after,
    .galerie-nofiltre .gallery-item .overlay::after {
        height: 1px;
    width: calc(50% - 20px);
    }

    .galerie-filtre .gallery-item .hover-title,
    .galerie-nofiltre .gallery-item .hover-title {
        transform: translateX(0);
        font-size: 1.2em;
        width: 80%;
        padding: 10px;
    }

    .horizontal-filtre .gallery-filters {
        margin-bottom: 1rem;
        position: relative;
        margin-top: inherit;
        text-align: left;
    }

    .gallery-filters .filter-btn {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
}

/* ============================================
   RESPONSIVE - MOBILE (MAX 480PX)
   ============================================ */

@media (max-width: 480px) {
    .carousel-buttons {
        gap: 0.2rem;
    }

    .carousel-arrow {
        width: 36px;
        height: 36px;
    }

    .carousel-arrow svg {
        width: 16px;
        height: 16px;
    }

    .filter-btn {
        padding: 0.6rem;
        font-size: 0.8rem;
    }

    .horizontal-nofiltre .gallery-item,
    .horizontal-filtre .gallery-item {
        width: 14.75rem;
        height: auto;
    }

    .horizontal-nofiltre .gallery-item img,
    .horizontal-filtre .gallery-item img {
        width: 14.75rem;
        height: 21.375rem;
    }

    .horizontal-nofiltre .gallery-container,
    .horizontal-filtre .gallery-container {
        gap: 0.5rem;
        padding: 0.5rem 0;
    }
}