.login {
  direction: rtl;
  background: var(--bg-main);
  padding: 0 20px calc(24px);
  box-sizing: border-box;
}

.login,
.login button,
.login input {
  font-family: "DanaFaNum", Tahoma, sans-serif;
}

.login__logo {
  width: 160px;
  margin: 100px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login__logo img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.login__intro {
  width: 100%;
  max-width: 390px;
  margin: 64px auto 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-dark);
  text-align: center;
}

.login__form {
  width: 100%;
  max-width: 390px;
  margin: 70px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login__form--otp {
  margin-top: 24px;
}

.login__form--verify {
  margin-top: 32px;
}

.login__intro--verify {
  margin-top: 64px;
  line-height: 1.8;
}

.login__mobile-display {
  display: inline-block;
  font-weight: 600;
  color: var(--blue-dark);
  unicode-bidi: isolate;
}

.login__otp-cells {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 390px;
  justify-content: center;
  direction: ltr;
}

.login__otp-cell-wrap {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.login__otp-cell-wrap:focus-within {
  border-color: var(--blue-dark);
}

.login__otp-cell {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
  font-size: 24px;
  font-weight: 600;
  color: var(--gray-dark);
  text-align: center;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  line-height: 1;
  caret-color: var(--blue-dark);
}

.login .login__otp-cell.num-en {
  width: 100%;
  max-width: 100%;
  direction: ltr;
  text-align: center;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  unicode-bidi: plaintext;
}

.login__otp-cell-wrap--filled {
  border-color: var(--blue-dark);
  background: var(--white);
}

.login__otp-cell-wrap--filled .login__otp-cell {
  color: var(--blue-dark);
}

.login__form--verify .login__field-error {
  margin-top: 12px;
}

.login__form--verify .login__submit {
  margin-top: 32px;
}

.login__resend {
  margin-top: 30px;
  font-size: 15px;
  color: var(--gray);
  text-align: center;
  min-height: 1.5em;
}

.login__resend-btn {
  font-size: 15px;
}

.login__form--verify .login__change-mobile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 35px;
  font-size: 15px;
  text-align: center;
}

.login__change-mobile-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-color: var(--blue-dark);
  mask-image: url("../../assets/icons/left-sign.svg");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-image: url("../../assets/icons/left-sign.svg");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
}

.login__form--verify .login__gradient-line {
  margin-top: 35px;
}

.login__form--verify .login__otp {
  margin-top: 35px;
}

.login__form--verify .login__terms {
  margin-top: 120px;
}

.login__box {
  --login-autofill-bg: #e8eef6;
  width: 100%;
  height: 135px;
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.login__box:has(.login__input:-webkit-autofill) {
  background: var(--login-autofill-bg);
}

.login__box--invalid {
  border-color: var(--red);
}

.login__box--single {
  height: 67px;
}

.login__box--single .login__row {
  height: 100%;
}

.login__row {
  height: calc((135px - 1px) / 2);
  display: flex;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
}

.login__row:focus-within {
  background: rgba(0, 31, 84, 0.03);
}

.login__box:has(.login__input:-webkit-autofill) .login__row:focus-within {
  background: transparent;
}

.login__divider {
  width: 350px;
  height: 1px;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.login__input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--gray-dark);
  text-align: right;
  padding: 0 20px;
  box-sizing: border-box;
}

.login__row--password .login__input {
  padding-left: 8px;
}

.login__input:-webkit-autofill,
.login__input:-webkit-autofill:hover,
.login__input:-webkit-autofill:focus,
.login__input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--login-autofill-bg, #e8eef6) inset;
  box-shadow: 0 0 0 1000px var(--login-autofill-bg, #e8eef6) inset;
  -webkit-text-fill-color: var(--gray-dark);
  caret-color: var(--gray-dark);
  transition: background-color 99999s ease-out 0s;
}

.login__input:autofill {
  box-shadow: 0 0 0 1000px var(--login-autofill-bg, #e8eef6) inset;
  -webkit-text-fill-color: var(--gray-dark);
  caret-color: var(--gray-dark);
}

.login__box:has(.login__input:autofill) {
  background: var(--login-autofill-bg);
}

.login__box:has(.login__input:-webkit-autofill) .login__divider {
  background: rgba(0, 0, 0, 0.1);
}

.login__input::placeholder {
  color: var(--gray);
}

.login__input--ltr,
.login .num-en {
  direction: ltr;
  text-align: right;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  unicode-bidi: plaintext;
}

.login__input--invalid {
  color: var(--red);
}

.login__clear {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin-left: 12px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login__clear[hidden] {
  display: none;
}

.login__clear-icon {
  position: relative;
  width: 16px;
  height: 16px;
  display: block;
}

.login__clear-icon::before,
.login__clear-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  background: var(--gray);
  border-radius: 1px;
}

.login__clear-icon::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.login__clear-icon::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.login__clear:hover .login__clear-icon::before,
.login__clear:hover .login__clear-icon::after {
  background: var(--gray-dark);
}

.login__toggle {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin-left: 8px;
  margin-right: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login__row--password .login__clear {
  margin-left: 4px;
}

.login__toggle img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
}

.login__field-error {
  width: 100%;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--red);
  text-align: right;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
}

.login__field-error:not(:empty)::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
  margin-top: 0.45em;
}

.login__field-error:not(:empty) {
  min-height: 1.25em;
}

.login__field-error + .login__field-error {
  margin-top: 4px;
}

.login__submit {
  width: 100%;
  height: 55px;
  margin-top: 40px;
  border: none;
  border-radius: var(--radius);
  background: var(--blue-dark);
  color: var(--white);
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
}

.login__submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.login__submit.login__submit--loading {
  position: relative;
  color: transparent;
  pointer-events: none;
  cursor: wait;
  background: color-mix(in srgb, var(--blue-dark) 62%, var(--white));
  opacity: 0.88;
}

.login__submit.login__submit--loading:disabled {
  opacity: 0.88;
}

.login__submit.login__submit--loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: login-submit-spin 0.75s linear infinite;
}

@keyframes login-submit-spin {
  to {
    transform: rotate(360deg);
  }
}

.login__link {
  color: var(--blue-dark);
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.login__forgot-row {
  margin-top: 30px;
  font-size: 15px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.login__forgot-text {
  color: var(--gray);
}

.login__gradient-line {
  width: 100%;
  height: 1px;
  margin-top: 35px;
  background: linear-gradient(
    to right,
    var(--gray) 0%,
    var(--white-4) 50%,
    var(--gray) 100%
  );
}

.login__otp {
  margin-top: 35px;
  font-size: 18px;
  text-align: center;
}

.login__terms {
  width: 100%;
  margin-top: 120px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray);
  text-align: center;
}

.login__terms-link {
  font-size: inherit;
  line-height: inherit;
  display: inline;
}

/* مودال قوانین */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.login-modal[hidden] {
  display: none;
}

.login-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.login-modal__panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  max-height: 75dvh;
  background: var(--white);
  border-radius: 16px 16px 0 0;
  padding: 20px 20px 28px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  animation: login-modal-slide 0.25s ease;
}

@keyframes login-modal-slide {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.login-modal__close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--white-3);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--gray-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-dark);
  text-align: center;
  margin: 8px 0 16px;
  padding: 0 40px;
}

.login-modal__body {
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.8;
  color: var(--gray-dark);
}

.login-modal__body h3,
.login-modal__body p {
  direction: rtl;
  text-align: right;
}

.login-modal__body h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--blue-dark);
  margin: 16px 0 8px;
}

.login-modal__body p {
  margin: 0 0 12px;
}

/* مودال کلمه عبور جدید (بازیابی) */
.login-modal--reset .login-modal__panel--reset {
  max-height: none;
  padding-bottom: 32px;
}

.login-modal__reset-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-modal__reset-form .login__box {
  margin-top: 8px;
}

.login-modal__reset-form .login__field-error {
  width: 100%;
  max-width: 390px;
  margin-top: 8px;
}

.login-modal__submit {
  width: 100%;
  max-width: 390px;
  margin-top: 24px;
}
