body {
    font-family: sans-serif;
    display: flex;
    align-items: flex-start; /* Align items to the top */
    background-color: #f0f2f5;
    min-height: 100vh;
    margin: 0;
}

.main-container {
    display: flex;
    gap: 20px;
    width: 100%;
}

.container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 50%;
    max-width: 600px;
}

#preview-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 50%;
    display: flex;
    flex-direction: column; /* Arrange canvas and controls vertically */
    align-items: center;
    gap: 15px; /* Space between canvas and controls */
}

#preview-canvas {
    max-width: 100%;
    height: auto; /* Maintain aspect ratio */
    max-height: 75vh;
    border-radius: 5px;
    border: 1px solid #ddd;
}

#zoom-controls {
    display: flex;
    gap: 10px;
}

#zoom-controls button {
    width: 36px;
    height: 36px;
    font-size: 1.0em;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

/* Custom Upload Button Style */
#upload-label {
    display: inline-block;
    width: auto; /* Let the content define the width */
    padding: 12px;
    background-color: #dc3545; /* Red */
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    text-align: center;
    cursor: pointer;
    margin-bottom: 10px; /* Add some space below */
    transition: background-color 0.3s ease;
}

#upload-label:hover {
    background-color: #c82333; /* Darker Red */
}

#extract-button {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#extract-button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

button:disabled:hover {
    background-color: #ccc;
}

#results-container {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.result-item:hover {
    background-color: #f9f9f9;
}

.result-item span {
    flex-grow: 1;
    margin-right: 10px;
    color: #333;
    font-size: 0.95em;
}

.result-item input {
    flex-grow: 2;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-right: 10px;
}

.result-item button {
    padding: 8px 12px;
    font-size: 0.9em;
    width: auto;
}

#save-all-button {
    margin-top: 20px;
    background-color: #28a745;
}

#save-all-button:hover {
    background-color: #218838;
}

.hidden {
    display: none;
}

@media (max-width: 900px) {
    .main-container {
        flex-direction: column;
        align-items: center;
    }
    .container, #preview-container {
        width: 100%;
        max-width: 600px;
    }
    #preview-container {
        margin-top: 20px;
    }
}
