/* Tik4 Mobile Auth — scoped under .t4ma / .t4ma-modal (no !important) */

.t4ma {
  --t4ma-ink: #1a2b3c;
  --t4ma-muted: #5a6d7e;
  --t4ma-line: #c5d0da;
  --t4ma-surface: #eef3f7;
  --t4ma-panel: rgba(255, 255, 255, 0.92);
  --t4ma-accent: #0e7c7b;
  --t4ma-accent-2: #1f6f8b;
  --t4ma-btn-text: #ffffff;
  --t4ma-danger: #b42318;
  --t4ma-radius: 14px;
  --t4ma-font: "Vazirmatn", "Tahoma", sans-serif;

  position: relative;
  max-width: 420px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 1.5rem;
  font-family: var(--t4ma-font);
  color: var(--t4ma-ink);
  background:
    radial-gradient(
      120% 80% at 100% 0%,
      color-mix(in srgb, var(--t4ma-accent) 18%, transparent),
      transparent 55%
    ),
    radial-gradient(
      90% 70% at 0% 100%,
      color-mix(in srgb, var(--t4ma-accent-2) 14%, transparent),
      transparent 50%
    ),
    linear-gradient(165deg, #f7fafc 0%, var(--t4ma-surface) 100%);
  border: 1px solid rgba(197, 208, 218, 0.85);
  border-radius: calc(var(--t4ma-radius) + 4px);
  box-shadow: 0 18px 40px rgba(26, 43, 60, 0.08);
  direction: rtl;
  text-align: right;
  overflow: hidden;
  animation: t4ma-rise 0.55s ease both;
  box-sizing: border-box;
}

.t4ma *,
.t4ma *::before,
.t4ma *::after,
.t4ma-modal *,
.t4ma-modal *::before,
.t4ma-modal *::after {
  box-sizing: border-box;
}

@keyframes t4ma-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .t4ma,
  .t4ma .t4ma__bar,
  .t4ma .t4ma__btn,
  .t4ma-modal .t4ma-modal__dialog {
    animation: none;
    transition: none;
  }
}

.t4ma .t4ma__signal {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 14px;
  margin-bottom: 1.1rem;
}

.t4ma .t4ma__bar {
  flex: 1;
  display: block;
  height: 4px;
  border-radius: 99px;
  background: var(--t4ma-line);
  transition: background 0.35s ease, transform 0.35s ease;
}

.t4ma .t4ma__bar.is-active {
  background: linear-gradient(90deg, var(--t4ma-accent), var(--t4ma-accent-2));
  transform: scaleY(1.35);
}

.t4ma .t4ma__title {
  margin: 0 0 0.4rem;
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--t4ma-ink);
}

.t4ma .t4ma__sub {
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--t4ma-muted);
}

.t4ma .t4ma__label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--t4ma-ink);
}

.t4ma .t4ma__phone-wrap {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  direction: ltr;
  border: 1px solid var(--t4ma-line);
  border-radius: var(--t4ma-radius);
  background: var(--t4ma-panel);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.t4ma .t4ma__phone-wrap:focus-within {
  border-color: var(--t4ma-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--t4ma-accent) 22%, transparent);
}

.t4ma .t4ma__prefix {
  display: flex;
  align-items: center;
  justify-content: center;
  order: 0;
  flex: 0 0 auto;
  min-width: 3.5rem;
  padding: 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--t4ma-muted);
  background: color-mix(in srgb, var(--t4ma-accent-2) 8%, #fff);
  border: 0;
  border-right: 1px solid var(--t4ma-line);
}

.t4ma .t4ma__phone-wrap .t4ma__input,
.t4ma input.t4ma__input--mobile {
  flex: 1;
  order: 1;
  min-width: 0;
  width: auto;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  background-image: none;
  padding: 0.9rem 0.85rem;
  font: inherit;
  font-family: var(--t4ma-font);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--t4ma-ink);
  outline: none;
  box-shadow: none;
  text-shadow: none;
}

.t4ma input::placeholder,
.t4ma textarea::placeholder {
  color: #b0bcc8;
  opacity: 1;
}

.t4ma input::-webkit-input-placeholder {
  color: #b0bcc8;
  opacity: 1;
}

.t4ma input::-moz-placeholder {
  color: #b0bcc8;
  opacity: 1;
}

.t4ma .t4ma__hint {
  margin: 0.45rem 0 0.9rem;
  font-size: 0.8rem;
  color: var(--t4ma-muted);
}

.t4ma .t4ma__captcha {
  margin: 0 0 1.15rem;
}

.t4ma .t4ma__captcha-field {
  display: flex;
  align-items: stretch;
  direction: ltr;
  border: 1px solid var(--t4ma-line);
  border-radius: var(--t4ma-radius);
  background: var(--t4ma-panel);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.t4ma .t4ma__captcha-field:focus-within {
  border-color: var(--t4ma-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--t4ma-accent) 22%, transparent);
}

.t4ma button.t4ma__captcha-img-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--t4ma-line);
  border-radius: 0;
  background: #eef3f7;
  background-image: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  text-transform: none;
  text-shadow: none;
  cursor: pointer;
  line-height: 0;
}

.t4ma button.t4ma__captcha-img-btn:hover {
  filter: brightness(0.97);
}

.t4ma .t4ma__captcha-img {
  display: block;
  width: 120px;
  height: 44px;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.t4ma .t4ma__captcha-field input.t4ma__input--captcha {
  flex: 1;
  min-width: 0;
  width: auto;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  background-image: none;
  padding: 0.75rem 0.85rem;
  font: inherit;
  font-family: var(--t4ma-font);
  font-size: 1rem;
  color: var(--t4ma-ink);
  outline: none;
  box-shadow: none;
}

.t4ma button.t4ma__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  height: auto;
  padding: 0.75rem 1rem;
  margin: 0;
  border: 0;
  border-radius: var(--t4ma-radius);
  background: linear-gradient(135deg, var(--t4ma-accent) 0%, var(--t4ma-accent-2) 100%);
  background-color: var(--t4ma-accent);
  background-image: linear-gradient(135deg, var(--t4ma-accent) 0%, var(--t4ma-accent-2) 100%);
  color: var(--t4ma-btn-text);
  font: inherit;
  font-family: var(--t4ma-font);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  text-shadow: none;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease, opacity 0.2s ease;
}

.t4ma button.t4ma__btn:hover {
  filter: brightness(1.05);
  color: var(--t4ma-btn-text);
}

.t4ma button.t4ma__btn:active {
  transform: translateY(1px);
}

.t4ma .t4ma__terms {
  margin: 0.85rem 0 0;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--t4ma-muted);
  text-align: center;
}

.t4ma .t4ma__terms a {
  color: var(--t4ma-accent-2);
  text-decoration: underline;
  font-weight: 600;
}

.t4ma .t4ma__terms a:hover {
  color: var(--t4ma-accent);
}

.t4ma button.t4ma__btn:focus-visible,
.t4ma button.t4ma__link:focus-visible,
.t4ma input.t4ma__otp-digit:focus-visible,
.t4ma button.t4ma__captcha-img-btn:focus-visible,
button.t4ma-open-modal:focus-visible {
  outline: 2px solid var(--t4ma-accent-2);
  outline-offset: 2px;
}

.t4ma button.t4ma__btn:disabled,
.t4ma button.t4ma__link:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.t4ma button.t4ma__link {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 0.75rem 0 0;
  padding: 0.35rem;
  border: 0;
  border-radius: var(--t4ma-radius);
  background: transparent;
  background-image: none;
  color: var(--t4ma-accent-2);
  font: inherit;
  font-family: var(--t4ma-font);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: normal;
  text-transform: none;
  text-shadow: none;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  text-align: center;
}

.t4ma button.t4ma__link.t4ma__link--muted {
  color: var(--t4ma-muted);
  font-weight: 500;
}

.t4ma .t4ma__msg {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.t4ma .t4ma__msg.is-error {
  background: #fef3f2;
  color: var(--t4ma-danger);
  border: 1px solid #fecdca;
}

.t4ma .t4ma__msg.is-ok {
  background: #ecfdf3;
  color: #067647;
  border: 1px solid #abefc6;
}

.t4ma .t4ma__otp-label {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--t4ma-muted);
}

.t4ma button.t4ma__inline-link {
  display: inline;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  background-image: none;
  color: var(--t4ma-accent-2);
  font: inherit;
  font-family: var(--t4ma-font);
  font-size: inherit;
  font-weight: 700;
  line-height: inherit;
  letter-spacing: normal;
  text-transform: none;
  text-shadow: none;
  text-decoration: underline;
  box-shadow: none;
  cursor: pointer;
  vertical-align: baseline;
}

.t4ma button.t4ma__inline-link:hover {
  color: var(--t4ma-accent);
}

.t4ma .t4ma__otp {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 0.4rem;
  width: 100%;
  margin-bottom: 1.15rem;
  direction: ltr;
}

.t4ma input.t4ma__otp-digit {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  max-width: none;
  height: 3rem;
  margin: 0;
  border: 1px solid var(--t4ma-line);
  border-radius: 10px;
  background: var(--t4ma-panel);
  background-image: none;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--t4ma-font);
  color: var(--t4ma-ink);
  padding: 0;
  box-shadow: none;
  outline: none;
}

.t4ma input.t4ma__otp-digit:focus {
  border-color: var(--t4ma-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--t4ma-accent) 22%, transparent);
  outline: none;
}

.t4ma .t4ma__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

button.t4ma-open-modal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 0;
  height: auto;
  padding: 0.65rem 1.15rem;
  margin: 0;
  border: 0;
  border-radius: var(--t4ma-radius);
  background: linear-gradient(135deg, var(--t4ma-accent), var(--t4ma-accent-2));
  background-color: var(--t4ma-accent);
  color: var(--t4ma-btn-text);
  font-family: var(--t4ma-font);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  text-shadow: none;
  box-shadow: none;
  cursor: pointer;
}

.t4ma-modal[hidden] {
  display: none;
}

.t4ma-modal:not([hidden]) {
  --t4ma-ink: #1a2b3c;
  --t4ma-accent: #0e7c7b;
  --t4ma-accent-2: #1f6f8b;
  --t4ma-btn-text: #ffffff;
  --t4ma-radius: 14px;
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.t4ma-modal .t4ma-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 32, 46, 0.55);
  backdrop-filter: blur(3px);
  cursor: pointer;
  animation: t4ma-fade 0.25s ease both;
}

@keyframes t4ma-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.t4ma-modal .t4ma-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  animation: t4ma-rise 0.35s ease both;
}

.t4ma.t4ma--logged {
  padding: 1rem;
  text-align: center;
  font-family: var(--t4ma-font);
}

body.login #login.t4ma-wp-login {
  width: min(100%, 440px);
  padding: 0;
}

body.login #login.t4ma-wp-login .t4ma {
  margin-top: 1rem;
}

/* WooCommerce My Account: hide default login when T4MA replaces it */
body.t4ma-wc-replace .woocommerce-account .u-columns,
body.t4ma-wc-replace .woocommerce-account #customer_login {
  display: none;
}

body.t4ma-wc-replace .t4ma-wc-login {
  display: block;
}

@media (max-width: 480px) {
  .t4ma {
    padding: 1.35rem 1.1rem;
  }

  .t4ma input.t4ma__otp-digit {
    height: 2.75rem;
    font-size: 1.1rem;
  }
}
