/**
 * Match Timeline CSS
 * 
 * Displays a chronological timeline of match events
 * Works offline (localStorage only, no platform calls)
 */

/* =========================================
   Timeline Container
   ========================================= */

.match-timeline {
    background: var(--color-surface, #1a1a2e);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem auto;
    max-width: 800px;
}

.match-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border, #333);
}

.match-timeline-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text, #fff);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.match-timeline-title i {
    color: var(--color-primary, #6366f1);
}

/* =========================================
   Filter Tabs
   ========================================= */

.timeline-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.timeline-filter-btn {
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--color-border, #333);
    background: transparent;
    color: var(--color-text-muted, #888);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.timeline-filter-btn:hover {
    background: var(--color-surface-hover, #252540);
    color: var(--color-text, #fff);
}

.timeline-filter-btn.active {
    background: var(--color-primary, #6366f1);
    border-color: var(--color-primary, #6366f1);
    color: white;
}

.timeline-filter-icon {
    font-size: 0.875rem;
}

/* =========================================
   Stats Summary
   ========================================= */

.timeline-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--color-surface-alt, #16162a);
    border-radius: 8px;
}

.timeline-stat {
    text-align: center;
}

.timeline-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text, #fff);
}

.timeline-stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted, #888);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =========================================
   Timeline Events List
   ========================================= */

.timeline-events {
    position: relative;
    padding-left: 2rem;
}

/* Vertical timeline line */
.timeline-events::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-border, #333);
}

.timeline-event {
    position: relative;
    padding: 0.75rem 0 0.75rem 1.5rem;
    border-bottom: 1px solid var(--color-border-subtle, #222);
}

.timeline-event:last-child {
    border-bottom: none;
}

/* Event dot on timeline */
.timeline-event::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--event-color, #6366f1);
    border: 2px solid var(--color-surface, #1a1a2e);
    z-index: 1;
}

/* =========================================
   Event Content
   ========================================= */

.timeline-event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.timeline-event-main {
    flex: 1;
}

.timeline-event-icon {
    font-size: 1rem;
    margin-right: 0.5rem;
}

.timeline-event-label {
    font-size: 0.9375rem;
    color: var(--color-text, #fff);
}

.timeline-event-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--color-text-muted, #888);
}

.timeline-event-time {
    font-family: var(--font-mono, monospace);
}

.timeline-event-badge {
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--event-color-dim, rgba(99, 102, 241, 0.15));
    color: var(--event-color, #6366f1);
}

.timeline-event-score {
    font-family: var(--font-mono, monospace);
    font-size: 0.875rem;
    color: var(--color-text-muted, #888);
    background: var(--color-surface-alt, #16162a);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* =========================================
   Category Colors
   ========================================= */

.timeline-event[data-category="lifecycle"] {
    --event-color: #6366f1;
    --event-color-dim: rgba(99, 102, 241, 0.15);
}

.timeline-event[data-category="scoring"] {
    --event-color: #22c55e;
    --event-color-dim: rgba(34, 197, 94, 0.15);
}

.timeline-event[data-category="period"] {
    --event-color: #f59e0b;
    --event-color-dim: rgba(245, 158, 11, 0.15);
}

.timeline-event[data-category="infraction"] {
    --event-color: #ef4444;
    --event-color-dim: rgba(239, 68, 68, 0.15);
}

.timeline-event[data-category="timeout"] {
    --event-color: #8b5cf6;
    --event-color-dim: rgba(139, 92, 246, 0.15);
}

.timeline-event[data-category="serve"] {
    --event-color: #06b6d4;
    --event-color-dim: rgba(6, 182, 212, 0.15);
}

.timeline-event[data-category="clock"] {
    --event-color: #64748b;
    --event-color-dim: rgba(100, 116, 139, 0.15);
}

.timeline-event[data-category="settings"] {
    --event-color: #94a3b8;
    --event-color-dim: rgba(148, 163, 184, 0.15);
}

/* =========================================
   Empty State
   ========================================= */

.timeline-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted, #888);
}

.timeline-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.timeline-empty-text {
    font-size: 1rem;
}

/* =========================================
   Responsive
   ========================================= */

@media (max-width: 640px) {
    .match-timeline {
        padding: 1rem;
        margin: 0.5rem;
        border-radius: 8px;
    }
    
    .match-timeline-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .timeline-filters {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
    }
    
    .timeline-filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .timeline-event {
        padding-left: 1rem;
    }
    
    .timeline-events {
        padding-left: 1.5rem;
    }
    
    .timeline-event-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .timeline-event-score {
        align-self: flex-start;
    }
}

/* =========================================
   Print Styles
   ========================================= */

@media print {
    .match-timeline {
        background: white;
        color: black;
        box-shadow: none;
    }
    
    .timeline-filters,
    .timeline-actions {
        display: none;
    }
    
    .timeline-event {
        break-inside: avoid;
    }
}
