/* assets/phonotp.css — polished UI */

/* ---------- Theme tokens ---------- */
:root {
  --otp-bg: #ffffff;
  --otp-fg: #101827;
  --otp-muted: #6b7280;
  --otp-primary: #f9b522;
  --otp-primary-hover: #e7a318;
  --otp-danger: #ef4444;
  --otp-success: #16a34a;
  --otp-border: #e5e7eb;
  --otp-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  --otp-radius: 16px;
  --otp-focus: 0 0 0 4px rgba(249, 181, 34, 0.20);
}

/* جلوگیری از اسکرول هنگام باز بودن مودال (اگر در JS کلاس body اضافه شد) */
body.phonotp-no-scroll { overflow: hidden; }

/* ---------- Backdrop & Modal ---------- */
.phonotp-modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.45);        /* نیمه‌تاریک */
  backdrop-filter: blur(6px);                 /* شیشه‌ای لطیف */
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 99999;
}

.phonotp-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.phonotp-modal {
  width: 100%;
  max-width: 380px;
  background: var(--otp-bg);
  color: var(--otp-fg);
  border-radius: var(--otp-radius);
  box-shadow: var(--otp-shadow);
  padding: 22px 20px;
  direction: rtl;
  font-family: inherit;
  transform: translateY(12px) scale(.98);
  opacity: 0;
  transition: transform .22s cubic-bezier(.22,.61,.36,1), opacity .22s ease;
}

.phonotp-modal-backdrop.active .phonotp-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ---------- Headings ---------- */
.phonotp-modal h3 {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 14px 0;
  letter-spacing: -.2px;
}

/* زیرتیترهای کوچک */
.phonotp-small { font-size: 12.5px; color: var(--otp-muted); }

/* ---------- Inputs ---------- */
.phonotp-input {
  width: 100%;
  background: #f9fafb;
  border: 1px solid var(--otp-border);
  color: var(--otp-fg);
  padding: 11px 12px;
  border-radius: 12px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.phonotp-input::placeholder { color: #9ca3af; }

.phonotp-input:focus {
  border-color: var(--otp-primary);
  box-shadow: var(--otp-focus);
  background: #fff;
}

/* برای ورودی کد */
#phonotp-code {
  letter-spacing: 6px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
}

/* ---------- Buttons ---------- */
.phonotp-row { display: flex; gap: 10px; align-items: center; }

.phonotp-btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
  margin-top: 15px;
}

.phonotp-btn:active { transform: translateY(1px); }

.phonotp-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}

/* اصلی (Primary) */
.phonotp-btn-primary {
  background: linear-gradient(180deg, var(--otp-primary), var(--otp-primary-hover));
  color: #111111;
  box-shadow: 0 8px 18px rgba(249, 181, 34, 0.24);
}
.phonotp-btn-primary:hover { filter: brightness(1.03); }

/* ثانویه/معمولی */
.phonotp-btn:not(.phonotp-btn-primary) {
  background: #f3f4f6;
  color: #111827;
}
.phonotp-btn:not(.phonotp-btn-primary):hover { background: #e5e7eb; }

/* دکمه باز کردن پاپ‌آپ */
.phonotp-open-btn {
  padding: 12px 5px;
  border-radius: 14px;
  border: 1px solid var(--otp-primary);
  background: #ffffff;
  color: var(--otp-primary);
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  transition: transform .08s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
  font-size:14px !important;
}

.phonotp-open-btn-login,
.phonotp-account-link {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--otp-primary);
  background: #ffffff;
  color: var(--otp-primary);
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  transition: transform .08s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
  font-size:13px !important;
}

.phonotp-open-btn:hover,
.phonotp-open-btn-login:hover,
.phonotp-account-link:hover,
.phonotp-account-link:focus {
  transform: translateY(-1px);
  background: var(--otp-primary);
  border-color: var(--otp-primary);
  color: #111111;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
}

/* ---------- Messages ---------- */
.phonotp-error {
  color: var(--otp-danger);
  font-size: 13px;
  margin-top: 6px;
}
.phonotp-success {
  color: var(--otp-success);
  font-size: 13px;
  margin-top: 6px;
}

/* ---------- Resend chip ---------- */
#phonotp-resend-row {
  margin-top: 6px;
}
#phonotp-resend {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: none;
}
#phonotp-resend[disabled] {
  background: #f3f4f6;
  color: #6b7280;
}

/* تایمر داخل دکمه */
#phonotp-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

/* ---------- Small screens ---------- */
@media (max-width: 420px) {
  .phonotp-modal { padding: 18px 16px; border-radius: 14px; }
  .phonotp-modal h3 { font-size: 17px; }
  .phonotp-input { padding: 10px 11px; }
}


/* در حالت موبایل و تبلت: فقط آیکون آدمک نمایش داده شود */
@media (max-width: 1024px) {
  .phonotp-account-text {
    display: none ;
  }
  .phonotp-open-btn,
  .phonotp-open-btn-login,
  .phonotp-account-link {
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    justify-content: center;
  }
  .phonotp-account-icon {
    width: 24px;
    height: 24px;
  }
}


/* ==========================================================
   Dedicated Lebaset login/register page template
   ========================================================== */
html:has(body.phonotp-login-page-body),
body.phonotp-login-page-body {
  min-height: 100%;
  margin: 0;
  background: #ffffff;
}

body.phonotp-login-page-body {
  min-height: 100vh;
  color: #111111;
  overflow-x: hidden;
  font-family: Tahoma, Arial, sans-serif;
}

body.phonotp-login-page-body #wpadminbar {
  display: none !important;
}

body.admin-bar.phonotp-login-page-body {
  margin-top: 0 !important;
}

.phonotp-auth-page,
.phonotp-auth-page * {
  box-sizing: border-box;
}

.phonotp-auth-page {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 50% 42%, rgba(249,181,34,.055), transparent 34%),
    #ffffff;
}

.phonotp-auth-card {
  width: 100%;
  max-width: 480px;
  min-height: 470px;
  border: 1px solid #e4e4e4;
  border-radius: 12px;
  background: #ffffff;
  padding: 34px 38px 28px;
  box-shadow: 0 3px 18px rgba(0,0,0,.035);
  direction: rtl;
}

.phonotp-auth-topbar {
  position: relative;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 34px;
}

.phonotp-auth-logo {
  display: block;
  width: auto;
  max-width: 175px;
  max-height: 62px;
  object-fit: contain;
}

.phonotp-auth-back {
  position: absolute;
  top: 50%;
  right: 0;
  width: 42px;
  height: 42px;
  transform: translateY(-50%);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111111;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease;
}

.phonotp-auth-back:hover,
.phonotp-auth-back:focus {
  background: #f6f6f6;
  color: #111111;
  transform: translateY(-50%) translateX(2px);
}

.phonotp-auth-back svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.phonotp-auth-step h1 {
  margin: 0 0 14px;
  color: #111111;
  font-size: 20px;
  line-height: 1.7;
  font-weight: 800;
  text-align: right;
}

.phonotp-auth-subtitle {
  margin: 0 0 24px;
  color: #777777;
  font-size: 14px;
  line-height: 2;
  text-align: right;
}

.phonotp-auth-subtitle strong {
  color: #111111;
  font-weight: 700;
  direction: ltr;
  unicode-bidi: isolate;
}

.phonotp-auth-label {
  display: block;
  margin: 0 0 8px;
  color: #333333;
  font-size: 13px;
  font-weight: 700;
}

.phonotp-auth-page .phonotp-auth-input {
  display: block;
  width: 100%;
  height: 58px;
  margin: 0;
  padding: 0 18px;
  border: 1px solid #cfcfcf;
  border-radius: 10px;
  background: #ffffff;
  color: #111111;
  font-family: inherit;
  font-size: 15px;
  line-height: 58px;
  text-align: right;
  outline: none;
  box-shadow: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.phonotp-auth-page .phonotp-auth-input::placeholder {
  color: #a0a0a0;
  opacity: 1;
}

.phonotp-auth-page .phonotp-auth-input:focus {
  border-color: #f9b522;
  box-shadow: 0 0 0 3px rgba(249,181,34,.18);
}

.phonotp-auth-page #phonotp-phone {
  direction: ltr;
  text-align: left;
}

.phonotp-auth-page .phonotp-auth-code {
  direction: ltr;
  text-align: center !important;
  letter-spacing: 10px;
  font-size: 21px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.phonotp-auth-page .phonotp-auth-submit {
  display: flex;
  width: 100%;
  height: 58px;
  margin: 18px 0 0;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  border: 1px solid #f9b522;
  border-radius: 10px;
  background: #f9b522;
  color: #111111;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  box-shadow: none;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .08s ease, opacity .18s ease;
}

.phonotp-auth-page .phonotp-auth-submit:hover,
.phonotp-auth-page .phonotp-auth-submit:focus {
  background: #efa917;
  border-color: #efa917;
  color: #111111;
  filter: none;
}

.phonotp-auth-page .phonotp-auth-submit:active {
  transform: translateY(1px);
}

.phonotp-auth-page .phonotp-auth-submit:disabled {
  opacity: .62;
  cursor: wait;
}

.phonotp-auth-secondary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 17px;
}

.phonotp-auth-link-btn {
  appearance: none;
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: #111111;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(249,181,34,.9);
  text-underline-offset: 4px;
}

.phonotp-auth-link-btn:hover,
.phonotp-auth-link-btn:focus {
  color: #8a6100;
}

.phonotp-auth-link-btn:disabled {
  color: #9b9b9b;
  text-decoration-color: #d7d7d7;
  cursor: not-allowed;
}

.phonotp-auth-message {
  min-height: 19px;
  margin-top: 7px;
  line-height: 1.7;
  text-align: right;
}

.phonotp-auth-page .phonotp-error {
  color: #c62828;
}

.phonotp-auth-page .phonotp-success {
  color: #16813b;
}

.phonotp-auth-terms {
  margin: 34px 0 0;
  color: #7a7a7a;
  font-size: 12px;
  line-height: 1.9;
  text-align: center;
}

@media (max-width: 600px) {
  .phonotp-auth-page {
    align-items: stretch;
    padding: 0;
    background: #ffffff;
  }

  .phonotp-auth-card {
    max-width: none;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    padding: max(24px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
    box-shadow: none;
  }

  .phonotp-auth-topbar {
    margin-bottom: 28px;
  }

  .phonotp-auth-logo {
    max-width: 155px;
    max-height: 56px;
  }

  .phonotp-auth-step h1 {
    font-size: 19px;
  }

  .phonotp-auth-page .phonotp-auth-input,
  .phonotp-auth-page .phonotp-auth-submit {
    height: 56px;
  }
}

/* ==========================================================
   WooCommerce native login/register replacement (OTP inline)
   ========================================================== */
.phonotp-woocommerce-customer-login,
.phonotp-inline-auth,
.phonotp-inline-auth * {
  box-sizing: border-box;
}

.phonotp-woocommerce-customer-login {
  width: 100%;
}

.phonotp-inline-auth {
  width: 100%;
  max-width: 520px;
  margin: 24px auto;
  direction: rtl;
  font-family: inherit;
}

.phonotp-inline-auth-inner {
  width: 100%;
  padding: 28px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
}

.phonotp-inline-title {
  margin: 0 0 10px;
  color: #111;
  font-size: 21px;
  line-height: 1.7;
  font-weight: 800;
}

.phonotp-inline-auth .phonotp-auth-subtitle {
  margin-bottom: 20px;
}

.phonotp-inline-auth .phonotp-auth-input {
  display: block;
  width: 100%;
  min-height: 54px;
  margin: 0;
  padding: 0 16px;
  border: 1px solid #d7d7d7;
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}

.phonotp-inline-auth #phonotp-phone {
  direction: ltr;
  text-align: left;
}

.phonotp-inline-auth .phonotp-auth-code {
  direction: ltr;
  text-align: center;
  letter-spacing: 9px;
  font-size: 20px;
  font-weight: 800;
}

.phonotp-inline-auth .phonotp-auth-submit {
  display: flex;
  width: 100%;
  min-height: 54px;
  margin-top: 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--otp-primary);
  border-radius: 10px;
  background: var(--otp-primary);
  color: #111;
  box-shadow: none;
}

.phonotp-inline-auth .phonotp-auth-submit:hover,
.phonotp-inline-auth .phonotp-auth-submit:focus {
  background: var(--otp-primary-hover);
  border-color: var(--otp-primary-hover);
  color: #111;
}

.phonotp-inline-auth .phonotp-auth-message {
  min-height: 18px;
  margin-top: 7px;
}

.phonotp-woo-login-form .phonotp-inline-auth {
  margin-top: 10px;
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  .phonotp-inline-auth {
    margin: 16px auto;
  }

  .phonotp-inline-auth-inner {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .phonotp-inline-title {
    font-size: 19px;
  }
}

/* ==========================================================
   v1.6.1 Authentication tabs / password login / registration
   ========================================================== */
.phonotp-auth-shell,
.phonotp-auth-card,
.phonotp-inline-auth-inner {
  position: relative;
}

.phonotp-main-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin: 0 0 24px;
  border-radius: 12px;
  background: #f5f5f5;
}

.phonotp-main-tab,
.phonotp-method-tab {
  appearance: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.phonotp-main-tab {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 9px;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 800;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.phonotp-main-tab.is-active {
  background: #fff;
  color: #111;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.phonotp-main-panel,
.phonotp-login-method {
  width: 100%;
}

.phonotp-method-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 20px;
}

.phonotp-method-tab {
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid #e1e1e1;
  border-radius: 10px;
  background: #fff;
  color: #666;
  font-size: 12.5px;
  line-height: 1.6;
  font-weight: 700;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.phonotp-method-tab.is-active {
  border-color: var(--otp-primary);
  background: rgba(249,181,34,.09);
  color: #111;
}

.phonotp-label-spaced {
  margin-top: 15px !important;
}

#phonotp-phone,
#phonotp-register-phone {
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
}

.phonotp-modal.phonotp-auth-shell {
  max-width: 460px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding-top: 38px;
}

.phonotp-modal-close {
  position: absolute;
  top: 10px;
  left: 12px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f5f5f5;
  color: #555;
  font-family: Arial, sans-serif;
  font-size: 24px;
  line-height: 34px;
  cursor: pointer;
}

.phonotp-modal-close:hover,
.phonotp-modal-close:focus {
  background: #ececec;
  color: #111;
}

.phonotp-modal .phonotp-inline-title {
  margin: 0 0 10px;
  font-size: 19px;
}

.phonotp-modal .phonotp-auth-subtitle {
  margin: 0 0 18px;
  color: #777;
  font-size: 13px;
  line-height: 1.9;
}

.phonotp-modal .phonotp-auth-label {
  display: block;
  margin: 0 0 7px;
  font-size: 13px;
  font-weight: 700;
}

.phonotp-modal .phonotp-auth-input {
  min-height: 50px;
}

.phonotp-modal .phonotp-auth-submit {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
}

.phonotp-auth-page .phonotp-auth-card {
  max-width: 520px;
  min-height: 0;
}

.phonotp-auth-page .phonotp-main-panel .phonotp-inline-title {
  margin: 0 0 10px;
  color: #111;
  font-size: 20px;
  line-height: 1.7;
  font-weight: 800;
}

.phonotp-auth-page .phonotp-method-tabs {
  margin-bottom: 22px;
}

.phonotp-inline-auth .phonotp-main-tabs {
  margin-bottom: 22px;
}

.phonotp-inline-auth .phonotp-label-spaced,
.phonotp-auth-page .phonotp-label-spaced {
  display: block;
}

.phonotp-inline-auth input[type="password"],
.phonotp-auth-page input[type="password"] {
  direction: ltr;
  text-align: left;
}

@media (max-width: 600px) {
  .phonotp-method-tabs {
    grid-template-columns: 1fr;
  }

  .phonotp-main-tabs {
    margin-bottom: 20px;
  }

  .phonotp-modal.phonotp-auth-shell {
    max-height: calc(100vh - 20px);
    padding: 38px 16px 18px;
  }
}
