/* Product edit: RBP — card language matches Wow Extensions dashboard settings (#fafafa, #e2e8f0, 3px radius). */

#general_product_data .wowext-rbp-product-panel {
  max-width: 52rem;
  /* width: 100%; */
  margin: 16px 12px 9px 12px;
  padding: 14px 16px 12px;
  background: #fafafa;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
  overflow: visible;
  position: relative;
  z-index: 0;
  clear: both;
}

#general_product_data .wowext-rbp-product-panel::after {
  content: "";
  display: table;
  clear: both;
}

#general_product_data .wowext-rbp-product-panel .woocommerce-help-tip-field {
  margin: 0 !important;
  max-width: none;
  line-height: 1.5;
  font-size: 0.875rem;
  color: #374151;
}

#general_product_data .wowext-rbp-product-panel p.form-field {
  padding-left: 0 !important;
  padding-bottom: 0;
}

/* Primary mode = WooCommerce field, laid out like OPC: title row, full-width control */
#general_product_data .wowext-rbp-product-panel p.wowext-rbp-wc-product-meta.form-field {
  display: block !important;
  float: none !important;
  clear: both !important;
  width: 100% !important;
  margin: 0 0 0.6rem 0 !important;
  padding: 0 !important;
}

#general_product_data .wowext-rbp-product-panel p.wowext-rbp-wc-product-meta.form-field > label {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  float: none !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 0 0.65rem 0 !important;
  padding: 0 !important;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}

/* WC tipTip needs position: relative; never use position: static on the tip. */
#general_product_data
  .wowext-rbp-product-panel
  p.wowext-rbp-wc-product-meta.form-field
  > label
  .woocommerce-help-tip {
  position: relative !important;
  top: 0;
  display: inline-block;
  flex-shrink: 0;
  margin: 0 0 0 auto !important;
  vertical-align: middle;
  z-index: 2;
  cursor: help;
  pointer-events: auto;
}

#general_product_data
  .wowext-rbp-product-panel
  p.wowext-rbp-wc-product-meta.form-field
  > .woocommerce-help-tip {
  position: relative !important;
  top: 0;
  display: inline-block;
  float: none !important;
  margin: 0 !important;
  vertical-align: middle;
  z-index: 2;
  cursor: help;
  pointer-events: auto;
}

#general_product_data .wowext-rbp-product-panel p.wowext-rbp-wc-product-meta.form-field:has(> .woocommerce-help-tip) {
  display: grid !important;
  grid-template-columns: 1fr auto;
  column-gap: 0.5rem;
  row-gap: 0.5rem;
  align-items: start;
  margin: 0 0 0.6rem 0 !important;
  overflow: visible;
}

#general_product_data
  .wowext-rbp-product-panel
  p.wowext-rbp-wc-product-meta.form-field:has(> .woocommerce-help-tip)
  > label {
  grid-column: 1;
  margin: 0 !important;
  justify-content: flex-start;
}

#general_product_data
  .wowext-rbp-product-panel
  p.wowext-rbp-wc-product-meta.form-field:has(> .woocommerce-help-tip)
  > .woocommerce-help-tip {
  grid-column: 2;
  margin: 0 !important;
  margin-top: 0.1rem !important;
  align-self: start;
  justify-self: end;
}

#general_product_data
  .wowext-rbp-product-panel
  p.wowext-rbp-wc-product-meta.form-field:has(> .woocommerce-help-tip)
  > select,
#general_product_data
  .wowext-rbp-product-panel
  p.wowext-rbp-wc-product-meta.form-field:has(> .woocommerce-help-tip)
  > .select2-container {
  grid-column: 1 / -1;
  width: 100% !important;
}

#general_product_data .wowext-rbp-product-panel p.wowext-rbp-wc-product-meta.form-field > select,
#general_product_data .wowext-rbp-product-panel p.wowext-rbp-wc-product-meta.form-field .select2-container {
  display: block !important;
  float: none !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
}

#general_product_data .wowext-rbp-product-panel p.wowext-rbp-wc-product-meta.form-field > select,
#general_product_data .wowext-rbp-product-panel p.wowext-rbp-wc-product-meta.form-field .select2-container--default .select2-selection--single {
  min-height: 40px;
  padding: 8px 12px;
  line-height: 1.4;
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 3px;
  font-size: 14px;
  color: #111827;
  box-shadow: none;
  box-sizing: border-box;
}

#general_product_data
  .wowext-rbp-product-panel
  p.wowext-rbp-wc-product-meta.form-field
  .select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  line-height: 38px;
  padding-left: 12px;
  color: #111827;
}

#general_product_data
  .wowext-rbp-product-panel
  p.wowext-rbp-wc-product-meta.form-field
  .select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  height: 38px;
}

#general_product_data .wowext-rbp-product-panel p.wowext-rbp-wc-product-meta.form-field > select:focus {
  border-color: #c4b5fd !important;
  outline: none;
  box-shadow: none !important;
}

/* Hints: stack under the control, not full WC sidebar layout */
#general_product_data .wowext-rbp-product-panel .wowext-rbp-override-legend,
#general_product_data .wowext-rbp-product-panel ._wowexfow_rbp_legend--inherit,
#general_product_data .wowext-rbp-product-panel ._wowexfow_rbp_legend--exclude {
  margin: 0.65rem 0 0.35rem !important;
  padding: 0.6rem 0 0 0;
  border-top: 1px solid #eef0f4;
  float: none !important;
  width: 100% !important;
  max-width: none !important;
  clear: both;
}

#general_product_data .wowext-rbp-product-panel .wowext-rbp-override-legend {
  font-size: 0.875rem;
}

#general_product_data .wowext-rbp-product-panel ._wowexfow_rbp_legend--inherit,
#general_product_data .wowext-rbp-product-panel ._wowexfow_rbp_legend--exclude {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #4b5563;
}

#general_product_data
  .wowext-rbp-product-panel
  .wowext-rbp-override-legend
  .description,
#general_product_data
  .wowext-rbp-product-panel
  ._wowexfow_rbp_legend--inherit
  .description,
#general_product_data
  .wowext-rbp-product-panel
  ._wowexfow_rbp_legend--exclude
  .description {
  display: block;
  margin-top: 0.3em;
  font-weight: 400;
}

#general_product_data .wowext-rbp-product-panel .wowext-rbp-override-panel {
  margin: 0.5rem 0 0;
}

#general_product_data .wowext-rbp-skin--product {
  margin-left: 0 !important;
  margin-top: 0.25rem;
  max-width: none;
}

/* WC re-shows .show_if_simple — hide inactive RBP state with !important */
#general_product_data .wowext-rbp-override-panel.wowext-rbp-mode-hidden,
#general_product_data .wowext-rbp-override-legend.wowext-rbp-mode-hidden,
#general_product_data .wowext-rbp-product-panel ._wowexfow_rbp_legend--inherit.wowext-rbp-mode-hidden,
#general_product_data .wowext-rbp-product-panel ._wowexfow_rbp_legend--exclude.wowext-rbp-mode-hidden {
  display: none !important;
}

/*
 * The WooCommerce product data metabox is narrower than the Wow Extensions dashboard.
 * Keep the default two-column (label | control) OPC grid, but relax the label column so
 * it can shrink, and force controls to 100% of their grid cell so inputs/selects don't
 * overflow the card.
 */
#general_product_data .wowext-rbp-override-panel .wowext-opc-settings {
  max-width: none;
}

#general_product_data .wowext-rbp-override-panel .wowext-opc-card {
  margin: 0;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

#general_product_data .wowext-rbp-override-panel .wowext-opc-fields {
  overflow: visible;
}

#general_product_data .wowext-rbp-override-panel .wowext-opc-field {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  column-gap: 16px;
  align-items: center;
  padding: 12px 14px;
  min-width: 0;
}

#general_product_data .wowext-rbp-override-panel .wowext-opc-field__label-row {
  min-width: 0;
}

#general_product_data .wowext-rbp-override-panel .wowext-opc-field__control {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#general_product_data .wowext-rbp-override-panel .wowext-opc-field__control > input,
#general_product_data .wowext-rbp-override-panel .wowext-opc-field__control > select,
#general_product_data .wowext-rbp-override-panel .wowext-opc-field__control .select2-container,
#general_product_data .wowext-rbp-override-panel .wowext-opc-field__control fieldset {
  display: block;
  float: none;
  width: 100% !important;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
}

#general_product_data .wowext-rbp-override-panel .wowext-opc-field__control fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 16px 6px 0;
  white-space: nowrap;
  float: none !important;
  width: auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

/*
 * Below ~900px the WC metabox gets very narrow — drop to a stacked single column
 * so controls don't get squeezed to an unusable width.
 */
@media (max-width: 900px) {
  #general_product_data .wowext-rbp-override-panel .wowext-opc-field {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: start;
    row-gap: 8px;
  }

  #general_product_data .wowext-rbp-override-panel .wowext-opc-field__label-row {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
  }

  #general_product_data .wowext-rbp-override-panel .wowext-opc-field__control {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
  }
}

/*
 * One field ("Default adjustment value") uses a real <label for="…"> for accessibility.
 * WooCommerce's product-data CSS forces `label { float: left; width: 150px; padding: 0 }`
 * on every label inside the metabox, which renders our heading as a boxed floater outside
 * the card (see screenshot). Reset this label so it matches the <p class="wowext-opc-field__text-label"> look.
 */
#general_product_data .wowext-rbp-override-panel label.wowext-opc-field__text-label {
  display: inline-block;
  float: none !important;
  clear: none !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  line-height: 1.35;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--opc-text, #111827);
}
