// This file is part of Indico.
// Copyright (C) 2002 - 2026 CERN
//
// Indico is free software; you can redistribute it and/or
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.

@use 'base' as *;
@use 'partials/boxes' as *;
@use 'design_system';

@mixin base-list-properties() {
  overflow: auto;
  list-style-type: none;
  padding: 0;

  li.item {
    &:hover {
      background: $light-blue;
    }

    padding: 5px;
    cursor: pointer;

    &.selected {
      background: $indico-blue;
    }

    &:not(:last-child) {
      border-bottom: 1px solid $separator-color;
    }
  }
}

#wholeLegend {
  margin: 60px 0 0 0;
}

#legendMainToggle {
  @include border-all();
  border-top-width: 0;
  background: $gray;
  color: $black;
  cursor: pointer;
  font-size: 11px;
  padding: 4px 5px 3px 5px;
  position: absolute;
  text-align: center;
  width: 116px;

  &:hover {
    color: white;
    background: $dark-gray;
  }

  &.active {
    background: #dfc87b;
  }

  &.active:hover {
    background: #9f883b;
  }
}

.timeTableLegend {
  @include border-all();
  @include default-border-radius();
  background: $light-gray;
  font-size: 11px;
  overflow: hidden;
  padding: 5px;
  z-index: 1;
  box-sizing: initial;

  &.sticky-scrolling {
    @include single-box-shadow();
    position: fixed;
    top: 1px;
  }

  #legendItemContainer {
    overflow: auto;
  }

  .legendItem {
    @include default-border-radius();
    @extend %flex-row;
    --flex-gap: 0.2em;
    align-items: center;
    background: $pastel-gray;
    color: $black;
    float: left;
    margin: 2px;
    padding: 5px;
    overflow: hidden;
    max-width: 200px;
  }

  .timeTableItemColour {
    border-radius: 50%;
    @include border-all(white, $width: 2px);
    float: left;
    margin-right: 3px;
    margin-top: -2px;
    height: 15px;
    width: 15px;
    min-width: 15px;
  }

  .legendCloseButton {
    @include icon-before('icon-cross');
    color: $dark-gray;
    cursor: pointer;
    float: right;
    font-size: 1.2em;
    margin: 1px 2px 0 2px;

    &:hover {
      color: $gray;
    }
  }

  .showMoreLink {
    color: $dark-gray;
    display: block;
    float: right;
    text-align: right;

    &:hover {
      color: $gray;
    }
  }
}

#move-timetable-entry-dialog {
  width: 800px;
  height: 440px;

  .section-title {
    font-size: 1.2em;
    color: $black;
    margin-bottom: 5px;
    margin-top: 10px;
  }

  .days {
    &.scrollable-container {
      height: 70px;
    }

    .scroll-btn {
      @include icon-before('icon-next');
      font-size: 1.2em;
      color: $light-black;
      cursor: pointer;

      &:hover {
        color: $black;
      }

      &.scroll-left {
        transform: rotate(180deg);
        margin-right: 10px;
      }

      &.scroll-right {
        margin-left: 10px;
      }
    }
  }

  .days-container {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    position: relative;

    &.scrollable {
      padding: 5px;
    }

    .day:not(:last-child) {
      margin-right: 0.5em;
    }
  }

  .days-container-wrapper {
    max-width: 730px;
    position: relative;
  }

  .fader {
    position: absolute;
    width: 6%;
    top: 0;
    bottom: 0;
    pointer-events: none;
    display: none;

    &.fader-right {
      background: linear-gradient(
        to left,
        white 0%,
        rgba(251, 251, 251, 0.5) 40%,
        rgba(251, 251, 251, 0) 100%
      );
      right: 0;
    }

    &.fader-left {
      background: linear-gradient(
        to right,
        white 0%,
        rgba(251, 251, 251, 0.5) 40%,
        rgba(251, 251, 251, 0) 100%
      );
      left: 0;
    }

    &.visible {
      display: block;
    }
  }

  .blocks {
    max-height: 300px;
    overflow: auto;
    overflow-y: auto;
  }

  .item {
    @extend .flexrow;

    &:not(.selected) {
      cursor: pointer;
    }

    &.selected {
      border-left: 4px solid $blue;
    }

    .icon {
      font-size: 22px;

      &::before {
        margin-right: 10px;
      }
    }

    .item-icon {
      flex-shrink: 0;
      width: 22px;
      height: 22px;
      border-radius: 15px;
      margin-right: 10px;
    }

    .start-dt {
      flex-shrink: 0;
      margin-left: auto;
      color: $dark-gray;
    }

    .move-btn {
      position: relative;
      padding-left: 10px;
      max-height: 22px; // Workaround to avoid jQuery "jumping" effect

      &:not(.active) {
        display: none;
      }

      button {
        white-space: nowrap;
      }
    }
  }
}

.bottomTip {
  @include border-all();
  @include default-border-radius();
  background: $light-gray;
  color: $light-black;
  display: none;
  padding: 10px;
  position: fixed;
  bottom: 15px;
  right: 20px;
  text-align: center;

  .circle {
    float: left;
    background: transparent url('static:images/circle.png') scroll no-repeat;
    width: 20px;
    height: 14px;
  }
}

@mixin timetable-entry-button {
  background: white;
  height: 19px;
  padding: 2px;
}

.entry-arrows {
  @include timetable-entry-button();
  @include border-horz();
  @include border-bottom();
  border-bottom-left-radius: $default-border-radius;
  border-bottom-right-radius: $default-border-radius;
  cursor: default;
  position: absolute;
  right: 0;
  right: 18px;
  visibility: hidden;

  a {
    background: transparent !important;

    &:first-child {
      margin-right: 2px;
    }
  }
}

.timetableBlock {
  &:hover .entry-arrows {
    visibility: visible;
  }
}

.entry-attachments {
  @include timetable-entry-button();
  border-bottom-left-radius: $default-border-radius;
  border-top-right-radius: $default-border-radius;
  @include border-left();
  @include border-bottom();
  @include icon-before(icon-attachment);
  position: absolute;
  right: 0;
  top: 0;
}
