/**
 * Animaciones y Efectos - CAINCO El Alto
 * Transiciones suaves y profesionales
 *animation.css
 */

/* ========================================
   ANIMACIONES KEYFRAMES
======================================== */

@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 slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }
    to {
        max-height: 500px;
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ========================================
   CLASES DE ANIMACIÓN
======================================== */

.animate-fade-in {
    animation: fadeIn 0.8s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.animate-fade-in-down {
    animation: fadeInDown 0.8s ease-out;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s ease-out;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s ease-out;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Delays para animaciones escalonadas (animation + transition para .reveal) */
.delay-1 { animation-delay: 0.1s; transition-delay: 0.08s; }
.delay-2 { animation-delay: 0.2s; transition-delay: 0.16s; }
.delay-3 { animation-delay: 0.3s; transition-delay: 0.24s; }
.delay-4 { animation-delay: 0.4s; transition-delay: 0.32s; }
.delay-5 { animation-delay: 0.5s; transition-delay: 0.40s; }
.delay-6 { animation-delay: 0.6s; transition-delay: 0.48s; }

/* ========================================
   EFECTOS HOVER MEJORADOS
======================================== */

.card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.card:hover::before {
    left: 100%;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 30px rgba(0, 51, 102, 0.2);
}

.card-img {
    transition: transform 0.6s ease;
}

.card:hover .card-img {
    transform: scale(1.1);
}

/* ========================================
   BOTONES CON EFECTOS
======================================== */

.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: scale(0.95);
}


/* ========================================
   BADGES CON ANIMACIÓN
======================================== */

.badge {
    transition: all 0.3s ease;
    display: inline-block;
}

.badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ========================================
   EFECTOS DE LÍNEA ANIMADA
======================================== */

.underline-animated {
    position: relative;
    display: inline-block;
}

.underline-animated::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 3px;
    background-color: var(--color-secundario);
    transition: width 0.4s ease;
}

.underline-animated:hover::after {
    width: 100%;
}

/* ========================================
   LOADING SPINNER ANIMADO
======================================== */

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner 0.75s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* ========================================
   CONTADOR ANIMADO — estilos base en style.css
======================================== */

/* ========================================
   EFECTOS DE SOMBRA DINÁMICA
======================================== */

.shadow-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 51, 102, 0.22);
}

/* ========================================
   GRADIENTES ANIMADOS
======================================== */

.gradient-animated {
    background: linear-gradient(135deg, #000020, #000d45, #000020);
    background-size: 200% 200%;
    animation: gradient-shift 8s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* ========================================
   EFECTOS DE TEXTO
======================================== */

.text-shine {
    background: linear-gradient(90deg, #000020 40%, #eba436 50%, #000020 60%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shine 3s infinite;
}

@keyframes shine {
    0%, 100% {
        background-position: 200% 0;
    }
    50% {
        background-position: 0 0;
    }
}

/* ========================================
   REVELAR AL SCROLL (Intersection Observer)
======================================== */

/* Base: fade + slide up */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition:
        opacity  0.65s cubic-bezier(.4,0,.2,1),
        transform 0.65s cubic-bezier(.34,1.36,.64,1);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Desde la izquierda */
.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition:
        opacity  0.65s cubic-bezier(.4,0,.2,1),
        transform 0.65s cubic-bezier(.34,1.36,.64,1);
}
.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

/* Desde la derecha */
.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition:
        opacity  0.65s cubic-bezier(.4,0,.2,1),
        transform 0.65s cubic-bezier(.34,1.36,.64,1);
}
.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

/* Scale in (para íconos, badges) */
.reveal-scale {
    opacity: 0;
    transform: scale(0.85);
    transition:
        opacity  0.55s cubic-bezier(.4,0,.2,1),
        transform 0.55s cubic-bezier(.34,1.56,.64,1);
}
.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

/* Delays más pronunciados para cascada real */
.delay-1 { transition-delay: 0.10s; animation-delay: 0.10s; }
.delay-2 { transition-delay: 0.22s; animation-delay: 0.22s; }
.delay-3 { transition-delay: 0.34s; animation-delay: 0.34s; }
.delay-4 { transition-delay: 0.46s; animation-delay: 0.46s; }
.delay-5 { transition-delay: 0.58s; animation-delay: 0.58s; }
.delay-6 { transition-delay: 0.70s; animation-delay: 0.70s; }

/* Línea del section-title se dibuja al aparecer */
.section-title h2::after {
    width: 0 !important;
    transition: width 0.6s cubic-bezier(.34,1.36,.64,1) 0.35s !important;
}
.section-title.active h2::after {
    width: 60px !important;
}

/* ========================================
   EFECTOS DE ÍCONOS
======================================== */

.icon-bounce {
    display: inline-block;
    transition: transform 0.3s ease;
}

.icon-bounce:hover {
    animation: bounce 0.6s;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.icon-rotate {
    transition: transform 0.4s ease;
}

.icon-rotate:hover {
    transform: rotate(360deg);
}

/* ========================================
   RIPPLE EFFECT (Efecto de onda)
======================================== */

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 200px;
    height: 200px;
}

/* ========================================
   SMOOTH SCROLL
======================================== */

html {
    scroll-behavior: smooth;
}

/* ========================================
   EFECTOS RESPONSIVOS
======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}