/**
 * Settings controls
 */

/**
 * Controls
 */
.mkb-control-wrap {
  position: relative;
  margin-bottom: 2em;
  margin-left: 0;

  &[data-type="title"] {
    margin-left: 0;

    &:first-child {
      .mkb-settings-title {
        margin-top: 0;
      }
    }
  }

  label,
  .mkb-toggle-label {
    display: block;
    margin-bottom: 0.5em;
  }

  input[type="text"]:not(.mkb-color-picker) {
    min-width: 30em;
    height: 2.8em;
    border-radius: 0.3em;
    padding: 0 1em;
  }

  textarea {
    min-width: 30em;
    border-radius: 0.3em;
    padding: 1em;
  }

  select[multiple][name="mkb_option_style_font_gf_weights"] {
    height: auto;
    min-height: 13.2em;
    width: 10em;
  }

  select[multiple][name="mkb_option_style_font_gf_languages"] {
    height: auto;
    min-height: 8em;
    width: 10em;
  }
}

.mkb-settings-textarea {
  width: 600px;
  max-width: 100%;
}

/**
 * Description
 */
.mkb-setting-description {
  margin: 0.3em 0;
  font-size: 0.9em;
  color: #aaa;
  max-width: 40em;
}

/**
 * Icon select
 */
.mkb-icon-select {
  position: relative;
  width: 40em;
  height: 20em;
  overflow-y: scroll;
  padding: 0.8em 0.2em 0.8em 1.2em;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.3em;
  text-align: left;
}

.mkb-icon-select__item {
  display: inline-block;
  width: 1.8em;
  height: 1.8em;
  color: #777;
  cursor: pointer;

  &.mkb-icon-selected {
    color: $icon-selected;
    border-radius: 0.3em;
  }
}

.mkb-icon-button__link {
  margin-bottom: 0.8em;
  color: #fff;

  &:hover {
    color: #eee;
  }

  &:focus,
  &:active,
  &:visited {
    color: #fff;
  }
}

/**
 * Image select
 */
.mkb-image-select__image {
  width: 130px;
  height: auto;
}

.mkb-image-select__item {
  cursor: pointer;
  display: inline-block;
  text-align: center;
  margin-right: 0.8em;
  opacity: 0.5;
  transition: opacity 0.1s ease-in;

  &:hover,
  &.mkb-image-selected {
    opacity: 1;
  }
}

.mkb-image-wrap {
  display: block;
  position: relative;

  .mkb-image-selected__checkmark {
    display: none;
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    height: 1em;
    top: 0;
    font-size: 2em;
    margin: auto;
    color: #fff;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.15);

    .mkb-image-selected & {
      display: block;
    }
  }
}

.mkb-image-select__item-label {
  display: block;
}

/**
 * Layout select
 */
.mkb-layout-select__available,
.mkb-layout-select__selected {
  display: inline-block;
  vertical-align: top;
  border-radius: 5px;
  background: #f5f5f5;
  padding: 1em;
  min-width: 16em;
  height: 18em;
  overflow: auto;
  box-shadow: inset 1px 1px 1px rgba(0,0,0,0.15);
}

.mkb-layout-select__available {
  margin-right: 1em;
}

.mkb-layout-select__item {
  padding: 0.7em;
  background: #fff;
  border: 1px solid #ccc;
  margin-bottom: 0.3em;
  font-weight: 600;
  font-size: 1em;
  cursor: move;
}

/**
 * Switch
 */

.mkb-toggle-label {
  position: absolute;
  left: 72px;
  top: 8px;
}

.mkb-switch {
  input[type="checkbox"] {
    display: none;
    opacity: 0;
  }

  input.mkb-toggle-round + label {
    padding: 2px;
    width: 58px;
    height: 30px;
    background-color: $switch-bg;
    border-radius: 30px;
    display: inline-block;
    position: relative;
  }
  input.mkb-toggle-round + label:before,
  input.mkb-toggle-round + label:after {
    display: block;
    position: absolute;
    top: 1px;
    left: 1px;
    bottom: 1px;
    content: "";
  }
  input.mkb-toggle-round + label:before {
    right: 1px;
    background-color: $switch-off;
    border-radius: 30px;
    transition: background 0.4s;
  }
  input.mkb-toggle-round + label:after {
    width: 30px;
    background-color: #fff;
    border-radius: 100%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: margin 0.4s;
  }
  input.mkb-toggle-round:checked + label:before {
    background-color: $switch-on;
  }
  input.mkb-toggle-round:checked + label:after {
    margin-left: 30px;
  }
}

/**
 * Title
 */
.mkb-settings-title-wrap {
  position: relative;

  .mkb-settings-title {
    font-size: 1.3em;
    font-weight: 500;
    color: #333;
    margin: 3em 0 0.5em 0;
    padding: 0 0 0.5em;
    transition: color 0.1s ease-in;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.15);

    .mkb-settings-preview {
      margin-left: 0.5em;
    }
  }
}

/**
 * Preview image
 */
.mkb-setting-preview-image {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  max-width: 600px;
  max-height: 200px;
  height: auto;
  z-index: 20;
  overflow: hidden;
  padding: 0;
  background: #fff;
  box-shadow: 0px 0px 3px rgba(0,0,0,0.25);

  img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    display: block;
    margin: 0;
  }
}

.mkb-settings-title:hover + .mkb-setting-preview-image {
  display: block;
}

/**
 * Usage code example
 */
.mkb-code-title {
  margin: 0 0 0.7em 0;
  font-size: 1em;
  color: #333;
}

.mkb-setting-code {
  padding: 0.8em;
  display: inline-block;
  background: #f0f0f0;
  max-width: 32em;
  color: #333;
  font-family: courier;
  box-shadow: inset 1px 1px 1px rgba(0,0,0,0.18);
  border-radius: 5px;
}

/**
 * Layout items visibility
 * fix for dynamic topics in Box view
 */
.mkb-layout-select__item[data-value="recent"],
.mkb-layout-select__item[data-value="top_likes"],
.mkb-layout-select__item[data-value="top_views"] {
  .mkb-layout-select--box-view & {
    display: none;
  }
}

/**
 * CSS size
 */
.mkb-css-size {
  display: inline-block;
}

.mkb-control-wrap {
  .mkb-css-size {
    input[type="text"].mkb-css-size__input {
      width: 5em;
      text-align: center;
      min-width: 0;
      margin: 0;
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }
  }
}

.mkb-css-size__units {
  display: inline-block;
  vertical-align: top;
  list-style-type: none;
  padding: 0;
  margin: 0;
  text-align: right;
  box-shadow: inset 0px 0px 3px rgba(0,0,0,0.3);
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;

  li {
    display: inline-block;
    margin: 0;

    .mkb-css-unit {
      padding: 0.1em 0.8em;
      display: inline-block;
      vertical-align: top;
      line-height: 2.8em;

      &--selected,
      &:hover {
        color: #fff;
        background: $wp-blue;
      }
    }

    &:not(:first-child) {
      border-left: 1px solid rgba(0,0,0,0.1);
    }
  }
}

/**
 * Page link
 */

.mkb-page-select-link {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.5em;
  background: $wp-blue;
  color: white;
  border: 0px solid $wp-blue;
  padding: 0.3em 0.7em;
  border-radius: 0.3em;
  box-shadow: 1px 2px 1px rgba(0,0,0,0.18);
  transition: all 0.2s ease-in;

  &:hover,
  &:active,
  &:focus,
  &:visited {
    color: #fff;
    box-shadow: 1px 2px 1px rgba(0,0,0,0.18);
  }

  &:hover {
    color: #eee;
  }

  &.mkb-disabled {
    opacity: 0.3;
    cursor: default;
  }
}