@import "colors";

.control-bar {
  background: $bar_background;
  border-radius: $panel_radius;
  display: flex;
  box-shadow: $bar_shadow;
  align-items: center;
  justify-content: center;

  @media (max-width: $mobile_breakpoint) {
    box-shadow: none;
  }
}

.control-bar-padded {
  padding: 0 5px;
}

.control-sep {
  height: 36px;
  background: #222222;
  width: 4px;

  @media (max-width: $mobile_breakpoint) {
    margin-left: -1px;
    margin-right: -1px;
    width: 6px;
  }
}

.secondary-bar {
  background: #222222;
  margin: 0 -1px;
  padding: 0 1px;

  &:first-child {
    border-radius: $panel_radius 0 0 $panel_radius;
  }

  .panel & button {
    height: 40px;
    padding: 4px;
  }

  &__undo {
    opacity: 0;
    transform: translate(50px, 0);
    pointer-events: none;
    touch-action: none;
    transition: transform 0.25s, opacity 0.25s;
    z-index: -1;

    &.active {
      opacity: 1;
      transform: translate(0, 0);
      pointer-events: all;
      touch-action: initial;
    }
  }
}

.panel button.undo-button {
  @media (max-width: 420px) {
    display: none;
  }
}
.panel {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 6;
  color: white;
  display: flex;
  align-items: center;
  transform: translateY(100px);
  transition: transform 500ms;

  &.active {
    transform: translateY(0);
  }

  &.right {
    left: auto;
    right: 10px;
  }

  &.center {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  button {
    border: none;
    background: transparent;
    padding: 8px;
    outline: none;
    cursor: pointer;
    display: inline-flex;
    color: white;
    align-items: center;
    transition: background-color 500ms;
    height: 48px;
    box-sizing: border-box;
    user-select: none;
    position: relative;

    &:hover {
      background: rgba(100, 100, 100, 0.2);
    }

    span {
      margin-right: 8px;
      font-size: 14px;
      font-weight: 500;
      margin-left: 8px;
      text-transform: uppercase;
    }

    &:first-child {
      border-radius: $panel_radius 0 0 $panel_radius;
    }

    &:last-child {
      border-radius: 0 $panel_radius $panel_radius 0;
    }

    &.active {
      svg {
        fill: url(#activeButtonGradient);
        stroke: url(#activeButtonGradient);
      }
    }

    &.disabled,
    &.inactive {
      color: #999999;

      svg {
        fill: #999999;
      }
    }

    &.disabled {
      pointer-events: none;
    }

    &.highlighted {
      background: rgba(255, 255, 255, 0.1);
    }

    &.cancel {
      // background: linear-gradient(270deg, #0f5871, #444444 60%);
    }

    &.primary {
      background: linear-gradient(150deg, $blue_primary, $blue_secondary) 50% 50% no-repeat;
      background-size: 100% 100%;
    }

    &.success {
      background: linear-gradient(150deg, $green_primary, $green_secondary) 50% 50% no-repeat;
      background-size: 100% 100%;
    }

    &.danger {
      background: linear-gradient(150deg, $red_primary, $red_secondary) 50% 50% no-repeat;
      background-size: 100% 100%;
    }

    &.single {
      border-radius: $panel_radius;
    }

    svg {
      fill: white;
      stroke: white;
      display: inline;
      fill-rule: evenodd;
      stroke-linecap: butt;
      stroke-linejoin: miter;
      stroke-miterlimit: 4;
      stroke-dasharray: none;
      stroke-width: 3;
    }
  }
}

.panel-tooltip {
  position: absolute;
  bottom: 58px;
  left: 50%;
  background: $tooltip_background;
  padding: 10px;
  transform: translate(-50%, -10px);
  border-radius: $panel_radius;
  opacity: 0;
  pointer-events: none;
  transition: all 250ms;
  font-size: 13px;
  color: white;

  @media (max-width: $mobile_breakpoint) {
    display: none;
  }

  &::after {
    content: ' ';
    width: 10px;
    height: 10px;
    position: absolute;
    background: $tooltip_background;
    bottom: 0;
    transform: translate(-50%, 5px) rotate(45deg);
    left: 50%;
  }

  &.top {
    bottom: auto;
    top: 43px;
    transform: translate(-50%, 10px);

    &::after {
      bottom: auto;
      top: 0;
      transform: translate(-50%, -5px) rotate(45deg);
    }
  }
}

.panel button,
.tooltip-container {
  position: relative;

  &:hover .panel-tooltip {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.control-bar-counter {
  color: white;
  min-width: 12px;
  height: 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 10px;
  position: absolute;
  bottom: 50%;
  right: 50%;
  box-sizing: border-box;
  transform: translate(50%, 50%);
  line-height: 12px;
}

.panel-separator {
  height: 48px;
  width: 4px;
  background: #222222;
}

.panel-user {
  @media (max-width: $mobile_breakpoint) {
    z-index: 3;
    flex-direction: column-reverse;
    align-items: flex-start;

    .control-sep {
      opacity: 0;
      height: 10px;
    }
  }

  @media (max-width: 350px) {
    bottom: 68px;
  }
}

.control-dialog {
  position: absolute;
  right: 10px;
  bottom: 68px;
  z-index: 3;
  color: white;
  box-sizing: border-box;
  // padding-bottom: 48px;
  box-shadow: inset rgba(255, 255, 255, 0.05) 1px 1px;
  background: #222222;
  border-radius: $panel_radius;

  &.bottom.right {
    width: 100%;
    max-width: 500px;
  }

  &.top {
    bottom: auto;
    top: 52px;
  }

  &.left,
  &__left {
    right: auto;
    left: 10px;

    @media (max-width: $micro_breakpoint) {
      left: 68px;
    }
  }

  .helper:first-child {
    border-radius: $panel_radius $panel_radius 0 0;
  }

  .helper:last-child {
    border-radius: 0 0 $panel_radius $panel_radius;
  }

  .helper:only-child {
    border-radius: $panel_radius;
  }

  &__big {
    width: calc(100% - 20px);
    max-width: 620px;

    @media (max-width: $micro_breakpoint) {
      width: calc(100% - 78px);
    }
  }

  &__medium {
    width: calc(100% - 20px);
    max-width: 417px;

    @media (max-width: $micro_breakpoint) {
      width: calc(100% - 78px);
    }
  }

  &__small {
    width: calc(100% - 20px);
    max-width: 324px;

    @media (max-width: $micro_breakpoint) {
      width: calc(100% - 78px);
    }
  }
}

.control-dialog-provider {
  width: 500px;

  @media (max-width: $mobile_breakpoint) {
    width: 100%;
    left: 0;
    padding: 0 10px;
  }
}

.helper {
  // width: 500px;
  padding: 12px;
  font-weight: 200;
  font-size: 1em;
  display: flex;

  //background: #222222;
  //border-radius: $panel_radius;
  box-shadow: $bar_shadow;

  @media (max-width: $mobile_breakpoint) {
    box-shadow: none;
  }
}

.helper-prefetch {
  flex-direction: column;
}

.helper__text {
  width: 100%;
  display: flex;
  align-items: center;

  svg {
    fill: white;
    width: 24px;
    height: 24px;
    margin-right: 6px;
  }

  &.success {
    color: $color_success;

    svg {
      fill: $color_success;
    }
  }

  &.primary {
    color: $color_danger;

    svg {
      fill: $color_danger;
    }
  }

  &.danger {
    color: $color_danger;

    svg {
      fill: $color_danger;
    }
  }
}

.flex_1 {
  flex: 1;
}

.helper__icon_button {
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  outline: none;
  cursor: pointer;

  svg {
    margin-right: 0;
  }

  &.inactive {
    opacity: 0.5;
  }

  &.active {
    svg {
      fill: url(#activeButtonGradient);
    }
  }
}

.helper__buttons {
  display: flex;
  align-items: center;
  user-select: none;

  .button {
    margin-left: 10px;
  }

  svg {
    fill: white;
    stroke: white;

    cursor: pointer;
    opacity: 0.5;
    transition: opacity 250ms;
  }

  &:hover svg {
    opacity: 1;
  }
}

.trash-buttons {
  @media (max-width: $mobile_breakpoint) {
    flex-direction: column;

    .button-group {
      margin-bottom: 10px;
    }
  }
}

.logo-helper {
  width: 200px;
  flex-direction: column;
  padding: 16px 0 16px 0;
  position: relative;
  overflow: hidden;
}

.helper-back {
  width: 200px;
  height: 200px;
  z-index: -1;
  position: absolute;
  bottom: 0;
  right: 0;

  svg {
    fill: $bar_background;
  }
}

.helper-menu-item {
  padding: 8px 20px;
  user-select: none;
  cursor: pointer;
  position: relative;

  &:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  &.active {
    &::after {
      content: ' ';
      width: 16px;
      height: 4px;
      left: 0;
      top: 14px;
      position: absolute;
      background: white;
    }
  }
}

.provider-helper {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-column-gap: 10px;
  grid-row-gap: 10px;

  .provider-helper-thumb {
    height: 100px;
    background: #333333;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: 50% 50% no-repeat;
    border-radius: $panel_radius;
    cursor: pointer;
    position: relative;
  }

  .provider-helper-check {
    width: 40px;
    height: 40px;
    position: absolute;
    bottom: 50%;
    right: 50%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    transform: translate(50%, 50%);

    svg {
      fill: white;
      padding: 4px;
    }
  }
}

.status-panel {
  position: fixed;
  top: 10px;
  left: 10px;
  height: 32px;
  z-index: 5;
  display: flex;

  &.bottom {
    top: auto;
    bottom: 68px;
  }

  &.right {
    left: auto;
    right: 10px;

    .status-bar {
      margin-right: 0;
      margin-left: 10px;
    }
  }
}

.status-bar {
  background: #222222;
  display: flex;
  font-weight: 200;
  color: #cccccc;
  user-select: none;
  border-radius: $panel_radius;
  margin-right: 10px;
  align-items: center;
  justify-content: center;
  box-shadow: $bar_shadow;
  outline: none;
  position: relative;

  @media (max-width: $mobile_breakpoint) {
    box-shadow: none;
  }

  span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    text-transform: uppercase;
    font-size: 0.9em;
  }

  &.square {
    width: 32px;
  }

  &.padded {
    padding: 0 10px;
  }

  &.warning {
    background-color: shade($red_secondary, 10%);

    svg {
      //fill: $red_secondary;
      fill: black;
    }
  }

  &.icon-only {
    padding: 0 10px 0 15px;
  }

  &.top-control {
    justify-content: flex-start;
  }

  svg {
    fill: #cccccc;
    margin-left: -5px;
  }

  &:hover {
    .status-bar-tip {
      opacity: 1;
    }
  }
}

.status-bar-tip {
  position: absolute;
  background: $bar_background;
  top: 100%;
  padding: 10px;
  margin-top: 10px;
  right: 0;
  border-radius: $panel_radius;
  touch-action: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 250ms;
}

.status-bar-sep {
  height: 24px;
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 8px 0 5px;
}

.dialog-prefetch-stage {
  font-size: 1em;
  text-transform: uppercase;
  opacity: 0.7;
}

.dialog-prefetch-progress {
  padding: 10px 0 5px;
}

.speed-helper {
  width: 300px;
  padding: 0 20px;

  .rc-slider {
    width: 100%;
  }
}

.title-dialog-wrapper {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 360px;
  height: 100%;
  background: transparent;
  z-index: 2;
  padding: 10px 10px 58px 10px;
  box-sizing: border-box;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  touch-action: none;
}

.title-dialog-sizer {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.title-dialog {
  z-index: 2;
  transition: opacity 500ms, transform 1s;
  transform: translate(0, 68px);
  user-select: none;
  pointer-events: all;
  touch-action: auto;
  display: flex;
  flex-direction: column;
  opacity: 0;
  align-items: flex-start;

  @media (max-width: $mobile_breakpoint) {
    display: none;
  }

  &.active {
    opacity: 1;
    transform: translate(0, 0);
  }

  .title-dialog-pane {
    margin-bottom: 10px;
    padding: 10px;
    background: $title_dialog_color;
    color: darken(white, 50%);
    font-size: 13px;
    box-sizing: border-box;
    border-radius: $panel_radius;

    h2 {
      margin: 0;
      padding: 0 5px 0 0;
      font-weight: 400;
      font-size: 1.6em;
      color: white;
    }
  }

  .title-dialog-text {
    overflow: hidden;
    transition: height 500ms;
    line-height: 14px;
    padding: 0;
    position: relative;
    color: white;

    > div {
      margin: 10px;
      white-space: pre-line;
    }

    &.has_shade {
      ::after {
        content: ' ';
        width: 100%;
        height: 40px;
        background: linear-gradient(darken($title_dialog_color, 0), $title_dialog_color);
        position: absolute;
        bottom: 0;
        left: 0;
        transition: opacity 250ms;
        pointer-events: none;
        touch-action: none;
      }

      &:hover {
        ::after {
          opacity: 0;
        }
      }
    }
  }
}

.location-bar {
  width: 32px;
}

.nominatim-panel {
  position: fixed;
  bottom: 53px;
  left: 10px;
  width: 272px;
}

.nominatim-search-input {
  padding-left: 10px;
  flex: 1;
}
