@use "../../../styles/variables" as vars;
@use "../../../styles/fonts" as fonts;
@use "../../../styles/colors" as colors;
@use "../../../styles/shadows" as shadows;

.online-board-filter {
  section.frame {
    background-color: colors.$blue-extra-light;
  }

  .p-accordion {
    .p-accordion-tab {
      .p-accordion-header {
        border-radius: 0;
        margin: 0;

        a {
          background-color: transparent;
          border: none;
          color: colors.$blue;
          border-radius: 0;
          padding: 0 vars.$space-l 0 vars.$space-xl;
          height: vars.$button-height;
          display: flex;
          align-items: center;
          font-weight: fonts.$font-bold;
          cursor: pointer;
          text-decoration: none;

          .p-header {
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;
          }
        }

        &.p-highlight {
          a {
            background-color: colors.$white;
            border: none;
            color: colors.$text-color;
          }

          border-bottom: none;
        }
      }

      .p-accordion-content {
        border-bottom: 1px solid colors.$border;
        @include shadows.box-shadow-small;
        padding: vars.$space-s vars.$space-xl vars.$space-xl vars.$space-xl;
      }

      &:first-child {
        .p-accordion-header {
          a {
            border-radius: 3px 3px 0 0;
          }
        }
      }

      &:not(:last-child) {
        .p-accordion-header {
          border-bottom: 1px solid colors.$border;
        }
      }

      &:last-child {
        .p-accordion-content {
          border-radius: 0 0 3px 3px;
          border: none;
        }
      }
    }
  }

  .label--filter {
    display: block;
    margin-right: vars.$space-xl;
    @include fonts.font-overflow();
    @include fonts.font-small(colors.$gray);
    margin-bottom: vars.$label-margin-bottom;
  }

  .number-input-composite {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    position: relative;

    .prefix {
      display: flex;
      align-items: center;
      flex-shrink: 0;
      @include shadows.control-border-shadow();
      height: vars.$standard-button-height;
      padding: 0 vars.$space-l;
      font-size: fonts.$font-size-l;
      font-weight: fonts.$font-regular;
      color: colors.$gray;
      transition-duration: 0.2s;
      @include fonts.font-overflow();
      border-right: none;
      border-radius: vars.$border-radius 0 0 vars.$border-radius;
    }

    .button-clear {
      // !important needed to override PrimeNG global button resets
      display: flex !important;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      min-width: 32px !important;
      width: 32px !important;
      height: vars.$standard-button-height !important;
      border: 1px solid colors.$border-input;
      border-left: none;
      border-radius: 0 vars.$border-radius vars.$border-radius 0;
      background: colors.$white;
      color: colors.$light-gray;
      font-size: 18px;
      line-height: vars.$standard-button-height;
      cursor: pointer;
      padding: 0;
      overflow: visible !important;

      &:hover {
        color: colors.$text-color;
      }
    }

    &.has-error {
      .prefix,
      .input--flight-number {
        border-color: colors.$red;
      }
    }
  }

  .validation-tooltip {
    background-color: colors.$red;
    color: colors.$white;
    padding: vars.$space-s vars.$space-m;
    border-radius: vars.$border-radius;
    font-size: fonts.$font-size-s;
    margin-bottom: vars.$space-s;
    position: relative;
  }

  .change-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;

    .button-change {
      margin-top: vars.$space-m;
      margin-bottom: -(vars.$space-m);
      display: flex;
      align-items: center;
      justify-content: center;
      height: vars.$medium-button-height;
      width: 35px;
      background-color: colors.$white;
      border: none;
      box-shadow: none;
      cursor: pointer;

      &:hover {
        background-color: colors.$white;
      }

      .svg--change-city {
        width: 25px;
        height: 12px;
        fill: colors.$blue;
        transform: rotate(90deg);
      }
    }
  }

  .wrapper--time-selector {
    margin-top: vars.$space-xl;

    .time-selector__label {
      font-size: fonts.$font-size-s;
      color: colors.$gray;
      margin-bottom: vars.$space-s;
    }

    .time-selector {
      padding: 0 vars.$space-s;
    }

    .time-selector__value {
      font-size: fonts.$font-size-s;
      color: colors.$gray;
      margin-top: vars.$space-s;
      text-align: right;
    }

    &.compact-view {
      display: flex;
      flex-direction: column;
      gap: 6px;

      .time-selector__label-value {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
      }

      .time-selector__label {
        color: #333;
        font-size: 12px;
        font-weight: 700;
        margin-bottom: 0;
      }

      .time-selector__value {
        color: #8a8a8a;
        font-size: 12px;
        margin-top: 0;
        text-align: left;
      }
    }
  }

  .input {
    &--filter {
      display: flex;
      align-items: center;
      @include shadows.control-border-shadow();
      height: vars.$standard-button-height;
      padding: 0 vars.$space-l;
      padding-left: vars.$space-m !important;
      font-size: fonts.$font-size-l;
      font-weight: fonts.$font-regular;
      color: colors.$text-color;
      width: 100%;
      transition-duration: 0.2s;
      @include fonts.font-overflow();

      &:enabled:hover:not(.p-state-error) {
        border-color: colors.$blue-light;
      }

      &:enabled:focus:not(.p-state-error) {
        box-shadow: 0 0 0 0.2em colors.$focus-shadow;
        border-color: colors.$blue-light;
      }
    }

    &--flight-number {
      display: block !important;
      border-left: 1px dotted colors.$border-input;
      border-radius: 0;
      width: auto !important;
      flex: 1 1 0 !important;
      min-width: 0 !important;
    }

    &--calendar {
      padding-right: 32px;
      background-image: url('/assets/img/calendar.svg');
      background-repeat: no-repeat;
      background-size: 16px 16px;
      background-position: right 8px center;
      cursor: pointer;
    }
  }

  .calendar {
    margin-top: vars.$space-xl;
  }

  .filter-content {
    // container for form fields inside accordion content
  }

  .filter-button {
    margin-top: 0;
  }

  .search-button {
    margin-top: vars.$space-xl;
    width: 100%;
    height: vars.$standard-button-height;
    background-color: colors.$blue-light;
    color: colors.$white;
    border: none;
    border-radius: vars.$border-radius;
    cursor: pointer;
    transition-duration: 0.2s;

    &:hover {
      background-color: colors.$blue-light--hover;
    }

    span {
      font-weight: fonts.$font-bold;
      font-size: fonts.$font-size-m;
      color: colors.$white;
    }
  }

  .arrow-icon {
    display: inline-flex;
    align-items: center;
    width: 12px;
    height: 8px;
    transition: transform 0.2s ease;
    color: currentColor;

    svg {
      width: 12px;
      height: 8px;
    }

    &--rotated {
      transform: rotate(180deg);
    }
  }

  // PrimeReact AutoComplete dropdown button — match Angular's subtle chevron
  .p-autocomplete-dropdown {
    background: transparent !important;
    border: none !important;
    color: colors.$gray !important;
    width: 2rem !important;
    padding: 0 !important;

    .p-icon {
      width: 0.75rem;
      height: 0.75rem;
    }
  }

  // PrimeReact Calendar button — match Angular's outline icon style
  .p-datepicker-trigger {
    background: transparent !important;
    border: none !important;
    color: colors.$gray !important;
    width: 2rem !important;
    padding: 0 !important;

    .p-icon {
      width: 1rem;
      height: 1rem;
      color: colors.$blue;
    }
  }
}
