* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

.upload-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.drop-zone {
    border: 3px dashed #ddd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.drop-zone.dragover {
    border-color: #667eea;
    background: #f0f2ff;
    transform: scale(1.02);
}

.upload-icon {
    color: #667eea;
    margin-bottom: 20px;
}

.or-text {
    margin: 15px 0;
    color: #999;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.file-status {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    display: none;
}

.file-status.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.file-status.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.encoding-section {
    margin-top: 20px;
    padding: 15px;
    background: #f0f4ff;
    border-radius: 6px;
    border: 1px solid #d0d8ff;
}

.encoding-section label {
    font-weight: bold;
    margin-right: 10px;
    color: #555;
}

.encoding-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    margin-right: 10px;
    cursor: pointer;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #5a6268;
}

.encoding-info {
    margin-left: 15px;
    color: #667eea;
    font-size: 0.9rem;
    font-style: italic;
}

.main-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.controls-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.control-group h3,
.analysis-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #667eea;
}

.trace-controls {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
}

.trace-control-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.trace-control-item:hover {
    background: #f5f5f5;
}

.trace-control-item input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.trace-control-item label {
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
}

.trace-color-indicator {
    width: 20px;
    height: 3px;
    margin-left: 10px;
    border-radius: 2px;
}

.analysis-results {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
}

.analysis-item {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 4px;
    border-left: 4px solid #667eea;
}

.analysis-item strong {
    color: #555;
    font-size: 0.9rem;
}

.analysis-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
}

.charts-section {
    display: grid;
    gap: 30px;
}

.chart-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.chart-container h3 {
    margin-bottom: 15px;
    color: #667eea;
}

.chart {
    width: 100%;
    min-height: 400px;
    background: white;
    border-radius: 6px;
    padding: 10px;
}

.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-indicator p {
    color: #666;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .controls-section {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 10px;
    }
}