<script setup lang="ts">

defineProps<{
    label: string
}>()

</script>

<template>
    <div class="field-change">
        <span class="field-label">{{ label }}</span>
        <div class="field-values">
            <span class="from">
                <slot name="from" />
            </span>
            <svg class="arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
                <path d="M5 12h14M13 6l6 6-6 6"/>
            </svg>
            <span class="to">
                <slot name="to" />
            </span>
        </div>
    </div>
</template>

<style scoped>
.field-change {
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
}

.field-change:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}

.field-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.field-values {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    min-width: 0;
}

.from {
    color: #6b7280;
    text-decoration: line-through;
    word-break: break-word;
    min-width: 0;
}

.arrow {
    width: 0.85rem;
    height: 0.85rem;
    color: #374151;
    flex-shrink: 0;
}

.to {
    color: #f9fafb;
    font-weight: 500;
    word-break: break-word;
    min-width: 0;
}

@media (max-width: 600px) {
    .field-change {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .field-values {
        display: grid;
        grid-template-columns: 1fr 1rem 1fr;
        align-items: center;
        gap: 0.4rem;
    }

    .arrow {
        justify-self: center;
    }

    .to {
        font-size: 0.9rem;
    }
}
</style>
