<div class="scheduler-timeline-component">
    <!-- Summary Stats -->
    <div class="scheduler-summary">
        <div class="scheduler-summary__item">
            <span class="scheduler-summary__value">{{ totalScheduledTasks }}</span>
            <span class="scheduler-summary__label">Total Tasks</span>
        </div>
        <div class="scheduler-summary__divider"></div>
        <div class="scheduler-summary__item">
            <span class="scheduler-summary__value">{{ dueTasks }}</span>
            <span class="scheduler-summary__label">Due Now</span>
        </div>
        <div class="scheduler-summary__divider"></div>
        <div class="scheduler-summary__item scheduler-summary__item--wide">
            <span class="scheduler-summary__label">Next Execution</span>
            <span class="scheduler-summary__value scheduler-summary__value--small">{{ nextExecution }}</span>
        </div>
    </div>

    <!-- Upcoming Tasks Timeline -->
    <div class="timeline" if="upcomingTasks">
        <for items="upcomingTasks" as="task">
            <div class="timeline-item">
                <div class="timeline-item__time">
                    <span class="timeline-badge timeline-badge--due" if="task.isDue">Due Now</span>
                    <span class="timeline-badge" if="!task.isDue">{{ task.nextRunRelative }}</span>
                </div>
                <div class="timeline-item__content">
                    <div class="timeline-item__header">
                        <span class="timeline-item__id">{{ task.id }}</span>
                        <span class="timeline-type-badge">{{ task.scheduleType }}</span>
                    </div>
                    <div class="timeline-item__footer">
                        <span class="timeline-item__date">{{ task.nextRun }}</span>
                    </div>
                </div>
            </div>
        </for>
    </div>

    <div class="scheduler-empty" if="!upcomingTasks">
        <div class="scheduler-empty__icon">📅</div>
        <div class="scheduler-empty__text">No scheduled tasks</div>
    </div>

    <div class="component-footer">
        <span class="component-footer__text">Last updated: {{ lastUpdated }}</span>
        <span class="component-footer__badge">Updates every 30s</span>
    </div>
</div>

<style>
.scheduler-timeline-component {
    padding: 0;
}

.scheduler-summary {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.scheduler-summary__item {
    text-align: center;
}

.scheduler-summary__item--wide {
    flex: 2;
}

.scheduler-summary__value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.scheduler-summary__value--small {
    font-size: 1rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.scheduler-summary__label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scheduler-summary__divider {
    width: 1px;
    height: 3rem;
    background: rgba(255,255,255,0.3);
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #007bff;
    border-radius: 8px;
    transition: all 0.2s;
}

.timeline-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left-color: #0056b3;
}

.timeline-item__time {
    flex-shrink: 0;
    min-width: 120px;
}

.timeline-badge {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.timeline-badge--due {
    background: #dc3545;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.timeline-item__content {
    flex: 1;
}

.timeline-item__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.timeline-item__id {
    font-weight: 600;
    font-size: 0.875rem;
}

.timeline-type-badge {
    background: #e9ecef;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
}

.timeline-item__footer {
    font-size: 0.75rem;
    color: #666;
}

.scheduler-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}

.scheduler-empty__icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.scheduler-empty__text {
    font-size: 1rem;
}

.component-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #666;
}

.component-footer__badge {
    background: #007bff;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
}
</style>
