/*
  Forms and form elements
*/

.formContainer {
  width: 100%;
  max-width: 1300px;
}

@media screen and (max-width: 800px) {
  .formContainer {
    max-width: unset;
  }
}

fieldset {
  border: 1px solid var(--form-fieldset-border);
  margin: 20px 0;
}

legend {
  padding: 0 5px;
}

/* editForms are used for creating and editing users, group, devices,
   schools, and so on */
.editForm {
  width: 100%;
  color: var(--form-fore);
}

/* Labels for checkboxes/radio buttons */
.editForm label {
  font-weight: normal;
  font-size: 120%;
  line-height: 2;
}

.editForm select {
  padding: 5px;
  width: 100%;
  border: 1px solid var(--form-element-border);
}

.editForm textarea {
  width: 100%;
}

/* Embedded tables */
.editForm td, th {
  padding: 10px;
}

.editForm th label {
  /* Row labels */
  font-size: 110%;
  font-weight: bold;
  word-wrap: none;
  color: var(--form-label-fore);
  padding: 0;
  margin: 0;
}

.editForm tr:nth-child(odd) {
  background: var(--form-odd-back);
}

.editForm tr:nth-child(even) {
  background: var(--form-even-back);
}

.editForm th {
  text-align: right;
  width: 250px;
}

.editForm .buttonRow th,
.editForm .buttonRow td {
  background: var(--form-button-row-back) !important;
  text-align: center;
}

.editForm input[type="text"],
.editForm input[type="password"] {
  width: 100%;
  padding: 10px;
  margin: 5px 0;

  background: #fff;
  border: 1px solid var(--form-element-border);
  color: #000;
}

  /* Used in user edit forms when listing verified addresses. */
.editForm input[type="text"]:read-only {
  background: #f4f4f4;
  border: 1px solid var(--form-element-border);
  color: #888;
}

.editForm textarea {
  border: 1px solid var(--form-element-border);
}

.editForm input[type="checkbox"],
.editForm input[type="radio"] {
  padding: 0;
  margin: 0 5px 0 0;    /* push labels away from the input box */
}

@media screen and (max-width: 800px) {
  .editForm input[type="checkbox"],
  .editForm input[type="radio"] {
    /* The label gets collapsed, so push the element away from the
       element above it. */
    margin: 10px;
  }
}

/* Submit and cancel buttons */
.editForm input[type="submit"] {
  /*font-size: 120%;*/
  height: 40px;
  width: 150px;
  max-width: 300px;
}

.editForm .cancel {
  display: inline;
  /*font-size: 100%;
  margin: 0;
  padding: 0;*/
  width: 100px;
  margin-left: 30px;
}

input[type="submit"] {
  cursor: pointer;
}

input[type="submit"]:hover {
}

/* The "* = required" label displayed at the top of forms */
.requiredTitle {
  color: var(--form-error-fore);
  font-style: italic;
}

/* Requird fields */
.requiredField {
}

.requiredField .field_with_errors {
  display: inline-block;
}

.requiredField:after {
  content: " *";
  font-size: 120%;
  color: var(--form-error-fore);
}

.field_error {
  color: var(--form-error-fore);
  display: block;
}

/* Fields with invalid/missing values */
.editForm .label_error {
  color: var(--form-error-fore);
}

/* The small label below the field explaining what's wrong with the current value.
   This class name cannot be changed, it comes from Rails' ActionView. */
.field_with_errors {
  color: var(--form-label-fore);
}

.field_with_errors input, .field_with_errors select {
  border: 1px solid var(--form-error-fore);
}

/* Groups list on user create/edit pages */
.groupsFilter input[type="search"] {
  background: url("/images/magnifier.png") no-repeat scroll 5px center #fff;
  text-indent: 2em;
  border: 1px solid var(--form-element-border);
  padding: 5px;
  width: 50%;
}

.groupsList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-x: clip;
  overflow-y: auto;
  resize: vertical;
}

.groupsList .noMatches {
  font-size: 110%;
  font-style: italic;
}

/* Printer permissions group filter */
.invalidRegexp {
  border: 2px solid var(--form-error-fore);
}

@media screen and (max-width: 800px) {
  /* Turn form tables into what looks like lists of table rows, just like
     non-form tables of things. */
  .editForm {
    padding: 0;
  }

  .editForm table,
  .editForm tbody {
    display: block;
  }

  .editForm tr {
    display: block;
    position: relative;
    padding: 5px 10px;
  }

  .editForm th {
    text-align: left;
    width: auto;
    padding: 0;
  }

  .editForm .buttonRow {
    background: var(--form-button-row-back) !important;
  }

  .editForm td {
    display: block;
    text-align: left;
    padding: 0;
  }
}
