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

.schedule-search {
  &__calendar {
    display: flex;
    gap: vars.$space-s;
    padding: vars.$space-xl;
    overflow-x: auto;
  }

  &__error {
    padding: vars.$space-xl;
    color: colors.$red;
  }

  // §4.1.12 — loader bar with cancel button
  &__loader-bar {
    display: flex;
    justify-content: center;
    padding: vars.$space-m vars.$space-xl;
  }

  &__cancel-btn {
    display: inline-block;
    padding: vars.$space-s2 vars.$space-xl;
    background-color: colors.$blue-light;
    color: colors.$white;
    border: none;
    border-radius: vars.$border-radius;
    cursor: pointer;
    font-size: fonts.$font-size-m;
    font-weight: fonts.$font-medium;
    transition: background-color 0.2s ease;

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

  // §4.1.11 — block filter/tabs/breadcrumbs while loading
  &[data-searching="true"] {
    .page-layout__left,
    .page-layout__sticky,
    .page-layout__breadcrumbs {
      pointer-events: none;
      opacity: 0.6;
    }
  }

  &__outbound,
  &__inbound {
    padding: vars.$space-xl 0;

    h2 {
      padding: 0 vars.$space-xl;
      margin: 0 0 vars.$space-m;
    }
  }

  &__inbound {
    border-top: 0;
  }
}

// `Туда / Обратно` segmented switch in the sticky header for round-
// trip schedules. Mirrors Angular `schedule-direction-switch.component`
// exactly: fixed-width 130×40 buttons with an extra-blue border, the
// active button filled extra-blue with white text. The $space-xl
// margin matches Angular's `.schedule-home-page-header { margin: $space-xl }`
// and the bottom border mirrors `.schedule-home-page-header-border`.
.schedule-direction-switch {
  display: flex;
  margin: vars.$space-xl;
  padding-bottom: vars.$space-xl;
  border-bottom: 1px solid colors.$border;

  @include screen.mobile {
    margin-left: 0;
    margin-right: 0;
    border-bottom: none;
  }

  &__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 130px;
    height: vars.$medium-button-height;
    background: colors.$white;
    border: 1px solid colors.$extra-blue;
    color: colors.$extra-blue;
    font-size: fonts.$font-size-s;
    font-weight: fonts.$font-medium;
    line-height: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 0;

    &:first-child {
      border-right: none;
      border-top-left-radius: vars.$border-radius;
      border-bottom-left-radius: vars.$border-radius;
    }

    &:last-child {
      border-left: none;
      border-top-right-radius: vars.$border-radius;
      border-bottom-right-radius: vars.$border-radius;
    }

    &--active {
      background: colors.$extra-blue;
      color: colors.$white;

      .schedule-direction-switch__icon { color: colors.$white; }
    }
  }

  &__icon {
    margin-right: vars.$space-s;
    width: 19px;
    height: 19px;
    color: colors.$extra-blue;
    transition: color 0.2s ease;
    fill: currentColor;

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

// Footer note: mirrors Angular's `page-footer-notes` component, rendered
// at the bottom of the schedule results frame.
.schedule-search-page,
.schedule-search {
  .page-footer-note {
    padding: vars.$space-xl;
    background-color: colors.$blue-extra-light;
    border-top: 1px solid colors.$border;
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 vars.$border-radius vars.$border-radius;
  }

  .page-footer-note--container {
    max-width: 700px;
    @include fonts.font-small();
    line-height: 16px;

    .line:not(:last-child) {
      margin-bottom: vars.$space-m;
    }

    .line1 {
      display: flex;
      align-items: flex-start;

      .sort-note {
        font-size: fonts.$font-size-xs;
        margin-right: 3px;
        margin-top: -1px;
      }
    }
  }
}
