@charset "UTF-8";

form {
    margin-bottom: 2.5em;
}

/* Form errors */
.form-errors {
    color: red;
    list-style: none;
    padding: 0px;
    margin: 8px 0px;
    font-size: 0.875rem;
}

.form-errors li {
    margin: 0;
}

/* Form row layout - mobile first */
form .form-row {
    display: flex;
    flex-direction: column;
}

form .form-row+.form-row {
    margin-top: 16px;
}

/* Form field wrapper for label + input */
form .form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Inputs take full width by default */
form .form-row input,
form .form-row select,
form .form-row textarea {
    width: 100%;
    min-width: fit-content;
    max-width: 280px;
    box-sizing: border-box;
}

/* Checkboxes: keep input and label inline */
form .field-checkbox .form-field {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

form .field-checkbox input {
    width: auto;
}

/* Tablet and up: side-by-side layout for label + input */
@media (min-width: 768px) {

    /* Standard fields get two-column layout */
    form .form-row:not(.field-checkbox):not(.field-textarea) .form-field {
        flex-direction: row;
        align-items: baseline;
        gap: 1rem;
    }

    form .form-row:not(.field-checkbox):not(.field-textarea) .form-field input,
    form .form-row:not(.field-checkbox):not(.field-textarea) .form-field select {
        flex: 1;
        max-width: unset;
    }

    /* Errors and help text always span full width */
    form .form-errors,
    form .help-text {
        width: 100%;
    }
}

/* Custom toggle switch for checkbox fields (CheckboxType and expanded EnumType/ChoiceType) */
form .toggle-checkbox.field-checkbox input[type="checkbox"],
form .toggle-checkbox.field-choice .choice-list input[type="checkbox"],
form .toggle-checkbox.field-enum .choice-list input[type="checkbox"] {
    display: none;
}

form .toggle-checkbox.field-checkbox label,
form .toggle-checkbox.field-choice .choice-list label,
form .toggle-checkbox.field-enum .choice-list label {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.125em 0 0.125em 3em;
}

/* Create the toggle background track */
form .toggle-checkbox.field-checkbox label::before,
form .toggle-checkbox.field-choice .choice-list label::before,
form .toggle-checkbox.field-enum .choice-list label::before {
    content: "";
    position: absolute;
    left: 0;
    width: 2.5em;
    height: 1.25em;
    background-color: var(--light-gray);
    border-radius: 1.25em;
    transition: background-color 0.2s;
}

/* Create the toggle knob */
form .toggle-checkbox.field-checkbox label::after,
form .toggle-checkbox.field-choice .choice-list label::after,
form .toggle-checkbox.field-enum .choice-list label::after {
    content: "";
    position: absolute;
    left: 0.125em;
    width: 1em;
    height: 1em;
    background-color: var(--white);
    border-radius: 50%;
    transition: transform 0.2s;
}

form .toggle-checkbox.field-checkbox input[type="checkbox"]:checked+label::before,
form .toggle-checkbox.field-choice .choice-list input[type="checkbox"]:checked+label::before,
form .toggle-checkbox.field-enum .choice-list input[type="checkbox"]:checked+label::before {
    background-color: var(--pallet-green);
}

form .toggle-checkbox.field-checkbox input[type="checkbox"]:checked+label::after,
form .toggle-checkbox.field-choice .choice-list input[type="checkbox"]:checked+label::after,
form .toggle-checkbox.field-enum .choice-list input[type="checkbox"]:checked+label::after {
    transform: translateX(1.25em);
}

form .toggle-checkbox ul.choice-list {
    list-style: none;
    margin: 0;
}

/* Form sections */
.form-section {
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.form-section legend {
    font-weight: 600;
    color: #495057;
    padding: 0 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

form .help-text {
    display: block;
    margin-top: 4px;
    color: var(--gray);
    font-size: 0.875rem;
}

/* Readonly/disabled input styles */
form input[readonly],
form input[disabled],
form textarea[readonly],
form textarea[disabled],
form select[readonly],
form select[disabled] {
    cursor: not-allowed;
    opacity: 0.7;
}

form input[readonly]:focus,
form textarea[readonly]:focus,
form select[readonly]:focus {
    outline: none;
    box-shadow: none;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

/* Form containers */
.edit-form-container,
.configuration-form-container,
.schedule-form-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.configuration-form-container {
    max-width: 900px;
}

.edit-form-container {
    max-width: 800px;
}

.schedule-form-container {
    max-width: 1200px;
}

.password-form-container {
    max-width: 500px;
}

button,
input[type="submit"] {
    background: var(--pallet-pink);
    color: var(--white);
    border: none;
    border-radius: 999px;
    padding: 12px 28px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover,
input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(255, 128, 128, 0.4);
}