// framework
.cs-framework{
  position: relative;
  margin-top: 20px;
  margin-right: 20px;

  // wp core settings error div
  .settings-error {
    margin: 0 0 15px 0;
  }

  // header
  .cs-header{
    position: relative;
    background-color: #050505;
    padding: 25px;
    @include border-radius(2px 2px 0 0);

    h1{
      color: #eee;
      float: left;
      font-size: 1.5em;
      line-height: 26px;
      font-weight: 400;
      margin: 0;

      small{
        font-size: 11px;
        color: #555;
        font-weight: 500;
      }
    }

    fieldset{
      float: right;

      input{
        margin: 0 2px;
        line-height: 26px;
      }
    }
  }

  // body
  .cs-body{
    position: relative;
    background-color: #fff;
  }

  // option navigation
  .cs-nav{
    display: block;
    position: relative;
    z-index: 10;
    float: left;
    width: 225px;

    ul{
      clear: left;
      margin: 0;
      list-style-type: none;

      li{
        margin-bottom: 0;

        a{
          font-size: 13px;
          position: relative;
          display: block;
          padding: 15px;
          text-decoration: none;
          color: #999;
          background-color: #222;
          border-bottom: 1px solid #2f2f2f;
          @include transition(all 0.2s ease-out);

          &:hover{
            color: #fff;
          }

          &:focus{
            outline: none;
            @include box-shadow(none);
          }
        }

        // active style and arrow
        .cs-section-active{
          color: #fff;
          background-color: #111;

          &:after{
            content: " ";
            position: absolute;
            right: 0;
            top: 50%;
            height: 0;
            width: 0;
            pointer-events: none;
            border: solid transparent;
            border-right-color: #fff;
            border-width: 4px;
            margin-top: -4px;
          }
        }

        .cs-arrow:after{
          content: "\f054";
          display: inline-block;
          font-family: "FontAwesome";
          font-size: 9px;
          line-height: 1;
          position: absolute;
          right: 10px;
          top: 50%;
          margin-top: -4px;
          @include transform(rotate(0));
          @include transition(transform 0.2s);
        }

        &.cs-tab-active .cs-arrow:after{
          @include transform( rotate(90deg) );
        }
      }

      ul{
        display: none;
        position: relative;
        border-bottom: 1px solid #2f2f2f;
        position: relative;

        li{

          a{
            font-size: 12px;
            padding: 13px 15px 13px 25px;
            background-color: #191919;
            border-bottom: 1px solid #222;
          }

          .cs-section-active{
            background-color: #101010;
          }

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

        &:before{
          content: '';
          position: absolute;
          top: 0;
          left: 15px;
          z-index: 1;
          width: 1px;
          height: 100%;
          background-color: rgba(#222, 0.75);
        }
      }
    }

    .cs-icon{
      width: 20px;
      margin-right: 5px;
      font-size: 14px;
      text-align: center;
    }

    .cs-seperator{
      color: #fff;
      font-weight: 600;
      text-transform: uppercase;
      padding: 30px 15px 15px 15px;
      border-bottom: 1px dashed #2f2f2f;
    }
  }

  // nav background
  .cs-nav-background{
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 9;
    width: 225px;
    background-color: #222;
  }

  // content
  .cs-content{
    position: relative;
    margin-left: 225px;

    .cs-sections{
      float: left;
      width: 100%;
    }

    .cs-section-title{
      display: none;
      padding: 20px 30px;
      background-color: #5bc0de;

      h3{
        color: #fff;
        margin: 0;
        padding: 0 !important;
        font-weight: bold;
        text-transform: uppercase;
        @include text-shadow(1px 1px 0 rgba(#44a7c5, 0.5));
      }
    }

    .cs-section{
      display:none;
    }

  }

  // footer
  .cs-footer{
    padding: 20px;
    color: #555;
    text-align: right;
    font-size: 11px;
    background-color: #050505;
    @include border-radius(0 0 2px 2px);
  }

  // others things
  .cs-show-all{
    .cs-nav-background,
    .cs-nav{
      display: none;
    }

    .cs-content{
      margin-left: 0;
    }

    .cs-section-title,
    .cs-section{
      display: block !important;
    }
  }

  .cs-expand-all{
    position: absolute;
    right: 40px;
    bottom: 5px;
    z-index: 1;
    color: #555;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;

    &:hover{
      color: #fff;
    }

    &:focus{
      @include box-shadow(none);
    }
  }

  .cs-element:last-child{
    border-bottom: 0 !important;
  }
}

// metabox framework
.cs-metabox-framework{
  margin: -6px -12px -12px -12px;

  .cs-content{
    .cs-section-title{
      padding: 20px;
    }
  }
}

// elements
.cs-element{
  position: relative;
  padding: 30px;
  border-bottom: 1px solid #eee;

  &:hover{
    background-color: #f9f9f9;
  }

  p:last-child{
    margin-bottom: 0 !important;
  }

  &.pseudo-field{
    padding: 0 5px 0 0 !important;
    border: none;
    display: inline-block;
  }

  h4{
    margin-top: 0;
  }

  .cs-title{
    position: relative;
    width: 25%;
    float: left;

    h4{
      margin: 0;
    }
  }

  .cs-fieldset{
    margin-left: 30%;
  }

  pre{
    clear: both;
    color: #ccc;
    background-color: #222;
    padding: 15px;
    overflow: auto;
    @include border-radius(2px);

    strong{
      color: #ffbc00;
    }
  }

}

// text
.cs-field-text{
  input{
    width: 340px;
    max-width: 100%;
  }
}

// textarea
.cs-field-textarea{
  textarea{
    width: 100%;
    max-width: 100%;
    min-height: 125px;
  }

  .cs-shortcode{
    margin-bottom: 10px;
  }
}

// number
.cs-field-number{
  input{
    width: 70px;
  }
  em{
    margin-left: 5px;
    color: #bbb;
  }
}

// select
.cs-field-select{
  select{
    max-width: 100%;
  }
}

// chosen fix
.chosen-container{
  max-width: 100%;

  .search-field input[type="text"] {
    height: inherit !important;
  }
}

// typography
.cs-field-typography{
  select,
  .chosen-container{
    margin-right: 5px;
  }
}

// checkbox and radio
.cs-field-checkbox,
.cs-field-radio{
  ul{
    margin: 0;
    padding: 0;
    list-style-type: none;
  }

  .horizontal li{
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 15px;
  }
}


// switch
.cs-field-switcher{

  label {
    float: left;
    cursor: pointer;
    position: relative;
    width: 62px;
    height: 26px;
    overflow: hidden;
    @include border-radius(20px);

    span {
      position: absolute;
      top: 4px;
      left: 4px;
      width: 18px;
      height: 18px;
      background-color: #fff;
      @include border-radius(16px);
      @include transition(left 0.15s ease-out);
    }

    input {
      position: absolute;
      top: 0;
      left: 0;
      opacity: 0;

      &:checked ~ em {
        background: #4fb845;
      }

      &:checked ~ em:before {
        opacity: 0;
      }

      &:checked ~ em:after {
        opacity: 1;
      }

      &:checked ~ span {
        left: 40px;
      }
    }

    em {
      position: relative;
      display: block;
      height: inherit;
      font-size: 11px;
      line-height: 26px;
      font-weight: 500;
      font-style: normal;
      text-transform: uppercase;
      color: #fff;
      background-color: #ed6f6f; // #d55050
      @include transition(background 0.15s ease-out);
    }

    em:before, em:after {
      position: absolute;
      @include transition(opacity 0.15s ease-out);
    }

    em:before {
      content: attr(data-off);
      right: 14px;
    }

    em:after {
      content: attr(data-on);
      left: 14px;
      opacity: 0;
    }
  }

  .cs-text-desc{
    margin-left: 70px;
    margin-top: 0;
    padding-top: 3px;
  }
}

// image_select
.cs-field-image_select{

  label{
    display: inline-block;
    margin: 5px;
    background-color: #fff;
    border: 2px solid #eee;
    @include transition(all 0.15s ease-out);

    &.selected{
      border-color: #333;

      img {
        @include opacity(1);
      }
    }

    img{
      max-width: 100%;
      vertical-align: bottom;
      @include opacity(0.75);
    }
  }

  input{
    display: none;
  }
}

// upload
.cs-field-upload{
  input{
    width: 340px;
    max-width: 100%;
  }
}

// background
.cs-field-background{
  .cs-attachment{
    width: 340px;
    max-width: 100%;
    margin-bottom: 5px;
  }

  .wp-color-result{
    margin: 0;
    vertical-align: middle;
  }
}

// color_picker
.cs-field-color_picker {

  .cs-alpha-wrap {
    display: none;
    position: relative;
    top: -1px;
    width: 235px;
    padding: 9px 10px;
    border: 1px solid #dfdfdf;
    border-top: none;
    background-color: #fff;
  }

  .cs-alpha-slider {
    position: absolute;
    width: 190px;
    margin-left: 2px;
    height: 18px;

    .ui-slider-handle {
      position: absolute;
      top: -3px;
      bottom: -3px;
      z-index: 5;
      border-color: #aaa;
      border-style: solid;
      border-width: 4px 3px;
      width: 10px;
      height: 16px;
      margin: 0 -5px;
      background: none;
      cursor: ew-resize;
      @include opacity(0.9);
      @include border-radius(4px);
      @include box-shadow(0 1px 2px rgba(black, 0.2));

      &:before {
        content: " ";
        position: absolute;
        left: -2px;
        right: -2px;
        top: -3px;
        bottom: -3px;
        border: 2px solid #fff;
        @include border-radius(3px);
      }
    }
  }

  .cs-alpha-slider-offset {
    height: 18px;
    width: 200px;
    background: url(../images/checkerboard.png) repeat-y center left scroll #fff;
    @include box-shadow(0 0 5px rgba(black, 0.4) inset);
    @include border-radius(2px);
  }

  .cs-alpha-text{
    position: absolute;
    top: 12px;
    right: 10px;
    width: 30px;
    font-size: 12px;
    line-height: 12px;
    text-align: center;
    color: #999;
  }
}

// backup
.cs-field-backup{
  textarea{
    width: 100%;
    min-height: 200px;
    margin-bottom: 5px;
  }

  small{
    display: inline-block;
    margin: 5px;
  }

  hr{
    margin: 30px 0;
  }
}

// group
.cs-field-group{

  $acc_text_color: #555;
  $acc_border_color: #e5e5e5;
  $acc_border_hover_color: #bbb;
  $acc_background_color: #fafafa;
  $acc_background_hover_color: #fafafa;

  .cs-add-group{
    margin-top: 10px;
  }

  .cs-group{
    display: none;
    position: relative;

    h4{
      font-size: 1em;
    }
  }

  .ui-accordion .cs-group{
    display: block;
  }

  .cs-remove{
    text-align: right;
    padding: 20px;
  }

  .ui-widget-content {
    border: 1px solid $acc_border_color;
    background: #fff;
  }

  .ui-icon{
    text-indent: 0;
    color: $acc_border_hover_color;
  }

  .ui-widget-header {
    border: 1px solid $acc_border_color;
    background: $acc_background_color;
  }

  .ui-state-default,
  .ui-widget-content .ui-state-default,
  .ui-widget-header .ui-state-default {
    border: 1px solid $acc_border_color;
    background: $acc_background_color;
  }

  .ui-state-focus,
  .ui-widget-content .ui-state-focus,
  .ui-widget-header .ui-state-focus {
    border: 1px solid $acc_border_color;
    background: $acc_background_hover_color;
    outline: none;
  }

  .ui-state-hover,
  .ui-widget-content .ui-state-hover,
  .ui-widget-header .ui-state-hover{
    border-color: $acc_border_hover_color;
  }

  .ui-state-active,
  .ui-widget-content .ui-state-active,
  .ui-widget-header .ui-state-active {
    border: 1px solid $acc_border_color;
    background: $acc_background_hover_color;
  }

  .ui-accordion .ui-accordion-header {
    display: block;
    cursor: pointer;
    position: relative;
    margin: 2px 0 0 0;
    padding: 15px;
    min-height: 0;
    font-size: 100%;
  }

  .ui-accordion .ui-accordion-icons {
    padding-left: 30px;
  }

  .ui-accordion .ui-accordion-icons .ui-accordion-icons {
    padding-left: 30px;
  }

  .ui-accordion .ui-accordion-header .ui-accordion-header-icon {
    position: absolute;
    left: .5em;
    top: 50%;
    margin-top: -10px;
  }

  .ui-accordion .ui-accordion-content {
    padding: 0;
    border-top: 0;
  }

  .ui-sortable-helper{
    .cs-group-content {
      display: none !important;
    }
  }
}

// help tooltip
.cs-help{
  position: absolute;
  top: 5px;
  right: 5px;
  padding: 5px;
  font-size: 14px;
  color: #aaa;
}

// heading
.cs-field-heading{
  background-color: #f5f5f5;

  h2{
    margin: 0;
    font-weight: bold;
  }
}

// subheading
.cs-field-subheading{
  padding-top: 17px;
  padding-bottom: 17px;
  background-color: #f7f7f7;

  h3{
    margin: 0;
    font-size: 14px;
    font-weight: bold;
  }
}

// notice
.cs-field-notice{
  padding: 0 !important;
  border: 0 !important;
  margin-top: -1px;

  .cs-notice{
    font-size: 12px;
    padding: 17px 30px;
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
  }

  .cs-success{
    color: #3c763d;
    border-color: #d6e9c6;
    background-color: #dff0d8;
  }

  .cs-info{
    color: #31708f;
    border-color: #bce8f1;
    background-color: #d9edf7;
  }

  .cs-warning{
    color: #8a6d3b;
    border-color: #faebcc;
    background-color: #fcf8e3;
  }

  .cs-danger{
    color: #a94442;
    border-color: #ebccd1;
    background-color: #f2dede;
  }

}

// icons
.cs-field-icon{

  .button{
    margin-right: 5px;
  }

  .cs-icon-preview i{
    display: inline-block;
    font-size: 14px;
    width: 30px;
    height: 26px;
    line-height: 26px;
    margin-right: 5px;
    text-align: center;
    vertical-align: top;
    color: #555;
    border: 1px solid #ccc;
    background-color: #f7f7f7;
    @include border-radius(3px);
    @include box-shadow(0 1px 0 rgba(black, 0.08));
  }
}

// red primary button
.cs-warning-primary{
  color: #fff !important;
  border-color: #d02c21 !important;
  background: #e14d43 !important;
  @include box-shadow(inset 0 1px #ec8b85, 0 1px 0 rgba( black, 0.15) !important);

  &:hover,
  &:focus{
    border-color: #ba281e !important;
    background: #dd382d !important;
    @include box-shadow(inset 0 1px #e8776f !important);
  }

  &:active {
    border-color: #ba281e !important;
    background: #d02c21 !important;
    color: white !important;
    @include box-shadow(inset 0 2px 5px -3px rgba(black, 0.5), 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8) !important);
  }
}

.cs-text-desc{
  font-style: italic;
  font-weight: 400;
  margin-top: 10px;
  color: #aaa;
}

.cs-text-success{
  color: #2b542c;
}

.cs-text-info{
  color: #31708f;
}

.cs-text-warning{
  color: #d02c21;
}

.cs-text-muted{
  color: #aaa;
}

.cs-text-center{
  text-align: center;
}


// ajax-save
#cs-save-ajax{
  display: none;
  position: relative;
  top: 4px;
  right: 5px;
  font-size: 12px;
  padding: 3px 8px;
  color: #fff;
  background-color: #27ae60;
  @include border-radius(2px);
}

// bootstrap tooltip
.tooltip {
  position: absolute;
  z-index: 500001;
  display: block;
  visibility: visible;
  font-size: 12px;
  line-height: 1.4;
  @include opacity(0);
  @include transition(opacity .15s linear);

  &.in {
    @include opacity(1);
  }
}

// wrapper for the tooltip content
.tooltip-inner {
  max-width: 200px;
  padding: 6px 12px;
  color: #fff;
  text-align: center;
  text-decoration: none;
  background-color: #000;
  background-color: rgba(black, 0.85);
  @include border-radius(4px);
}

// framework shortcode manager
.cs-dialog{
  display: none;
  padding: 0;

  .cs-dialog-header{
    width: 100%;
    padding: 16px 0;
    background-color: #f5f5f5;
    border-bottom: 1px solid #eee;

    select,
    .chosen-container{
      display: block;
      margin: 0 auto;
      width: 250px !important;
    }
  }

  .cs-element{
    padding: 15px 30px 15px 15px;
  }

  .cs-insert-button{
    text-align: center;
    width: 100%;
    padding: 16px 0;
    background-color: #f5f5f5;
    border-top: 1px solid #eee;
  }

  .cs-dialog-load{
    min-height: 250px;
    overflow: hidden;
    overflow-y: auto;
  }

  .cs-clone-button{
    margin-top: 10px;
    text-align: center;
  }

  .cs-shortcode-clone{
    position: relative;
    border-top: 1px dashed #5cb85c;

    .cs-remove-clone{
      display:none;
      position: absolute;
      right: 5px;
      top: 5px;
      z-index: 1;
      padding: 5px;
      color: #ed6f6f;
      font-size: 14px;

      &:hover{
        text-decoration: none;
        color: darken( #ed6f6f, 10% );
      }
    }
  }

  a{
    &:active,
    &:focus{
      outline: none;
      @include box-shadow(none);
    }
  }

  h4{
    font-size: 13px;

    small{
      font-style: italic;
      font-weight: 400;
      color: #aaa;
    }
  }

}

// icon dialog
#cs-icon-dialog{

  .cs-icon-search{
    width: 250px;
    height: 40px;
    line-height: 40px;
  }

  a{
    display: inline-block;
    padding: 5px;
    cursor: pointer;

    .cs-icon{
      position: relative;
      padding: 5px;
      display: inline-block;
      font-size: 14px;
      width: 30px;
      height: 26px;
      line-height: 26px;
      text-align: center;
      vertical-align: top;
      color: #555;
      border: 1px solid #ccc;
      background-color: #f7f7f7;
      @include border-radius(3px);
      @include box-shadow(0 1px 0 rgba(black, 0.08));
    }

    &:hover .cs-icon{
      color: #fff;
      border-color: #222;
      background-color: #222;
    }
  }

  .cs-icon-loading{
    color: #999;
    text-align: center;
    margin-top: 10px;
  }

  .cs-icon-title{
    padding: 15px;
    margin: 10px 0;
    text-align: center;
    text-transform: uppercase;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    background-color: #fafafa;

    &:first-child{
      margin-top: 0;
      border-top: 0;
    }
  }
}

// side metabox
#side-sortables{
  .cs-content .cs-section-title{
    padding: 15px 20px;
  }

  .cs-element{
    padding: 20px;

    .cs-title{
      float: none;
      width: 100%;
      margin-bottom: 10px;
    }

    .cs-fieldset{
      margin-left: 0;
    }

    .cs-field-upload{
      input{
        width: 170px;
      }
    }
  }
}

// wp customize options
#customize-controls{

  .customize-control-cs_field{
    position: relative;
    top: -10px;
    margin-bottom: 0;

    &:last-child{
      margin-bottom: -25px;

      .cs-element{
        border-bottom: none;
      }
    }
  }

  .cs-element{
    margin-right: -20px;
    margin-left: -20px;
    padding: 20px;

    .cs-title{
      float: none;
      width: 100%;
      margin-bottom: 10px;

      h4{
        font-size: 14px;
      }
    }

    .cs-fieldset{
      margin-left: 0;
    }

  }

  .cs-field-select select{
    width: 100%;
  }

  .cs-field-upload input{
    width: 170px;
    margin-right: 5px;
  }
}

// framework responsive utilities
@media only screen and (max-width:1200px){
  .cs-metabox-framework{
    .cs-element{

      .cs-title{
        float: none;
        width: 100%;
        margin-bottom: 10px;
      }

      .cs-fieldset{
        margin-left: 0;
      }
    }
  }
}

@media only screen and (max-width:782px){
  .cs-framework{
    .cs-header{
      text-align: center;

      h1{
        width: 100%;
        margin-bottom: 10px;
      }

      fieldset{
        float: none;
      }
    }

    .cs-expand-all,
    .cs-nav-background,
    .cs-nav{
      display: none;
    }

    .cs-content{
      margin-left: 0;
    }

    .cs-section-title,
    .cs-section{
      display: block !important;
    }

    .cs-element{

      .cs-title{
        float: none;
        width: 100%;
        margin-bottom: 10px;
      }

      .cs-fieldset{
        margin-left: 0;
      }
    }
  }
}