<div class="counter-component">
    <div class="counter-display">
        <h2>Counter: <span class="count">{{ count }}</span></h2>
        <if condition="lastUpdate">
            <p class="last-update">Last update: {{ lastUpdate }}</p>
        </if>
    </div>

    <div class="counter-actions">
        <button
            data-live-action="decrement"
            data-live-prevent
            class="btn btn-danger"
        >
            - Decrement
        </button>

        <button
            data-live-action="increment"
            data-live-prevent
            class="btn btn-success"
        >
            + Increment
        </button>

        <button
            data-live-action="reset"
            data-live-prevent
            class="btn btn-secondary"
        >
            Reset
        </button>
    </div>

    <div class="counter-custom">
        <form data-live-action="addAmount" data-live-prevent>
            <input
                type="number"
                name="amount"
                placeholder="Enter amount"
                value="5"
                class="form-control"
            />
            <button type="submit" class="btn btn-primary">Add Amount</button>
        </form>
    </div>
</div>

<style>
.counter-component {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.counter-display {
    text-align: center;
    margin-bottom: 2rem;
}

.counter-display h2 {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    color: #333;
}

.counter-display .count {
    color: #007bff;
    font-weight: bold;
}

.last-update {
    font-size: 0.875rem;
    color: #666;
    margin: 0;
}

.counter-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.counter-actions button {
    flex: 1;
}

.counter-custom {
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.counter-custom form {
    display: flex;
    gap: 0.5rem;
}

.counter-custom input {
    flex: 1;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.form-control {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
}
</style>
