@import 'variables';
@import 'transitions';

.#{$prefix}main *,
.#{$prefix}wrapper * {
  box-sizing: border-box;
}

.#{$prefix}clearfix {
  &:after, &:before {
    content: " ";
    display: table;
  }

  &:after {
    clear: both;
  }
}

.#{$prefix}input-group {
  display: flex;
  position: relative;

  input {
    flex-grow: 1;
    border: 1px solid #dadada;
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    line-height: 30px;
    padding: 0 10px;

    &:not(.#{$prefix}is-editable) {
      cursor: pointer;
    }
  }

  label {
    color: white;
    white-space: nowrap;

    svg + span {
      display: inline-block;
      margin-right: 4px;
      vertical-align: middle;
    }
  }

  &.#{$prefix}disabled {
    input, label {
      cursor: default;
    }
  }

  .#{$prefix}clear-btn {
    position: absolute;
    left: 0;
    top: 0;
    line-height: 32px;
    width: 30px;
    cursor: pointer;
    text-align: center;
    font-style: normal;
    font-family: monospace, sans-serif;
    opacity: 0.4;

    &:hover {
      opacity: 0.7;
    }
  }
}

.#{$prefix}icon-btn {
  cursor: pointer;
  padding: 0 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.#{$prefix}wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}

.#{$prefix}container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.#{$prefix}content {
  opacity: 1;
  transition: all .4s cubic-bezier(0.25, 0.1, 0.17, 1.84);
  text-align: right;
  direction: rtl;
  width: $width;
  background-color: #ffffff;
  box-shadow: 5px 22px 95px -14px rgba(0, 0, 0, 1);
  cursor: default;
}

.#{$prefix}sidebar-container {
  display: grid;
  grid-template-columns: auto auto;
  width: $width + $sidebar-width !important;
}

.#{$prefix}sidebar {
  grid-row-start: 1;
  grid-row-end: 3;
  width: $sidebar-width;
}

.#{$prefix}header {
  color: #ffffff;
  padding: 10px 20px;
  position: relative;
}

.#{$prefix}body {
  position: relative;
}

.#{$prefix}year-label {
  margin-bottom: 2px;
  position: relative;
  height: 24px;
  opacity: 0.7;
  overflow: hidden;
  cursor: pointer;
  font-size: 16px;

  > span {
    display: inline-block;
    padding: 0 10px;
    line-height: 22px;
    height: 22px;
    border-width: 1px;
    border-style: solid;
    border-radius: 2px;
    transition: all 0.1s ease-out;

    &:not(:hover) {
      border-color: transparent !important;
      color: inherit !important;
    }
  }
}

.#{$prefix}date {
  position: relative;
  font-size: 28px;
  line-height: 40px;
  height: 40px;
  overflow: hidden;

  span {
    display: block;
    height: inherit;
    line-height: inherit;
  }
}

.#{$prefix}week {
  font-size: 12px;
  padding: 0 14px;
  line-height: 20px;
  color: #b9b9b9;
  margin-bottom: 10px;
  height: 20px;
}

.#{$prefix}weekday {
  float: right;
  width: $day-size;
  text-align: center;
}

.#{$prefix}days {
  padding: 0 18px;
  position: relative;
  overflow: hidden;
  transition: height 300ms cubic-bezier(0.75, 0.02, 0.27, 0.99);
}

.#{$prefix}day {
  width: $day-size;
  height: $day-size;
  float: right;
  line-height: $day-size;
  position: relative;

  &:not(.#{$prefix}empty) {
    cursor: pointer;
    transition: color 450ms ease;
    text-align: center;
  }

  &[disabled='true'] {
    cursor: default;
    color: darken(#ffffff, 20%);

    .#{$prefix}day-effect {
      background-color: transparent;
    }

    .#{$prefix}day-text {
      color: darken(#ffffff, 20%);
    }
  }

  &:not([disabled='true']) {
    &:hover {
      color: #ffffff;

      .#{$prefix}day-effect {
        transform: scale(1);
        opacity: 0.6;
      }
    }

    &.#{$prefix}selected {
      color: #ffffff;

      .#{$prefix}day-effect {
        transform: scale(1);
        opacity: 1;
      }
    }

    &.#{$prefix}range-between {
      color: #ffffff;
      .#{$prefix}day-effect {
        transform: scale(0.75);
        opacity: 1;
      }
    }

    &.#{$prefix}range-hover {
      color: #ffffff;
      .#{$prefix}day-effect {
        transform: scale(0.7);
        opacity: 0.6;
      }
    }
  }
}

.#{$prefix}day-effect {
  position: absolute;
  width: $day-size - 4px;
  height: $day-size - 4px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transform: scale(0);
  opacity: 0;
  transition: all 450ms ease;
}

.#{$prefix}day-text {
  position: relative;
}

.#{$prefix}controls {
  position: relative;
  z-index: 2;
  height: $month-label-height;
  line-height: $month-label-height;
  text-align: center;

  button {
    position: relative;
    background-color: transparent;
    border: none;
    user-select: none;
    outline: none;
    cursor: pointer;

    &[disabled='true'] {
      opacity: 0.3;
      cursor: default;
    }
  }
}

.#{$prefix}next,
.#{$prefix}prev {
  width: $month-label-height;
  height: $month-label-height;
  line-height: $month-label-height;
}

.#{$prefix}next {
  float: right;
}

.#{$prefix}prev {
  float: left;
}

.#{$prefix}arrow {
  width: 11px;
  height: 11px;
}

.#{$prefix}month {
  position: relative;
  overflow: hidden;
}

.#{$prefix}month-label {
  position: absolute;
  top: 0;
  left: $month-label-height;
  right: $month-label-height;
  overflow: hidden;
  width: 95px;
  margin-left: auto;
  margin-right: auto;
  line-height: $month-label-height;
  height: $month-label-height;
  text-align: center;
  cursor: pointer;

  > span {
    display: inline-block;
    padding: 0 5px;
    line-height: 26px;
    height: 26px;
    border-width: 1px;
    border-style: solid;
    border-radius: 2px;
    transition: all 0.1s ease-out;
    white-space: nowrap;

    &:not(:hover) {
      border-color: transparent !important;
      color: inherit !important;
    }
  }
}

.#{$prefix}actions {
  text-align: right;
  padding: 8px;

  button {
    border: none;
    background-color: transparent;
    display: inline-block;
    cursor: pointer;
    outline: none;
    font-size: 14px;
    text-transform: uppercase;
    min-width: 88px;
    text-align: center;
    -webkit-appearance: none;
    line-height: 36px;
    height: 36px;
    transition: all 0.3s ease;

    &:hover {
      background-color: darken(#ffffff, 5%);
    }

    &[disabled='true'] {
      opacity: 0.6;
      cursor: default;
    }
  }
}

.#{$prefix}addon-list-content {
  direction: rtl;
}

.#{$prefix}addon-list-item {
  width: (1/3)*100%;
  text-align: center;
  font-size: 14px;
  height: 44px;
  line-height: 36px;
  transition: all 0.3s ease;
  color: #8a8a8a;
  cursor: pointer;
  float: right;
  border: solid 4px #fff;

  &.#{$prefix}selected, &:hover {
    background-color: #f9f9f9;
  }

  &.#{$prefix}selected {
    font-weight: bold;
    background-color: #f5f5f5;
  }
}

.#{$prefix}addon-list {
  width: 100%;
  background-color: #ffffff;
  position: absolute;
  z-index: 2;
  overflow: auto;
  top: 0;
  bottom: 52px;
  border-bottom: solid 1px #eee;
  direction: ltr;

  &.#{$prefix}can-close {
    padding-top: 30px;
  }
}

.#{$prefix}month-list {
  padding-top: 15px;

  .#{$prefix}addon-list-item {
    height: 54px;
    line-height: 46px;

    // &.#{$prefix}selected, &:hover {}
  }
}

.#{$prefix}addon-list-item[disabled='true'] {
  opacity: 0.3;
  cursor: default !important;
  background-color: transparent !important;
}

.#{$prefix}close-addon {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  width: 30px;
  height: 30px;
  line-height: 30px;
  color: #444;
  font-family: sans-serif;
  text-align: center;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.1);
}

.#{$prefix}time {
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;

  .#{$prefix}time-h,
  .#{$prefix}time-m {
    position: relative;
    margin-top: 70px;
    float: left;
    width: 50%;
    height: 100%;
    text-align: center;
    color: #a2a2a2;

    .#{$prefix}counter {
      font-size: 90px;
      height: 100px;
      line-height: 100px;
      overflow: hidden;
      position: relative;
      direction: ltr;
      transition: opacity 0.3s ease-in-out;
    }

    .#{$prefix}counter-item {
      height: inherit;
      width: 51px;
      display: inline-block;
      vertical-align: text-top;
      position: relative;
    }
  }

  .#{$prefix}time-h:after {
    position: absolute;
    top: 50%;
    right: 0;
    content: ':';
    font-size: 70px;
    transform: translate(50%, -50%);
    transition: inherit;
  }

  .#{$prefix}up-arrow-btn,
  .#{$prefix}down-arrow-btn {
    display: block;
    cursor: pointer;
    outline: none;
    height: 34px;

    &:active svg path {
    }
  }

  &.#{$prefix}disabled .#{$prefix}counter-item {
    opacity: 0.5;
  }
}

.#{$prefix}time-column {
  .#{$prefix}counter {
    position: relative;
    input {
      position: absolute;
      z-index: 5;
      border: none;
      background-color: transparent;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      text-align: center;
      outline: none;
      font-size: inherit;
      color: inherit;
      line-height: inherit;
      opacity: 0;
      padding: 5% 0 0 0;
    }
    input:focus {
      opacity: 1;
      &:not(.is-empty) ~ div {
        opacity: 0;
      }
    }
  }
}

.#{$prefix}prev-step {
  position: absolute;
  top: 0;
  left: 0;
  width: 30px;
  height: 30px;
  text-align: center;
  padding: 9px;
  cursor: pointer;

  &:hover {
    background-color: rgba(0, 0, 0, 0.2);
  }
}

[data-type="time"] {
  .#{$prefix}time {
    .#{$prefix}time-m,
    .#{$prefix}time-h {
      margin-top: 40px;
    }
  }
}

.#{$prefix}is-inline {
  position: static;
  background-color: transparent;
  height: auto;
  width: auto;
  display: block;
  margin-top: 2px;

  .#{$prefix}container {
    position: static;
    transform: none;
  }

  .#{$prefix}content {
    box-shadow: 0 0 1px -1px black;
  }
}

.#{$prefix}is-popover {
  display: inline-block;
  position: relative;
  .#{$prefix}wrapper {
    position: static;
    width: auto;
    height: 0;
    .#{$prefix}container {
      transform: none;
      top: auto;
      left: auto;
      z-index: 500;
    }
    .#{$prefix}content {
      transition: none;
      box-shadow: 0 3px 8px rgba(black, 0.4);
    }
  }
  &[data-placement="top-left"] {
    .#{$prefix}container {
      bottom: 100%;
      left: 0;
    }
    .#{$prefix}content {
      box-shadow: 0 -3px 8px rgba(black, 0.4);
    }
  }
  &[data-placement="top-right"] {
    .#{$prefix}container {
      bottom: 100%;
      right: 0;
    }
    .#{$prefix}content {
      box-shadow: 0 -3px 8px rgba(black, 0.4);
    }
  }
  &[data-placement="bottom-left"] {
    .#{$prefix}container {
      top: 100%;
      left: 0;
    }
  }
  &[data-placement="bottom-right"] {
    .#{$prefix}container {
      top: 100%;
      right: 0;
    }
  }
  &[data-placement="left-top"] {
    .#{$prefix}container {
      bottom: 0;
      right: 100%;
    }
  }
  &[data-placement="left-bottom"] {
    .#{$prefix}container {
      top: 0;
      right: 100%;
    }
  }
  &[data-placement="right-top"] {
    .#{$prefix}container {
      bottom: 0;
      left: 100%;
    }
  }
  &[data-placement="right-bottom"] {
    .#{$prefix}container {
      top: 0;
      left: 100%;
    }
  }
}

.#{$prefix}no-footer {
  .#{$prefix}addon-list {
    bottom: 0;
    border-bottom: none;
  }
}

.#{$prefix}wrapper {
  &[data-type="datetime"] {
    &.#{$prefix}compact-time {
      .#{$prefix}time {
        margin-top: 10px;
        display: block !important;
        position: relative;
        border-top: solid 1px #eee;
        overflow: hidden;
        .#{$prefix}addon-list-content {
          display: flex;
          justify-content: center;
          direction: ltr;
        }
        .#{$prefix}counter-item {
          width: 18px;
        }
        .#{$prefix}counter {
          height: 30px;
          font-size: 20px;
          line-height: 34px;
          width: 40px;
        }
        .#{$prefix}up-arrow-btn,
        .#{$prefix}down-arrow-btn {
          position: absolute;
          top: 0;
          height: 26px;
          width: 26px;
          margin: 2px;
          border-radius: 50%;
          display: flex;
          justify-content: center;
          align-items: center;
          background-color: rgba(black, 0.05);
        }
        .#{$prefix}time-m {
          margin-top: 0;
          float: none;
          width: 100px;
          .#{$prefix}up-arrow-btn {
            right: 30px;
          }
          .#{$prefix}down-arrow-btn {
            right: 0;
          }
        }
        .#{$prefix}time-h {
          margin-top: 0;
          float: none;
          width: 100px;
          &:after {
            font-size: 20px;
          }
          .#{$prefix}counter {
            margin-left: auto;
          }
          .#{$prefix}up-arrow-btn {
            left: 0;
          }
          .#{$prefix}down-arrow-btn {
            left: 30px;
          }
        }
        svg {
          height: 10px;
        }
      }
    }

    .#{$prefix}date {
      font-size: 22px;
    }
  }

  &.#{$prefix}is-range {
    .#{$prefix}date {
      font-size: 16px;
    }
  }
  &.#{$prefix}is-multiple {
    .#{$prefix}date {
      font-size: 14px;
      white-space: normal;
      line-height: 20px;
    }
  }
}

@media screen and (max-height: 460px) {
  .#{$prefix}wrapper {
    overflow: auto;
    text-align: center;

    .#{$prefix}container {
      position: relative;
      top: 0;
      left: 0;
      transform: none;
      display: inline-block;
      margin: 20px auto;
    }
  }
}

.#{$prefix}locales {
  list-style-type: none;
  padding: 0;
  margin: 0;
  position: absolute;
  left: 14px;
  top: 12px;
  line-height: 24px;
  text-align: center;
  opacity: 0.7;

  li {
    cursor: pointer;
  }
}

// =======================
//      Simple Mode
// =======================
.#{$prefix}simple-body {
  .#{$prefix}header {
    display: flex;
    padding: 10px;
    justify-content: space-between;
  }
  .#{$prefix}locales {
    position: static;
    padding: 0 5px;
    line-height: unset;
  }
}

.#{$prefix}simple-content {
  display: flex;
  justify-content: center;
  height: 240px;
  direction: ltr;

  .#{$prefix}column {
    height: 100%;
    flex-grow: 1;
    display: flex;
    flex-flow: column;
    padding: 5px;

    .#{$prefix}column-header {
      text-align: center;
      font-weight: bold;
      color: black;
      height: 30px;
      line-height: 30px;
    }

    .#{$prefix}column-content {
      flex-grow: 1;
      height: 100%;
      overflow: auto;
      padding-right: 4px;
      position: relative;
      &:before,
      &:after {
        display: block;
        height: 80px;
        content: '';
      }

      @media screen and (min-width: 640px) {
        &::-webkit-scrollbar {
          width: 8px;
        }
        &::-webkit-scrollbar-track {
          background: rgba(black, 0.05);
          border-radius: 5px;
        }
        &::-webkit-scrollbar-thumb {
          background: rgba(black, 0.2);
          border-radius: 5px;
        }
        &::-webkit-scrollbar-thumb:hover {
          background: rgba(black, 0.5);
        }
      }
    }
  }

  .#{$prefix}addon-list-item {
    width: 100%;
    float: none !important;
    line-height: 42px;
    height: 44px;
    border: solid 1px white;
  }

  .#{$prefix}range-first {
    border-radius: 40px 40px 0 0;
  }

  .#{$prefix}range-between {
    font-weight: bold;
    background-color: #f5f5f5;
  }

  .#{$prefix}range-last {
    border-radius: 0 0 40px 40px;
    &.#{$prefix}range-first {
      border-radius: 40px;
    }
  }

  .#{$prefix}column.#{$prefix}is-mounted {
    .#{$prefix}selected:not(.#{$prefix}range-first):not(.#{$prefix}range-last):not([disabled='true']) {
      position: sticky;
      top: 0;
      bottom: 0;
    }
  }
}

.#{$prefix}is-multiple {
  .#{$prefix}simple-content {
    .#{$prefix}column {
      .#{$prefix}selected {
        position: static !important;
      }
    }
  }
}


.#{$prefix}dir-ltr {
  .#{$prefix}content,
  .#{$prefix}actions,
  .#{$prefix}addon-list-content {
    direction: ltr;
  }

  .#{$prefix}content,
  .#{$prefix}actions {
    text-align: left;
    font-family: sans-serif;
  }

  .#{$prefix}month-label {
    font-size: 90%
  }

  .#{$prefix}addon-list-item,
  .#{$prefix}weekday,
  .#{$prefix}day {
    float: left;
  }

  .#{$prefix}locales {
    left: auto;
    right: 14px;
  }
}

.#{$prefix}dir-rtl {
  .#{$prefix}next,
  .#{$prefix}prev {
    transform: rotateY(180deg);
  }

  .#{$prefix}next {
    float: left
  }

  .#{$prefix}prev {
    float: right
  }
}
