* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}
.container {
    max-width: 1400px;
    margin: 0 auto;
}
h1 {
    color: white;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 30px;
}
h2 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 18px;
}
.section {
    background: white;
    padding: 25px;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
button {
    padding: 12px 24px;
    margin: 5px;
    font-size: 14px;
    cursor: pointer;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 600;
}
button:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
button:active {
    transform: translateY(0);
}
button:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}
.btn-success { background: #48bb78; }
.btn-success:hover:not(:disabled) { background: #38a169; }
.btn-warning { background: #ed8936; }
.btn-warning:hover:not(:disabled) { background: #dd6b20; }
.btn-danger { background: #f56565; }
.btn-danger:hover:not(:disabled) { background: #e53e3e; }

.status-box {
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.status-connected { background: #c6f6d5; color: #22543d; }
.status-disconnected { background: #fed7d7; color: #742a2a; }
.status-realtime { background: #c6f6d5; color: #22543d; }
.status-csv { background: #feebc8; color: #7c2d12; }

.mode-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
}
.mode-realtime { background: #48bb78; color: white; }
.mode-csv { background: #ed8936; color: white; }

#fileList {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    max-height: 400px;
    overflow-y: auto;
}
.file-item {
    padding: 15px;
    margin: 8px 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.file-item:hover {
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.file-item.selected {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* Timeline */
.timeline-container {
    margin-top: 20px;
    padding: 25px;
    background: #f7fafc;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
}

.timeline-slider {
    width: 100%;
    height: 14px;
    border-radius: 7px;
    background: #e2e8f0;
    cursor: pointer;
    position: relative;
    margin: 20px 0;
}

.timeline-progress {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 7px;
    width: 0%;
    transition: width 0.1s;
}

.timeline-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 26px;
    height: 26px;
    background: white;
    border: 4px solid #667eea;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    left: 0%;
}

.timeline-thumb:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.15);
}

.timeline-time {
    display: flex;
    justify-content: space-between;
    color: #4a5568;
    font-size: 14px;
    margin-bottom: 15px;
    font-weight: 600;
}

.timeline-time span {
    background: white;
    padding: 8px 14px;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.control-group label {
    font-weight: 600;
    color: #4a5568;
}

.speed-btn {
    padding: 10px 18px;
    font-size: 13px;
    min-width: 65px;
    background: white;
    color: #667eea;
    border: 2px solid #e2e8f0;
}

.speed-btn:hover:not(:disabled) {
    background: #edf2f7;
    border-color: #667eea;
}

.speed-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.log {
    background: #1a202c;
    padding: 15px;
    border-radius: 8px;
    max-height: 350px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}
.log-entry {
    margin: 4px 0;
    padding: 6px;
    border-left: 3px solid transparent;
    border-radius: 3px;
}
.log-debug { border-left-color: #4299e1; color: #90cdf4; }
.log-info { border-left-color: #48bb78; color: #9ae6b4; }
.log-success { border-left-color: #48bb78; color: #9ae6b4; }
.log-error { border-left-color: #f56565; color: #fc8181; }
.log-warning { border-left-color: #ed8936; color: #fbd38d; }
.timestamp { color: #718096; font-size: 11px; }

.control-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.selected-file-box {
    margin: 15px 0;
    padding: 15px;
    background: #f7fafc;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.home-button {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(37, 99, 235, 1) 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease-in-out;
}