<template>
    <div class="typing-indicator">
        <div class="typing-dot"></div>
        <div class="typing-dot"></div>
        <div class="typing-dot"></div>
        <div v-if="showText" class="typing-text">{{ text }}</div>
    </div>
</template>

<script>
export default {
    name: 'TypingIndicator',
    props: {
        showText: {
            type: Boolean,
            default: false
        },
        text: {
            type: String,
            default: 'Bezig met typen...'
        }
    },
    methods: {
        // Andere methoden kunnen hier staan
    }
};
</script>

<style scoped>
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    margin: 10px 0;
    background-color: #f0f0f0;
    border-radius: 18px;
    max-width: 80px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    margin: 0 2px;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

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

.typing-text {
    margin-left: 10px;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Alternative pulse animation */
@keyframes typing-pulse {
    0%, 60%, 100% {
        transform: initial;
        opacity: 0.4;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .typing-indicator {
        padding: 8px 12px;
        margin: 8px 0;
    }
    
    .typing-dot {
        width: 6px;
        height: 6px;
    }
    
    .typing-text {
        font-size: 0.8rem;
        margin-left: 8px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .typing-indicator {
        background-color: #2a2a2a;
    }
    
    .typing-dot {
        background-color: #ccc;
    }
    
    .typing-text {
        color: #aaa;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .typing-indicator {
        border: 1px solid #333;
    }
    
    .typing-dot {
        background-color: #000;
    }
    
    .typing-text {
        color: #000;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .typing-dot {
        animation: none;
        opacity: 0.7;
    }
    
    .typing-indicator {
        opacity: 0.8;
    }
}
</style>