input[type='text'],
input[type='color'],
input[type='email'],
input[type='url'],
input[type='datetime-local'],
input[type='date'],
input[type='time'],
input[type='file'],
input[type='number'],
input[type='password'],
input[type='submit'],
input[type='button'],
input[type='reset'],
a.button,
button,
textarea,
legend {
  max-width: 100%;
  border-radius: 3px;
}

form {
  display: block;
  margin: 0;
  padding: 0;
}

fieldset {
  display: block;
  margin: 1em 0;
  padding: 1em 0.5em;
  border-width: 1px 0;
  border-style: solid;
  border-color: var(--fieldset-border);
  background: var(--fieldset-background);

  hr {
    background-color: var(--fieldset-border);
    border-width: 0;
    margin: 1em 0;
  }

  &:focus-within {
    background-color: var(--fieldset-focus-background);
  }
}

input[type='text'],
input[type='color'],
input[type='email'],
input[type='url'],
input[type='datetime-local'],
input[type='date'],
input[type='time'],
input[type='file'],
input[type='number'],
textarea {
  font-family: var(--sans-serif-input);
  font-size: 100%;
}

legend {
  padding: 0.2em 0.6em;
  border-width: 1px;
  border-style: solid;
  border-color: var(--legend-border);
  background: var(--legend-background);
  margin-bottom: 0.5em;
}

label .maximal,
textarea.maximal,
input.maximal,
select.maximal {
  width: 100%;
}

input[type='text'],
input[type='password'],
input[type='color'],
input[type='email'],
input[type='url'],
input[type='datetime-local'],
input[type='date'],
input[type='time'],
input[type='file'],
input[type='number'],
textarea,
input:not([type='file']):invalid,
input:not([type='file']):invalid:placeholder-shown {
  // color: $input-color;
  // background: $input-background;
  box-shadow: 1px 1px 2px var(--input-shadow) inset;
  padding: 3px;
  border-width: 1px;
  border-style: solid;
  border-color: var(--input-border);
}

select {
  max-width: 100%;
  // color: $input-color;
  box-shadow: 1px 1px 2px var(--input-shadow) inset;
  padding: 3px;
  vertical-align: top;
}

// Special for invalid but not required fields
input:invalid:not(:required),
textarea:invalid:not(:required),
select:invalid:not(:required),
input:not([type='file']):invalid:not(:focus):not(:required) {
  color: var(--invalid-input-color);
  box-shadow: 0 0 0 3px var(--invalid-input-shadow);
}

input:invalid:not(:required),
textarea:invalid:not(:required),
input:not([type='file']):invalid:not(:focus):not(:required) {
  border: 1px solid var(--invalid-input-border);
  background: var(--invalid-input-background);
}

input:focus,
textarea:focus {
  border-color: var(--input-focus);
}

textarea {
  padding: 2px 0;

  &.maximal {
    resize: vertical;
  }

  .area & {
    display: block;
    width: 100%;
    resize: vertical;
  }
}

select {
  padding: 2px 0;
  vertical-align: middle;
}

@supports (-webkit-hyphens: none) {
  /* Safari 9+ only (https://browserstrangeness.bitbucket.io/css_hacks.html#webkit) */
  select {
    font-size: initial;
  }
}

select.l10n option {
  padding-left: 16px;
}

option.avail10n {
  background: url(../images/check-on.png) no-repeat 0 50%;
  background-color: transparent;
}

input[type='text'],
input[type='color'],
input[type='email'],
input[type='url'],
input[type='datetime-local'],
input[type='date'],
input[type='time'],
input[type='number'],
input[type='password'],
textarea {
  margin-right: 0.3em;
}

input[type='checkbox'],
input[type='radio'],
input[type='file'] {
  border: none;
  margin: -0.235ex 0.33em 0 0; // margin-top: -.235ex see https://www.matthecat.com/aligner-icone-et-texte.html
  padding: 0;
  // background: transparent;
}

input + input[type='checkbox'] {
  // Used for js expand/hide (lists, options, ...)
  margin-left: 0.33em;
}

a input {
  // Used for js expand/hide (lists, options, ...)
  margin-right: 0.33em;
}

input[type='file'] {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
}

input[type='color'] {
  width: 4em;
  height: 3em;
}

optgroup {
  font-weight: bold;
  font-style: normal;
}

option {
  font-weight: normal;
}

label,
label span {
  display: block;
}

label.ib,
input.ib {
  display: inline-block;
}

label.classic {
  display: inline;
}

label.classic input,
label span input,
label.classic select,
label span select {
  display: inline;
}

label.required {
  font-weight: bold;
}

label.required abbr {
  color: var(--required);
  font-size: 1.3em;
  text-decoration: none;
}

label.bold {
  text-transform: uppercase;
  font-weight: bold;
  margin-top: 2em;
}

label.area,
p.area,
div.area {
  width: inherit !important;
}

div.area {
  margin-bottom: 1em;
}

p.field {
  position: relative;

  label {
    display: inline-block;
    width: 14em;
  }

  &.wide label {
    width: 21em;
  }

  input,
  select {
    display: inline-block;
  }
}

.form-note,
.form-stats {
  font-style: italic;
  font-weight: normal;
  color: var(--form-note-color);
}

p.form-note,
p.form-stats {
  margin-top: -0.7em;
}

span.form-note,
span.form-stats {
  text-transform: none;
}

.missing {
  background-color: inherit;
  animation-name: kf-missing;
  animation-duration: 1s;
}

@keyframes kf-missing {
  50% {
    background-color: var(--error-background);
  }
}

.focus {
  background-color: inherit;
  animation-name: kf-focus;
  animation-duration: 1s;
}

@keyframes kf-focus {
  50% {
    background-color: var(--input-focus);
  }
}

// .more-info Additional information on fieldset, field, … (may be hide from user-prefs)
.no-more-info {
  display: none !important;
}
