* {
  box-sizing: border-box;
}

body {
  font-size: $font-size;
}

// 
// T4 Logo
.brand {
  color: $font-color;
  font-size: $font-size-l*1.5;
  font-weight: 500;
  float: left;
  line-height: $base-padding*4;
  padding: $base-padding*1.5 0;
}

.t4-current-style {
  color: $font-color;
  font-size: $font-size-l*1.5;
  font-weight: 500;
  float: left;
  line-height: $base-padding*4;
  padding: $base-padding*1.5 0;
  position: relative;

  h1 {
    font-size: $font-size;
    margin: 0 $base-margin 0 0;
    float: left;

    @media screen and (min-width: $sm) {
      font-size: $font-size-l;
      min-width: 190px;
    }
  }

  .dropdown-toggle {
    background-color: $gray-200;
    border: 1px solid $white;
    border-radius: 3px;
    display: block;
    float: left;
    height: $base-height*3;
    line-height: 1;
    margin-top: 4px;
    position: relative;
    text-align: center;
    width: $base-width*3;
    z-index: 20;

    &:after {
      display: none;
    }

    &:hover {
      border: 1px solid $border-color;
      cursor: pointer;
    }

    i {
      font-size: $font-size-s;
      line-height: $base-height*3;
      vertical-align: top;
    }
  }

  .dropdown-menu {
    border: 1px solid $border-color;
    border-radius: 3px 0 3px 3px;
    box-shadow: $elevationZ2;
    font-size: $font-size;
    right: 0;
    top: 37px;
    padding-top: 0;
    padding-bottom: 0;
    overflow-y: auto;
    max-height: 780px;
    z-index: 10;

    .dropdown-title {
      background-color: $gray-200;
      border-bottom: 1px solid $gray-300;
      color: $gray-800;
      display: block;
      font-size: $font-size-xs;
      font-weight: 600;
      padding: $base-padding;
      line-height: 1;
      text-transform: uppercase;
    }

    ul {
      list-style: none;
      margin: 0;
      padding: 0;

      li {
        border-bottom: 1px solid $gray-200;
        font-size: $font-size-s;
        padding: 0;

        &:last-child {
          border-bottom: 0;

          a {
            border-radius: 0 0 3px 3px;
          }
        }
      }

      a {
        color: $gray-700;
        display: block;
        padding: $base-padding $base-padding*2;
        transition: $btn-trans;

        &:hover, &:focus, &:active {
          background-color: $gray-100;
          color: $gray-700;
          text-decoration: none;
        }
      }

      li {
        &.master a {
          padding: 0;

          span {
            padding: $base-padding $base-padding*7 $base-padding $base-padding*2;
          }
        }

        > span {
          padding: $base-padding $base-padding*2;
        }
      }

      span {
        display: inline-block;
        position: relative;
      }

      li.master span:before {
        background-color: $blue;
        border-radius: 3px;
        content: "Default";
        display: inline-block;
        color: $white;
        font-size: 9px;
        letter-spacing: 0.5px;
        line-height: 1;
        padding: 3px 4px;
        position: absolute;
        text-transform: uppercase;
        top: 2px;
        right: 2px;
      }

      // Current style
      li.current {
        font-weight: 600;

        span {
          color: $green;
        }
      }

      li.master span {
        padding-right: $base-padding*7;
      }
    }
  }

  &.open,
  &.show {
    .dropdown-toggle {
      border: 1px solid $border-color;
      border-radius: 3px 3px 0 0;
      border-bottom: 0;
    }
  }
}

#attrib-themeConfig {
  background-color: whitesmoke;
  border-radius: 0;
  border: 0;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  bottom: 0;
  margin: 0;
  z-index: 1050;
  width: 100%;

  @media screen and (min-width: $lg) {
    background-color: $white;
  }
}

#custom-style-preview {
  background-color: $gray-100;
  display: none;
  left: $view-panel-width + $view-panel-container-width + 3px;
  top: $commands-panel-height;
  right: 0;
  bottom: 0;
  position: absolute;
  margin: 0 auto;
  padding: $base-padding/2;
  overflow: auto;
  text-align: center;
  transition: $btn-trans;

  @media screen and (min-width: $lg) {
    display: block;
    overflow: hidden;
  }

  iframe {
    border: 1px dashed rgba(0,0,0,0.2);
    height: 100%;
    padding: 2px;
    max-width: none;
    width: 100%;
  }
}

.t4-sidebar-preview {
  background-color: $main-color;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  height: $commands-panel-height;
  padding: 0 0 0 $base-padding*2;
  position: absolute;
  top: 0;
  left: 0;
  text-align: right;
  width: 100%;
  z-index: 200;

  @media screen and (min-width: $sm) {
    position: fixed;
    display: flex;
    align-items: stretch;
  }

  //template title
  .t4-template-title {
    padding-top: $base-padding*1.5;
    padding-bottom: $base-padding*1.5;
    position: absolute;
    right: 460px;

    .control-label{
      width: auto;
    }

    .controls {
      margin: 0;
      float: left;
      @include clearfix();
    }

    #jform_title {
      width: 220px;
    }
  }

  .t4-toolbar {
    padding-top: $base-padding*1.5;
    padding-bottom: ($base-padding*1.5) - 1;

    @media screen and (min-width: $lg) {
      background-color: rgba($black, 0.03);
    }
  }
}

// Reload preview button
.reload-preview {
  color: $gray-400;
  display: none;
  font-family: $main-font;
  font-size: $font-size-xs;
  font-weight: 500;
  margin-left: auto;
  padding-right: 1rem;
  letter-spacing: 1px;
  line-height: 55px;
  text-transform: uppercase;

  @media screen and (min-width: $lg) {
    display: inline-block;
  }

  &:hover {
    color: $link-hover-color;
    cursor: pointer;
  }

  i {
    margin-right: $base-margin/2;
  }
}

// Toolbar devices
.toolbar-devices {
  border-right: 1px solid rgba($black, 0.075);
  border-left: 1px solid rgba($black, 0.065);
  display: none;
  list-style: none;
  margin: 0;
  padding-left: $base-padding*2;
  padding-right: $base-padding;
  @include clearfix();

  @media screen and (min-width: $lg) {
    display: block;
  }

  li {
    float: left;
  }

  .label {
    background-color: transparent;
    color: $gray-500;
    border-radius: 0;
    font-size: $font-size-s;
    letter-spacing: 0.5px;
    line-height: $base-height*4;
    padding: 0 $base-padding 0 0;
    text-transform: uppercase;
  }

  .default {
    display: inline-block;
    font-weight: 500;
    font-size: $font-size-s;
    font-family: $main-font;
    line-height: $base-height*4;
    padding-right: $base-padding;
    text-transform: uppercase;

    &:hover {
      cursor: pointer;
    }
  }

  .btn {
    margin: 0 $base-margin/2;
    @include btn-reset();
    @include btn-icon($font-size-s, $gray-600, $blue, 16px, 16px, 8px);
  }

  .active {
    color: $blue;

    span {
      color: $blue;
    }
  }
}


// Toolbar save
.toolbar-save {
  padding-left: $base-padding;
  padding-right: $base-padding*2;

  .t4-btn {
    margin-left: $base-margin;

    &.btn-save {
      background-color: $green;
      box-shadow: $elevationZ2;
      color: $white;
    }

    &.btn-close {
      i {
        margin-right: 0;
      }
    }

    i {
      margin-right: 0;

      @media screen and (min-width: $sm) {
        margin-right: $base-margin/2;
      }      
    }
  }

  span.btn-text {
    display: none;

    @media screen and (min-width: $sm) {
      display: inline-block;
    }
  }
}

// Toolbar disabled
.t4-sidebar-preview.disabled {
  .toolbar-save .btn-save {
    background-color: $btn-bg;
    box-shadow: none;
    color: $btn-color;
  }

  .toolbar-save .t4-btn.dropdown-toggle {
    background-color: $btn-bg;
    color: $btn-color;

    .caret {
      border-top-color: $btn-color;
      border-bottom-color: $btn-color;
    }
  }
}

.j4, .j5 {
  .disabled {
    opacity: .6;
  }

  #fieldset-themeConfig {
    display: none;
  }
}

// Save button
.t4-admin-save {
  float: left;
  position: relative;

  .t4-btn.btn-save {
    border-radius: $input-border-radius 0 0 $input-border-radius;
    padding-right: $base-padding;
    -webkit-appearance: none; //fixed on safari
  }

  .t4-btn.dropdown-toggle {
    background-color: $green;
    border-left: 1px solid rgba(0,0,0,0.1);
    border-radius: 0 $input-border-radius $input-border-radius 0;
    margin-left: 0;
    padding-left: $base-padding;
    padding-right: $base-padding;
    -webkit-appearance: none; //fixed on safari
    .caret {
      margin-top: 14px;
    }
  }

  .dropdown-menu {
    border-radius: 5px;
    left: auto;
    right: 0;
    top: 40px;
    padding-top: 0;
    padding-bottom: 0;

    &:before,
    &:after {
      border-left: 5px solid transparent;
      border-right: 5px solid transparent;
      border-bottom: 5px solid $white;
      content: "";
      display: block;
      position: absolute;
      top: -5px;
      right: 10px;
    }

    &:before {
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
      border-bottom: 6px solid $gray-300;
      right: 9px;
      top: -7px;
    }

    li:first-child a {
      border-radius: 5px 5px 0 0;
      border-bottom: 1px solid lighten($border-color, 3%);
    }

    li:last-child a {
      border-radius: 0 0 5px 5px;
    }

    a {
      padding-top: $base-padding;
      padding-bottom: $base-padding;

      &:hover, &:focus, &:active {
        background-color: $gray-200;
        color: $gray-800;
      }
    }
  }
}


//
// PANEL STYLE
// -----------------------------------

// Template information
// --------------------
.t4-tpl-detail {
  clear: both;
  margin-top: $base-margin;

  .tpl-preview {
    margin-bottom: $base-margin*3;

    img {
      border: 1px solid $border-color;
      border-radius: 5px;
      box-shadow: 0 3px 3px rgba(0,0,0,0.1);
      max-width: 100%;
    }
  }
}

.t4-admin-overview-features {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  overflow: hidden;

  li {
    padding: 0 $base-padding $base-padding 0;

    a {
      background-color: $gray-200;
      border-radius: $input-border-radius;
      color: $gray-600;
      display: block;
      height: $base-height*4;
      line-height: $base-height*4;
      padding: 0 $base-padding*1.5;
      text-align: center;
      transition: $btn-trans;

      &:hover, &:focus, &:active {
        background-color: $blue;
        color: $white;
        text-decoration: none;
      }

      span {
        margin-right: $base-margin;
      }
    }
  }
}

.t4-admin-overview-body {
  margin-bottom: $base-margin*2;
}

.t4-template-more-info {
  background-color: $gray-100;
  border-radius: 5px;
  margin-bottom: $base-margin*2;
  padding: $base-padding*2;

  h4 {
    margin: 0 0 $base-margin;
  }

  ul {
    list-style: none;
    margin: 0;
    padding: 0;

    li {
      border-bottom: 1px dashed $border-color;
      padding: $base-padding 0;

      span {
        color: $gray-600;
        font-weight: 600;
        display: inline-block;
        min-width: 120px;
      }
    }
  }
}

// Menu Assignment
// --------------------
#assignment.t4-assignment {
  padding: $base-padding*2;

  .btn-toolbar {
    .btn {
      @extend .t4-button;
      background-color: $gray-300;
    }
  }

  .menu-links-block {
    background-color: $white;
    border-radius: 5px;
    border: 1px solid $border-color;
    transition: $btn-trans;

    label {
      font-size: $font-size-xs;
      margin-bottom: $base-margin*1.5;
      padding-left: 0;

      input[type="checkbox"] {
        border: 1px solid $border-color;
        margin-left: 0;
        margin-right: $base-margin;
      }
    }

    .btn {
      @extend .t4-button;
    }

    &:hover {
      border: 1px solid darken($border-color, 10%);
      box-shadow: 0 0 5px rgba(0,0,0,0.1);
    }
  }
}

// Loading
.t4admin-loading::after {
  background: url(../images/t4admin-loading.gif) no-repeat center center #fff;
  bottom: 0;
  content: "";
  display: block;
  top: 0;
  left: 0;
  position: fixed;
  right: 0;
  z-index: 1000;
}


// Disable form element
.disabled {
  button, .btn, .controls, label {
    pointer-events: none;
  }
}

// Disable configure modal on mobile
// ---------------------------------
.themeConfigModal {
  display: none;

  @media screen and (min-width: $md) {
    display: block;
  }
}