/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
@import "~@bentley/ui-core/lib/ui-core/style/themecolors";

$top-position: 6px;
$bottom-position: 4px;

.solar-timeline-wrapper {
  box-sizing: border-box;
  background: $buic-background-2;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 8px 16px;
  color: $buic-foreground-body;
  font-size: 14px;

  > .header {
    display: flex;
    align-items: center;
    position: relative;

    > .play-button {
      width: 26px;
      height: 26px;
      background: inherit;
      border: none;
      font-size: 20px;
    }

    > .shadow-settings-button {
      display: flex;
      align-items: center;
      color: $buic-foreground-body;
      width: 26px;
      height: 26px;
      background: inherit;
      border: none;
      font-size: 16px;
      margin-left: 6px;
      cursor: pointer;

      &:hover {
        color: $buic-foreground-activehover;
      }

      &:focus {
        outline: none;
      }
    }

    > .current-date {
      margin-left: 20px;
      margin-right: 4px;
      background: inherit;
      padding: 3px 4px;
      border: none;
      display: flex;
      align-items: center;
      color: $buic-foreground-body;
      font-size: 14px;
      cursor: pointer;

      >span:nth-child(2) {
        margin: 0 6px;
      }

      > .icon-calendar {
        margin-left: 6px;
      }
    }

    > .speed-container {
      display: flex;
      align-items: center;
      margin-left: auto;
      cursor: pointer;

      > .speed {
        margin-left: 12px;
        width: 0;
        opacity: 0;
        transition: all .2s linear;
        margin-right: 10px;
      }
    }

    > .expanded-icon {
      margin-left: 12px;
      margin-right: 5px;
      font-size: 12px;
      transition: transform .5s ease;
      cursor: pointer;

      &:hover {
        color: $buic-foreground-activehover;
      }
      &:focus {
        outline: none;
      }
    }

    > .loop-playback {
      color: $buic-foreground-primary;
      font-size: 16px;
      cursor: pointer;

      &:hover {
        color: $buic-foreground-primary-tone;
      }
      &:focus {
        outline: none;
      }
    }

    > .no-loop-playback {
      color: $buic-foreground-body;
      font-size: 16px;
      cursor: pointer;

      &:hover {
        color: $buic-foreground-activehover;
      }
      &:focus {
        outline: none;
      }
    }
  }

  .solar-slider {
    position: relative;
    display: flex;
    box-sizing: border-box;
    align-items: center;
    flex: 1;
    height: 25px;

    .rail-outer {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      width: 100%;
      height: 20px;
      cursor: pointer;
    }

    .rail-inner,
    .rail-solar {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      height: 4px;
      pointer-events: none;
    }

    .rail-inner {
      width: 100%;
      background: $buic-background-5;
    }

    .rail-solar {
      background: $buic-foreground-primary;
      z-index: 1;
    }

    .rail-tooltip {
      position: absolute;
      margin-left: -11px;
      top: 0;
      transform: translateY(-50%);
      z-index: 1;
    }

    .solar-handle {
      position: absolute;
      top: 50%;
      z-index: 4;
      width: 38px;
      height: 20px;
      border-radius: 3px;
      border: 1px solid $buic-background-5;
      background-image: linear-gradient(to bottom, $buic-background-3, $buic-background-3), linear-gradient(to bottom, $buic-background-1, $buic-background-1);
      display: flex;
      align-items: center;
      justify-content: center;
      box-sizing: border-box;
      transform: translate(-50%, -50%);
      cursor: pointer;

      >div {
        width: 1px;
        height: 10px;
        opacity: 0.25;
        margin: 0 1px;
        background-color: $buic-foreground-body;
      }
    }

    .tick-mark {
      position: absolute;
      bottom: calc(#{$bottom-position} + 15px);
      width: 1px;
      height: 5px;
      background: rgb(200, 200, 200);
    }

    .tick-label {
      position: absolute;
      bottom: $bottom-position;
      font-size: 10px;
      text-align: center;
    }

    .sunrise,
    .sunset {
      font-size: 22px;
      margin: 0 5px 2px 0;
      cursor: default;
    }

    .sunrise {
      color: #ffcf00;
    }

    &.showticks {
      position: relative;
      display: none;
      align-items: flex-start;
      background: $buic-background-1;
      border: 1px solid $buic-background-5;
      box-sizing: border-box;
      flex: 1;
      height: 57px;

      .rail-outer {
        top: $top-position;
        transform: none;
      }

      .rail-inner,
      .rail-solar {
        top: calc(#{$top-position} + 8px);
        transform: none;
      }

      .solar-handle {
        top: $top-position;
        transform: translateX(-50%);
      }

      .rail-tooltip {
        top: $top-position;
        transform: none;
      }

      .sunrise,
      .sunset {
        font-size: 22px;
        margin: 0 15px;
      }
    }
  }
}

.tooltip {
  position: absolute;
  top: -20px;
  display: inline-block;
  border-bottom: 1px dotted #222;
  margin-left: 22px;
  font-size: 14px;

  .tooltip-text {
    width: 100px;
    background-color: #222;
    color: #fff;
    // opacity: 0.8;
    text-align: center;
    border-radius: 6px;
    padding: 8px 0;
    position: absolute;
    z-index: 1;
    bottom: 150%;
    left: 50%;
    margin-left: -60px;

    &:after {
      content: "";
      position: absolute;
      top: 100%;
      left: 50%;
      margin-left: -5px;
      border-width: 5px;
      border-style: solid;
      border-color: #222 transparent transparent transparent;
    }
  }
}

.solar-timeline-wrapper> .header> .speed-container:hover> .speed {
  opacity: 1;
  width: 80px;
}

.solar-timeline-wrapper.expanded .header .expanded-icon {
  transform: rotate(180deg);
}

.solar-timeline-wrapper.expanded> .header> .current-date {
  margin-left: 70px;
}

.solar-timeline-wrapper .solar-timeline-expanded {
  display: none;
  margin-bottom: 8px;
}

.solar-timeline-wrapper .solar-timeline {
  display: flex;
  margin: 0 30px;
}

.solar-timeline-wrapper.expanded {
  height: 100px;
}

.solar-timeline-wrapper.expanded .solar-timeline-expanded {
  display: flex;
}

.solar-timeline-wrapper.expanded .solar-timeline {
  display: none;
}


.shadow-settings-color-top {
  display: inline;
}

.shadow-settings-color-bottom {
  display: flex;
  flex-direction: row;
}

.shadow-settings-popup-container {
  width: 220px;
  padding: 10px 10px 0px;
  display: flex;
  flex-direction: column;

  .shadow-settings-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
  }

  .shadow-settings-color {
    display: flex;
    flex-direction: column;

    .shadow-settings-color-top {
      height: 150px;
      margin: 1em;
    }

    .shadow-settings-color-bottom {
      width: 100%;
      height: 32px;
      margin-top: 10px;
      margin-bottom: 10px;

      .shadow-settings-color-bottom-left {
        width: calc(100% - 2em - 32px);
        height: 100%;
        margin-left: 1em;
        margin-right: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
      }

      .shadow-settings-color-bottom-right {
        width: 32px;
        height: 100%;
      }
    }
  }

  .shadow-settings-color-presets {
    width: 100%;
    height: 24px;
    padding-top: 10px;
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
    grid-column-gap: 2px;
    border-top: 1px solid $buic-background-5;
  }
}

.sunrise-tip {
  position: absolute;
  top: -8px;
  display: inline-block;
  border-bottom: 1px dotted #222;
  font-size: 14px;
}

.solar-tooltip-text {
  width: 100px;
  background-color: #222;
  color: #fff;
  // opacity: 0.8;
  text-align: center;
  border-radius: 6px;
  padding: 8px 0;
  position: absolute;
  z-index: 1;
  bottom: 150%;
  left: 50%;
  margin-left: -60px;

  &:after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #222 transparent transparent transparent;
  }
}

.core-tooltip-tooltip.components-rail-tooltip {
  pointer-events: none;
}

div.ui-component-solar-slider-sizer {
  width: 100%;
  height: 100%;
}
