:root {
  --storefront-child-section-title-size: 1.618em;
}

#masthead,
.storefront-handheld-footer-bar,
.site-footer,
.storefront-breadcrumb,
.storefront-primary-navigation,
.storefront-secondary-navigation {
  display: none !important;
}

.entry-header,
.woocommerce-products-header {
  display: none !important;
}

/* =========================================================================
   Shared WooCommerce payment flows (checkout, pay-order, add payment method)
   ========================================================================= */

body.storefront-child-wc-flow .storefront-child-checkout-section-title,
body.storefront-child-wc-flow .woocommerce-billing-fields > h3,
body.storefront-child-wc-flow .woocommerce-shipping-fields > h3,
body.storefront-child-wc-flow #order_review_heading {
  /*font-size: var(--storefront-child-section-title-size) !important; */
  font-weight: 600 !important;
  line-height: 1.2 !important;
  margin: 0.35em 0 0.5em !important;
  padding: 0 !important;
  letter-spacing: normal;
  text-transform: uppercase;
}

body.storefront-child-wc-flow #place_order,
body.storefront-child-wc-flow #payment .button.alt,
body.storefront-child-wc-flow .form-row.place-order .button.alt {
  background-color: var(--storefront-child-accent) !important;
  border-color: var(--storefront-child-accent) !important;
  color: #fff !important;
}

body.storefront-child-wc-flow #place_order:hover,
body.storefront-child-wc-flow #payment .button.alt:hover,
body.storefront-child-wc-flow .form-row.place-order .button.alt:hover {
  background-color: var(--storefront-child-accent-hover) !important;
  border-color: var(--storefront-child-accent-hover) !important;
  color: #fff !important;
}

body.storefront-child-wc-flow input[type="checkbox"] {
  accent-color: var(--storefront-child-accent);
}

/* Subscription / variation meta: "Label: Value" on one line (Woo wraps value in <p>) */
body.storefront-child-wc-flow table.shop_table dl.variation,
body.storefront-child-wc-flow
  .woocommerce-checkout-review-order-table
  dl.variation,
body.storefront-child-wc-flow dl.variation {
  margin: 0.35em 0 0;
  padding: 0;
}

body.storefront-child-wc-flow table.shop_table dl.variation dt,
body.storefront-child-wc-flow table.shop_table dl.variation dd,
body.storefront-child-wc-flow dl.variation dt,
body.storefront-child-wc-flow dl.variation dd {
  display: inline !important;
  margin: 0;
  padding: 0;
  vertical-align: top;
  float: none !important;
  width: auto !important;
}

body.storefront-child-wc-flow table.shop_table dl.variation dd p,
body.storefront-child-wc-flow dl.variation dd p {
  display: inline !important;
  margin: 0;
  padding: 0;
}

/* New line after each label + value pair */
body.storefront-child-wc-flow table.shop_table dl.variation dd::after,
body.storefront-child-wc-flow dl.variation dd::after {
  content: "";
  display: block;
  margin-bottom: 0.2em;
}

body.storefront-child-wc-flow .wc-item-meta {
  margin: 0.35em 0 0;
  padding: 0;
}

body.storefront-child-wc-flow .wc-item-meta li {
  display: block;
  margin: 0.15em 0;
  padding: 0;
  list-style: none;
}

body.storefront-child-wc-flow .wc-item-meta li strong {
  display: inline;
  font-weight: 600;
}

/* Pay for order page */
body.storefront-child-wc-flow .storefront-child-wc-flow-pay .shop_table {
  margin-bottom: 1em;
}

body.storefront-child-wc-flow .storefront-child-wc-flow-pay #payment {
  margin-top: 0.5em;
}

/* -------------------------------------------------------------------------
   Billing field grid (desktop): pairs side by side, tighter gaps
   ------------------------------------------------------------------------- */

@media (min-width: 769px) {
  body.storefront-child-wc-flow form.checkout.storefront-child-checkout {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
  }

  body.storefront-child-wc-flow .woocommerce-billing-fields__field-wrapper {
    display: grid;
    /* 6 columns: pairs span 3 (50%), optional fields span 2 (33%) */
    grid-template-columns: repeat(6, minmax(0, 1fr));
    column-gap: 1em;
    row-gap: 0.65em;
    align-items: end;
    max-width: 100%;
    min-width: 0;
  }

  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .form-row {
    width: 100% !important;
    min-width: 0;
    float: none !important;
    margin: 0 !important;
    padding: 0;
    clear: none;
  }

  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .woocommerce-input-wrapper,
  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .select2-container {
    max-width: 100%;
    min-width: 0;
  }

  /* Visual order (DOM/locale/AJAX may differ from data-priority) */
  body.storefront-child-wc-flow #billing_country_field {
    order: 10;
  }

  body.storefront-child-wc-flow #aelia_cs_currency_field {
    order: 11;
  }

  body.storefront-child-wc-flow #billing_first_name_field {
    order: 12;
  }

  body.storefront-child-wc-flow #billing_last_name_field {
    order: 13;
  }

  body.storefront-child-wc-flow #billing_company_field {
    order: 20;
  }

  body.storefront-child-wc-flow #billing_address_1_field {
    order: 21;
  }

  body.storefront-child-wc-flow #billing_address_2_field {
    order: 22;
  }

  body.storefront-child-wc-flow #billing_city_field {
    order: 30;
  }

  body.storefront-child-wc-flow #billing_state_field {
    order: 31;
  }

  body.storefront-child-wc-flow #billing_postcode_field {
    order: 32;
  }

  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .storefront-child-billing-toggle-wrap {
    order: 40;
  }

  body.storefront-child-wc-flow #customer_location_self_certified_field {
    order: 41;
  }

  body.storefront-child-wc-flow #billing_email_field {
    order: 50;
  }

  body.storefront-child-wc-flow #billing_phone_field {
    order: 51;
  }

  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .form-row-first,
  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .form-row-last {
    grid-column: span 3;
  }

  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .form-row-third,
  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .form-row-third.form-row-wide,
  body.storefront-child-wc-flow #billing_company_field,
  body.storefront-child-wc-flow #billing_address_1_field,
  body.storefront-child-wc-flow #billing_address_2_field,
  body.storefront-child-wc-flow #billing_city_field,
  body.storefront-child-wc-flow #billing_state_field,
  body.storefront-child-wc-flow #billing_postcode_field {
    grid-column: span 2;
  }

  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .form-row-wide:not(.form-row-third),
  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    #customer_location_self_certified_field,
  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .storefront-child-billing-toggle-wrap {
    grid-column: 1 / -1;
  }
}

/* Optional billing fields hidden before JS (and when collapsed) */
body.storefront-child-wc-flow.storefront-child-billing-optional-collapsed
  #billing_company_field,
body.storefront-child-wc-flow.storefront-child-billing-optional-collapsed
  #billing_address_1_field,
body.storefront-child-wc-flow.storefront-child-billing-optional-collapsed
  #billing_address_2_field,
body.storefront-child-wc-flow.storefront-child-billing-optional-collapsed
  #billing_city_field,
body.storefront-child-wc-flow.storefront-child-billing-optional-collapsed
  #billing_state_field,
body.storefront-child-wc-flow.storefront-child-billing-optional-collapsed
  #billing_postcode_field {
  display: none !important;
}

.storefront-child-billing-toggle-wrap {
  margin: 0 0 0.35em !important;
  padding: 0 !important;
}

.storefront-child-billing-toggle-wrap .checkout-billing-toggle {
  float: none;
  display: inline-block;
  margin-right: 1.25em;
  font-size: 14px;
  color: var(--storefront-child-accent) !important;
}

/* -------------------------------------------------------------------------
   EU location self-certification field
   ------------------------------------------------------------------------- */

body.storefront-child-wc-flow #customer_location_self_certified_field {
  margin: 0.5em 0 0 !important;
  padding: 1em 1.15em !important;
  border: 1px solid #e0e6e3 !important;
  border-radius: 4px;
  background-color: #f8f8f8;
  clear: both;
}

body.storefront-child-wc-flow
  #customer_location_self_certified_field
  #customer_location_self_certified-description,
body.storefront-child-wc-flow
  #customer_location_self_certified_field
  .description {
  display: none !important;
}

body.storefront-child-wc-flow
  #customer_location_self_certified_field
  .optional {
  display: none;
}

body.storefront-child-wc-flow
  #customer_location_self_certified_field
  .woocommerce-input-wrapper {
  display: block;
}

body.storefront-child-wc-flow
  #customer_location_self_certified_field
  label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.65em;
  margin: 0;
  padding: 0;
  cursor: pointer;
  font-weight: normal;
}

body.storefront-child-wc-flow
  #customer_location_self_certified_field
  .self_certification_label {
  margin: 0;
  line-height: 1.45;
  font-size: 0.9375rem;
  color: #333;
}

/* Custom checkboxes: self-certification, terms & conditions, etc. */
body.storefront-child-wc-flow
  #customer_location_self_certified_field
  input.input-checkbox,
body.storefront-child-wc-flow
  input.woocommerce-form__input-checkbox.input-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  min-width: 1.125rem;
  margin: 0.2em 0 0;
  padding: 0;
  border: 2px solid #b8c4be;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

body.storefront-child-wc-flow
  #customer_location_self_certified_field
  input.input-checkbox:checked,
body.storefront-child-wc-flow
  input.woocommerce-form__input-checkbox.input-checkbox:checked {
  background-color: var(--storefront-child-accent);
  border-color: var(--storefront-child-accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' d='M1 5l3 3 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.75rem;
}

body.storefront-child-wc-flow
  #customer_location_self_certified_field
  input.input-checkbox:focus,
body.storefront-child-wc-flow
  input.woocommerce-form__input-checkbox.input-checkbox:focus {
  outline: 2px solid var(--storefront-child-accent);
  outline-offset: 2px;
}

/* Terms & conditions checkbox — match self-certification layout */
body.storefront-child-wc-flow
  #payment
  label.woocommerce-form__label-for-checkbox.checkbox,
body.storefront-child-wc-flow
  .woocommerce-terms-and-conditions-wrapper
  label.woocommerce-form__label-for-checkbox.checkbox {
  display: flex;
  align-items: center;
  gap: 0.65em;
  margin: 0;
  padding: 0;
  cursor: pointer;
  font-weight: normal;
}

body.storefront-child-wc-flow .woocommerce-terms-and-conditions-checkbox-text {
  margin: 0;
  line-height: 1.45;
  font-size: 0.9375rem;
  color: #333;
}

body.storefront-child-wc-flow
  label.woocommerce-form__label-for-checkbox.checkbox
  .required {
  margin-left: 0.15em;
}

/* WooCommerce notices — override Storefront 2.617924em bottom margin */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.woocommerce-noreviews,
p.no-comments {
  margin-bottom: 1em !important;
}

.woocommerce-info::before,
.woocommerce-info a {
  color: #fff !important;
}

/* Hide Additional Information (order notes) on main checkout */
body.storefront-child-wc-flow.woocommerce-checkout
  .woocommerce-additional-fields,
body.storefront-child-wc-flow.woocommerce-checkout
  .woocommerce-additional-fields__field-wrapper {
  display: none !important;
}

/* -------------------------------------------------------------------------
   Main checkout layout: billing full width, then order | payment columns
   ------------------------------------------------------------------------- */

body.storefront-child-wc-flow
  form.checkout.storefront-child-checkout
  #customer_details.storefront-child-billing-section {
  width: 100% !important;
  float: none !important;
  max-width: 100%;
  margin-bottom: 1em;
  clear: both;
}

body.storefront-child-wc-flow
  form.checkout.storefront-child-checkout
  #customer_details
  .col-1,
body.storefront-child-wc-flow
  form.checkout.storefront-child-checkout
  #customer_details
  .col-2 {
  width: 100%;
  float: none;
  margin-right: 0;
}

body.storefront-child-wc-flow
  form.checkout.storefront-child-checkout
  .storefront-child-order-payment-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5em;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  clear: both;
  align-items: start;
  margin-top: 0.25em;
}

body.storefront-child-wc-flow
  form.checkout.storefront-child-checkout
  #order_review_heading,
body.storefront-child-wc-flow
  form.checkout.storefront-child-checkout
  .storefront-child-order-col,
body.storefront-child-wc-flow
  form.checkout.storefront-child-checkout
  .storefront-child-payment-col {
  float: none !important;
  width: 100% !important;
  max-width: 100%;
  position: static;
}

body.storefront-child-wc-flow
  form.checkout.storefront-child-checkout
  #order_review,
body.storefront-child-wc-flow form.checkout.storefront-child-checkout #payment {
  width: 100%;
  float: none;
}

/* Mobile spacing */
@media (max-width: 768px) {
  body.storefront-child-wc-flow form.checkout.storefront-child-checkout {
    margin-bottom: 1rem;
  }

  body.storefront-child-wc-flow .form-row {
    margin-bottom: 0.5em;
  }

  body.storefront-child-wc-flow
    form.checkout.storefront-child-checkout
    .storefront-child-order-payment-row {
    grid-template-columns: 1fr;
    gap: 1em;
  }

  body.storefront-child-wc-flow
    .woocommerce-billing-fields__field-wrapper
    .form-row {
    margin-bottom: 0.5em !important;
  }
}

/* Register link CTAs (not #place_order) */
body.storefront-child-wc-flow .woocommerce-form-login-toggle a,
body.storefront-child-wc-flow a.showlogin,
body.storefront-child-wc-flow .woocommerce-checkout-registration a,
body.storefront-child-wc-flow a.wlrp-popup-toggle,
body.storefront-child-wc-flow a.wlrp-popup-open {
  color: var(--storefront-child-accent) !important;
}

body.storefront-child-wc-flow a.button[href*="register"],
body.storefront-child-wc-flow a.button[href*="sign-up"],
body.storefront-child-wc-flow a.button[href*="signup"],
body.storefront-child-wc-flow .wl101-reg-btn a {
  background-color: var(--storefront-child-accent) !important;
  border-color: var(--storefront-child-accent) !important;
  color: #fff !important;
}
