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

.mini-list {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  background: colors.$white;
  // Angular's `section.frame` helper uses $border-radius (3px) and a
  // subtle box-shadow. Match it so the mini-list card aligns with the
  // other left-column cards (filter, search-history).
  border-radius: vars.$border-radius;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);

  // Angular hides the sidebar mini-list on mobile (the main details
  // card already shows everything). React's PageLayout floats the
  // left column above the main content on mobile, so the mini-list
  // would render as a duplicate summary card. Hide it.
  @include screen.mobile {
    display: none;
  }

  &__item {
    padding: vars.$space-m2 14px;
    border-bottom: 1px solid colors.$border;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: background-color 0.2s ease;

    &:last-child {
      border-bottom: none;
    }

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

    // Angular's `flights-details-list-flight.component.scss` uses
    //   &.selected .flight-card { border: 2px solid $blue-light }
    // — the lighter brand blue (#4a90e2), not $blue (#1b62b4).
    &--selected {
      box-shadow: inset 0 0 0 2px colors.$blue-light;
      background: colors.$blue-extra-light;
    }
  }

  // Angular renders the mini-list header ('SU 6272') darker and larger
  // than the surrounding meta: 16px / 400, uses $blue-dark (#022040)
  // for the brand navy rather than pure black.
  &__flight-number {
    font-size: fonts.$font-size-l;
    font-weight: fonts.$font-regular;
    color: colors.$blue-dark;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  &__status-icon {
    display: inline-flex;
    font-size: fonts.$font-size-m;

    &--blue { color: colors.$blue; }
    &--green { color: colors.$green; }
    &--cancelled { color: colors.$red; }
  }

  &__times {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: vars.$space-s2;
    margin-bottom: 4px;
  }

  &__dep,
  &__arr {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  &__arr {
    text-align: right;
  }

  // Depart/arrive times inside the mini-list item: 20px / 500 / colors.$blue-dark
  // (dark navy) to match Angular's big time-group.
  &__time {
    font-size: fonts.$font-size-xl1;
    font-weight: fonts.$font-medium;
    color: colors.$blue-dark;
    line-height: 1;
  }

  &__date {
    font-size: 11px;
    color: colors.$light-gray;
  }

  &__stations {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: vars.$space-s2;
  }

  &__station {
    display: flex;
    flex-direction: column;
    gap: 2px;

    &--arrival {
      text-align: right;
    }
  }

  &__city {
    font-size: fonts.$font-size-s;
    color: colors.$text-color;
  }

  &__airport {
    font-size: 11px;
    color: colors.$light-gray;
    text-decoration: underline;

    // TZ §4.1.15.2-R19/R20 + §4.1.16.2 Table 57: SVO/VKO shown as hyperlinks.
    // Uses span+role=link to avoid <a> nesting inside the outer Link element.
    &--link {
      display: inline;
      color: colors.$blue;
      text-decoration: underline;
      cursor: pointer;
      user-select: none;

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

      &:focus-visible {
        outline: 2px solid colors.$blue;
        outline-offset: 1px;
        border-radius: 1px;
      }
    }
  }
}
