/*
 * Storefront redesign: login, registration and password reset
 * (body.itm-auth-page, woocommerce/myaccount/form-login.php and the lost
 * password templates). Tokens and notices come from itm-base.css.
 */

body.itm-auth-page #content {
  padding-bottom: 80px;
}

body.itm-auth-page .entry-content > .woocommerce {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 40px;
}

body.itm-auth-page .entry-content > .woocommerce::before,
body.itm-auth-page .entry-content > .woocommerce::after {
  display: none;
}

body.itm-auth-page h1.itm-auth-head__title {
  margin: 0;
  font-family: var(--itm-font);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-transform: none;
  color: var(--itm-ink);
}

/* Guest checkout (itmedia-integrations-ui panel): the heading comes in
   Martfury's .row around woocommerce_before_checkout_form; keep it first,
   above the cart notices, and aligned with the content. */
body.itm-guest-checkout .entry-content > .woocommerce > .row:has(> .itm-auth-head) {
  order: -1;
  margin: 0;
}

/* Part A: two cards side by side, stacked on phones (login first). */
body.itm-auth-page .itm-auth {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 24px;
  margin: 0;
}

body.itm-auth-page .itm-auth::before,
body.itm-auth-page .itm-auth::after {
  display: none;
}

body.itm-auth-page .itm-auth-card {
  display: flex;
  flex: 1 1 380px;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  margin: 0;
  padding: 40px;
  border: 1px solid var(--itm-line);
  border-radius: 24px;
  background: var(--itm-white);
}

body.itm-auth-page .itm-auth-card__head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.itm-auth-page :is(h1, h2).itm-auth-card__title {
  margin: 0 !important; /* Martfury: heading margins */
  padding: 0;
  font-family: var(--itm-font);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--itm-ink);
}

body.itm-auth-page p.itm-auth-card__lead {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--itm-muted-2);
}

body.itm-auth-page .itm-auth-card form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

/* A form that is the card itself (lost password, reset). Martfury frames
   form.lost_reset_password (430px, 20px padding, 5px radius). */
body.itm-auth-page.woocommerce-account form.itm-auth-card.lost_reset_password {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 40px;
  border: 1px solid var(--itm-line);
  border-radius: 24px;
  background: var(--itm-white);
}

body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) .form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
}

body.itm-auth-page .itm-auth-card__names {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 16px;
}

/* Fields: label above, 48px input (same component as the homepage quote form). */
body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) .form-row > label:not(.woocommerce-form__label-for-checkbox) {
  display: block;
  margin: 0;
  font-family: var(--itm-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--itm-ink);
}

body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) .required {
  border: 0;
  color: var(--itm-ink) !important; /* Martfury: red */
  text-decoration: none;
}

/* Hidden helpers that would still add a flex gap (order attribution, an empty privacy text). */
body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) > wc-order-attribution-inputs,
body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) > .woocommerce-privacy-policy-text:not(:has(*)) {
  display: none;
}

body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) :is(input.input-text, input[type="email"], input[type="password"], input[type="text"]) {
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid var(--itm-input-border) !important;
  border-radius: 12px !important;
  background: var(--itm-paper);
  box-shadow: none;
  font-family: var(--itm-font);
  font-size: 16px;
  color: var(--itm-ink);
}

body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) :is(input.input-text, input[type="email"], input[type="password"], input[type="text"]):focus {
  border-color: var(--itm-ink) !important;
  outline: none;
  background: var(--itm-white);
}

body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) input[aria-invalid="true"] {
  border-color: #b3261e !important;
}

/* WooCommerce's show/hide password button, as a text button "Arată" / "Ascunde". */
body.itm-auth-page .itm-auth-card .password-input {
  position: relative;
  display: block;
  width: 100%;
}

body.itm-auth-page .itm-auth-card .password-input input {
  padding-right: 84px;
}

body.itm-auth-page .itm-auth-card .show-password-input {
  position: absolute;
  top: 50% !important; /* Martfury: 10px */
  right: 8px;
  display: inline-flex;
  align-items: center;
  height: 36px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  transform: translateY(-50%);
}

body.itm-auth-page .itm-auth-card .show-password-input {
  opacity: 1 !important; /* Martfury dims it */
}

/* .password-input outweighs Martfury's ".woocommerce .customer-login
   .password-input .show-password-input:before" (Linearicons !important, 16px,
   700); with Linearicons the "ă" of "Arată" came out as an icon glyph. */
body.itm-auth-page .itm-auth-card .password-input .show-password-input::before {
  content: "Arată" !important; /* Martfury: an eye icon (Linearicons) */
  font-family: var(--itm-font) !important;
  font-size: 13px;
  font-weight: 600;
  color: var(--itm-ink-2) !important;
}

body.itm-auth-page .itm-auth-card .password-input .show-password-input.display-password::before {
  content: "Ascunde" !important;
}

body.itm-auth-page .itm-auth-card .password-input .show-password-input::after {
  display: none;
}

body.itm-auth-page .itm-auth-card .show-password-input:focus-visible {
  outline: 2px solid var(--itm-ink);
}

/* Password strength meter under the registration password: one small line. */
body.itm-auth-page .itm-auth-card .woocommerce-password-strength {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  color: var(--itm-muted-2);
}

body.itm-auth-page .itm-auth-card .woocommerce-password-strength.short,
body.itm-auth-page .itm-auth-card .woocommerce-password-strength.bad {
  color: #b3261e;
}

body.itm-auth-page .itm-auth-card .woocommerce-password-strength.strong {
  color: #2f6b3a;
}

body.itm-auth-page .itm-auth-card .woocommerce-password-hint {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  color: var(--itm-muted-3);
}

/* Checkboxes: 20px square, 1.5px ink border. */
body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) input[type="checkbox"] {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  border: 1.5px solid var(--itm-ink);
  border-radius: 6px;
  background: var(--itm-white);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) input[type="checkbox"]:checked {
  background: var(--itm-ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3.2L15 7' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") center / 18px no-repeat;
}

body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--itm-ink);
  outline-offset: 2px;
}

body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) label.woocommerce-form__label-for-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-family: var(--itm-font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--itm-ink);
  cursor: pointer;
}

body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) label.woocommerce-form__label-for-checkbox a {
  color: var(--itm-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Remember me + lost password on one row. */
body.itm-auth-page :is(.itm-auth-card form, form.itm-auth-card) .itm-auth-card__row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

body.itm-auth-page .itm-auth-card a.lost-password {
  float: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--itm-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.itm-auth-page .itm-auth-card .woocommerce-privacy-policy-text p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--itm-muted-2);
}

/* Buttons: ink (login) and ghost (registration), 52px pills. */
body.itm-auth-page .itm-auth-card button.itm-auth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 20px;
  border-radius: 999px !important;
  box-shadow: none;
  font-family: var(--itm-font);
  font-size: 16px;
  font-weight: 600 !important;
  line-height: 1.2;
  text-transform: none;
  cursor: pointer;
}

body.itm-auth-page .itm-auth-card button.itm-auth-button--ink,
body.itm-auth-page.woocommerce-account.woocommerce-lost-password form.lost_reset_password .form-row button.itm-auth-button--ink {
  border: 0;
  background: var(--itm-ink) !important;
  color: var(--itm-white) !important;
}

body.itm-auth-page .itm-auth-card button.itm-auth-button--ink:hover,
body.itm-auth-page.woocommerce-account.woocommerce-lost-password form.lost_reset_password .form-row button.itm-auth-button--ink:hover {
  background: var(--itm-ink-2) !important;
}

body.itm-auth-page .itm-auth-card button.itm-auth-button--ghost {
  border: 1px solid var(--itm-ink) !important;
  background: var(--itm-white) !important;
  color: var(--itm-ink) !important;
}

body.itm-auth-page .itm-auth-card button.itm-auth-button--ghost:hover {
  background: var(--itm-soft) !important;
}

body.itm-auth-page .itm-auth-card button.itm-auth-button:focus-visible {
  outline: 2px solid var(--itm-ink);
  outline-offset: 2px;
}

/* Account benefits at the bottom of the registration card. */
body.itm-auth-page .itm-auth-benefits {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--itm-line);
  font-size: 14px;
  line-height: 1.45;
  color: var(--itm-ink-2);
}

body.itm-auth-page p.itm-auth-benefits__title {
  margin: 0;
  font-weight: 600;
  color: var(--itm-ink);
}

body.itm-auth-page .itm-auth-benefits ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.itm-auth-page .itm-auth-benefits li {
  margin: 0;
  padding: 0;
}

body.itm-auth-page .itm-auth-benefits li::before {
  content: "\2713";
  margin-right: 6px;
  color: var(--itm-ink);
}

/* Part C: lost password, confirmation and reset: one narrow centred card. */
body.itm-auth-page .itm-auth-card--narrow {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  flex: none;
}

body.itm-auth-page .itm-auth-card--sent {
  max-width: 560px;
}

body.itm-auth-page h1.itm-auth-card__title--page {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

body.itm-auth-page .itm-auth-card__check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--itm-ink);
  font-size: 18px;
  color: var(--itm-white);
}

body.itm-auth-page a.itm-auth-back {
  font-size: 15px;
  font-weight: 600;
  color: var(--itm-ink);
}

body.itm-auth-page a.itm-auth-back:hover {
  text-decoration: underline;
}

body.itm-auth-page a.itm-auth-back--center {
  align-self: center;
}

body.itm-auth-page.woocommerce-lost-password .woocommerce-notices-wrapper:not(:empty) {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

body.itm-auth-page .woocommerce-notices-wrapper a:not(.button) {
  font-weight: 600;
}

@media (max-width: 1100px) {
  body.itm-auth-page h1.itm-auth-head__title {
    font-size: 38px;
  }
}

@media (max-width: 760px) {
  body.itm-auth-page .entry-content > .woocommerce {
    gap: 20px;
    padding-top: 24px;
  }

  body.itm-auth-page h1.itm-auth-head__title {
    font-size: 30px;
  }

  body.itm-auth-page .itm-auth-card,
  body.itm-auth-page.woocommerce-account form.itm-auth-card.lost_reset_password {
    padding: 24px;
  }

  body.itm-auth-page h1.itm-auth-card__title--page {
    font-size: 26px;
  }
}
