/* FWOA Light OTP Auth - Frontend Styles */

:root {
  --fwoa-primary: #c1121f;
  --fwoa-primary-dark: #8f0d17;
  --fwoa-dark: #171717;
  --fwoa-muted: #777;
  --fwoa-border: #e9e2da;
  --fwoa-card: #ffffff;
  --fwoa-radius: 22px;
  --fwoa-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.fwoa-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  direction: rtl;
}

.fwoa-modal.is-open {
  display: flex;
}

body.fwoa-modal-open {
  overflow: hidden;
}

.fwoa-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(8px);
}

.fwoa-modal__box {
  position: relative;
  width: 100%;
  max-width: 470px;
  background: var(--fwoa-card);
  border-radius: var(--fwoa-radius);
  box-shadow: var(--fwoa-shadow);
  padding: 28px;
  overflow: hidden;
}

.fwoa-modal__close {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: #f7f1ea;
  color: var(--fwoa-dark);
  font-size: 24px;
  line-height: 36px;
  cursor: pointer;
}

.fwoa-modal__title {
  position: relative;
  z-index: 2;
  margin: 0 0 20px;
  padding-left: 44px;
  color: var(--fwoa-dark);
  font-size: 22px;
  font-weight: 800;
  text-align: right;
}

.fwoa-wrap {
  position: relative;
  z-index: 2;
  direction: rtl;
  text-align: right;
}

.fwoa-wrap * {
  box-sizing: border-box;
}

.fwoa-auth-head {
  text-align: center;
  margin-bottom: 18px;
}

.fwoa-auth-title {
  color: var(--fwoa-dark);
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 6px;
}

.fwoa-auth-subtitle {
  color: var(--fwoa-muted);
  font-size: 13px;
  line-height: 1.8;
}

.fwoa-panel {
  display: none;
}

.fwoa-panel.is-active {
  display: block;
}

.fwoa-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fwoa-form label {
  color: #262626;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: -4px;
}

.fwoa-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--fwoa-border);
  border-radius: 15px;
  background: #fff;
  color: var(--fwoa-dark);
  font-size: 15px;
  padding: 0 15px;
  outline: none;
}

.fwoa-form input:focus {
  border-color: rgba(193, 18, 31, 0.55);
  box-shadow: 0 0 0 4px rgba(193, 18, 31, 0.09);
}

.fwoa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.fwoa-grid p {
  margin: 0;
}

.fwoa-otp-row,
.fwoa-password-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fwoa-btn {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--fwoa-primary), var(--fwoa-primary-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(193, 18, 31, 0.26);
}

.fwoa-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.fwoa-verify,
.fwoa-password-login-submit {
  background: linear-gradient(135deg, #151515, #3a3a3a);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

.fwoa-form-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 2px;
}

.fwoa-link-btn {
  border: 0;
  background: transparent;
  color: var(--fwoa-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 10px;
}

.fwoa-link-btn:hover {
  background: rgba(193, 18, 31, 0.08);
}

.fwoa-message {
  min-height: 22px;
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.8;
}

.fwoa-message.is-ok {
  color: #12805c;
}

.fwoa-message.is-error {
  color: var(--fwoa-primary);
}

.fwoa-register-note {
  background: #fff6e8;
  color: #8a5a00;
  border: 1px solid #ffe0ad;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.8;
  text-align: center;
}

.fwoa-myaccount-auth,
.fwoa-wrap:not(.fwoa-logged-in) {
  max-width: 480px;
  margin: 0 auto;
}

.fwoa-myaccount-auth .fwoa-wrap,
.entry-content > .fwoa-wrap,
.elementor-widget-shortcode .fwoa-wrap {
  background: #fff;
  border: 1px solid var(--fwoa-border);
  border-radius: var(--fwoa-radius);
  padding: 24px;
}

body.fwoa-replace-woo-auth .woocommerce-form-login,
body.fwoa-replace-woo-auth .woocommerce-form-register,
body.fwoa-replace-woo-auth .u-columns {
  display: none !important;
}

/* مخفی‌سازی قطعی */
.is-hidden,
.fwoa-otp-row.is-hidden,
.fwoa-password-row.is-hidden,
.fwoa-verify.is-hidden,
.fwoa-password-login-submit.is-hidden,
.fwoa-login-options.is-hidden,
.fwoa-show-password-login.is-hidden,
.fwoa-show-otp-login.is-hidden {
  display: none !important;
}

/* نمایش کنترل‌شده */
.fwoa-otp-row:not(.is-hidden),
.fwoa-password-row:not(.is-hidden) {
  display: flex !important;
}

button.fwoa-verify:not(.is-hidden),
button.fwoa-password-login-submit:not(.is-hidden),
.fwoa-show-password-login:not(.is-hidden),
.fwoa-show-otp-login:not(.is-hidden) {
  display: block !important;
}

.fwoa-login-options:not(.is-hidden) {
  display: flex !important;
}
#fwoa-modal[aria-hidden="true"] {
  display: none !important;
}

body:not(.fwoa-modal-open) #fwoa-modal:not(.is-open) {
  display: none !important;
}
/* اصلاح اسکرول فرم روی موبایل */
@media (max-width: 520px) {
  .fwoa-modal {
    align-items: flex-start; /* فرم از بالا شروع کنه */
    overflow-y: auto; /* فعال کردن اسکرول عمودی */
    padding: 14px;
  }

  .fwoa-modal__box {
    max-height: 90vh; /* محدودیت ارتفاع تا از صفحه بیرون نره */
    overflow-y: auto; /* فعال کردن اسکرول داخلی فرم */
    -webkit-overflow-scrolling: touch; /* smooth scroll روی iOS */
    padding: 24px 18px 20px;
    border-radius: 24px;
  }
}
/* دکمه بستن پاپ‌آپ */
/* حذف استایل پیش‌فرض مرورگر از دکمه */
  
.fwoa-modal__close {
	    all: unset; /* همه استایل‌های پیش‌فرض حذف می‌شود */

    position: absolute;
    top: 20px;
    left: 20px;  /* این خط جایگزین right می‌شود */
    right: auto;  /* اطمینان از اینکه راست پاک شود */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    text-align: center;
    line-height: 1;
    transition: background-color 0.2s ease;
}

.fwoa-modal__close:hover {
    background-color: rgba(0,0,0,0.8);
}