// stylelint-disable selector-not-notation
// stylelint-disable at-rule-empty-line-before
// stylelint-disable scss/at-extend-no-missing-placeholder
// Forms

form {
  // code here
}

input {
  &[type=text]:not(.form-control),
  &[type=password]:not(.form-control),
  &[type=number]:not(.form-control) {
    display: inline-block;
    padding: $input-padding-y $input-padding-x;
    font-family: $input-font-family;
    @include font-size($input-font-size);
    font-weight: $input-font-weight;
    line-height: $input-line-height;
    color: $input-color;
    background-color: $input-bg;
    background-clip: padding-box;
    border: $input-border-width solid $input-border-color;
    appearance: none;
    @include border-radius($input-border-radius, 0);
    @include box-shadow($input-box-shadow);
    @include transition($input-transition);

    &:focus {
      color: $input-focus-color;
      background-color: $input-focus-bg;
      border-color: $input-focus-border-color;
      outline: 0;

      @if $enable-shadows {
        @include box-shadow($input-box-shadow, $input-focus-box-shadow);
      } @else {
        box-shadow: $input-focus-box-shadow;
      }
    }

    // &::placeholder {
    //   color: $input-placeholder-color;
    //   opacity: 1;
    // }
  }

  &[type=checkbox]:not(.form-check-input),
  &[type=radio]:not(.form-check-input) {
    width: $form-check-input-width;
    height: $form-check-input-width;
    margin-top: ($line-height-base - $form-check-input-width) * .75;
    vertical-align: top;
    background-color: $form-check-input-bg;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: $form-check-input-border;
    appearance: none;
    color-adjust: exact; // Keep themed appearance for print

    &:active {
      filter: $form-check-input-active-filter;
    }

    &:focus {
      border-color: $form-check-input-focus-border;
      outline: 0;
      box-shadow: $form-check-input-focus-box-shadow;
    }

    &:checked {
      background-color: $form-check-input-checked-bg-color;
      border-color: $form-check-input-checked-border-color;
    }

    &:disabled {
      pointer-events: none;
      filter: none;
      opacity: $form-check-input-disabled-opacity;
    }
  }

  &[type=checkbox]:not(.form-check-input) {
    @include border-radius($form-check-input-border-radius);

    &:checked {
      @if $enable-gradients {
        background-image: escape-svg($form-check-input-checked-bg-image), var(--#{$variable-prefix}gradient);
      } @else {
        background-image: escape-svg($form-check-input-checked-bg-image);
      }
    }
  }

  &[type=radio]:not(.form-check-input) {
    border-radius: $form-check-radio-border-radius;

    &:checked {
      @if $enable-gradients {
        background-image: escape-svg($form-check-radio-checked-bg-image), var(--#{$variable-prefix}gradient);
      } @else {
        background-image: escape-svg($form-check-radio-checked-bg-image);
      }
    }
  }

  &[type=file] {
    // display: block;
    // width: 100%;
    display: inline-block;
    width: auto;
    padding: $input-padding-y $input-padding-x;
    font-family: $input-font-family;
    @include font-size($input-font-size);
    font-weight: $input-font-weight;
    line-height: $input-line-height;
    color: $input-color;
    background-color: $input-bg;
    background-clip: padding-box;
    border: $input-border-width solid $input-border-color;
    appearance: none; // Fix appearance for date inputs in Safari

    // Note: This has no effect on <select>s in some browsers, due to the limited stylability of `<select>`s in CSS.
    @include border-radius($input-border-radius, 0);

    @include box-shadow($input-box-shadow);
    @include transition($input-transition);

    &::file-selector-button {
      padding: $input-padding-y $input-padding-x;
      margin: (-$input-padding-y) (-$input-padding-x);
      margin-inline-end: $input-padding-x;
      color: $form-file-button-color;
      @include gradient-bg($form-file-button-bg);
      pointer-events: none;
      border-color: inherit;
      border-style: solid;
      border-width: 0;
      border-inline-end-width: $input-border-width;
      border-radius: 0;
      @include transition($btn-transition);
    }
  }

  &:hover:not(:disabled):not([readonly])::file-selector-button {
    background-color: $form-file-button-hover-bg;
    color: color-contrast($form-file-button-hover-bg);
  }
}

.form-control {
  &:hover:not(:disabled):not([readonly])::file-selector-button {
    color: color-contrast($form-file-button-hover-bg);
  }
}

select:not(.form-select) {
  @extend .form-select;
}

.form-select,
select {
  option:checked {
    color: $body-color;
    background-color: $pma-selected-bg;
  }
}

textarea {
  background-color: $input-bg;
  border: $input-border-width solid $input-border-color;

  &:focus {
    color: $input-focus-color;
    background-color: $input-focus-bg;
    border-color: $input-focus-border-color;
    outline: 0;

    @if $enable-shadows {
      @include box-shadow($input-box-shadow, $input-focus-box-shadow);
    } @else {
      // Avoid using mixin so we can pass custom focus shadow properly
      box-shadow: $input-focus-box-shadow;
    }
  }

  &.char {
    margin: 6px;
  }

  &.charField {
    width: 95%;
  }
}

fieldset {
  .group-header {
    th {
      background: $pma-fieldset-bg;
    }

    + tr th {
      padding-top: .6em;
    }
  }

  .group-field-1 th,
  .group-header-2 th {
    padding-left: 1.5em;
  }

  .group-field-2 th,
  .group-header-3 th {
    padding-left: 3em;
  }

  .group-field-3 th {
    padding-left: 4.5em;
  }

  .disabled-field {
    th, th small, td {
      color: $pma-fieldset-color;
      background-color: $pma-fieldset-bg;
    }
  }
}

// Validation error message styles
input {
  &[type=text].invalid_value,
  &[type=password].invalid_value,
  &[type=number].invalid_value,
  &[type=date].invalid_value {
    background: #fcc;
  }
}

select.invalid_value,
.invalid_value {
  background: #fcc;
}
