/* ===== ANIMATIONS CSS ===== */

/* Page Loader Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader {
    animation: spin 1s linear infinite;
}

/* Fade In Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in {
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

.animate-fade-in-delay {
    opacity: 0;
    animation: fadeIn 1s ease forwards 0.5s;
}

/* Pulse Animation for CTA Button */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Navbar Slide Down Animation */
@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.header {
    animation: slideDown 0.5s ease forwards;
}

/* Scroll Animation for Elements */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.show {
    opacity: 1;
    transform: translateY(0);
}

/* Carousel Animation */
@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-200px * 3)); }
}

.carousel-track {
    animation: scroll 20s linear infinite;
}

/* Stats Counter Animation */
@keyframes countUp {
    from { content: "0"; }
    to { content: attr(data-count); }
}

/* Card Hover Effects */
.course-card .card-inner {
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.course-card:hover .card-inner {
    transform: rotateY(180deg);
}

/* Button Hover Animation */
.learn-more-btn, .enroll-btn, .submit-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.learn-more-btn:hover, .enroll-btn:hover, .submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.learn-more-btn:after, .enroll-btn:after, .submit-btn:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.learn-more-btn:hover:after, .enroll-btn:hover:after, .submit-btn:hover:after {
    transform: translateX(0);
}

/* Form Input Animation */
.form-group input, .form-group textarea, .form-group select {
    transition: border-color 0.3s ease;
}

.focus-border {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #007BFF;
    transition: width 0.3s ease;
}

.form-group input:focus ~ .focus-border,
.form-group textarea:focus ~ .focus-border,
.form-group select:focus ~ .focus-border {
    width: 100%;
}

/* Social Icons Animation */
.social-icon {
    transition: all 0.3s ease;
}

.social-icon:hover {
    transform: translateY(-5px);
}

/* Back to Top Button Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.back-to-top {
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.3s ease;
}

.back-to-top.show:hover {
    animation: bounce 1s ease infinite;
}

/* Testimonial Slider Animation */
@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.testimonial-item.active {
    animation: fadeInRight 0.5s ease forwards;
}

.testimonial-item.prev {
    animation: fadeInLeft 0.5s ease forwards;
}

/* Particles Animation */
@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 8s infinite;
}

/* Chat Bubble Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.chat-icon {
    animation: bounce 2s ease infinite;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.chat-popup {
    animation: slideUp 0.3s ease forwards;
}

/* Modal Animation */
@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content {
    animation: zoomIn 0.3s ease forwards;
}

/* Progress Bar Animation */
@keyframes progress {
    from { width: 0%; }
    to { width: 100%; }
}

/* Parallax Effect */
.parallax-bg {
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Hover Effects for Nav Links */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #28A745;
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Filter Button Animation */
.filter-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.filter-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #007BFF;
    transition: width 0.3s ease;
}

.filter-btn:hover::after,
.filter-btn.active::after {
    width: 100%;
}

/* Hamburger Menu Animation */
.hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Mobile Menu Animation */
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideOutRight {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

.nav-menu.active {
    animation: slideInRight 0.3s ease forwards;
}

.nav-menu.closing {
    animation: slideOutRight 0.3s ease forwards;
}

/* Loading Animation for Form Submission */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: rotate 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

/* Typing Animation for Chat */
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

.typing-animation {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #007BFF;
    animation: typing 2s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: #007BFF }
}

/* Shake Animation for Form Validation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease;
}