$orange-color: #ff8726;
$emerald-color: #49bf88;
$lime-color: #5dca70;
$white-color: #fff;
$small-radius: 4px;
$large-radius: 40px;
$cyan-color: #2196f3;
$button_shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);

@mixin borderRadius($px) {
  -webkit-border-radius: $px;
  -moz-border-radius: $px;
  border-radius: $px;
}

@mixin boxSizing($value) {
  -webkit-box-sizing: $value;
  -moz-box-sizing: $value;
  box-sizing: $value;
}

@mixin boxShadow($value) {
  -webkit-box-shadow: $value;
  -moz-box-shadow: $value;
  box-shadow: $value;
}

@mixin transition($value) {
  -webkit-transition: $value;
  -moz-transition: $value;
  -ms-transition: $value;
  -o-transition: $value;
  transition: $value;
}

@mixin transform($value) {
  -webkit-transform: $value;
  -moz-transform: $value;
  -ms-transform: $value;
  -o-transform: $value;
  transform: $value;
}


%overlay {
  content: '';
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: $white-color;
  opacity: 0.12;
  pointer-events: none;
}

%notice {
  padding: 10px;
  margin: 20px 20px 20px 0;
  background-color: $white-color;
  border-left: 5px solid #000;
  @include boxShadow(0 1px 1px 0 rgba(0,0,0,.3));
}

.clearfix {
  &:after, &:before {
    content: '';
    display: block;
    clear: both;
  }
}

.no-display {
  display: none;
}

.hidden-item {
  visibility: hidden;
}

// Tabs general styles
.tabs {
  display: flex;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  white-space: nowrap;
  width: 100%;
  background-color: $white-color;

  .tab {
    flex-grow: 1;
    display: block;
    text-align: center;
    padding: 0;
    margin: 0;
    float: left;
    text-transform: uppercase;
    text-overflow: ellipsis;
    overflow: hidden;
    letter-spacing: 0.8px;
    min-width: 80px;
    background-color: $cyan-color;

    a {
      text-decoration: none;
      color: $white-color;
      background-color: $cyan-color;
      display: block;
      width: 100%;
      height: 100%;
      text-overflow: ellipsis;
      overflow: hidden;
      @include transition(color 0.3s ease);
    }

    &.disabled a {
      cursor: default;
      opacity: 0.6;
    }
  }

  .indicator {
    position: absolute;
    bottom: 0;
    height: 3px;
    will-change: left, right;
    background-color: $orange-color;
  }
}

// Button style
.ju-button {
  background-color: transparent;
  color: #000;
  padding: 10px 15px;
  min-width: 180px;
  border: 1px solid #9fabba;
  text-transform: uppercase;
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  letter-spacing: 2px;
  transition: all ease 0.5s;
  vertical-align: middle;
  @include borderRadius($large-radius);

  &:focus {
    outline: none;
  }

  &:hover {
    @include boxShadow($button_shadow);
  }

  &.orange-button {
    background-color: $orange-color;
    color: $white-color;
    border-color: $orange-color;
  }

  &.orange-outline-button {
    background-color: $white-color;
    color: $orange-color;
    border-color: $white-color;
  }
}

// Rectangular orange button
.ju-rect-button {
  background-color: $white-color;
  border: 1px solid $orange-color;
  color: $orange-color;
  cursor: pointer;
  padding: 10px 15px;
  @include borderRadius($small-radius);
}

// Material styles button
.ju-material-button {
  border: none;
  outline: none;
  padding: 10px 20px;
  text-transform: uppercase;
  cursor: pointer;
  font-size: 14px;
  background-color: $cyan-color;
  color: $white-color;

  &:hover {
    @include boxShadow($button_shadow);
  }
}

// Input style
input.ju-input {
  padding: 15px;
  border: 1px solid #ddd;
  background-color: $white-color;
  height: auto;
  @include borderRadius($small-radius);

  &:focus {
    border-color: $orange-color;
    box-shadow: none;
    outline: none;
  }

  // Input with color picker (minicolors - should include minicolors styles)
  &.minicolors {
    padding-left: 55px;

    + .minicolors-swatch {
      height: 48px;
      width: 48px;
      top: 2px;
      left: 2px;
      border: none;

      .minicolors-swatch-color {
        @include borderRadius($small-radius);
      }
    }

    .minicolors-grid {
      .minicolors-picker {
        @include boxSizing(content-box);

        > div {
          @include boxSizing(content-box);
        }
      }
    }
  }
}

// Selection
select.ju-select {
  padding: 0 15px;
  height: 50px;
  vertical-align: middle;
  @include borderRadius($small-radius);

  &:focus {
    border: 1px solid $orange-color;
    box-shadow: none;
    outline: none;
  }
}

// Checkbox
input.ju-checkbox:checked {
  background-color: $emerald-color;
  border: 1px solid $emerald-color;

  &:before {
    color: $white-color;
  }
}

// Radio box
input.ju-radiobox {
  border-color: #7d8a9a;
  @include boxShadow(none);

  &:checked {
    border-color: $emerald-color;

    &:before {
      width: 10px;
      height: 10px;
      margin: 2px;
      background-color: $emerald-color;
    }
  }

  &:focus {
    border-color: $emerald-color;
    @include boxShadow(none);
  }
}

// Notice on top
.ju-notice-success {
  @extend %notice;
  border-left-color: #46b450;
}

.ju-notice-error {
  @extend %notice;
  border-left-color: #cc0000;
}

.ju-notice-close {
  float: right;
  color: #aaa;

  &:hover {
    color: #c00;
    cursor: pointer;
  }
}

// Switch button
.ju-switch-button {
  float: right;
  margin-left: 10px;
  margin-right: 30px;

  .switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
    margin: 10px;

    input {
      display: none;
    }

    .slider {
      position: absolute;
      cursor: pointer;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: #ccc;
      @include transition(.4s);
      @include borderRadius(40px);

      &:before {
        position: absolute;
        content: '';
        height: 27px;
        width: 27px;
        left: 2px;
        bottom: 2px;
        background-color: $white-color;
        @include transition(.4s);
        @include borderRadius(50%);
      }
    }

    input:checked {
      + .slider {
        background-color: $lime-color;

        &:before {
          @include transform(translateX(20px));
        }
      }
    }
  }
}

// Settings option style
.settings-list {
  display: flex;
  flex-wrap: wrap;
  flex: auto;
}

.ju-settings-option {
  width: 48%;
  margin-bottom: 20px;
  margin-right: 2%;
  background-color: $white-color;
  @include boxShadow(0 10px 30px 0 rgba(160, 166, 190, 0.08));
  @include borderRadius($small-radius);

  &.settings-separator {
    background-color: transparent;
    @include boxShadow(none);
  }

  &.full-width, &.settings-separator {
    width: 98%;
  }

  &.settings-separator {
    .settings-separator-title {
      display: block;
      font-size: 20px;
      font-weight: bold;
    }
  }
}

// Label for settings option
.ju-setting-label {
  float: left;
  display: inline-block;
  min-width: 150px;
  max-width: calc(100% - 150px);
  overflow: hidden;
  white-space: nowrap;
  -ms-text-overflow: ellipsis;
  text-overflow: ellipsis;
  margin: 0;
  line-height: 50px;
  cursor: pointer;
}

// Main wrapper
.ju-main-wrapper {
  margin-left: -20px; // This will make the left panel settings come near wp menus
  font-family: 'Roboto', sans-serif;

  * {
    @include boxSizing(border-box);
  }

  img {
    max-width: 100%;
  }

  // Style for left side panel
  .ju-left-panel {
    width: 300px;
    height: 100%;
    padding: 20px 0;
    background-image: linear-gradient(to bottom, #6465e2, #60c3ef);
    position: fixed;
    overflow: auto;
    z-index: 15;
    @include boxShadow(10px 20px 20px 0 rgba(186, 192, 213, 0.1));

    // Left side logo
    .ju-logo a {
      display: block;
      width: 230px;
      height: 90px;
      margin: auto;
    }

    // Search menus
    .ju-menu-search {
      margin: 20px 10px;
      padding: 10px 5px;
      border: none;
      border-bottom: 1px solid #6294e9;

      .ju-menu-search-icon {
        font-size: 20px;
        color: $white-color;
        vertical-align: text-bottom;
      }

      .ju-menu-search-input {
        background: transparent;
        color: $white-color;
        border: none;
        outline: none;
        padding: 5px;
        font-size: 18px;
        @include boxShadow(none);

        &::placeholder {
          color: $white-color;
          opacity: 0.5;
        }
      }
    }

    // Left side menu tabs
    .tabs.ju-menu-tabs {
      display: block;
      background-color: transparent;
      height: auto;
      margin: 20px 0;

      li.tab {
        float: none;
        width: auto;
        height: auto;
        text-align: left;
        position: relative;
        line-height: normal;
        background-color: transparent;

        a.link-tab {
          padding: 20px;
          opacity: 0.7;
          background-color: transparent;

          &:hover:before {
            @extend %overlay;
          }

          &:focus {
            outline: none;
            @include boxShadow(none);
          }

          &:after {
            font-family: 'Material Icons';
            font-size: 24px;
            vertical-align: text-bottom;
            position: absolute;
            right: 15px;
          }

          &.with-submenus:not(.expanded):after {
            content: '\e313';
          }

          &.active {
            opacity: 1;
            background-color: #4c79ca;

            &.with-submenus.expanded {
              &:after {
                content: '\e316';
              }

              + .ju-submenu-tabs {
                max-height: 500px;
              }
            }

            &:not(.expanded) {
              background-color: transparent;

              &:before {
                @extend %overlay;
              }
            }
          }
        }

        .ju-submenu-tabs {
          display: block;
          max-height: 0;
          background-color: #4c79ca;
          @include transition(max-height cubic-bezier(0.3, 1.1, 0.3, 1.1) 1s);

          div.link-tab {
            padding: 20px;
            cursor: pointer;
            color: #fff;
            margin-left: 32px;
            font-size: 16px;
            opacity: 0.7;

            &:hover:before {
              @extend %overlay;
            }

            &.active {
              opacity: 1;

              &:before {
                @extend %overlay;
              }
            }
          }
        }

        .menu-tab-icon {
          font-size: 22px;
          vertical-align: sub;
        }

        .tab-title {
          font-size: 16px;
          margin-left: 5px;
          display: inline-block;
          max-width: 75%;
          overflow: hidden;
          -ms-text-overflow: ellipsis;
          text-overflow: ellipsis;
          vertical-align: text-bottom;
        }
      }

      .indicator {
        display: none;
      }
    }
  }

  // Style for right side panel
  .ju-right-panel {
    width: calc(100% - 300px);
    padding: 0 20px;
    font-size: 14px;
    margin-left: 300px;
    background-color: #f3f6fa;

    &:before {
      content: '';
      display: block;
      clear: both;
      padding: 1px 0 0 0;
    }

    // Top nav tabs
    .ju-top-tabs-wrapper {
      background-color: #fff;
      margin: auto -20px;
    }

    .tabs.ju-top-tabs {
      width: fit-content !important;

      li.tab {
        text-transform: capitalize;
        min-width: 200px;
        background-color: $white-color;

        a.link-tab {
          color: $orange-color;
          background-color: $white-color;
          font-weight: bold;
          padding: 20px;

          &.active:before {
            content: '\f147';
            font-family: 'dashicons';
            font-size: 20px;
            vertical-align: middle;
          }

          &:focus {
            @include boxShadow(none);
          }
        }
      }

      .indicator {
        background-color: $orange-color;
        z-index: 10;
      }
    }
  }

  .ju-left-panel-toggle {
    display: none;
    position: fixed;
    top: 120px;
    left: 35px;
    cursor: pointer;
    background-color: $white-color;
    width: auto;
    height: auto;
    padding: 25px 5px;
    border: 1px solid #ddd;
    opacity: 0.5;
    z-index: 15;
    @include borderRadius(0 25px 25px 0);

    &:hover, &:focus {
      opacity: 1;
    }

    .ju-left-panel-toggle-icon {
      color: $orange-color;
    }
  }
}

.search-result {
  outline: 1px solid $orange-color;
  @include boxShadow(1px 1px 12px #ccc);
}

//Support RTL
.rtl {
  .ju-main-wrapper {
    margin-left: 0;
    margin-right: -20px;

    .ju-left-panel {
      .tabs.ju-menu-tabs li.tab {
        text-align: inherit;
      }
    }

    .ju-right-panel {
      margin-left: 0;
      margin-right: 300px;
    }

    .ju-left-panel-toggle {
      left: unset;
      right: 35px;
      @include borderRadius(25px 0 0 25px);
    }
  }

  .ju-setting-label {
    float: right;
  }

  .ju-switch-button {
    float: left;
  }
}

@media screen and (max-width: 960px) {
  .ju-main-wrapper {
    .ju-left-panel {
      display: none;
    }

    .ju-right-panel {
      width: 100%;
      margin-left: 0;

      .tabs.ju-top-tabs {
        width: 100% !important;
        flex-wrap: wrap;

        li.tab {
          flex: 0 0 100%;

          a.link-tab {
            &.active {
              background-color: $orange-color;
              color: $white-color;

              &:before {
                display: none;
              }
            }
          }
        }

        .indicator {
          display: none;
        }
      }
    }

    .ju-left-panel-toggle {
      display: block;
    }
  }

  .rtl {
    .ju-main-wrapper {
      .ju-right-panel {
        margin-right: 0;
      }
    }
  }
}

@media screen and (max-width: 782px) {
  .ju-main-wrapper {
    .ju-left-panel-toggle {
      left: 0;
    }
  }

  .ju-settings-option {
    width: 98%;
  }

  .rtl {
    .ju-main-wrapper {
      .ju-left-panel-toggle {
        right: 0;
      }
    }
  }
}