:root {
    --accent-color: #7d187a; /* Raja */
    --background-color:#ffffff; /* Metsä */
    --background-text-color: black;
    --input-border-color:#a36828; /* Korkeuskäyrä */
    --table-border-color: var(--input-border-color);
    --button-color: #ede8e6; /* Avokallio d3c8c5 */
    --button-border-color: #ede0dd;
    --button-text-color:var(--background-text-color);
    --background-border-color: #c5bbb7;
}
* {
    font-family: 'Archivo', sans-serif; /* Apply Archivo font */
    font-size: 12px; /* Set a consistent font size for all text */
    color: var(--background-text-color)
}
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent scroll bars */
    overscroll-behavior: none; /* Prevent zooming and panning propagation to the viewport */
}
body {
    touch-action: none; /* Prevent default zooming and panning on the page */
}
#map {
    width: 100%;
    height: 100%;
    position: relative;
    touch-action: pan-x pan-y; /* Allow touch gestures for panning and zooming on the map */
}
.input-box, .custom-controls, select, input, button {
    border-radius: 5px;
    border-width: 1px;
    border-style: solid;
    padding: 7px;
}
.input-box, .custom-controls {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Add spacing between rows */
    background: var(--background-color);
    border-color: var(--background-border-color); /* Use the same border color for all elements */
    padding: 15px; /* Consistent padding */
    z-index: 1000;
    overflow: auto; /* Add scrollbars if content overflows */
    gap: 10px; /* Add spacing between elements */
}
.a4-box {
    position: absolute;
    border: 3px solid white;
    pointer-events: auto; /* Enable interaction for dragging */
    /* background: rgba(255, 255, 255, 0.5); Add a semi-transparent background for visibility */
    transition: transform 0.1s, width 0.1s, height 0.1s; /* Smooth zooming */
    cursor: move; /* Indicate draggable rectangles */
}
.a4-box.no-pointer-events {
    pointer-events: none; /* Temporarily disable pointer events */
}
.rectangle-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: white;
    color: black;
    font-weight: bold;
    padding: 2px 5px;
    border-bottom-right-radius: 10px;
    pointer-events: none; /* Prevent interaction with the badge */
}
.input-box {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 400px; /* Further increase the width to fit the orientation dropdown */
}
select {
    appearance: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    background: url("data:image/svg+xml,<svg height='10px' width='10px' viewBox='0 0 16 16' fill='%23000000' xmlns='http://www.w3.org/2000/svg'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>") no-repeat;
    background-position: calc(100% - 0.4rem) center !important;
}
.custom-controls {
    position: absolute;
    top: 10px;
    left: 450px; /* Increase spacing to avoid overlap */
    padding: 10px
}
.label-and-input {
    flex: 1;
    display: flex;
    flex-direction: column; /* Stack label and input vertically */
    gap: 5px; /* Add spacing between label and input */
}
#map-series-name-container {
    flex: 8;
}
#scale-container{
    flex: 4;
}
#size-container {
    flex: 2;
}
#margins-container {
    flex: 4;
}
.input-box table {
    width: 100%;
    border-collapse: collapse; /* Ensure borders collapse into a single line */
    border-top: 1px solid var(--table-border-color); /* Top border of the table */
    border-bottom: 1px solid var(--table-border-color); /* Bottom border of the table */
}
.input-box th {
    border-bottom: 1px solid var(--table-border-color); /* Bottom border of the header row */
    padding: 8px;
    text-align: left;
    font-weight: normal;
}
.input-box td {
    padding: 8px;
    text-align: left;
}
.input-box input[type="text"], .input-box input[type="text"], .input-box input[type="number"], .input-box select {
    width: 100%;
    border-color: var(--input-border-color); /* Use the same border color for all elements */
    box-sizing: border-box; /* Ensure inputs fit within their containers */
}
button {
    /* width: 100%; */
    color: var(--button-text-color);
    background-color: var(--button-color);
    border-color: var(--button-border-color);
    text-align: center;
}
button:disabled {
    cursor: not-allowed;
    opacity: 0.6; /* Slightly transparent for a disabled effect */
}
button .fa-spinner {
    margin-right: 5px; /* Add spacing between spinner and text */
}
.reorder-buttons {
    display: inline-flex;
    gap: 5px; /* Add spacing between buttons */
}
.reorder-buttons button {
    flex: 1;
    min-width: 30px; /* Ensure buttons are wide enough for arrows */
    padding: 5px; /* Add padding for better clickability */
    margin: 0px;
}
.reorder-buttons button:disabled {
    /* background-color: #d3d3d3; Light grey background for disabled buttons */
    color: #d5d5d5; /* Greyed-out text */
    /* border-color: #c0c0c0; Lighter border color */
    cursor: not-allowed; /* Show a not-allowed cursor */
    opacity: 0.6; /* Slightly transparent for a disabled effect */
}
.button-container {
    display: flex;
    gap: 10px; /* Add spacing between buttons */
    margin-top: 0px; /* Consistent spacing above the buttons */
}
.button-container button {
    flex: 1; /* Ensure buttons take equal space */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px; /* Add spacing between icon and text */
}
.flex-row {
    flex: 1;
    display: flex;
    align-items: center; /* Vertically align label and input */
    gap: 10px; /* Add spacing between label and input */
}
.input-with-unit {
    position: relative;
    display: inline-block;
    flex: 1;
}
.input-with-unit input {
    width: calc(100% - 30px); /* Leave space for the unit text */
    padding-right: 30px; /* Add padding to avoid overlap with the unit text */
}
.input-with-unit .unit {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    color: #aaa; /* Greyed-out text */
    font-size: 12px;
    pointer-events: none; /* Prevent interaction with the unit text */
}
.label-and-checkbox {
    flex:1;
    display: flex;
    gap: 5px; /* Add spacing between label and checkbox */
    align-items: center; /* Vertically align label and input */
}
#additional-options {
    flex-direction: row;
    gap: 10px; /* Add spacing between options */
}
#additional-options .label-and-checkbox, #additional-options button {
    flex: 1; /* Ensure all options take equal space */
}
.ol-zoom, .ol-rotate-reset {
    display: none; /* Hide default zoom controls */
}
/* Add styles for the translucent black overlay */
#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Translucent black */
    pointer-events: none; /* Prevent interaction with the overlay */
    clip-path: url(#dynamic-clip-path); /* Updated to use SVG clipPath */
    z-index: 999; /* Ensure it appears above other elements */
}