/* ========================================
   ANIMATED GRADIENT EFFECTS
   Hiệu ứng gradient đổ màu động
   ======================================== */

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

/* Gradient Animation - Flowing Colors */
@keyframes gradient-flow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Gradient Animation - Rotate */
@keyframes gradient-rotate {
    0% {
        background-position: 0% 0%;
    }
    25% {
        background-position: 100% 0%;
    }
    50% {
        background-position: 100% 100%;
    }
    75% {
        background-position: 0% 100%;
    }
    100% {
        background-position: 0% 0%;
    }
}

/* Gradient Animation - Wave */
@keyframes gradient-wave {
    0% {
        background-position: 0% 50%;
        background-size: 100% 100%;
    }
    50% {
        background-position: 100% 50%;
        background-size: 150% 150%;
    }
    100% {
        background-position: 0% 50%;
        background-size: 100% 100%;
    }
}

/* Gradient Animation - Diagonal Sweep */
@keyframes gradient-sweep {
    0% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 200% 200%;
    }
}

/* ============ GRADIENT CLASSES ============ */

/* Gradient Flow - Smooth horizontal movement */
.gradient-flow {
    background: linear-gradient(
        90deg,
        #4FC3F7 0%,
        #FF6B6B 25%,
        #4FC3F7 50%,
        #FF6B6B 75%,
        #4FC3F7 100%
    );
    background-size: 200% 100%;
    animation: gradient-flow 8s ease infinite;
}

/* Gradient Rotate - Circular rotation */
.gradient-rotate {
    background: linear-gradient(
        135deg,
        #4FC3F7 0%,
        #FF6B6B 25%,
        #81D4FA 50%,
        #FF8A80 75%,
        #4FC3F7 100%
    );
    background-size: 200% 200%;
    animation: gradient-rotate 10s linear infinite;
}

/* Gradient Wave - Pulsing effect */
.gradient-wave {
    background: linear-gradient(
        45deg,
        #4FC3F7 0%,
        #FF6B6B 50%,
        #4FC3F7 100%
    );
    background-size: 100% 100%;
    animation: gradient-wave 6s ease-in-out infinite;
}

/* Gradient Sweep - Diagonal sweep */
.gradient-sweep {
    background: linear-gradient(
        135deg,
        #4FC3F7 0%,
        #FF6B6B 50%,
        #4FC3F7 100%
    );
    background-size: 200% 200%;
    animation: gradient-sweep 8s linear infinite;
}

/* ============ HERO GRADIENT OVERLAY ============ */

.hero-gradient-animated {
    position: relative;
    overflow: hidden;
}

.hero-gradient-animated::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(79, 195, 247, 0.8) 0%,
        rgba(255, 107, 107, 0.8) 50%,
        rgba(79, 195, 247, 0.8) 100%
    );
    background-size: 200% 200%;
    animation: gradient-rotate 12s ease infinite;
    z-index: 1;
}

.hero-gradient-animated > * {
    position: relative;
    z-index: 2;
}

/* ============ BUTTON GRADIENTS ============ */

.btn-gradient-animated {
    background: linear-gradient(
        90deg,
        #4FC3F7 0%,
        #FF6B6B 50%,
        #4FC3F7 100%
    );
    background-size: 200% 100%;
    animation: gradient-flow 4s ease infinite;
    color: white;
    border: none;
    transition: all 0.3s ease;
}

.btn-gradient-animated:hover {
    background-size: 300% 100%;
    animation-duration: 2s;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 195, 247, 0.4);
}

/* ============ TEXT GRADIENTS ============ */

.text-gradient-animated {
    background: linear-gradient(
        90deg,
        #4FC3F7 0%,
        #FF6B6B 25%,
        #81D4FA 50%,
        #FF8A80 75%,
        #4FC3F7 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-flow 6s linear infinite;
}

/* ============ CARD GRADIENT BORDERS ============ */

.card-gradient-border {
    position: relative;
    background: white;
    padding: 2px;
    border-radius: 16px;
    overflow: hidden;
}

.card-gradient-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(
        135deg,
        #4FC3F7 0%,
        #FF6B6B 50%,
        #4FC3F7 100%
    );
    background-size: 200% 200%;
    animation: gradient-rotate 8s linear infinite;
    border-radius: 16px;
    z-index: -1;
}

.card-gradient-border-inner {
    background: white;
    border-radius: 14px;
    padding: 30px;
    position: relative;
    z-index: 1;
}

/* ============ UNDERLINE GRADIENT ============ */

.underline-gradient-animated {
    position: relative;
    display: inline-block;
}

.underline-gradient-animated::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(
        90deg,
        #4FC3F7 0%,
        #FF6B6B 50%,
        #4FC3F7 100%
    );
    background-size: 200% 100%;
    animation: gradient-flow 4s ease infinite;
    border-radius: 2px;
}

/* ============ SECTION BACKGROUNDS ============ */

.section-gradient-bg {
    background: linear-gradient(
        135deg,
        rgba(79, 195, 247, 0.05) 0%,
        rgba(255, 107, 107, 0.05) 50%,
        rgba(79, 195, 247, 0.05) 100%
    );
    background-size: 200% 200%;
    animation: gradient-wave 15s ease-in-out infinite;
}

/* ============ ICON GRADIENT ============ */

.icon-gradient-animated {
    background: linear-gradient(
        135deg,
        #4FC3F7 0%,
        #FF6B6B 100%
    );
    background-size: 200% 200%;
    animation: gradient-rotate 6s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============ BORDER GRADIENT ANIMATION ============ */

@keyframes border-gradient-rotate {
    0% {
        border-image-source: linear-gradient(0deg, #4FC3F7, #FF6B6B);
    }
    25% {
        border-image-source: linear-gradient(90deg, #4FC3F7, #FF6B6B);
    }
    50% {
        border-image-source: linear-gradient(180deg, #4FC3F7, #FF6B6B);
    }
    75% {
        border-image-source: linear-gradient(270deg, #4FC3F7, #FF6B6B);
    }
    100% {
        border-image-source: linear-gradient(360deg, #4FC3F7, #FF6B6B);
    }
}

.border-gradient-animated {
    border: 3px solid;
    border-image-slice: 1;
    border-image-source: linear-gradient(135deg, #4FC3F7, #FF6B6B);
    animation: border-gradient-rotate 4s linear infinite;
}

/* ============ GLOW GRADIENT ============ */

@keyframes glow-gradient {
    0%, 100% {
        box-shadow: 0 0 20px rgba(79, 195, 247, 0.5),
                    0 0 40px rgba(79, 195, 247, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.5),
                    0 0 40px rgba(255, 107, 107, 0.3);
    }
}

.glow-gradient-animated {
    animation: glow-gradient 3s ease-in-out infinite;
}

/* ============ SHIMMER EFFECT ============ */

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer-gradient {
    background: linear-gradient(
        90deg,
        rgba(79, 195, 247, 0.1) 0%,
        rgba(255, 107, 107, 0.3) 50%,
        rgba(79, 195, 247, 0.1) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 3s infinite;
}

/* ============ AUTO-APPLY TO ELEMENTS ============ */

/* Hero sections get animated gradient */
.hero-section {
    position: relative;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(79, 195, 247, 0.9) 0%,
        rgba(255, 107, 107, 0.7) 50%,
        rgba(79, 195, 247, 0.9) 100%
    );
    background-size: 200% 200%;
    animation: gradient-wave 15s ease-in-out infinite;
    z-index: -1;
}

/* CTA sections */
.cta {
    background: linear-gradient(
        135deg,
        #4FC3F7 0%,
        #FF6B6B 50%,
        #4FC3F7 100%
    );
    background-size: 200% 200%;
    animation: gradient-rotate 12s ease infinite;
}

/* Service cards get gradient border on hover */
.service-card {
    transition: all 0.4s ease;
}

.service-card:hover {
    background: linear-gradient(
        135deg,
        rgba(79, 195, 247, 0.05) 0%,
        rgba(255, 107, 107, 0.05) 100%
    );
}

/* ============ RESPONSIVE ============ */

@media (max-width: 768px) {
    /* Giảm animation speed trên mobile */
    .gradient-flow {
        animation-duration: 12s;
    }
    
    .gradient-rotate {
        animation-duration: 15s;
    }
    
    .gradient-wave {
        animation-duration: 10s;
    }
}

/* ============ PERFORMANCE OPTIMIZATION ============ */

/* Reduce animations for low-end devices */
@media (prefers-reduced-motion: reduce) {
    .gradient-flow,
    .gradient-rotate,
    .gradient-wave,
    .gradient-sweep,
    .btn-gradient-animated,
    .text-gradient-animated,
    .hero-gradient-animated::before,
    .hero-section::before,
    .cta {
        animation: none !important;
    }
}
