@use 'sass:math';

@import '../commonStyles/no-select';
@import '../commonStyles/colors';

$header-height: 36px;

$header-logo-width: 86px !default;
$header-logo-height: 18px !default;

.centerStyle {
  top: 50%;
  position: absolute;
}

.root {
  @include no-select;
  box-sizing: border-box;
  padding: 0;
  border-radius: 3px;
  position: fixed;
  display: block;
  visibility: visible;
  bottom: 0;
  background-color: #fff;
  transition: visibility 0.2s 0s linear, opacity 0.2s 0s linear,
    transform 0.1s 0s ease-in-out;
  z-index: 99999;
  box-shadow: 0px 0px 5px 1px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.root.left {
  left: 0;
}
.root.right {
  right: 0;
}
.root.left {
  left: 0;
}
.root.right {
  right: 0;
}
.root.left {
  left: 0;
}
.root.right {
  right: 0;
}
.root.dragging {
  transition: opacity 0.1s 0s linear;
}

.root.closed {
  visibility: hidden;
  opacity: 0;
}

.root.loading {
  display: none;
}

.header {
  @include no-select;
  position: relative;
  height: $header-height;
  line-height: $header-height;
  min-width: 134px;
  text-align: center;
  cursor: move;
  z-index: 11;
  overflow: hidden;
  font-family: Helvetica;
  font-weight: normal;
  border-bottom: 1px solid #e8e9ed;
  box-sizing: border-box;
}

.minimized.header {
  border-bottom: none;
  cursor: ew-resize;
}

.logo {
  @include no-select;
  @extend .centerStyle;
  left: 50%;
  height: $header-logo-height;
  width: $header-logo-width;
  margin-top: -(math.div($header-logo-height, 2));
  margin-left: -(math.div($header-logo-width, 2));
  display: none;
}

.logo.visible {
  display: inline-block;
}

.presence {
  @extend .centerStyle;
  left: 20px;
  height: 14px;
  width: 14px;
  border-radius: 8px;
  margin-top: -7px;
  display: none;
  cursor: pointer;
}

.dropdownPresence {
  display: none;
  position: absolute;
  width: 100%;
  height: 100vh;
}

.showDropdown {
  display: block;
}

.presenceItem {
  padding: 10px 15px;
  display: block;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  &:hover {
    background-color: #f5f5f5;
  }
}

.selected {
  color: #066fac;
}

.line {
  position: relative;
  width: 160px;
  min-width: 134px;
  left: 5px;
  padding: 0;
  min-height: 30px;
  box-sizing: border-box;
  box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.2);
  background-color: #ffffff;
  border-style: solid;
  border-width: 0;
  border-top-width: 1px;
  border-bottom-width: 0px;
  border-color: #eeeeee;
  border-radius: 4px;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #2f2f2f;
  .horizontal {
    display: inline-flex;
  }

  .clickable {
    cursor: pointer;
  }

  .noborder {
    border: none;
  }
}

.minimized .presence {
  left: 10px;
}

.Offline {
  display: block;
  background: #cdcdcd;
}

.Busy {
  display: block;
  background: #f95b5c;
}

.Available {
  display: block;
  background-color: #32ae31;
}

.presenceBar {
  display: none;
  position: absolute;
  width: 8px;
  height: 2px;
  border-radius: 1.5px;
  background-color: #ffffff;
  transform-origin: 50% 50%;
  transform: translate(3px, 6px);
}

.DoNotAcceptAnyCalls {
  display: block;
  background: #f95b5c;
  .presenceBar {
    display: block;
  }
}

.statusIcon {
  display: inline-block;
  position: relative;
  margin-right: 5px;
  top: 2px;
  left: 0;
  margin-top: 0;
}

.button {
  box-sizing: border-box;
  @extend .centerStyle;
  height: 20px;
  width: 20px;
  margin-top: -10px;
  border-radius: 3px;
  cursor: pointer;
  border-style: solid;
  border-width: 1px;
  border-color: transparent;
}

.toggle {
  right: 44px;
}
.minimized .toggle {
  right: -18px;
}

.minimizeIcon {
  position: absolute;
  box-sizing: border-box;
  left: 3px;
  bottom: 7px;
  width: 12px;
  height: 2px;
  border: 1px solid #888888;
}
.minimized .minimizeIcon {
  height: 12px;
  bottom: 3px;
}

.minimizeIconBar {
  width: 100%;
  height: 1px;
  background-color: #888888;
}
.close {
  right: 16px;
}
.minimized .close {
  display: none;
}
.closeIcon {
  position: relative;
  overflow: hidden;
  margin: 2px;
  width: 14px;
  height: 14px;
  :first-child,
  :last-child {
    position: absolute;
    height: 2px;
    width: 100%;
    top: 6px;
    left: 0;
    background: #888888;
    border-radius: 1px;
  }
  :first-child {
    transform: rotate(45deg);
  }
  :last-child {
    transform: rotate(-45deg);
  }
}
.contentFrame {
  display: block;
  border: none;
  width: 0;
  height: 0;
}
.frameContainer {
  overflow: hidden;
  transition: width 0.1s 0s ease-in-out, height 0.1s 0s ease-in-out;
}

@keyframes glow {
  0% {
    box-shadow: inset 0 0 7px -10px $primary-color;
  }
  40%,
  50% {
    box-shadow: inset 0 0 7px 0px $primary-color;
  }
  100% {
    box-shadow: inset 0 0 7px -10px $primary-color;
  }
}

.minimized.ringing {
  animation-name: glow;
  animation-duration: 2s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

@keyframes moveIn {
  0% {
    display: none;
    top: -50%;
  }
  100% {
    display: inline-block;
    top: 50%;
  }
}
@keyframes moveOut {
  0% {
    display: inline-block;
    top: 50%;
  }
  100% {
    top: 150%;
    display: none;
  }
}

.moveIn {
  animation-name: moveIn;
  animation-duration: 1s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}
.moveOut {
  animation-name: moveOut;
  animation-duration: 1s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

@mixin callInfo {
  position: absolute;
  top: -50%;
  left: 50%;
  height: 16px;
  line-height: 16px;
  margin-top: -8px;
  color: #666666;
  font-size: 12px;
  white-space: nowrap;
}
.duration.visible,
.ringingCalls.visible,
.onHoldCalls.visible,
.otherDeviceCalls.visible {
  top: 50%;
}
.duration {
  @include callInfo;
  width: 33px;
  margin-left: -60px;
  cursor: pointer;
}
.duration.center {
  margin-left: -16px;
}
.ringingCalls,
.onHoldCalls,
.otherDeviceCalls {
  @include callInfo;
  width: 100px;
  margin-left: -100px;
  text-overflow: ellipsis;
  overflow: hidden;
  text-align: center;
}
.ringingCalls.center,
.onHoldCalls.center,
.otherDeviceCalls.center {
  margin-left: -50px;
}

@mixin btn {
  position: absolute;
  top: -50%;
  left: 50%;
  padding: 0 5px;
  height: 18px;
  line-height: 18px;
  border-radius: 10.5px;
  font-size: 11px;
  margin-top: -10px;
  margin-left: -13px;
  overflow: hidden;
  white-space: nowrap;
  min-width: 66px;
  max-width: 110px;
  cursor: pointer;
}

.currentCallBtn {
  @include btn;
  border: solid 1px $leaf;
  color: $leaf;
}
.currentCallBtn.visible {
  display: inline-block;
  margin-top: -10px;
  top: 50%;
}
.currentCallBtn:hover {
  color: $leaf;
}
.currentCallBtn.left {
  margin-left: -80px;
}
.viewCallsBtn {
  @include btn;
  border: solid 1px $orange;
  color: $orange;
  margin-left: 0;
}
.viewCallsBtn:hover {
  color: $orange;
}
.viewCallsBtn.visible {
  display: inline-block;
  margin-top: -10px;
  top: 50%;
}
