@use '../../style/theming';

// MARK: Variables

// MARK: Mixin
@mixin core() {
  .dbx-form-search-form {
    width: 100%;

    .mat-mdc-notch-piece.mdc-notched-outline__notch {
      width: 100%;
    }
  }

  .dbx-section-page-header-search-bar {
    width: 100%;
    display: flex;
    align-items: center;

    .dbx-forge {
      width: 100%;
    }

    // df-mat-input / mat-form-field rendering (e.g. dbx-form-search-form's text input)
    .mat-mdc-form-field > .mat-mdc-text-field-wrapper {
      padding: 0;

      > .mat-mdc-form-field-flex {
        .mdc-notched-outline__leading {
          display: none;
        }

        .mdc-floating-label.mat-mdc-floating-label {
          margin-left: -4px; // align with the input
        }

        @include theming.hide-mdc-notched-outline-border;
      }
    }

    .mat-mdc-form-field-subscript-wrapper {
      display: none;
    }

    // dbx-forge-form-field-wrapper rendering (e.g. boolean fields)
    dbx-forge-form-field-wrapper {
      > .dbx-forge-form-field-wrapper {
        margin-top: 0;

        > .dbx-forge-form-field-outline {
          .dbx-forge-form-field-outline-leading {
            display: none;
          }

          .dbx-forge-form-field-outline-leading,
          .dbx-forge-form-field-outline-notch,
          .dbx-forge-form-field-outline-trailing {
            border: 0;
          }
        }

        .dbx-forge-form-field-outline-label {
          margin-left: -4px; // align with the input
        }

        .dbx-forge-form-field-content {
          padding: 0;
        }
      }
    }
  }

  .dbx-section-page-header-search-bar-with-bottom-bar {
    // df-mat-input / mat-form-field rendering
    .mat-mdc-form-field > .mat-mdc-text-field-wrapper {
      > .mat-mdc-form-field-flex > .mdc-notched-outline {
        .mdc-notched-outline__notch,
        .mdc-notched-outline__trailing {
          border-bottom: var(--mat-form-field-outlined-outline-width, 1px) solid;
          border-radius: 0;
        }
      }

      &:hover,
      &.mdc-text-field--focused {
        > .mat-mdc-form-field-flex > .mdc-notched-outline {
          .mdc-notched-outline__notch,
          .mdc-notched-outline__trailing {
            border-bottom-width: var(--mat-form-field-outlined-focus-outline-width, 2px);
          }
        }
      }
    }

    // dbx-forge-form-field-wrapper rendering
    dbx-forge-form-field-wrapper > .dbx-forge-form-field-wrapper {
      > .dbx-forge-form-field-outline {
        .dbx-forge-form-field-outline-notch,
        .dbx-forge-form-field-outline-trailing {
          border-bottom: var(--mat-form-field-outlined-outline-width, 1px) solid;
          border-radius: 0;
        }
      }

      &:hover,
      &:focus-within {
        > .dbx-forge-form-field-outline {
          .dbx-forge-form-field-outline-notch,
          .dbx-forge-form-field-outline-trailing {
            border-bottom-width: var(--mat-form-field-outlined-focus-outline-width, 2px);
          }
        }
      }
    }
  }
}

@mixin theme($theme-config) {
}
