@keyframes wpcpq-spinner {
  to {
    transform: rotate(360deg);
  }
}

@-webkit-keyframes wpcpq-spinner {
  to {
    -webkit-transform: rotate(360deg);
  }
}

.wpcpq-items-wrapper {
  --border: #c3c4c7;
  --primary: #2271b1;
  --background: #ffffff;
  --background2: #fafafa;

  margin-bottom: 10px;

  .woocommerce_options_panel & {
    max-width: 100%;
  }

  .wpcpq-items {
    position: relative;

    &.wpcpq-items-loading {
      &:before {
        content: '';
        display: block;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, .05);
        position: absolute;
        top: 0;
        left: 0;
        z-index: 9;
      }

      &:after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        z-index: 10;
        display: block;
        width: 30px;
        height: 30px;
        margin-top: -15px;
        margin-left: -15px;
        border-width: 4px;
        border-style: solid;
        border-radius: 100%;
        border-top-color: rgba(0, 0, 0, .5);
        border-left-color: rgba(0, 0, 0, .1);
        border-bottom-color: rgba(0, 0, 0, .1);
        border-right-color: rgba(0, 0, 0, .1);
        animation: wpcpq-spinner 1s linear infinite;
        -webkit-animation: wpcpq-spinner 1s linear infinite;
      }
    }

    .wpcpq-item {
      display: block;
      width: 100%;
      padding: 0;
      margin-bottom: 10px;
      background-color: #ffffff;
      border: 1px solid var(--border);
      border-radius: 4px;
      position: relative;
      overflow: hidden;

      &:last-child {
        margin-bottom: 0;
      }

      .wpcpq-item-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 40px;
        line-height: 40px;
        padding: 0 40px 0 0;
        border: none;
        cursor: pointer;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;

        &:after {
          content: "\f140";
          display: inline-block;
          width: 40px;
          height: 40px;
          text-align: center;
          font: normal 16px/40px dashicons;
          position: absolute;
          top: 0;
          right: 0;
          speak: none;
          -webkit-font-smoothing: antialiased;
          -moz-osx-font-smoothing: grayscale;
          text-decoration: none !important;
        }

        .wpcpq-item-move {
          cursor: move;
          width: 40px;
          height: 40px;
          flex: 0 0 40px;
          text-align: center;
          font-size: 0;

          &:before {
            content: "\f545";
            display: inline-block;
            width: 40px;
            height: 40px;
            text-align: center;
            font: normal 12px/40px dashicons;
            speak: none;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            text-decoration: none !important;
          }
        }
      }

      .wpcpq-item-content {
        border-top: 1px solid var(--border);
        display: none;
        padding: 0 20px;
        background: var(--background2);

        p {
          margin: 0;
          padding: 0;
        }

        .description {
          font-size: 13px;
        }
      }

      .wpcpq-item-line {
        padding: 15px 0;
        border-bottom: 1px solid #eee;

        &:last-child {
          margin-bottom: 0;
        }

        .input-panel {
          margin-top: 10px;
          position: relative;
          display: flex;
          align-items: center;

          .wpcpq-qty-wrapper, .wpcpq-price-wrapper, .wpcpq-text-wrapper {
            display: inline-block;
            width: calc(33% - 20px);
            margin-right: 10px;

            input {
              width: 100%;
            }
          }

          .wpcpq-remove-qty {
            display: inline-block;
            width: 24px;
            height: 24px;
            line-height: 24px;
            text-align: center;
            cursor: pointer;

            &:hover {
              color: #ff4f3b;
            }
          }

          + button {
            margin-top: 10px;
          }
        }

        label {
          float: none;
          margin: 0 0 10px 0;
          width: auto;
          display: block;
        }

        input {
          &[type="text"],
          &[type="number"] {
            width: auto;
            float: none;
          }
        }

        .input-block {
          display: block !important;
          width: 100% !important;
          margin-top: 8px;
          float: none;
        }

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

      &.active {
        .wpcpq-item-header {
          &:after {
            content: "\f142";
          }
        }

        .wpcpq-item-content {
          display: block;
        }
      }

      &:hover {
        .wpcpq-item-remove, .wpcpq-item-duplicate {
          opacity: 1;
          visibility: visible;
        }
      }

      .wpcpq-item-label {
        font-weight: 600;
        flex-grow: 1;
        text-overflow: ellipsis;
        font-size: 14px;
        overflow: hidden;
        white-space: nowrap;

        .wpcpq-label-apply {
          font-weight: 400;
          color: #999999;
          font-size: 12px;
          font-style: italic;

          &:before {
            content: '- ';
          }
        }
      }

      .wpcpq-item-remove, .wpcpq-item-duplicate {
        text-decoration: underline;
        margin: 0 5px;
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
      }

      .wpcpq-item-remove {
        color: #ff4f3b;
      }

      .wpcpq-item-duplicate {
        color: #2271b1;
      }

      /* Select2 */
      .select2-container {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
        box-sizing: border-box !important;
        display: inline-block !important;
        margin-top: 10px;
      }

      .select2-search__field {
        width: auto !important;
        max-width: 100% !important;
        margin-top: 0 !important;
        border: none !important;
        box-shadow: none !important;
      }

      .select2-container--default .select2-selection--multiple {
        border: 1px solid #dddddd;
      }

      .select2-selection__rendered {
        padding-top: 3px !important;
        padding-bottom: 3px !important;
        display: block !important;
      }

      .select2-selection__rendered li {
        height: 30px !important;
        line-height: 28px !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-top: 2px !important;
        margin-bottom: 2px !important;
        margin-right: 2px !important;
      }

      .select2-selection__rendered li:last-child {
        margin-bottom: 0;
      }
    }
  }

  .nav-tab-wrapper {
    .nav-tab-active {
      background: var(--primary);
      border-color: var(--primary);
      color: #fff;
    }
  }

  .nav-tab-content {
    display: none;
    border: 1px solid var(--border);
    border-top: 0;
    background: #fff;

    &.active {
      display: block;
    }
  }

  .wpcpq_settings_override & {
    .wpcpq-item-apply, .wpcpq-label-apply {
      display: none;
    }
  }

  [class="hint--right"][aria-label]:after {
    width: 300px;
    max-width: 300px;
    white-space: break-spaces;
    line-height: 1.4;
  }
}

.wpcpq-help-tip {
  color: #666;
  display: inline-block;
  font-size: 1.1em;
  font-style: normal;
  height: 16px;
  line-height: 16px;
  position: relative;
  vertical-align: middle;
  width: 16px;

  &:after {
    font-family: Dashicons;
    speak: never;
    font-weight: 400;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    text-indent: 0;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-align: center;
    content: "\f223";
    cursor: help;
  }
}

.wpcpq_settings {
  padding: 12px;

  label {
    float: none !important;
    margin: 0 !important;
    width: auto !important;
  }

  .hint--big:after {
    min-width: 200px;
    max-width: 300px;
    white-space: pre-line;
    line-height: 1.4;
  }

  .wpcpq-add-qty {
    display: block;
    margin-top: 10px;
  }
}

.wpclever_settings_page_content .wpcpq_settings {
  padding: 0;
}

.wpcpq_settings_override {
  margin-top: 10px;
}

.wpcpq_overview_disable {
  opacity: 0.5;
}

#wpcpq_overview_popup ul {
  margin: 0;
  padding: 0;
}

#wpcpq_overview_popup ul li, #wpcpq_overview_popup ol li {
  padding: 10px 0;
  margin: 0;
}

#wpcpq_overview_popup ul li:nth-child(2n+1), #wpcpq_overview_popup ol li:nth-child(2n+1) {
  background-color: #f6f7f7;
}

/* WPC Dialog */
.ui-widget-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.1);
}

.ui-dialog.wpc-dialog {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100102;
  background-color: #fff;
  border: 1px solid #dfdfdf;
  border-radius: 0;
  -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  color: #3c434a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 13px;
  line-height: 1.4em;
}

.ui-dialog.wpc-dialog .ui-dialog-titlebar {
  background: #fcfcfc;
  border-width: 0 0 1px 0;
  border-style: solid;
  border-color: #dfdfdf;
  border-radius: 0;
  height: 36px;
  font-size: 16px;
  font-weight: 600;
  line-height: 36px;
  padding: 0 36px 0 16px;
}

.ui-dialog.wpc-dialog .ui-dialog-titlebar .ui-dialog-title {
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  height: 36px;
  line-height: 36px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ui-dialog.wpc-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close {
  background: 0 0;
  border: none;
  -webkit-box-shadow: none;
  box-shadow: none;
  color: #666;
  cursor: pointer;
  display: block;
  padding: 0;
  margin: 0;
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 36px;
  line-height: 36px;
  text-align: center;
  outline: none;
  overflow: hidden;
  font-size: 0;
}

.ui-dialog.wpc-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close:before {
  font: 400 20px/1 dashicons;
  vertical-align: top;
  speak: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 36px;
  width: 36px;
  height: 36px;
  content: "\f158";
}

.ui-dialog.wpc-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close:hover {
  color: #00a0d2;
}

.ui-dialog.wpc-dialog .ui-dialog-titlebar .ui-dialog-titlebar-close span {
  display: none;
}

.ui-dialog.wpc-dialog .ui-dialog-content {
  padding: 16px;
  overflow: auto;
}

#wpcpq_overview_popup {
  .wpcpq-overview-content {
    .wpcpq-overview-line {
      padding: 10px;

      &:nth-child(2n+1) {
        background-color: #f6f7f7;
      }

      table {
        table-layout: fixed;
        width: 100%;
        margin: 5px 0 0 0;
        border: 1px solid #dddddd;
        background-color: #ffffff;
        border-spacing: 0;
        border-collapse: collapse;

        tr {
          td {
            border: 1px solid #dddddd;
            padding: 2px 10px;
          }
        }
      }
    }
  }
}

/* Single Product */

.wpcpq_settings_enable {
  display: flex;
  align-items: center;
}

.wpcpq_settings_enable select {
  float: none !important;
}

.wpcpq_settings_override .wpcpq-item-duplicate {
  display: none !important;
}

/* Variation */

.wpcpq-variation-settings {
  margin: 1em 0;
}

.wpcpq-variation-settings label {
  display: block;
}

.wpcpq-variation-wrap {
  margin-top: 10px;
  background-color: #fafafa;
  border: 1px solid #8c8f94;
  border-radius: 4px;
  position: relative;
}

.wpcpq-variation-wrap:before {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  background-color: #fafafa;
  border-width: 1px 0 0 1px;
  border-style: solid;
  border-color: #8c8f94;
  transform: rotate(45deg);
  position: absolute;
  top: -6px;
  left: 15px;
}

.wpcpq-variation-wrap .wpcpq_settings select {
  width: auto;
  height: auto;
  line-height: 2;
  min-height: 30px;
  padding: 0 24px 0 8px;
  margin: 0;
  float: left;
  vertical-align: middle;
}

.wpcpq-variation-wrap .wpcpq_settings input.button {
  width: auto;
  margin-left: 8px;
}

.wpcpq-variation-wrap .wpcpq-items-wrapper .wpcpq-items .wpcpq-item .wpcpq-item-content {
  background: var(--background);
}