/* General Styles */
body {
    font-family: Arial, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f0f0f0;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.example {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.demo-container {
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f8f8;
    border-radius: 5px;
    margin: 20px 0;
}

/* Example 1: Bouncing Ball Animation */
.ball {
    width: 50px;
    height: 50px;
    background-color: #4CAF50;
    border-radius: 50%;
    /* The animation property is a shorthand for:
       - animation-name
       - animation-duration
       - animation-timing-function
       - animation-iteration-count */
    animation: bounce 1s ease-in-out infinite;
}

/* Define the bounce keyframes animation */
@keyframes bounce {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-80px);
    }
    100% {
        transform: translateY(0);
    }
}

/* Example 2: Color Changing Card Animation */
.card {
    width: 100px;
    height: 150px;
    background-color: #2196F3;
    border-radius: 8px;
    /* This animation combines multiple properties:
       - Color changes
       - Size scaling
       - Smooth transitions with ease-in-out */
    animation: colorChange 3s ease-in-out infinite;
}

@keyframes colorChange {
    0% {
        background-color: #2196F3;
        transform: scale(1);
    }
    33% {
        background-color: #4CAF50;
        transform: scale(1.1);
    }
    66% {
        background-color: #FFC107;
        transform: scale(0.9);
    }
    100% {
        background-color: #2196F3;
        transform: scale(1);
    }
}

/* Example 3: Loading Animation */
.loading {
    display: flex;
    gap: 10px;
}

.dot {
    width: 20px;
    height: 20px;
    background-color: #9C27B0;
    border-radius: 50%;
    /* Each dot uses the same animation but with different delays */
    animation: pulse 1.5s ease-in-out infinite;
}

/* Add different delays for each dot */
.dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Footer Styles */
footer {
    margin-top: 40px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

footer ol {
    padding-left: 20px;
    line-height: 1.6;
}

/* Example 4: Path Animation */
.path-container {
    position: relative;
}

.path-ball {
    width: 40px;
    height: 40px;
    background-color: #FF5722;
    border-radius: 50%;
    position: absolute;
    bottom: 20px;
    left: 20px;
    /* Animation properties:
       - 4s duration for clear visualization
       - ease-in-out for smooth movement
       - forwards to maintain final position
       - 1 iteration to stop at the end */
    animation: squarePath 4s ease-in-out forwards;
}

@keyframes squarePath {
    0% {
        transform: translate(0, 0); /* Start: bottom left */
    }
    25% {
        transform: translate(0, -140px); /* Move to top */
    }
    50% {
        transform: translate(140px, -140px); /* Move to right */
    }
    75% {
        transform: translate(140px, 0); /* Move to bottom */
    }
    100% {
    transform: translate(0, 0); /* Move to left and stop */
    }
}

/* Example 5: Sequential Shapes Animation */
.sequence-container {
    position: relative;
}

/* Common styles for all shapes */
.sequence-ball,
.sequence-square,
.sequence-rectangle {
    position: absolute;
    left: 20px;
    animation-duration: 2s;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}

/* Ball styling and animation */
.sequence-ball {
    width: 40px;
    height: 40px;
    background-color: #9C27B0;
    border-radius: 50%;
    bottom: 20px;
    animation-name: moveUp;
}

/* Square styling and animation */
.sequence-square {
    width: 40px;
    height: 40px;
    background-color: #2196F3;
    top: 20px;
    animation-name: moveDown;
    animation-delay: 2s; /* Starts after ball finishes */
}

/* Rectangle styling and animation */
.sequence-rectangle {
    width: 60px;
    height: 30px;
    background-color: #FF5722;
    top: 85px; /* Centered vertically */
    animation-name: moveRight;
    animation-delay: 4s; /* Starts after square finishes */
}

/* Ball moving up */
@keyframes moveUp {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-140px);
    }
}

/* Square moving down */
@keyframes moveDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(140px);
    }
}

/* Rectangle moving right */
@keyframes moveRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(140px);
    }
}
