/**
 * Shared consent checkboxes — registration + checkout.
 * Larger square control, high-contrast border, clear error state.
 */

:root {
  --sr-consent-size: 24px;
  --sr-consent-radius: 4px;
  --sr-consent-border: 2px solid var(--savorroots-main-black);
  --sr-consent-bg: #ffffff;
  --sr-consent-checked-bg: var(--savorroots-main-accent);
  --sr-consent-error: var(--savorroots-red);
  --sr-consent-error-ring: rgba(170, 6, 8, 0.18);
  --sr-consent-check-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10' fill='none'%3E%3Cpath d='M10.5 1L4.125 8.125L1.5 5.25' stroke='%23181818' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* —— Registration (HivePress): custom checkmark —— */
#user_register_modal .hp-form__field--checkbox,
#user_login_modal .hp-form__field--checkbox,
#review_submit_modal .hp-form__field--checkbox,
.hp-template--user-register-page .hp-form__field--checkbox,
.hp-form__field--checkbox {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}

#user_register_modal .hp-form__field--checkbox .hp-field--checkbox,
#user_login_modal .hp-form__field--checkbox .hp-field--checkbox,
#review_submit_modal .hp-form__field--checkbox .hp-field--checkbox,
.hp-template--user-register-page .hp-form__field--checkbox .hp-field--checkbox,
.hp-form__field--checkbox .hp-field--checkbox {
  display: inline-flex !important;
  align-items: flex-start !important;
  gap: 12px;
  padding-left: 0 !important;
  cursor: pointer;
  line-height: 1.35 !important;
  color: var(--savorroots-main-black) !important;
}

#user_register_modal .hp-form__field--checkbox .hp-field--checkbox > input[type="checkbox"],
#user_login_modal .hp-form__field--checkbox .hp-field--checkbox > input[type="checkbox"],
#review_submit_modal .hp-form__field--checkbox .hp-field--checkbox > input[type="checkbox"],
.hp-template--user-register-page .hp-form__field--checkbox .hp-field--checkbox > input[type="checkbox"],
.hp-form__field--checkbox .hp-field--checkbox > input[type="checkbox"] {
  position: absolute !important;
  left: 0 !important;
  bottom: auto !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip: rect(0, 0, 0, 0);
}

#user_register_modal .hp-form__field--checkbox .hp-field--checkbox .checkmark,
#user_login_modal .hp-form__field--checkbox .hp-field--checkbox .checkmark,
#review_submit_modal .hp-form__field--checkbox .hp-field--checkbox .checkmark,
.hp-template--user-register-page .hp-form__field--checkbox .hp-field--checkbox .checkmark,
.hp-form__field--checkbox .hp-field--checkbox .checkmark {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  flex: 0 0 var(--sr-consent-size);
  box-sizing: border-box !important;
  width: var(--sr-consent-size) !important;
  height: var(--sr-consent-size) !important;
  min-width: var(--sr-consent-size) !important;
  min-height: var(--sr-consent-size) !important;
  margin-top: 1px;
  padding: 0 !important;
  border: var(--sr-consent-border) !important;
  border-radius: var(--sr-consent-radius) !important;
  background: var(--sr-consent-bg) !important;
  background-image: none !important;
  box-shadow: inset 0 0 0 1px rgba(24, 24, 24, 0.08);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

#user_register_modal .hp-form__field--checkbox .hp-field--checkbox .checkmark::before,
#user_register_modal .hp-form__field--checkbox .hp-field--checkbox .checkmark::after,
#user_login_modal .hp-form__field--checkbox .hp-field--checkbox .checkmark::before,
#user_login_modal .hp-form__field--checkbox .hp-field--checkbox .checkmark::after,
#review_submit_modal .hp-form__field--checkbox .hp-field--checkbox .checkmark::before,
#review_submit_modal .hp-form__field--checkbox .hp-field--checkbox .checkmark::after,
.hp-template--user-register-page .hp-form__field--checkbox .hp-field--checkbox .checkmark::before,
.hp-template--user-register-page .hp-form__field--checkbox .hp-field--checkbox .checkmark::after,
.hp-form__field--checkbox .hp-field--checkbox .checkmark::before,
.hp-form__field--checkbox .hp-field--checkbox .checkmark::after {
  display: none !important;
}

#user_register_modal .hp-form__field--checkbox .hp-field--checkbox input[type="checkbox"]:checked + .checkmark,
#user_login_modal .hp-form__field--checkbox .hp-field--checkbox input[type="checkbox"]:checked + .checkmark,
#review_submit_modal .hp-form__field--checkbox .hp-field--checkbox input[type="checkbox"]:checked + .checkmark,
.hp-template--user-register-page .hp-form__field--checkbox .hp-field--checkbox input[type="checkbox"]:checked + .checkmark,
.hp-form__field--checkbox .hp-field--checkbox input[type="checkbox"]:checked + .checkmark {
  border-color: var(--savorroots-main-black) !important;
  background-color: var(--sr-consent-checked-bg) !important;
  background-image: var(--sr-consent-check-icon) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 12px 10px !important;
}

#user_register_modal .hp-form__field--checkbox .hp-field--checkbox a,
#user_login_modal .hp-form__field--checkbox .hp-field--checkbox a,
#review_submit_modal .hp-form__field--checkbox .hp-field--checkbox a,
.hp-template--user-register-page .hp-form__field--checkbox .hp-field--checkbox a,
.hp-form__field--checkbox .hp-field--checkbox a {
  color: var(--savorroots-main-black) !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
  font-weight: 700;
}

#user_register_modal .hp-form__field--checkbox .hp-field--checkbox a:hover,
#user_login_modal .hp-form__field--checkbox .hp-field--checkbox a:hover,
#review_submit_modal .hp-form__field--checkbox .hp-field--checkbox a:hover,
.hp-template--user-register-page .hp-form__field--checkbox .hp-field--checkbox a:hover,
.hp-form__field--checkbox .hp-field--checkbox a:hover {
  color: var(--savorroots-main-accent) !important;
}

#user_register_modal .hp-form__field--checkbox.sr-consent--invalid .hp-field--checkbox .checkmark,
#user_login_modal .hp-form__field--checkbox.sr-consent--invalid .hp-field--checkbox .checkmark,
#review_submit_modal .hp-form__field--checkbox.sr-consent--invalid .hp-field--checkbox .checkmark,
.hp-template--user-register-page .hp-form__field--checkbox.sr-consent--invalid .hp-field--checkbox .checkmark,
.hp-form__field--checkbox.sr-consent--invalid .hp-field--checkbox .checkmark,
#user_register_modal .hp-form__field--checkbox .hp-field--checkbox input[type="checkbox"]:user-invalid + .checkmark,
.hp-form__field--checkbox .hp-field--checkbox input[type="checkbox"]:user-invalid + .checkmark,
.hp-form__field--checkbox .hp-field--checkbox input[type="checkbox"].wpforms-error + .checkmark {
  outline: 2px solid #AA0608 !important;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(170, 6, 8, 0.18), inset 0 0 0 24px #fff5f5 !important;
}

.hp-form__field--checkbox.sr-consent--invalid .hp-field--checkbox {
  color: var(--sr-consent-error) !important;
}

.hp-form__field--checkbox.sr-consent--invalid .sr-consent__error,
.sr-consent__error {
  display: none;
  width: 100%;
  margin: 8px 0 0;
  padding-left: calc(var(--sr-consent-size) + 12px);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--sr-consent-error);
}

.hp-form__field--checkbox.sr-consent--invalid .sr-consent__error {
  display: block;
}

/* —— Checkout (WooCommerce): native checkbox ——
   Absolute checkbox + inline text flow keeps * next to the label and
   prevents policy links from becoming separate flex wrap items. */
.woocommerce-checkout .form-row.privacy {
  padding-left: 0 !important;
  margin-bottom: 14px !important;
}

.woocommerce-checkout .form-row.privacy label,
.woocommerce-checkout .privacy .woocommerce-form__label-for-checkbox {
  position: relative !important;
  display: block !important;
  padding-left: calc(var(--sr-consent-size) + 12px) !important;
  line-height: 1.35;
  color: var(--savorroots-main-black);
  cursor: pointer;
  text-align: left;
}

.woocommerce-checkout .form-row.privacy .input-checkbox,
.woocommerce-checkout .form-row.privacy input[type="checkbox"] {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  position: absolute !important;
  left: 0 !important;
  top: 1px !important;
  box-sizing: border-box;
  width: var(--sr-consent-size) !important;
  height: var(--sr-consent-size) !important;
  min-width: var(--sr-consent-size) !important;
  margin: 0 !important;
  border: var(--sr-consent-border) !important;
  border-radius: var(--sr-consent-radius) !important;
  background: var(--sr-consent-bg) !important;
  background-image: none !important;
  box-shadow: inset 0 0 0 1px rgba(24, 24, 24, 0.08);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.woocommerce-checkout .form-row.privacy input[type="checkbox"]:checked {
  border-color: var(--savorroots-main-black) !important;
  background-color: var(--sr-consent-checked-bg) !important;
  background-image: var(--sr-consent-check-icon) !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 12px 10px !important;
}

.woocommerce-checkout .form-row.privacy a {
  color: var(--savorroots-main-black) !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
  font-weight: 700;
}

.woocommerce-checkout .form-row.privacy a:hover {
  color: var(--savorroots-main-accent) !important;
}

.woocommerce-checkout .form-row.privacy .sr-consent-tail {
  white-space: nowrap;
}

.woocommerce-checkout .form-row.privacy .sr-consent-tail .required,
.woocommerce-checkout .form-row.privacy .required {
  display: inline !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  color: var(--savorroots-red, #AA0608);
  text-decoration: none !important;
  white-space: nowrap;
}

.woocommerce-checkout .form-row.privacy.sr-consent--invalid input[type="checkbox"],
.woocommerce-checkout .form-row.privacy.woocommerce-invalid input[type="checkbox"] {
  border-color: var(--sr-consent-error) !important;
  background-color: #fff5f5 !important;
  box-shadow: 0 0 0 3px var(--sr-consent-error-ring);
}

.woocommerce-checkout .form-row.privacy.sr-consent--invalid label,
.woocommerce-checkout .form-row.privacy.woocommerce-invalid label {
  color: var(--sr-consent-error);
}

/* Suppress old circular ::before check on consent labels */
.hp-form__field--checkbox .hp-field--checkbox:before,
.woocommerce-checkout .form-row.privacy label:has(> input[type="checkbox"]):before {
  display: none !important;
  content: none !important;
}
