form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.label {
    text-align: left;
    font-size: 0.8em;
    margin-left: 1px;
    font-weight: bold;
    letter-spacing: 2px;
}

.field-wrapper {
    flex: 1 1 0;
    justify-content: flex-end;
    width: fit-content;
    max-width: 100%;
    margin-top: 5px;
    margin-bottom: 5px;
    display: flex;
    flex-direction: column;
    gap: 0em; /* space between label and field */
}

/* CHECKBOX */

.checkbox-wrapper {
    display: flex;
    flex-direction: row; /* force side-by-side layout */
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 0.5em; /* optional spacing between box and label */
}

.checkbox-input {
    display: none;
}

.error_field {
    border: 1px solid #bb3311;
}

.checkbox-box {
    width: 23px;
    height: 23px;
    border: 2px solid #aaa;
    border-radius: 3px;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s;
    display: inline-block;
}

/* Add tick when checked */
.checkbox-input:checked ~ .checkbox-box::after {
    content: '✓';
    color: white;
    font-size: 25px;
    position: absolute;
    top: 55%;
    left: 57%;
    transform: translate(-50%, -50%);
}

/* Optional styling when checked */
.checkbox-input:checked ~ .checkbox-box {
    background-color: #64a749;
    border-color: #64a749;
}

/* Focus ring */
.checkbox-input:focus ~ .checkbox-box {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.checkbox-label {
    font-size: 0.9em;
}


/* DATE */

input[type="date"] {
    padding: 0.3em 0.5em;
    line-height: 1.2em;
    font-size: 1em;
    text-align: center;
    width: fit-content;
    max-width: 200px;
}


    input, select, textarea {
        font-family: 'Nunito', sans-serif;
        font-size: 1em;
        display: block;
        letter-spacing: 0.1em;
        color: #343434;
        line-height: 1.3;
        padding: 0;
        padding-left: 0.8em;
        padding-right: 0.8em;
        max-height: 30px;
        min-height: 40px;
        width: fit-content;
        height: 30px;
        min-width: 50px;
        max-width: 100%;
        box-sizing: border-box;
        margin: 0;
        margin-bottom: 3px;
        border-radius: 5px;
        -moz-appearance: none;
        -webkit-appearance: none;
        appearance: none;
        background-color: #fff;
        outline: none;
        border: 1px solid #a0a0a0;
        -webkit-box-shadow: 0 6px 10px -10px rgba(0,0,0,0.4);
        -moz-box-shadow: 0 6px 10px -10px rgba(0,0,0,0.4);
        box-shadow: 0 6px 10px -10px rgba(0,0,0,0.4);
        margin-bottom: 5px;
    }

    select[multiple] {
        min-height: 120px;
        height: auto;
        background-image: none; /* Remove dropdown arrow for multiple */
    }


    .checkbox-box:disabled,
    input:disabled,
    textarea:disabled,
    select:disabled,
    button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    .checkbox-wrapper input:disabled ~ .checkbox-label {
        opacity: 0.5;
        cursor: not-allowed;
    }


    textarea {
        min-height: 100px;
        padding: 0.4em;
        line-height: 1.5em;
    }

    input:hover, select:hover, textarea:hover {
        filter: brightness(110%);
    }

    input:focus, select:focus, textarea:focus {
        filter: brightness(120%);
    }

    input::-webkit-outer-spin-button,
    input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    input[type=number] {
        -moz-appearance: textfield;
    }


select {
    font-family: 'Nunito', sans-serif;
    outline: none;
    border: 1px solid #a0a0a0;
    box-sizing: border-box;
    border-radius: 5px;
    letter-spacing: 0.1em;
    color: #535252;
    padding: 0;
    padding-top: 2px;
    padding-left: 0.8em;
    padding-right: 0.8em;
    line-height: 1.3;
    width: 100%;
    max-height: 40px;
    min-height: 40px;
    max-width: 100%;
    padding-right: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    background-image:
            linear-gradient(45deg, transparent 50%, #7e7e7e 50%),
            linear-gradient(135deg, #7e7e7e 50%, transparent 50%),
            linear-gradient(to right, transparent, transparent);
    background-position:
            calc(100% - 20px) calc(0.9em - 2px),
            calc(100% - 10px) calc(0.9em - 2px),
            100% 0;
    background-size:
            10px 10px,
            10px 10px,
            2.5em 2.5em;
    background-repeat: no-repeat;
    -webkit-box-shadow: 0 6px 10px -10px rgba(0,0,0,0.4);
    -moz-box-shadow: 0 6px 10px -10px rgba(0,0,0,0.4);
    box-shadow: 0 6px 10px -10px rgba(0,0,0,0.4);
}

select:hover {
    cursor: pointer;
}


    button, .button, a.button {
        font-family: 'Nunito', sans-serif;
        display: flex;
        align-items: center;
        justify-content: center;
        width: fit-content;
        height: 40px;
        margin: 0;
        letter-spacing: 2px;
        font-size: 1em;
        background-color: #5b5b5b;
        border: none;
        border-radius: 5px;
        color: #ffffff;
        padding-left: 20px;
        padding-right: 20px;
        padding-top: 10px;
        padding-bottom: 10px;
        cursor: pointer;
        font-weight: bold;
    }

    button.link {
        all: unset; /* clean slate */
        color: #3a57a7;
        text-decoration: none;
        cursor: pointer;
        font: inherit;
    }

    button.link:hover {
        filter: brightness(120%);
    }

    button.shadow {
        -webkit-box-shadow: 0 6px 10px -10px rgba(0,0,0,1);
        -moz-box-shadow: 0 6px 10px -10px rgba(0,0,0,1);
        box-shadow: 0 6px 10px -10px rgba(0,0,0,1);
    }

    button:hover, .button:hover {
        filter: brightness(120%);
    }

    .blue {
        background-color: #4960a7;
    }

    .dark_blue {
        background-color: #36477c;
    }

    .light_blue {
        background-color: #6d81be;
    }

    button.dark_red, .button.dark_red {
        background-color: #7c3640;
    }

    button.green, .button.green {
        background-color: #64a749;
    }

    button.red, .button.red {
        background-color: #a74949;
    }

    button.purple, .button.purple {
        background-color: #724588;
    }

    button.light_grey, .button.light_grey {
        background-color: #848484;
    }

    button.dark_grey, .button.dark_grey {
        background-color: #464646;
    }

    button.deselected_grey, .button.deselected_grey {
        background-color: #b7b7b7;
    }

    button.small {
        font-size: 1em;
        height: 40px;
    }

    .board_colour {
        margin: 5px;
        border: 1px solid black;
    }

    .board_colour_W {
        background-color: white;
    }

    .board_colour_B {
        background-color: black;
    }

    .colour_W {
        color: red;
    }

    .coulour_B {
        color: black;
    }