/* Arabic WooCommerce My Account — authenticated layout and RTL field presentation. */
html[lang^="ar"] body.logged-in.woocommerce-account #primary .entry-content {
  width: min(1180px, calc(100% - 48px)) !important;
  max-width: none !important;
  margin-inline: auto !important;
}

/* Kadence authenticated account DOM has three direct children:
   avatar, navigation and content. Place each explicitly. */
html[lang^="ar"] body.logged-in.woocommerce-account #primary .entry-content > .woocommerce {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 280px !important;
  grid-template-rows: auto auto !important;
  column-gap: 48px !important;
  row-gap: 18px !important;
  align-items: start !important;
  width: 100% !important;
  max-width: none !important;
  margin: 48px auto 80px !important;
  padding: 0 !important;
  box-sizing: border-box;
  direction: ltr;
}

html[lang^="ar"] body.logged-in.woocommerce-account .kadence-account-avatar {
  grid-column: 2 !important;
  grid-row: 1 !important;
  float: none !important;
  clear: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
  position: static !important;
  transform: none !important;
  direction: ltr !important;
  text-align: left !important;
}

html[lang^="ar"] body.logged-in.woocommerce-account .kadence-customer-image {
  position: static !important;
  transform: none !important;
  flex: 0 0 60px !important;
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  margin: 0 !important;
}

html[lang^="ar"] body.logged-in.woocommerce-account .kadence-customer-image a,
html[lang^="ar"] body.logged-in.woocommerce-account .kadence-customer-image img {
  display: block !important;
  width: 60px !important;
  height: 60px !important;
  max-width: 60px !important;
  margin: 0 !important;
  border-radius: 50%;
}

html[lang^="ar"] body.logged-in.woocommerce-account .kadence-customer-name {
  position: static !important;
  transform: none !important;
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  direction: ltr !important;
  text-align: left !important;
  line-height: 1.4 !important;
}

html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation {
  grid-column: 2 !important;
  grid-row: 2 !important;
  float: none !important;
  clear: none !important;
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  margin: 0 !important;
  direction: rtl;
}

html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-content {
  grid-column: 1 !important;
  grid-row: 1 / span 2 !important;
  align-self: start !important;
  float: none !important;
  clear: none !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  direction: rtl;
  text-align: right;
}

html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation ul {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100% !important;
}

html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation li,
html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation a {
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation a {
  display: block;
  padding: 11px 14px;
  line-height: 1.55;
  white-space: nowrap !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  writing-mode: horizontal-tb !important;
}

html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-Addresses {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-Addresses .col-1,
html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-Addresses .col-2 {
  float: none !important;
  width: auto !important;
  min-width: 0;
}

html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce form .form-row label,
html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce form .form-row input,
html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce form .form-row select,
html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce form .form-row textarea {
  text-align: right;
}

html[lang^="ar"] body.logged-in.woocommerce-account .select2-container .select2-selection--single,
html[lang^="ar"] body.logged-in.woocommerce-account .select2-container .select2-selection__rendered {
  direction: rtl;
  text-align: right;
}

@media (max-width: 900px) {
  html[lang^="ar"] body.logged-in.woocommerce-account #primary .entry-content {
    width: calc(100% - 40px) !important;
  }

  html[lang^="ar"] body.logged-in.woocommerce-account #primary .entry-content > .woocommerce {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto !important;
    gap: 22px !important;
  }

  html[lang^="ar"] body.logged-in.woocommerce-account .kadence-account-avatar,
  html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation,
  html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-content {
    grid-column: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html[lang^="ar"] body.logged-in.woocommerce-account .kadence-account-avatar { grid-row: 1 !important; }
  html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation { grid-row: 2 !important; }
  html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-content { grid-row: 3 !important; }

  html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
  }

  html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation a {
    white-space: normal !important;
  }
}

@media (max-width: 560px) {
  html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-MyAccount-navigation ul,
  html[lang^="ar"] body.logged-in.woocommerce-account .woocommerce-Addresses {
    grid-template-columns: 1fr;
  }

  html[lang^="ar"] body.logged-in.woocommerce-account .kadence-customer-name {
    white-space: normal !important;
  }
}
