/**
 * ZenVote - Animations Sophistiquées
 * Système d'animations inspiré des meilleures galeries modernes
 * 
 * @package ZenVote
 * @version 1.0.0
 */

/* ============================================
   ANIMATIONS DE BASE
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ============================================
   CLASSES D'ANIMATION
   ============================================ */

/* Éléments cachés par défaut pour l'animation au scroll */
.animate-on-scroll {
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
}

/* Animations d'apparition */
.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

.fade-in-up {
    animation: fadeInUp 0.8s ease forwards;
}

.fade-in-down {
    animation: fadeInDown 0.8s ease forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.8s ease forwards;
}

.fade-in-right {
    animation: fadeInRight 0.8s ease forwards;
}

.scale-in {
    animation: scaleIn 0.6s ease forwards;
}

.zoom-in {
    animation: zoomIn 0.6s ease forwards;
}

.slide-in-right {
    animation: slideInRight 0.8s ease forwards;
}

/* Délais d'animation */
.animate-delay-100 {
    animation-delay: 0.1s;
}

.animate-delay-200 {
    animation-delay: 0.2s;
}

.animate-delay-300 {
    animation-delay: 0.3s;
}

.animate-delay-400 {
    animation-delay: 0.4s;
}

.animate-delay-500 {
    animation-delay: 0.5s;
}

.animate-delay-600 {
    animation-delay: 0.6s;
}

/* ============================================
   GALERIE D'IMAGES AVEC ANIMATIONS
   ============================================ */

.gallery-container {
    position: relative;
    width: 100%;
}

.gallery-grid-animated {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.gallery-item-animated {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    aspect-ratio: 1;
    cursor: pointer;
    background: var(--zen-gray-100);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}

.gallery-item-animated.animated {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.gallery-item-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.gallery-item-animated:hover::before {
    opacity: 1;
}

.gallery-item-animated img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item-animated:hover img {
    transform: scale(1.1);
}

/* Overlay au survol */
.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.9);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.gallery-item-animated:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-animated:hover .gallery-item-overlay {
    animation: zoomIn 0.4s ease;
}

/* Badge de catégorie */
.gallery-item-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--zen-gray-900);
    z-index: 3;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s ease;
}

.gallery-item-animated:hover .gallery-item-badge {
    opacity: 1;
    transform: translateY(0);
}

/* Icône de zoom au survol */
.gallery-item-zoom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.gallery-item-animated:hover .gallery-item-zoom {
    transform: translate(-50%, -50%) scale(1);
}

.gallery-item-zoom svg {
    width: 24px;
    height: 24px;
    color: var(--zen-green);
}

/* ============================================
   CARTES AVEC ANIMATIONS
   ============================================ */

.card-animated {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-animated.animated {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.card-animated:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Image de carte animée */
.card-image-animated {
    position: relative;
    overflow: hidden;
    height: 220px;
    background: linear-gradient(135deg, var(--zen-green-100) 0%, var(--zen-green-200) 100%);
}

.card-image-animated img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-animated:hover .card-image-animated img {
    transform: scale(1.1);
}

/* Overlay sur l'image de carte */
.card-image-animated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.card-animated:hover .card-image-animated::after {
    opacity: 1;
}

/* ============================================
   LIGHTBOX AMÉLIORÉ
   ============================================ */

.lightbox-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.lightbox-container.active {
    display: flex;
    opacity: 1;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.lightbox-container.active .lightbox-image {
    transform: scale(1);
}

/* Boutons de navigation du lightbox */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox-nav:hover {
    background: rgba(16, 185, 129, 0.9);
    border-color: var(--zen-green);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav-prev {
    left: 2rem;
}

.lightbox-nav-next {
    right: 2rem;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox-close:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: #ef4444;
    transform: scale(1.1);
}

.lightbox-close svg,
.lightbox-nav svg {
    width: 24px;
    height: 24px;
    color: white;
}

/* Informations du lightbox */
.lightbox-info {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 30px;
    color: white;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-container.active .lightbox-info {
    opacity: 1;
}

/* ============================================
   EFFET PARALLAXE
   ============================================ */

.parallax-element {
    transition: transform 0.3s ease-out;
}

/* ============================================
   EFFET SHIMMER (chargement)
   ============================================ */

.shimmer {
    background: linear-gradient(
        90deg,
        var(--zen-gray-200) 0%,
        var(--zen-gray-100) 50%,
        var(--zen-gray-200) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ============================================
   ANIMATIONS STAGGER (échelonnées)
   ============================================ */

.stagger-animation > * {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-animation.animated > *:nth-child(1) {
    transition-delay: 0.1s;
}

.stagger-animation.animated > *:nth-child(2) {
    transition-delay: 0.2s;
}

.stagger-animation.animated > *:nth-child(3) {
    transition-delay: 0.3s;
}

.stagger-animation.animated > *:nth-child(4) {
    transition-delay: 0.4s;
}

.stagger-animation.animated > *:nth-child(5) {
    transition-delay: 0.5s;
}

.stagger-animation.animated > *:nth-child(6) {
    transition-delay: 0.6s;
}

.stagger-animation.animated > * {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .gallery-grid-animated {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .lightbox-nav-prev {
        left: 1rem;
    }
    
    .lightbox-nav-next {
        right: 1rem;
    }
    
    .lightbox-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}

/* ============================================
   PERFORMANCE
   ============================================ */

/* Utiliser will-change pour améliorer les performances */
.gallery-item-animated,
.card-animated,
.lightbox-image {
    will-change: transform, opacity;
}

/* Réinitialiser will-change après l'animation */
.gallery-item-animated.animated,
.card-animated.animated {
    will-change: auto;
}
