.calendar-widget {
  position: relative;
}
.calendar {
  position: relative;
  display: block;
  border-radius: 3px;
  background: white;
  width: 260px;
  margin-bottom: 15px;
  overflow: hidden;
  cursor: pointer;
  height: 46px;
}
a.calendar {
  text-decoration: none
}
.calendar-icon {
  position: relative;
  width: 34px;
  height: 100%;
  box-sizing: border-box;
  background-color: @blue;
  display: inline-block;

  &:after {
    position: absolute;
    top: 0;
    left: 4%;
    width: 50px;
    height: 50px;
    background-color: @blue;
    transform: rotate(45deg) skew(8deg, 8deg);
    border-radius: 3px;
    box-sizing: border-box;
    content: '';
    z-index: 1;
  }

  &:before {
    position: absolute;
    left: 11px;
    top: 11px;
    width: 24px;
    height: 24px;
    background-size: cover;
    background-image: data-uri('../images/calendar.svg');
    content: '';
    z-index: 2;
  }

}
.calendar-text {
  position: absolute;
  top: 0;
  display: inline-block;
  padding: 14px 30px 14px;
}
.calendar-text span {
  color: black;
  text-decoration: none;
  border-bottom: 1px dotted black;
}

/* Popup styles */
.calendar-popup {
  width: 500px;
  border-radius: 3px;
  padding: 26px 26px 21px;
  background-color: #fff;
  position: fixed;
  transition: transform 150ms ease-in-out;
  top: 0;
  left: 50%;
  margin-left: -250px;
  z-index: 14;
  box-shadow: 0 6px 9px rgba(0,0,0,.15);
  transform: translateY(60px);
  &.hidden {
    display: block;
    visibility: visible;
    opacity: 1;
    transform: translateY(-600px);
  }
}

.calendar-chart-wrap {
  width: 100%;
  margin-bottom: 20px;
  user-select: none;
  ul {
    margin: 0;
    padding: 0;
    position: relative;
    list-style-type: none;
    width: 100%;
    height: 100%;
  }
}

.border-values {
  position: absolute;
  top: 11px;
  left: -10px;
  font-size: 10px;
  color: @text-gray;
  text-align: right;

  .border-price {
    margin-bottom: 32px;
    position: relative;

    &:after {
      content: '';
      position: absolute;
      top: 9px;
      right: -417px;
      width: 413px;
      height: 1px;
      background: @gray-light;
    }

  }

}

.arrow-wrap {
  width: 20px;
  height: 20px;
  position: absolute;
  top: 0;
  cursor: pointer;
  z-index: 3;

  &.prev-month {
    left: -5px;
  }

  &.next-month {
    right: -5px;
  }

  &.prev-month .calendar-arrow {
    transform: rotate(90deg);
    left: 12px;
  }

  &.next-month .calendar-arrow {
    transform: rotate(270deg);
    right: 12px;
  }

  &.arrow-inactive {
    opacity: 0.4;
  }

}

.calendar-arrow {
  display: inline-block;
  position: absolute;
  top: 4px;
  height: 12px;
  width: 12px;
  cursor: pointer;

  &:before, &:after {
    content: '';
    position: absolute;
    bottom: 0;
    height: 1px;
    width: 50%;
    background: @blue;
  }

  &:after {
    right: 0;
    transform: skew(0deg, -40deg);
    transform-origin: 100% 0;
  }

  &:before {
    left: 0;
    transform: skew(0deg, 40deg);
    transform-origin: 0 0;
  }

}


.calendar-chart {
  height: 155px; /* + ul margin-top */
  position: relative;
  .calendar-chart-bar-wrap {
    position: relative;
    width: 410px;
    height: 100%;
    overflow: hidden;
    transform: translateX(0) scaleZ(1);
    margin: auto;
  }
  ul {
    margin-top: 20px;
    position: absolute;
    left: 0;
    transition: transform .25s ease-in-out;
    width: 3000%;
  }
  li {
    width: 30px;
    position: relative;
    height: 100px;
    display: inline-block;
    cursor: pointer;
    overflow: visible;
  }
  li:last-child {
    margin-right: 0;
  }
  .calendar-chart-loading {
    opacity: 0.4;
  }
  .calendar-bar, .calendar-bar-current {
    display: block;
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
    width: 20px;
    padding-right: 10px;
    background-color: @blue;
    vertical-align: bottom;
  }

  .calendar-bar:hover {
    background-color: @blue-light;
  }

  .calendar-bar-unknown {
    background-color: @blue-middle-light;
  }

  .calendar-bar-unknown:hover {
    background-color: @blue-lighter;
  }

  .calendar-bar {
    transition: height .25s linear;
  }

  .calendar-bar-current {
    background-color: @orange;
  }

  .calendar-bar-current:hover {
    background-color: @orange-light;
  }

  .selected-day-current .calendar-bar {
    background-color: @orange;
    padding-top: 100px;
    opacity: 0.15;
  }

  .calendar-price-tooltip {
    text-align: center;
    font-size: 14px;
    position: absolute;
    bottom: 100px;
    white-space: nowrap;
    right: 0;
    padding-bottom: 5px;
    margin-right: -200%;
    width: 500%;
    z-index:100;
    display: none;
  }

  .calendar-day-hover .calendar-price-tooltip {
    display: block;
  }


  /* Inactive day styles */
  .calendar-day-inactive {
    cursor: default;
    padding-top: 100px;
  }
  .calendar-day-inactive .calendar-day {
    opacity: 0.15;
  }

  .calendar-day-inactive .calendar-bar {
    padding-top: 100px;
    background-color: inherit;
  }

  /* Hide price hover for inactive day */
  .calendar-day-inactive .calendar-price-tooltip {
    visibility: hidden;
  }

  .calendar-day {
    font-size: 14px;
    width: 100%;
    margin-top: 108px;
    width: 20px;
    text-align: center;
    display: block;
    position: absolute;
    top: 0;
    line-height: 13px;
  }

  .calendar-day-weekend {
    color: @red;
  }

  .calendar-month-arrow {
    cursor: pointer;
    position: absolute;
    background: none;
    height: 100%;
    top: 0;
    width: 16px;
    background: 0 70px url(/images/calendar-arrow.svg) no-repeat;
    background-size: contain;
  }

  .calendar-month-prev {
    .calendar-month-arrow;
    margin-left: -24px;
    left: 0;
  }

  .calendar-icon-arrow {
    width: 16px;
    height: 16px;
  }

  .calendar-month-next {
    .calendar-month-arrow;
    margin-right: -24px;
    right: 0;
  }

  .calendar-month-next {
    transform: rotate(-180deg);
    background-position: 0 64px;
  }

  .calendar-day-devider {
    background: none;
    cursor: default;
  }
  .calendar-month-devider {
    transform: rotate(-90deg);
    position: absolute;
    padding-bottom: 5px;
    width: 100%;
    bottom: 20%;
  }
}

.calendar-months {
  position: relative;
}

.month-wrap {
  position: relative;
  width: 49%;
  display: inline-block;
  text-align: center;
  margin-right: 2%;
  color: #000;
  transition: width .25s ease-in-out;
  transform: translateZ(0);

  &:before {
    content: '';
    position: absolute;
    top: 10px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #ccc;
    z-index: 1;
  }

  &:after {
    content: '';
    position: absolute;
    top: 7px;
    right: 0;
    width: 1px;
    height: 7px;
    background: #ccc;
  }

  &.last {
    margin-right: 0;

    &:after {
      left: 0;
    }

  }
}

.hide-months(1, 4, first);
.hide-months(10, 13, last);

.hide-months(@i, @n, @order) when (@i =< @n) {
  .months-inner-wrap.state-@{i} .month-wrap.@{order} .month-name {
    opacity: 0;
  }
  .hide-months((@i + 1), @n, @order);
}

.months-inner-wrap {
  width: 91.3%;
  margin: 10px auto 0;

  &.state-0 .month-wrap.first {
    width: 98%;

    &:after {
      display: none;
    }

    &:before {
      width: 102%;
    }

  }

  &.state-0 .month-wrap.last {
    width: 0;


    &:after {
      display: none;
    }

  }

  &.state-0 .month-wrap.last {
    .month-name {
      opacity: 0;
    }
  }

  &.state-1 .month-wrap.first {
    width: 5%;
  }

  &.state-1 .month-wrap.last {
    width: 93%;
  }

  &.state-2 .month-wrap.first {
    width: 12.4%;
  }

  &.state-2 .month-wrap.last {
    width: 85.6%;
  }

  &.state-3 .month-wrap.first {
    width: 19.6%;
  }

  &.state-3 .month-wrap.last {
    width: 78.4%;
  }

  &.state-4 .month-wrap.first {
    width: 27.1%;
  }

  &.state-4 .month-wrap.last {
    width: 70.9%;
  }

  &.state-5 .month-wrap.first {
    width: 34.6%;
  }

  &.state-5 .month-wrap.last {
    width: 63.4%;
  }

  &.state-6 .month-wrap.first {
    width: 42%;
  }

  &.state-6 .month-wrap.last {
    width: 56%;
  }

  &.state-7 .month-wrap.first {
    width: 49.5%;
  }

  &.state-7 .month-wrap.last {
    width: 48.5%;
  }

  &.state-8 .month-wrap.first {
    width: 56.5%;
  }

  &.state-8 .month-wrap.last {
    width: 41.5%;
  }

  &.state-9 .month-wrap.first {
    width: 64.2%;
  }

  &.state-9 .month-wrap.last {
    width: 33.8%;
  }

  &.state-10 .month-wrap.first {
    width: 71.2%;
  }

  &.state-10 .month-wrap.last {
    width: 26.8%;
  }

  &.state-11 .month-wrap.first {
    width: 78.5%;
  }

  &.state-11 .month-wrap.last {
    width: 19.5%;
  }

  &.state-12 .month-wrap.first {
    width: 86%;
  }

  &.state-12 .month-wrap.last {
    width: 12%;
  }

  &.state-13 .month-wrap.first {
    width: 93.4%;
  }

  &.state-13 .month-wrap.last {
    width: 4.6%;
  }

}

.month-name {
  display: inline-block;
  background-color: #fff;
  padding: 0 5px;
  z-index: 2;
  position: relative;
  transition: opacity .25s ease-in-out;
}

.calendar-month {
  ul {
    text-align: center;
  }
  li {
    display: inline-block;
    margin-right: 12px;
    color: @gray;
    cursor: pointer;
    box-sizing: border-box;
    border-bottom: 1px solid transparent;
  }
  li:hover {
    border-bottom: 1px dotted @gray;

  }
  .calendar-month-current {
    color: @blue-dark;
  }
  .calendar-month-current:hover {
    border-bottom: 1px dotted @blue-dark;
  }
}
.calendar-head-title {
  vertical-align: bottom;
  font-size: 18px;
  height: 1.2em;
  font-weight: 600;
}

.calendar-flight-info {
  font-size: 13px;
  font-weight: 600;
}

.calendar-head-close {
  float: right;
  cursor: pointer;
  border-bottom: 1px dotted #000;
}

.calendar-price-wrap {
  width: 100%;
  line-height: 18px;
  overflow: hidden;
  .calendar-price-info {
    font-size: 18px;
    float: left;
    font-weight: 600;
  }
  .calendar-price-info div {
    height: 1em;
  }
  .calendar-total-price {
    display: inline-block;
  }
  .calendar-search-button {
    float: right;
  }
  &:after {
    clear: both;
    content: ' ';
  }
}
.calendar-search-button {
  cursor: pointer;
  background-color: @orange;
  color: white;
  width: 124px;
  height: 35px;
  border-radius: 2px;
  border: 1px solid #e16800;
  box-sizing: border-box;
  font-size: 18px;
}

/* loader */
@-moz-keyframes whirly-loader {
  0% {
    -moz-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -moz-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
@-webkit-keyframes whirly-loader {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
@keyframes whirly-loader {
  0% {
    -moz-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -moz-transform: rotate(360deg);
    -ms-transform: rotate(360deg);
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

.calendar-loader {
  position: absolute;
  top: 42px;
  left: 192px;
  height: 50px;
  width: 50px;
  z-index: 10;
  animation: rotate 0.8s infinite linear;
  border: 6px solid @blue;
  border-right-color: transparent;
  border-radius: 50%;
  visibility: visible;
}
.calendar-loader.hidden {
  visibility: none;
}

.calendar-overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  background-color: black;
  top: 0;
  left: 0;
  opacity: 0.2;
  z-index: 13;
}

.flight-params {
  font-size: 10px;
}

.direction-arrow {
  position: relative;
  display: inline-block;
  vertical-align: top;
  width: 12px;
  height: 12px;
  background: data-uri('../images/ticket-arrow.svg') no-repeat 0 0;
  margin: 0 6px;
}
