/* Copyright (c) Fortanix, Inc.
|* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
|* the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */

@use '../../../styling/defs.scss' as bk;

@layer baklava.components {
  .bk-search-input {
    @include bk.component-base(bk-search-input);
    position: relative;
    display: flex;
    flex: 1;
    border-block-end: 1px solid bk.$theme-form-rule-default;

    .bk-search-input__input{
      border: none;
      inline-size: 100%;
      input {
        background-color: transparent;
        border: none;
      }
    }

    .bk-search-input__search-icon,
    .bk-search-input__search-key {
      margin-inline-end: bk.$spacing-1;
    }


    .bk-search-input__search-key {
      flex: 1 0 auto;
    }
  }
  
  .bk-search-input--invalid {
    border-block-end: 1px solid bk.$theme-form-rule-error;
  }
  
  .bk-search-input--active {
    border-block-end: 1px solid bk.$theme-form-rule-focused;
  }

  .bk-multi-search__filters {
    display: flex;
    margin-block-start: bk.$spacing-3;

    .bk-multi-search__filters-wrapper {
      display: flex;
      flex-wrap: wrap;
      gap: bk.$spacing-3;

      .bk-multi-search__filter {
        .filter-operand {
          margin-inline-start: bk.$spacing-1;
        }

        .filter-value {
          margin-inline-start: bk.$spacing-1;
          font-weight: bk.$font-weight-semibold;
        }
      }
    }

    .bk-multi-search__filter-actions {
      margin-inline-start: auto;
      flex-shrink: 0;
      padding-inline-start: bk.$spacing-3;
      
      .clear-all {
        color: bk.$theme-text-link-default;

        &:hover {
          cursor: pointer;
          text-decoration: underline;
        }
      }
    }
  }

  .bk-multi-search__operators {
    .operator {
      display: flex;
      justify-content: center;
    }
  }

  .bk-multi-search__alternatives {
    .bk-multi-search__alternatives-group {
      padding: bk.$spacing-3;
      
      .bk-multi-search__alternatives-group__content {
        flex-wrap: nowrap;
      }
    }

    .bk-multi-search__alternatives-action {
      padding-block-start: bk.$spacing-3;
      display: flex;
      justify-content: center;
    }
  }

  .bk-multi-search__date-time {
    .bk-multi-search__date-time-group {
      .bk-multi-search__date-time-label {
        margin-block-end: bk.$spacing-2;
        font-weight: bk.$font-weight-semibold;
      }

      padding: bk.$spacing-3;
    }

    .bk-multi-search__date-time-action {
      padding-block-start: bk.$spacing-3;
      display: flex;
      justify-content: center;
    }
  }


  .bk-multi-search__suggested-keys {
    .bk-multi-search__suggested-key-input {
      padding: bk.$spacing-1 bk.$spacing-3;
    }
  }

  .bk-multi-search__error-msg,
  .bk-multi-search__dropdown-error-msg {
    padding-block-start: bk.$spacing-3;
    color: bk.$theme-form-text-error-message;
    max-inline-size: calc(bk.$spacing-8 * 10);
    display: block;
  }

  .bk-multi-search__dropdown-error-msg {
    padding: bk.$spacing-3;
  }
}
