:root {
  --wpcpo-error: #e2401c;
}

.wpcpo-wrapper {
  display: block;
  width: 100%;
  clear: both;
}

.wpcpo-total {
  margin: 20px 0 40px 0;
  padding: 20px 0 0 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
  overflow: hidden;

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

    li {
      display: flex;
      justify-content: space-between;
      padding: 5px 0;

      &.wpcpo-subtotal {
        border-top: 1px solid #eee;
        padding: 10px 0;
        margin-top: 20px;
        justify-content: space-between;

        &.wpcpo-subtotal-0 {
          .wpcpo-clear {
            opacity: 0;
            appearance: none;
          }
        }

        .amount {
          margin-left: 10px;
          font-weight: 700;
        }
      }
    }
  }
}

.wpcpo-disabled {
  opacity: .5 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}

.wpcpo-option {
  .form-row {
    .wpcpo-option-field {

    }
  }

  &.wpcpo-has-error {
    label {
      color: var(--wpcpo-error);
    }

    .wpcpo-option-field {
      border-color: var(--wpcpo-error)
    }
  }

  &.wpcpo-option-image-radio {
    .form-row {
      display: flex;
      flex-wrap: wrap;
      margin-left: -5px;
      margin-right: -5px;

      .field-image-radio, .field-radio {
        display: none;
      }

      input[type="radio"]:checked + label {
        border: 1px solid green;

        &:before {
          content: "✓";
          color: #ffffff;
          display: block;
          width: 24px;
          height: 24px;
          line-height: 20px;
          background-color: green;
          text-align: center;
          font-size: 14px;
          border-radius: 24px;
          border-width: 2px;
          border-style: solid;
          border-color: #ffffff;
          border-image: initial;
          box-sizing: border-box;
          position: absolute;
          top: -10px;
          right: -10px;
        }
      }

      label {
        width: 25%;
        text-align: center;
        padding: 10px;
        margin: 5px;
        border: 1px solid #dddddd;
        box-sizing: border-box;
        cursor: pointer;
        position: relative;

        img {
          display: inline-block;
        }
      }
    }
  }

  &.wpcpo-option-image-checkbox {
    .form-row {
      display: flex;
      flex-wrap: wrap;
      margin-left: -5px;
      margin-right: -5px;

      .field-image-checkbox, .field-checkbox {
        display: none;
      }

      input[type="checkbox"]:checked + label {
        border: 1px solid green;

        &:before {
          content: "✓";
          color: #ffffff;
          display: block;
          width: 24px;
          height: 24px;
          line-height: 20px;
          background-color: green;
          text-align: center;
          font-size: 14px;
          border-radius: 0;
          border-width: 2px;
          border-style: solid;
          border-color: #ffffff;
          border-image: initial;
          box-sizing: border-box;
          position: absolute;
          top: -10px;
          right: -10px;
        }
      }

      label {
        width: 25%;
        text-align: center;
        padding: 10px;
        margin: 5px;
        border: 1px solid #dddddd;
        box-sizing: border-box;
        cursor: pointer;
        position: relative;

        img {
          display: inline-block;
        }
      }
    }
  }

  &.wpcpo-option-color-radio {
    .form-row {
      display: flex;
      flex-wrap: wrap;
      margin-left: -5px;
      margin-right: -5px;

      .field-color-radio, .field-radio {
        display: none;
      }

      input[type="radio"]:checked + label {
        border: 1px solid green;

        &:before {
          content: "✓";
          color: #ffffff;
          display: block;
          width: 24px;
          height: 24px;
          line-height: 20px;
          background-color: green;
          text-align: center;
          font-size: 14px;
          border-radius: 50%;
          border-width: 2px;
          border-style: solid;
          border-color: #ffffff;
          border-image: initial;
          box-sizing: border-box;
          position: absolute;
          top: -10px;
          right: -10px;
        }
      }

      label {
        width: 25%;
        text-align: center;
        padding: 10px 5px;
        margin: 5px;
        border: 1px solid #dddddd;
        box-sizing: border-box;
        cursor: pointer;
        display: flex;
        align-items: center;
        position: relative;

        > * {
          margin: 0 5px;
        }

        .label-color {
          display: inline-block;
          width: 32px;
          height: 32px;
          flex: 0 0 32px;
        }
      }
    }
  }

  &.wpcpo-option-color-checkbox {
    .form-row {
      display: flex;
      flex-wrap: wrap;
      margin-left: -5px;
      margin-right: -5px;

      .field-color-checkbox, .field-checkbox {
        display: none;
      }

      input[type="checkbox"]:checked + label {
        border: 1px solid green;

        &:before {
          content: "✓";
          color: #ffffff;
          display: block;
          width: 24px;
          height: 24px;
          line-height: 20px;
          background-color: green;
          text-align: center;
          font-size: 14px;
          border-radius: 0;
          border-width: 2px;
          border-style: solid;
          border-color: #ffffff;
          border-image: initial;
          box-sizing: border-box;
          position: absolute;
          top: -10px;
          right: -10px;
        }
      }

      label {
        width: 25%;
        text-align: center;
        padding: 10px 5px;
        margin: 5px;
        border: 1px solid #dddddd;
        box-sizing: border-box;
        cursor: pointer;
        display: flex;
        align-items: center;
        position: relative;

        > * {
          margin: 0 5px;
        }

        .label-color {
          display: inline-block;
          width: 32px;
          height: 32px;
          flex: 0 0 32px;
        }
      }
    }
  }

  &.wpcpo-option-quantity {
    .quantity {
      float: none !important;
    }
  }

  &.wpcpo-option-dimensions {
    .wpcpo-dimensions {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
  }

  &[data-logic="show"] {
    display: none;
  }
}

form.cart [name="wpcpo-hidden-quantity"] {
  display: none !important;
}

.wp-picker-container {
  .button {
    border-radius: 2px;

    &:before, &:after {
      display: none !important;
    }
  }

  .button.wp-picker-clear {
    font-size: 11px;
    line-height: 1;
  }
}

.box-color-picker {
  display: inline-block;
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

.box-image-radio, .box-image-checkbox {
  display: inline-block;
  width: 40px;
  vertical-align: middle;

  img {
    width: 100%;
    height: auto;
  }
}

/* Tippy */

.wpcpo-tippy-inner {
  padding: 5px 1px;
  display: flex;
  flex-direction: column;
  text-align: center;
  align-items: center;
  justify-content: center;
}

.wpcpo-tippy-inner .wpcpo-tippy-label {
  font-weight: 700;
}

.wpcpo-tippy-inner > span {
  margin-bottom: 5px;
}

.wpcpo-tippy-inner > span:last-child {
  margin-bottom: 0;
}

.wpcpo-tippy-inner .wpcpo-tippy-image {
  display: block;
  width: 100%;
  min-width: 150px;
  max-width: 600px;
}

.wpcpo-tippy-inner .wpcpo-tippy-image img {
  width: 100%;
  height: auto;
  border-radius: 3px;
  margin: 0 !important;
  padding: 0 !important;
}