﻿/**
 * FADE-EFFECT CSS - Sistema de animaciones fade-in con retraso
 * ============================================================
 * 
 * Este archivo contiene todos los estilos CSS necesarios para el sistema
 * de fade-effect.js. Incluir este archivo junto con fade-effect.js para
 * tener un sistema completo de animaciones.
 * 
 * INSTRUCCIONES:
 * 1. Incluir este CSS en tu proyecto: <link rel="stylesheet" href="fade-effect.css">
 * 2. Incluir el JS: <script src="fade-effect.js"></script>
 * 3. Usar: applyFadeEffect('.mi-clase');
 */

/* ===================================================================== */
/* SISTEMA BASE - CLASES GENÉRICAS PARA CUALQUIER CONTENEDOR */
/* ===================================================================== */

/* Estado normal - elementos visibles por defecto */
.fade-container {
    opacity: 1;
    transform: none;
    transition: none; /* Evitar conflictos con otras transiciones */
}

/* Estado inicial oculto para animación */
.fade-container.fade-animate {
    opacity: 0 !important;
    transform: translateY(20px) !important;
    transition: none !important;
}

/* Estado de animación con delay dinámico */
.fade-container.fade-show {
    animation: containerFadeIn 0.6s ease forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

/* Keyframe principal para fade-in */
@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================================================== */
/* VARIACIONES DE ANIMACIÓN */
/* ===================================================================== */

/* Fade desde arriba */
.fade-container.fade-from-top.fade-animate {
    transform: translateY(-20px) !important;
}

.fade-container.fade-from-top.fade-show {
    animation: fadeFromTop 0.6s ease forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

@keyframes fadeFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade desde la izquierda */
.fade-container.fade-from-left.fade-animate {
    transform: translateX(-20px) !important;
}

.fade-container.fade-from-left.fade-show {
    animation: fadeFromLeft 0.6s ease forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

@keyframes fadeFromLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade desde la derecha */
.fade-container.fade-from-right.fade-animate {
    transform: translateX(20px) !important;
}

.fade-container.fade-from-right.fade-show {
    animation: fadeFromRight 0.6s ease forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

@keyframes fadeFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade con escala */
.fade-container.fade-scale.fade-animate {
    transform: scale(0.9) !important;
}

.fade-container.fade-scale.fade-show {
    animation: fadeScale 0.6s ease forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

@keyframes fadeScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===================================================================== */
/* EASINGS PERSONALIZADOS */
/* ===================================================================== */

/* Bounce suave */
.fade-container.fade-bounce.fade-show {
    animation: fadeInBounce 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

@keyframes fadeInBounce {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    60% {
        opacity: 0.8;
        transform: translateY(-5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Elastic */
.fade-container.fade-elastic.fade-show {
    animation: fadeInElastic 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

@keyframes fadeInElastic {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    50% {
        opacity: 0.7;
        transform: translateY(-10px) scale(1.1);
    }
    70% {
        opacity: 0.9;
        transform: translateY(3px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===================================================================== */
/* UTILIDADES Y HELPERS */
/* ===================================================================== */

/* Para ocultar elementos durante la carga */
.fade-loading {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Para elementos que no deben animarse */
.fade-no-animation {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* Para desactivar animaciones en dispositivos con prefer-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .fade-container,
    .fade-container.fade-animate,
    .fade-container.fade-show,
    .fade-container.fade-from-top,
    .fade-container.fade-from-left,
    .fade-container.fade-from-right,
    .fade-container.fade-scale,
    .fade-container.fade-bounce,
    .fade-container.fade-elastic {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ===================================================================== */
/* CLASES DE DURACIÓN */
/* ===================================================================== */

/* Duraciones personalizadas */
.fade-fast.fade-show {
    animation-duration: 0.3s !important;
}

.fade-slow.fade-show {
    animation-duration: 1s !important;
}

.fade-slower.fade-show {
    animation-duration: 1.5s !important;
}

/* ===================================================================== */
/* EJEMPLOS DE CLASES ESPECÍFICAS PARA DIFERENTES ELEMENTOS */
/* ===================================================================== */

/* Para cards de productos */
.product-card {
    opacity: 1;
    transform: none;
}

.product-card.fade-animate {
    opacity: 0 !important;
    transform: translateY(20px) !important;
}

.product-card.fade-show {
    animation: containerFadeIn 0.6s ease forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

/* Para elementos de lista */
.list-item {
    opacity: 1;
    transform: none;
}

.list-item.fade-animate {
    opacity: 0 !important;
    transform: translateY(20px) !important;
}

.list-item.fade-show {
    animation: containerFadeIn 0.6s ease forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

/* Para grid items */
.grid-item {
    opacity: 1;
    transform: none;
}

.grid-item.fade-animate {
    opacity: 0 !important;
    transform: translateY(20px) !important;
}

.grid-item.fade-show {
    animation: containerFadeIn 0.6s ease forwards !important;
    animation-delay: var(--fade-delay, 0.1s) !important;
}

/* ===================================================================== */
/* DEBUGGING Y DESARROLLO */
/* ===================================================================== */

/* Clase para visualizar elementos durante desarrollo */
.fade-debug {
    border: 2px dashed #ff6b6b !important;
    background-color: rgba(255, 107, 107, 0.1) !important;
}

.fade-debug.fade-animate {
    border-color: #4ecdc4 !important;
    background-color: rgba(78, 205, 196, 0.1) !important;
}

.fade-debug.fade-show {
    border-color: #45b7d1 !important;
    background-color: rgba(69, 183, 209, 0.1) !important;
}

/* ===================================================================== */
/* RESPONSIVE - OPTIMIZACIONES PARA MÓVILES */
/* ===================================================================== */

/* Reducir animaciones en móviles para mejor performance */
@media (max-width: 768px) {
    .fade-container.fade-show,
    .product-card.fade-show,
    .list-item.fade-show,
    .grid-item.fade-show {
        animation-duration: 0.4s !important;
    }
    
    /* Reducir distancia de movimiento en móviles */
    .fade-container.fade-animate,
    .product-card.fade-animate,
    .list-item.fade-animate,
    .grid-item.fade-animate {
        transform: translateY(10px) !important;
    }
}

/* En pantallas muy pequeñas, simplificar aún más */
@media (max-width: 480px) {
    .fade-container.fade-show,
    .product-card.fade-show,
    .list-item.fade-show,
    .grid-item.fade-show {
        animation-duration: 0.3s !important;
    }
}

/* ===================================================================== */
/* COMBINACIONES ÚTILES */
/* ===================================================================== */

/* Fade in con hover effect */
.fade-container.fade-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Fade in con efecto de focus para accesibilidad */
.fade-container.fade-focus:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/*
EJEMPLOS DE USO:

HTML:
<div class="fade-container">Contenido normal</div>
<div class="product-card">Producto</div>
<div class="fade-container fade-from-left">Desde izquierda</div>
<div class="fade-container fade-scale fade-bounce">Con bounce</div>
<div class="fade-container fade-fast">Animación rápida</div>

JavaScript:
applyFadeEffect('.fade-container');
applyFadeEffect('.product-card', {delay: 0.15});
quickFade('.list-item');
*/