/* Animations CSS */

/* Text Animations */
.animated-text {
    position: relative;
    display: inline-block;
}

.animated-text::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--accent-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.5s;
}

.animated-text:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Element Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Apply Animations */
.fade-in {
    animation: fadeIn 1s ease;
}

.slide-in-left {
    animation: slideInLeft 1s ease;
}

.slide-in-right {
    animation: slideInRight 1s ease;
}

.pulse {
    animation: pulse 2s infinite;
}

.shake {
    animation: shake 0.5s;
}

/* Staggered Animation for Multiple Elements */
.stagger-item {
    opacity: 0;
}

.stagger-item.visible {
    animation: fadeIn 0.5s ease forwards;
}

.stagger-item:nth-child(1).visible {
    animation-delay: 0.1s;
}

.stagger-item:nth-child(2).visible {
    animation-delay: 0.2s;
}

.stagger-item:nth-child(3).visible {
    animation-delay: 0.3s;
}

.stagger-item:nth-child(4).visible {
    animation-delay: 0.4s;
}

.stagger-item:nth-child(5).visible {
    animation-delay: 0.5s;
}

.stagger-item:nth-child(6).visible {
    animation-delay: 0.6s;
}

/* Button Animations */
.btn-hover-effect {
    overflow: hidden;
    position: relative;
}

.btn-hover-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transition: left 0.7s;
}

.btn-hover-effect:hover::before {
    left: 100%;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Notification Animation */
@keyframes notification {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    10% {
        transform: translateX(0);
        opacity: 1;
    }
    90% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification {
    animation: notification 4s ease-in-out forwards;
}

/* Term Card Hover Animation */
.term-card-hover {
    transition: all 0.3s;
}

.term-card-hover:hover {
    transform: translateY(-10px) rotate(2deg);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

/* Success Animation */
@keyframes success {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    25% {
        transform: scale(1.2);
        opacity: 1;
    }
    50% {
        transform: scale(0.9);
    }
    75% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.success-animation {
    animation: success 1s ease-in-out;
}

/* Error Animation */
@keyframes error {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-10px);
    }
    40%, 80% {
        transform: translateX(10px);
    }
}

.error-animation {
    animation: error 0.6s ease-in-out;
}

/* Highlight Animation */
@keyframes highlight {
    0% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(140, 26, 255, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

.highlight-animation {
    animation: highlight 1.5s ease-in-out;
}
