/* ===== RTL (default Arabic) ===== */

/* RTL - label resting position: inside the field, right-aligned, vertically centered */
.muirtl-1m7xc33,
label.MuiInputLabel-root[data-shrink="false"] {
  top: 0 !important;
  transform: translate(-14px, 16px) scale(1) !important;
}

/* RTL - label shrinks to the right when focused or has value */
.MuiFormControl-root:focus-within > label[data-shrink="false"],
.MuiFormControl-root:has(input:not([value=""])) > label[data-shrink="false"],
.MuiFormControl-root:focus-within > label,
.MuiFormControl-root:has(input:not([value=""])) > label,
label.MuiInputLabel-shrink {
  transform: translate(-14px, -9px) scale(0.75) !important;
  pointer-events: auto;
  user-select: none;
  max-width: calc(133% - 32px);
}

/* RTL - legend notch opens when focused or has value */
.MuiFormControl-root:focus-within legend,
.MuiFormControl-root:has(input:not([value=""])) legend {
  max-width: 100% !important;
}

/* ===== LTR (English) ===== */

/* LTR - label resting position: inside the field, left-aligned, vertically centered like a placeholder */
[dir="ltr"] label.MuiInputLabel-root,
[dir="ltr"] label.MuiInputLabel-root[data-shrink="false"],
[dir="ltr"] .muirtl-1m7xc33 {
  right: auto !important;
  left: 0 !important;
  top: 0 !important;
  transform: translate(14px, 16px) scale(1) !important;
  transform-origin: top left !important;
  padding-left: 0 !important;
}

/* LTR - label shrinks to the top-left border when focused or has value */
[dir="ltr"] .MuiFormControl-root:focus-within > label[data-shrink="false"],
[dir="ltr"] .MuiFormControl-root:has(input:not([value=""])) > label[data-shrink="false"],
[dir="ltr"] .MuiFormControl-root:focus-within > label,
[dir="ltr"] .MuiFormControl-root:has(input:not([value=""])) > label,
[dir="ltr"] label.MuiInputLabel-shrink {
  transform: translate(14px, -9px) scale(0.75) !important;
  top: 0 !important;
  left: 0 !important;
  right: auto !important;
  padding-left: 0 !important;
  transform-origin: top left !important;
  pointer-events: auto;
  user-select: none;
  max-width: calc(133% - 32px);
}

/* LTR - legend notch */
[dir="ltr"] .MuiFormControl-root:focus-within legend,
[dir="ltr"] .MuiFormControl-root:has(input:not([value=""])) legend {
  max-width: 100% !important;
}

/* LTR - fix fieldset legend alignment */
[dir="ltr"] .MuiOutlinedInput-notchedOutline legend {
  text-align: left !important;
}

/* LTR - prevent long labels from overflowing the field boundary */
[dir="ltr"] label.MuiInputLabel-root {
  max-width: calc(100% - 28px) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
[dir="ltr"] .MuiFormControl-root:focus-within > label,
[dir="ltr"] .MuiFormControl-root:has(input:not([value=""])) > label {
  max-width: calc(133% - 32px) !important;
  overflow: visible !important;
  text-overflow: clip !important;
}

/* Hide the Google reCAPTCHA badge (white box at bottom-right) */
.grecaptcha-badge {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
