body {
    font-family: sans-serif;
    line-height: 1.6;
    padding: 20px;
    background-color: #f4f4f4;
}

h1, h2 {
    text-align: center;
    color: #333;
}

.container {
    display: flex;
    gap: 30px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.image-section, .controls-section {
    flex: 1; /* Each section takes up half the space */
    min-width: 350px; /* Minimum width before wrapping */
}

.image-section h2, .controls-section h2 {
    text-align: left;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 15px;
}

#imageInput {
    display: block;
    margin-bottom: 10px;
}

#originalDimensions {
    font-weight: bold;
    color: #555;
    font-size: 0.9em;
     display: block; /* Ensure it takes its own line */
     margin-bottom: 15px;
}

.image-container {
    width: 100%;
    max-height: 450px; /* Adjust as needed */
    background-color: #eee;
    margin-bottom: 15px;
     
	display: block;
    /* align-items: center;
    justify-content: center; */
    border: 1px solid #ccc;
    position: relative; /* For instructions */
    overflow: auto; /* Contain the image */
}

.image-container > div {
    /* This might not be strictly necessary depending on browser */
    /* but ensures the container Cropper attaches to is sized */
    height: 600px;
	width: 100%
    display: flex; /* Helps center image initially if smaller */
    align-items: flex-start; /* Align tall images to the top */
    justify-content: center;
}

/* Cropper.js needs the img to be block and max-width */
#preview-image {
    display: block;
    max-height: none;
    /* Cropper.js will handle visibility */
    opacity: 0;
}
.cropper-hidden {
    opacity: 1 !important; /* Make sure Cropper shows it */
}

.instructions {
    text-align: center;
    color: #666;
    padding: 10px;
}

.controls-section .instructions {
     font-size: 0.9em;
     margin-bottom: 10px;
}


#crop-definitions {
    margin-bottom: 15px;
    max-height: 300px; /* Scroll if many definitions */
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: #f9f9f9;
}

.crop-definition-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
    padding: 8px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    flex-wrap: wrap; /* Wrap inputs on small widths */
    cursor: pointer; /* Indicate it's clickable */
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.crop-definition-row:hover {
    background-color: #f0f8ff; /* Light blue on hover */
}

/* Style for the currently active row */
.crop-definition-row.active-definition {
    background-color: #e7f4ff;
    border-color: #90caf9;
    box-shadow: 0 0 3px rgba(33, 150, 243, 0.5);
}


.crop-definition-row label {
    font-size: 0.9em;
    min-width: 15px; /* Align labels somewhat */
    text-align: right;
}

.crop-definition-row input[type="number"] {
    width: 60px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.9em;
}

.crop-definition-row button.remove-def-btn {
    padding: 3px 8px;
    font-size: 0.8em;
    cursor: pointer;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 3px;
    margin-left: auto; /* Push remove button to the right */
}
.crop-definition-row button.remove-def-btn:hover {
    background-color: #d32f2f;
}


button {
    padding: 10px 15px;
    font-size: 1em;
    cursor: pointer;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    margin-right: 10px;
    transition: background-color 0.2s ease;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

button:not(:disabled):hover {
    background-color: #45a049;
}

#loading-message {
    color: #007bff;
    font-weight: bold;
}

/* Ensure Cropper elements are visible */
.cropper-container {
    direction: ltr;
    font-size: 0;
    line-height: 0;
    position: relative;
    -ms-touch-action: none;
    touch-action: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}