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

.schedule-start-page {
  section.frame {
    padding: 0;

    h2 {
      padding: 50px;
      padding-bottom: vars.$space-xl;
    }

    .titles-container {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      padding: 0 50px;
      padding-bottom: 50px;

      .title {
        width: 50%;
        padding: 30px;
        padding-right: 50px;
        padding-left: 65px;
        background-repeat: no-repeat;
        background-position: left center;

        a {
          cursor: default;
          font-size: fonts.$font-size-xl;
        }

        div {
          color: colors.$gray;
          padding-top: vars.$space-s;
        }

        &.title1 {
          background-image: url('/assets/img/schedule-title-icon-1.svg');
        }

        &.title2 {
          background-image: url('/assets/img/schedule-title-icon-2.svg');
        }

        &.title3 {
          background-image: url('/assets/img/schedule-title-icon-3.svg');
        }

        &.title4 {
          background-image: url('/assets/img/schedule-title-icon-4.svg');
        }
      }
    }
  }

  @media (max-width: vars.$media-breakpoint-mobile) {
    section.frame h2 {
      padding: vars.$space-xl;
      font-size: fonts.$font-size-xl1;
      line-height: 28px;
      padding-bottom: 0;
      padding-top: 30px;
    }

    .titles-container {
      padding: vars.$space-xl !important;
      padding-top: 0 !important;

      div.title {
        width: 100% !important;
        padding: vars.$space-xl !important;
        padding-left: 50px !important;
        background-size: 35px auto !important;

        a {
          font-size: fonts.$font-size-l;
        }
      }
    }
  }

  .page-title {
    width: auto;
    display: inline-block;
    max-width: 100%;
    white-space: normal !important;
  }

  h1.text--white {
    @include fonts.font-overflow();

    @include screen.smTablet {
      font-size: fonts.$font-size-xxxl--tablet;
      margin-bottom: vars.$space-m + vars.$space-s;
      overflow: visible;
      white-space: normal;
    }

    @include screen.mobile {
      font-size: fonts.$font-size-xxxl--mobile;
      margin-bottom: vars.$space-m + vars.$space-s;
      margin-top: vars.$space-m;
      overflow: visible;
      white-space: normal;
    }
  }

  // Schedule filter panel in content-left column
  .schedule-start__form {
    @include shadows.box-shadow-small;
    background-color: colors.$white;
    border-radius: vars.$border-radius;
    padding: vars.$space-xl;
    display: flex;
    flex-direction: column;
    gap: vars.$space-m;
  }

  .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-top: calc(vars.$space-m * -1);
    position: relative;
  }

  .schedule-start__field {
    display: flex;
    flex-direction: column;
    gap: vars.$space-s;

    label {
      font-weight: fonts.$font-medium;
      @include fonts.font-small(colors.$gray);
      margin-bottom: vars.$label-margin-bottom;
    }

    // Give the checkbox a proper box + sliding-knob style, matching
    // Angular's schedule filter. Native `input[type="checkbox"]` is too
    // thin at 16px and its accented colour differs between browsers.
    label:has(input[type="checkbox"]) {
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: vars.$space-m;
      font-weight: fonts.$font-regular;
      margin-bottom: 0;
      cursor: pointer;
      font-size: fonts.$font-size-m;
      color: colors.$text-color;
    }

    input[type="checkbox"] {
      appearance: none;
      -webkit-appearance: none;
      width: 18px;
      height: 18px;
      border: 1.5px solid colors.$border;
      border-radius: vars.$border-radius;
      background: colors.$white;
      position: relative;
      cursor: pointer;
      flex-shrink: 0;
      transition: background-color 0.2s ease, border-color 0.2s ease;

      &:checked {
        background-color: colors.$blue;
        border-color: colors.$blue;

        &::after {
          content: "";
          position: absolute;
          top: 1px;
          left: 5px;
          width: 5px;
          height: 10px;
          border: solid colors.$white;
          border-width: 0 2px 2px 0;
          transform: rotate(45deg);
        }
      }

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

    input[type="text"],
    input[type="date"] {
      @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.$text-color;
      width: 100%;
      transition-duration: 0.2s;
      @include fonts.font-overflow();

      &:focus {
        outline: none;
        border-color: colors.$blue-light;
        box-shadow: 0 0 0 0.2em colors.$focus-shadow;
      }
    }
  }

  // Time-range slider styled the same way as the online-board filter.
  // Those rules are nested under `.online-board-filter` in the other
  // SCSS file, so we duplicate them here — the schedule page isn't
  // wrapped in that class.
  .wrapper--time-selector {
    margin-top: vars.$space-m;

    .time-selector__label {
      @include fonts.font-small(colors.$gray);
      margin-bottom: vars.$space-s;
    }

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

    .time-selector__value {
      @include fonts.font-small(colors.$gray);
      margin-top: vars.$space-s;
      text-align: right;
    }
  }

  .schedule-start__time-row {
    .schedule-start__time-inputs {
      display: flex;
      align-items: center;
      gap: vars.$space-s;

      input[type="time"] {
        @include shadows.control-border-shadow();
        height: vars.$standard-button-height;
        padding: 0 vars.$space-m;
        font-size: fonts.$font-size-l;
        font-weight: fonts.$font-regular;
        color: colors.$text-color;
        flex: 1;
        min-width: 0;
        transition-duration: 0.2s;

        &:focus {
          outline: none;
          border-color: colors.$blue-light;
          box-shadow: 0 0 0 0.2em colors.$focus-shadow;
        }
      }
    }

    .schedule-start__time-sep {
      color: colors.$gray;
      flex-shrink: 0;
    }
  }

  // Mirrors Angular `bottom-description.component.scss` 1:1 — no gray
  // color override on the text block, no link restyling (Angular leaves
  // `a` unstyled here so the global link mixin takes over).
  .bottom-description-frame {
    margin-top: vars.$space-xl;
  }

  .bottom-description-container {
    padding: vars.$space-xxl;
  }

  .bottom-description-title {
    font-size: fonts.$font-size-xl1;
    font-weight: fonts.$font-regular;
  }

  .bottom-description-text {
    margin-top: vars.$space-xl;
    line-height: 20px;
  }

  .bottom-description-text p {
    margin: 0 0 vars.$space-s2;
  }

  .bottom-description-text p:last-child {
    margin-bottom: 0;
  }

  .schedule-start__submit {
    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;
    font-weight: fonts.$font-bold;
    font-size: fonts.$font-size-m;

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

    &:focus {
      box-shadow: 0 0 0 0.2em colors.$focus-shadow;
    }
  }

  // PrimeReact AutoComplete dropdown — 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 trigger — background/border/icon handled in
  // shared `styles/_prime-calendar.scss`. Keep only the width override.
  .p-datepicker-trigger {
    width: 2rem !important;
    padding: 0 !important;
  }

  // PrimeReact Calendar input — step the font down from the start-page's
  // 16px so the full 'ДД.ММ.ГГГГ - ДД.ММ.ГГГГ' placeholder fits in the
  // narrow left-column width. Matches Angular's `body .p-inputtext`
  // baseline of 14px for calendar inputs. Horizontal padding is owned
  // by the shared rule in `styles/_prime-calendar.scss` — don't
  // double-pad right (the `.p-datepicker-trigger` button sits next to
  // the input and already owns the icon column).
  .p-calendar input.p-inputtext {
    font-size: fonts.$font-size-m !important;
  }

  // Swap-cities button styling moved to the shared `SwapCityButton` component
  // — classes `.change-container` + `.button-change` are now global.
}
