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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #333;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 15px;
    height: 100vh;
    overflow: hidden;
}


.file-input {
    display: none;
}

.file-label {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background-color: #3498db;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    border: none;
    text-align: center;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.file-label:hover {
    background-color: #2980b9;
}

.file-label span {
    pointer-events: none;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 15px;
    height: calc(100vh - 30px);
    align-items: start;
}

.canvas-container {
    position: relative;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mainCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    cursor: crosshair;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    font-size: 1.1rem;
}

.controls-panel {
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.control-group {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}


.patch-info {
    background: #f8f9fa;
    padding: 8px;
    border-radius: 3px;
    margin-bottom: 10px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #666;
}

.slider-group {
    margin-bottom: 10px;
}

.slider-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.threshold-note {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
    font-style: italic;
}

.color-legend {
    background: #f0f0f0;
    padding: 8px;
    border-radius: 3px;
    margin-top: 8px;
    text-align: center;
}

.color-legend small {
    color: #666;
    font-size: 0.75rem;
}

.progress-container {
    margin: 12px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #27ae60);
    width: 0%;
    transition: width 0.2s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    font-family: monospace;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
    font-weight: 500;
    color: #555;
}

.results-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 3px;
    margin-bottom: 10px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-item .label {
    font-weight: 500;
    color: #555;
}

.result-item span:last-child {
    font-family: monospace;
    font-weight: 600;
    color: #2c3e50;
}

.btn {
    width: 100%;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 6px;
}

.btn:last-child {
    margin-bottom: 0;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #27ae60;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #219a52;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #7f8c8d;
}



.selection-rectangle {
    position: absolute;
    border: 2px dashed #3498db;
    background: rgba(52, 152, 219, 0.1);
    pointer-events: none;
    z-index: 10;
}

.match-highlight {
    position: absolute;
    border: 2px solid;
    pointer-events: none;
    z-index: 5;
}

.match-high {
    border-color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.2);
}

.match-medium {
    border-color: #f39c12;
    background-color: rgba(243, 156, 18, 0.2);
}

.match-low {
    border-color: #f1c40f;
    background-color: rgba(241, 196, 15, 0.2);
}
