

/* Cart conditions metabox styling */
#acfw-cart-conditions.postbox {
  .inside {
    padding: 0;
    margin: 0;
    overflow: hidden;
  }
  .acfw-cart-condition-tabs {
    .rules-tab {
      a:before {
        content : "\f536";
      }
    }
    .settings-tab {
      a:before {
        content: "\f111";
      }
    }
  }
}
#acfw_cart_conditions {
  position: relative;
  float: left;
  width: 80%;
  padding: 15px 15px 0; 

  .condition-data-wrap {
    padding-bottom: 55px;
    min-height: 350px;

    .acfw-tab-info {
      margin: 0;
    }

    > h2 {
      padding: 20px 20px;
      text-align: center;
      text-transform: uppercase;
      font-weight: bold;
      font-size: 20px;
    }

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

    .condition-groups {
      margin-bottom: 10px;
      position: relative;

      .no-condition-group {
        padding: 160px 0;
        position: relative;
        font-size: 30px;
        text-align: center;
        font-weight: bold;
        color: #ececec;
        z-index: 1;
        line-height: 1em;
      }

      .condition-notice {
        padding: 1rem;
        margin-bottom: 1rem;
        border: solid 1px #c3c4c7;
        border-left: solid 3px #46b450;
        p {
            padding: 0;
        }
        ul {
          padding: 0 1.5rem;
          list-style: initial;
        }
        .action-wrap {
          padding: .5rem 0 .5rem 0;
          a {
            text-decoration: none;
            background: #C6CD2E;
            font-size: 1rem;
            font-weight: bold;
            padding: .5rem 1rem;
            color: black;
          }
        }
      }

      .condition-group {
        position: relative;
        border: 1px dashed #1287b7;
        border-radius: 1px;
        padding-top: 30px;

        .condition-group-fields {
          margin-left: 20px;
          margin-right: 20px;
        }

        .condition-field {
          position: relative;
          padding: 10px 12px 15px 12px;

          label {
            display: block;
            width: 100%;
            float: none;
            margin: 0 0 0 1px;
          }

          select {
            float: none;
          }

          .wc-enhanced-select , .select2-container {
            float: none;
            width: 100%;
            max-width: 100%;
          }
        }

        .condition-field-premium {
          border: 1px dashed red !important;
          background: #f6f1ee !important;
        }

        .condition-field, .condition-set {
          border: 1px dashed #c7c7c7;
          border-radius: 0;
          background: #f5f5f5;
        }
        
        .condition-field-title {
          margin: 0 0 10px;
        }

        .empty-conditions {
          padding: 20px;
          text-align: center;
          font-style: italic;
          font-size: 16px;
          color: #ccc;
          border-radius: 5px;
        }

        .logic-condition-field {
          background: transparent;
          padding: 20px 10px;
          margin: 10px 0;
          text-align: center;
          border: 0;

          &:before {
            content: '';
            position: absolute;
            top: 0;
            left: calc(50% - 0.5px);
            z-index: 1;
            display: block;
            width: 1px;
            height: 100%;
            background: #2c87b7;
          }

          * {
            position: relative;
            z-index: 2;
            float: none;
          }

          .field-control {
            background: #fff;
            padding: 5px 0;
          }
        }

        .acfw-styled-table {

          tr {

            th , td {
              padding: 8px;
              box-sizing: border-box;
            }

            .product {
              width: auto;
            }

            .condition {
              width: 25%;

              select {
                width: 100%;
              }
            }

            .quantity {
              width: 15%;

              .condition-quantity {
                position: static;
                top: auto;
                width: 100%;
              }
            }

            .actions {
              width: 121px;
              min-width: 121px;
            }
          }

          tfoot td {
            background: #f1f1f1;
            border-color: #f1f1f1;
          }
        } 
      }

      .condition-group-logic {
        position: relative;
        text-align: center;
        padding: 30px 10px;
        margin: 20px 0;

        &:before {
          content: '';
          position: absolute;
          top: 0;
          left: calc(50% - 0.5px);
          z-index: 1;
          display: block;
          width: 1px;
          height: 100%;
          background: #2c87b7;
        }

        * {
            float: none;
        }

        .field-control {
          position: relative;
          z-index: 2;
          padding: 5px 0;
          background: #fff;
        }
      }
    }

    .condition-group-actions {
        position: relative;
        padding: 20px 10px;
        margin: 10px 0;
        text-align: center;

        &:before {
          content: '';
          position: absolute;
          top: 0;
          left: calc(50% - 0.5px);
          z-index: 1;
          display: block;
          width: 1px;
          height: 100%;
          background: #2c87b7;
        }

        * {
          position: relative;
          z-index: 2;
          float: none;
        }

        .add-condition-form {
          background: #fff;
          padding: 5px 0;

          select.condition-types {
              width: 300px;
          }

          .select2 {
            margin-top: -5px;
            text-align: left;

            .select2-selection__arrow {
              position: absolute;
            }
          }
        }

        .add-condition-trigger {
          outline: 5px solid #fff;
          text-decoration: none;
          font-size: 14px;
          font-weight: 700;

          .dashicons {
            margin-top: 6px;
          }
        }
    }
  }

  .field-control {

    .select2-container {
      width: 100% !important;
    }
  }

  .cart-quantity-field,
  .cart-subtotal-field,
  .customer-registration-date-field,
  .customer-last-ordered-field,
  .total-customer-spend-field,
  .custom-taxonomy-field,
  .custom-user-meta-field,
  .custom-cart-item-meta-field,
  .total-customer-spend-field,
  .product-category-field {

    &:after {
      content: '';
      display: table;
      clear: both;
    }

    label {
      width: 100%;
    }

    .field-control {
      float: left;
      width: 150px;
      margin: 5px 10px 0 0;

      &.no-label {
        margin-top: 28px;
      }

      input, select {
        width: 100%;
      }

      input[type="checkbox"] {
        width: 1rem;
      }

      &.wider {
        width: 200px;
      }

      &.side-label {
          
        input {
          width: 80px;
          margin-right: 5px;
        }

        label {
          float: left !important;
          width: auto !important;
          position: relative;
          top: 5px;
        }
      }
    }
    
    .add-edit-product-form {
        clear: both;

        &:after {
            content: '';
            display: table;
            clear: both;
        }
    }
  }
  
  .customer-registration-date-field {

    .field-control {
      width: 350px;

      input {
        width: 50%;
      }
    }
  }

  .custom-taxonomy-field {

    .field-control-wide {
      width: calc( 100% - 170px );
    }
  }

  .cart-conditions-main-actions {
    position:absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    background: #fafafa;
    border-top: 1px solid #e5e5e5;

    &:after {
      content: '';
      display: table;
      clear: both;
    }

    #save-cart-conditions {
      float: left;
    }
  }

  .shipping-zone-region-field {

    &:after {
      content: '';
      display: table;
      clear: both;
    }

    .field-control {
      float: left;
      width: 250px;
      margin: 5px 10px 0 0;

      input , label, select {
        width: 100%;
      }

      .select2-container {
        width: 100% !important;
      }

      &.regions {
        width: calc(100% - 300px);
      }
    }
  }

  .product-category-field {

      .field-control.categories {
        width: 100%;
      }
      
  }

    a#remove-all-premium-condition,
    a.remove-condition-group,
    a.remove-condition-field {
        display: inline-block;
        position: absolute;
        top:  8px;
        right: 5px;
        color: #b3b3b3;
        text-decoration: none;

      &:hover {
        color: #c00;
      }

      * {
        font-size: 16px;
      }
  }

  a.remove-condition-group {
      top: 7px;
  }

  .additional-settings {
    display: none;
    padding: 0 20px 80px;
    margin: 0 -15px;

    .acfw-tab-info {
      margin: 0 0 25px;
    }

    > h2 {
      padding: 10px 0;
      font-size: 20px;
      font-weight: normal;
    }

    .condition-settings-field {
      margin-bottom: 15px;

      label {
        float: left;
        width: 240px;
        box-sizing: border-box;
        margin: 0 10px 0 0;
      }

      .text-input {
        width: 50%;
      }

      &:after {
        content: '';
        display: table;
        clear: both;
      }

      p.desc-tip {
        clear: both;
        margin-left: 240px;
      }
    }
  }

  .add-condition-group-trigger {
    position: relative;
    padding: 30px 10px;
    text-align: center;

    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: calc(50% - 0.5px);
      z-index: 1;
      display: block;
      width: 1px;
      height: 100%;
      background: #2c87b7;
    }

    .field-control {
      position: relative;
      z-index: 2;
      padding: 5px 0;
      background: #fff;
    }

    #add-cart-condition-group {
      margin: 0;
      font-weight: bold;
      font-size: 16px;
      outline: 0 !important;

      .dashicons {
        margin-top: 8px;
      }
    }
  }
}
