/* ==========================================================================
   COMPONENT / FORM FIELDS
   Shared text input / label / checkbox styling. First built for
   "Cart - Sign in"; expect reuse on Sign In, LogIn, My Account, and any
   other form (Figma tokens: input bg #0000801A, radius 8px).
   ========================================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.field label {
  font-family: var(--font-main);
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  color: #434656;
  text-align: right;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"] {
  width: 100%;
  padding: 17px var(--space-6);
  border: none;
  border-radius: var(--radius-input);
  background: var(--color-input-bg);
  font-family: var(--font-main);
  font-weight: 400;
  font-size: 16px;
  color: var(--color-text-heading);
  text-align: right;
  direction: rtl;
}

.field input::placeholder {
  color: var(--color-profile-text);
  opacity: 0.6;
}

.field input:focus {
  outline: 2px solid var(--color-pink-accent);
  outline-offset: 1px;
}

.field-hint {
  font-family: var(--font-main);
  font-weight: 400;
  font-size: 14px;
  line-height: 16px;
  color: #183B51;
  text-align: right;
}

/* --- Validation error message ---
   Shared by every pure-JS-validated form on the site (Contact Us,
   Blog's newsletter card, etc.) so the error style/behavior is defined
   once. Populate the matching <span class="field-error" role="alert">
   with the message; :empty keeps it collapsed with no reserved space. */
.field-error {
  display: none;
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 18px;
  color: #C0392B;
  text-align: right;
}

.field-error:not(:empty) {
  display: block;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  outline: 2px solid #C0392B;
  outline-offset: 1px;
}

/* --- Row layouts --- */
.form-row {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.form-row .field {
  flex-basis: 0;
}

/* --- Checkbox ---
   Figma gives two distinct checkbox styles: the default here (navy,
   1.5px border) matches the "business purchase?" checkbox; the terms
   checkbox further down the flow uses a lighter 1px border instead —
   add .checkbox-row--light to switch to that variant. */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
   /* RTL: label to the right of the box */
  flex-direction: row;
}

.checkbox-row input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 2px;
  border: 1.5px solid var(--color-border-checkbox-strong);
  background: var(--color-white);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
}

.checkbox-row--light input[type="checkbox"] {
  border: 1px solid var(--color-border-checkbox);
}

.checkbox-row input[type="checkbox"]:checked {
  background: var(--color-primary-navy);
  border-color: var(--color-primary-navy);
}

.checkbox-row input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--color-white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-row label {
  font-family: var(--font-main);
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  color: var(--color-text-heading);
  text-align: right;
}

.checkbox-row label a {
  font-weight: 500;
  color: var(--color-text-heading);
  text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE — Form fields
   ========================================================================== */
@media (max-width: 599px) {
  .form-row {
    gap: var(--space-4);
  }

  .form-row .field {
    flex-basis: 100%;
  }

  .field input[type="text"],
  .field input[type="email"],
  .field input[type="password"],
  .field input[type="tel"] {
    padding: 14px var(--space-4);
  }
}
