/* ═══════════════════════════════════════════════════════
   EduProfe — Sistema de Animaciones y Efectos
   Versión 2026 · Paleta: #0070B0 (azul) + #F0C000 (Gerbi)
════════════════════════════════════════════════════════ */

/* ── Variables de animación ────────────────────────────── */
:root {
    --ep-ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ep-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ep-ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ep-transition-fast: 0.15s;
    --ep-transition-base: 0.3s;
    --ep-transition-slow: 0.6s;
}

/* ══════════════════════════════════════════════════════
   1. SCROLL REVEAL ANIMATIONS
══════════════════════════════════════════════════════ */

/* Fade in desde abajo */
.ep-scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: 
        opacity var(--ep-transition-slow) var(--ep-ease-smooth),
        transform var(--ep-transition-slow) var(--ep-ease-smooth);
}

.ep-scroll-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fade in desde la izquierda */
.ep-scroll-reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: 
        opacity var(--ep-transition-slow) var(--ep-ease-smooth),
        transform var(--ep-transition-slow) var(--ep-ease-smooth);
}

.ep-scroll-reveal-left.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Fade in desde la derecha */
.ep-scroll-reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: 
        opacity var(--ep-transition-slow) var(--ep-ease-smooth),
        transform var(--ep-transition-slow) var(--ep-ease-smooth);
}

.ep-scroll-reveal-right.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale in */
.ep-scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.92);
    transition: 
        opacity var(--ep-transition-slow) var(--ep-ease-smooth),
        transform var(--ep-transition-slow) var(--ep-ease-bounce);
}

.ep-scroll-reveal-scale.is-visible {
    opacity: 1;
    transform: scale(1);
}

/* Staggered reveals para grids */
.ep-scroll-reveal-stagger {
    opacity: 0;
    transform: translateY(20px);
    transition: 
        opacity var(--ep-transition-slow) var(--ep-ease-smooth),
        transform var(--ep-transition-slow) var(--ep-ease-smooth);
}

.ep-scroll-reveal-stagger.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.ep-scroll-reveal-stagger:nth-child(1) { transition-delay: 0.05s; }
.ep-scroll-reveal-stagger:nth-child(2) { transition-delay: 0.1s; }
.ep-scroll-reveal-stagger:nth-child(3) { transition-delay: 0.15s; }
.ep-scroll-reveal-stagger:nth-child(4) { transition-delay: 0.2s; }
.ep-scroll-reveal-stagger:nth-child(5) { transition-delay: 0.25s; }
.ep-scroll-reveal-stagger:nth-child(6) { transition-delay: 0.3s; }
.ep-scroll-reveal-stagger:nth-child(7) { transition-delay: 0.35s; }
.ep-scroll-reveal-stagger:nth-child(8) { transition-delay: 0.4s; }
.ep-scroll-reveal-stagger:nth-child(9) { transition-delay: 0.45s; }

/* ══════════════════════════════════════════════════════
   2. BOTONES Y CTAs
══════════════════════════════════════════════════════ */

/* Shimmer effect en hover */
.ep-btn-shimmer {
    position: relative;
    overflow: hidden;
}

.ep-btn-shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.6s ease;
}

.ep-btn-shimmer:hover::before {
    left: 100%;
}

/* Ripple effect */
.ep-btn-ripple {
    position: relative;
    overflow: hidden;
}

.ep-btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
}

.ep-btn-ripple:active::after {
    animation: ep-ripple 0.6s ease-out;
}

@keyframes ep-ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(30);
        opacity: 0;
    }
}

/* Efecto "lift" mejorado */
.ep-btn-lift {
    transition: 
        transform var(--ep-transition-base) var(--ep-ease-bounce),
        box-shadow var(--ep-transition-base) ease;
}

.ep-btn-lift:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 8px 24px rgba(0, 112, 176, 0.25),
        0 4px 12px rgba(30, 58, 95, 0.15);
}

.ep-btn-lift:active {
    transform: translateY(-1px) scale(0.99);
    transition-duration: 0.1s;
}

/* Botón con pulso (para CTAs principales) */
.ep-btn-pulse {
    animation: ep-pulse 2.5s ease-in-out infinite;
}

@keyframes ep-pulse {
    0%, 100% {
        box-shadow: 
            0 0 0 0 rgba(0, 112, 176, 0.4),
            0 4px 14px rgba(0, 96, 152, 0.25);
    }
    50% {
        box-shadow: 
            0 0 0 12px rgba(0, 112, 176, 0),
            0 4px 14px rgba(0, 96, 152, 0.25);
    }
}

/* ══════════════════════════════════════════════════════
   3. CARDS Y PANELES
══════════════════════════════════════════════════════ */

/* Glass panel mejorado */
.ep-glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(0, 112, 176, 0.15);
    box-shadow: 
        0 8px 32px rgba(30, 58, 95, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: all var(--ep-transition-base) var(--ep-ease-smooth);
}

.ep-glass-panel:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 112, 176, 0.3);
    box-shadow: 
        0 12px 40px rgba(30, 58, 95, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

html[data-theme="dark"] .ep-glass-panel {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .ep-glass-panel:hover {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(148, 163, 184, 0.35);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Card con efecto de profundidad */
.ep-card-depth {
    position: relative;
    transition: 
        transform var(--ep-transition-base) var(--ep-ease-bounce),
        box-shadow var(--ep-transition-base) ease,
        border-color var(--ep-transition-base) ease;
}

.ep-card-depth::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: linear-gradient(135deg, 
        rgba(0, 112, 176, 0.15), 
        rgba(240, 192, 0, 0.15)
    );
    opacity: 0;
    transition: opacity var(--ep-transition-base) ease;
    z-index: -1;
    filter: blur(12px);
}

.ep-card-depth:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 
        0 20px 60px rgba(0, 112, 176, 0.15),
        0 8px 20px rgba(30, 58, 95, 0.1);
}

.ep-card-depth:hover::after {
    opacity: 1;
}

/* Card con borde animado */
.ep-card-border-glow {
    position: relative;
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #0070B0, #F0C000) border-box;
    transition: all var(--ep-transition-base) ease;
}

.ep-card-border-glow::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, #0070B0, #F0C000);
    opacity: 0;
    filter: blur(8px);
    transition: opacity var(--ep-transition-base) ease;
    z-index: -1;
}

.ep-card-border-glow:hover::before {
    opacity: 0.6;
}

html[data-theme="dark"] .ep-card-border-glow {
    background: linear-gradient(#1e293b, #1e293b) padding-box,
                linear-gradient(135deg, #0070B0, #F0C000) border-box;
}

/* ══════════════════════════════════════════════════════
   4. GERBI ANIMACIONES MEJORADAS
══════════════════════════════════════════════════════ */

@keyframes ep-gerbi-float {
    0%, 100% {
        transform: translateY(0) rotate(-2deg);
    }
    25% {
        transform: translateY(-10px) rotate(0deg);
    }
    50% {
        transform: translateY(-5px) rotate(2deg);
    }
    75% {
        transform: translateY(-15px) rotate(0deg);
    }
}

.ep-gerbi-float {
    animation: ep-gerbi-float 7s ease-in-out infinite;
    filter: drop-shadow(0 6px 16px rgba(0, 112, 176, 0.25));
    transition: transform var(--ep-transition-base) var(--ep-ease-bounce);
}

.ep-gerbi-float:hover {
    animation-play-state: paused;
    transform: scale(1.12) rotate(8deg);
}

/* Bounce in para aparición de Gerbi */
@keyframes ep-gerbi-bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(50px);
    }
    50% {
        opacity: 1;
        transform: scale(1.08) translateY(-10px);
    }
    70% {
        transform: scale(0.95) translateY(5px);
    }
    100% {
        transform: scale(1) translateY(0);
    }
}

.ep-gerbi-bounce-in {
    animation: ep-gerbi-bounce-in 0.8s var(--ep-ease-bounce);
}

/* ══════════════════════════════════════════════════════
   5. BADGES Y ETIQUETAS
══════════════════════════════════════════════════════ */

/* Badge con brillo */
.ep-badge-shine {
    position: relative;
    overflow: hidden;
}

.ep-badge-shine::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.7) 50%,
        transparent 70%
    );
    animation: ep-badge-shine 3.5s ease-in-out infinite;
}

@keyframes ep-badge-shine {
    0%, 100% { 
        transform: translateX(-120%) translateY(-120%) rotate(45deg); 
    }
    50% { 
        transform: translateX(120%) translateY(120%) rotate(45deg); 
    }
}

/* Badge con pulso suave */
.ep-badge-pulse {
    animation: ep-badge-pulse 2s ease-in-out infinite;
}

@keyframes ep-badge-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(240, 192, 0, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 16px rgba(240, 192, 0, 0.5);
    }
}

/* ══════════════════════════════════════════════════════
   6. TOOLTIPS ANIMADOS
══════════════════════════════════════════════════════ */

.ep-tooltip {
    position: relative;
}

.ep-tooltip::before,
.ep-tooltip::after {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    transition: 
        opacity var(--ep-transition-base) ease,
        transform var(--ep-transition-base) var(--ep-ease-bounce);
}

/* Contenido del tooltip */
.ep-tooltip::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 0.5rem 0.85rem;
    background: var(--ink);
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius);
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(30, 58, 95, 0.25);
    z-index: 100;
}

/* Flecha del tooltip */
.ep-tooltip::before {
    content: '';
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    border: 4px solid transparent;
    border-top-color: var(--ink);
    z-index: 101;
}

.ep-tooltip:hover::before,
.ep-tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

html[data-theme="dark"] .ep-tooltip::after {
    background: #1e293b;
    border: 1px solid #475569;
}

html[data-theme="dark"] .ep-tooltip::before {
    border-top-color: #475569;
}

/* ══════════════════════════════════════════════════════
   7. LOADING Y SKELETON
══════════════════════════════════════════════════════ */

/* Skeleton loader */
.ep-skeleton {
    background: linear-gradient(
        90deg,
        var(--slate-100) 0%,
        var(--slate-200) 20%,
        var(--slate-100) 40%,
        var(--slate-100) 100%
    );
    background-size: 200% 100%;
    animation: ep-skeleton-loading 1.8s ease-in-out infinite;
    border-radius: var(--radius);
}

@keyframes ep-skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ep-skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 0.75rem;
}

.ep-skeleton-text {
    height: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.ep-skeleton-text:last-child {
    width: 80%;
}

.ep-skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

html[data-theme="dark"] .ep-skeleton {
    background: linear-gradient(
        90deg,
        #1e293b 0%,
        #334155 20%,
        #1e293b 40%,
        #1e293b 100%
    );
    background-size: 200% 100%;
}

/* Spinner circular */
.ep-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(0, 112, 176, 0.2);
    border-top-color: #0070B0;
    border-radius: 50%;
    animation: ep-spin 0.8s linear infinite;
}

@keyframes ep-spin {
    to { transform: rotate(360deg); }
}

.ep-spinner-gerbi {
    border-top-color: #F0C000;
}

/* ══════════════════════════════════════════════════════
   8. PROGRESS BAR DE SCROLL
══════════════════════════════════════════════════════ */

.ep-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #0070B0, #F0C000, #0070B0);
    background-size: 200% 100%;
    width: 0%;
    z-index: 1000;
    transition: width 0.1s ease-out;
    box-shadow: 0 2px 8px rgba(0, 112, 176, 0.35);
    animation: ep-progress-shimmer 3s linear infinite;
}

@keyframes ep-progress-shimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* ══════════════════════════════════════════════════════
   9. PARALLAX SUAVE
══════════════════════════════════════════════════════ */

.ep-parallax-slow {
    will-change: transform;
    transition: transform 0.4s var(--ep-ease-smooth);
}

.ep-parallax-medium {
    will-change: transform;
    transition: transform 0.3s var(--ep-ease-smooth);
}

.ep-parallax-fast {
    will-change: transform;
    transition: transform 0.2s var(--ep-ease-smooth);
}

/* ══════════════════════════════════════════════════════
   10. EFECTOS ESPECIALES
══════════════════════════════════════════════════════ */

/* Efecto typewriter */
@keyframes ep-typewriter {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes ep-blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--blue); }
}

.ep-typewriter {
    overflow: hidden;
    border-right: 2px solid var(--blue);
    white-space: nowrap;
    animation: 
        ep-typewriter 3s steps(40, end),
        ep-blink-caret 0.75s step-end infinite;
}

/* Efecto confetti para celebraciones */
@keyframes ep-confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.ep-confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #F0C000;
    animation: ep-confetti-fall 3s linear forwards;
}

/* Shake para errores */
@keyframes ep-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-8px); }
    20%, 40%, 60%, 80% { transform: translateX(8px); }
}

.ep-shake {
    animation: ep-shake 0.6s ease-in-out;
}

/* Bounce para éxito */
@keyframes ep-bounce-success {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-20px); }
    60% { transform: translateY(-10px); }
}

.ep-bounce-success {
    animation: ep-bounce-success 1s ease-in-out;
}

/* ══════════════════════════════════════════════════════
   11. COUNTER ANIMATIONS (preparado para JS)
══════════════════════════════════════════════════════ */

.ep-counter {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum';
}

.ep-counter-animate {
    transition: all 0.4s var(--ep-ease-smooth);
}

/* ══════════════════════════════════════════════════════
   12. MICRO-INTERACCIONES
══════════════════════════════════════════════════════ */

/* Hover con escala sutil */
.ep-hover-scale {
    transition: transform var(--ep-transition-base) var(--ep-ease-bounce);
}

.ep-hover-scale:hover {
    transform: scale(1.05);
}

/* Hover con brillo */
.ep-hover-brightness {
    transition: filter var(--ep-transition-base) ease;
}

.ep-hover-brightness:hover {
    filter: brightness(1.15);
}

/* Hover con rotación */
.ep-hover-rotate {
    transition: transform var(--ep-transition-base) var(--ep-ease-smooth);
}

.ep-hover-rotate:hover {
    transform: rotate(5deg);
}

/* ══════════════════════════════════════════════════════
   13. MODOS DE ACCESIBILIDAD
══════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .ep-scroll-reveal,
    .ep-scroll-reveal-left,
    .ep-scroll-reveal-right,
    .ep-scroll-reveal-scale,
    .ep-scroll-reveal-stagger {
        opacity: 1;
        transform: none;
    }
    
    .ep-parallax-slow,
    .ep-parallax-medium,
    .ep-parallax-fast {
        transform: none !important;
    }
}

/* ══════════════════════════════════════════════════════
   14. UTILIDADES DE PERFORMANCE
══════════════════════════════════════════════════════ */

.ep-will-animate {
    will-change: transform, opacity;
}

.ep-gpu-accelerate {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ══════════════════════════════════════════════════════
   15. EFECTOS DE FOCO MEJORADOS
══════════════════════════════════════════════════════ */

.ep-focus-ring:focus-visible {
    outline: 3px solid rgba(0, 112, 176, 0.5);
    outline-offset: 3px;
    border-radius: var(--radius);
    transition: outline-offset var(--ep-transition-fast) ease;
}

.ep-focus-ring:focus-visible:active {
    outline-offset: 1px;
}

/* Focus con glow */
.ep-focus-glow:focus-visible {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(0, 112, 176, 0.3),
        0 0 20px rgba(0, 112, 176, 0.2);
}

html[data-theme="dark"] .ep-focus-ring:focus-visible {
    outline-color: rgba(56, 189, 248, 0.6);
}

html[data-theme="dark"] .ep-focus-glow:focus-visible {
    box-shadow: 
        0 0 0 3px rgba(56, 189, 248, 0.4),
        0 0 20px rgba(56, 189, 248, 0.3);
}
