/* ============ ورود پیامکی - استایل فرانت‌اند ============ */

[hidden] { display: none !important; }

.afzone-login-trigger,
.afzone-inline,
.afzone-modal-box,
.afzone-form,
.afzone-form *,
.afzone-modal *,
.afzone-logged-in-box { box-sizing: border-box; }

/* ---------- دکمه ورود (شورت‌کد [afzone_login]) ---------- */

.afzone-login-trigger {
    --afzone-accent: #0ea5e9;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 13px 30px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    background: linear-gradient(135deg, var(--afzone-accent), color-mix(in srgb, var(--afzone-accent) 70%, #073a77));
    background-color: var(--afzone-accent);
    box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--afzone-accent) 65%, transparent);
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.afzone-login-trigger::before {
    content: '';
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.afzone-login-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px -12px color-mix(in srgb, var(--afzone-accent) 75%, transparent);
}

.afzone-login-trigger:active { transform: translateY(0); }

/* ---------- کارت فرم ---------- */

.afzone-inline {
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 22px;
    padding: 36px 28px 32px;
    box-shadow: 0 26px 60px -28px rgba(2, 6, 23, .28);
    max-width: 440px;
    width: 100%;
    margin: 0 auto;
}

.afzone-form {
    --afzone-accent: #0ea5e9;
}

.afzone-form-head {
    text-align: center;
    margin-bottom: 26px;
}

.afzone-form-logo {
    display: block;
    max-width: 120px;
    max-height: 70px;
    object-fit: contain;
    margin: 0 auto 14px;
}

.afzone-form-badge {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--afzone-accent) 14%, #fff);
    color: var(--afzone-accent);
}

.afzone-form-badge svg { width: 30px; height: 30px; }

.afzone-form-title {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.5;
}

.afzone-form-sub {
    margin: 8px 0 0;
    font-size: 13.5px;
    line-height: 1.9;
    color: #64748b;
}

/* ---------- گام‌ها ---------- */

.afzone-step { margin-top: 4px; }

[data-afzone-step]:not([hidden]) {
    animation: afzStepIn .45s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes afzStepIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

.afzone-label {
    display: block;
    margin: 0 0 9px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.afzone-phone-input,
.afzone-code-input {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 13px;
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
    background: #fbfcfe;
}

.afzone-phone-input { direction: ltr; letter-spacing: 1px; }
.afzone-code-input { direction: ltr; letter-spacing: .45em; }

.afzone-phone-input:focus,
.afzone-code-input:focus {
    border-color: var(--afzone-accent);
    background: #fff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--afzone-accent) 18%, transparent);
}

.afzone-phone-input::placeholder,
.afzone-code-input::placeholder { color: #a6b3c2; font-weight: 500; }

/* ---------- دکمه‌ها ---------- */

.afzone-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
    padding: 14px 20px;
    border: 0;
    border-radius: 13px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--afzone-accent), color-mix(in srgb, var(--afzone-accent) 70%, #073a77));
    background-color: var(--afzone-accent);
    box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--afzone-accent) 65%, transparent);
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
    line-height: 1;
}

.afzone-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -12px color-mix(in srgb, var(--afzone-accent) 75%, transparent);
}

.afzone-btn:active:not(:disabled) { transform: translateY(0); }

.afzone-btn:disabled { opacity: .6; cursor: not-allowed; }

.afzone-btn-spinner {
    width: 17px;
    height: 17px;
    border: 2.5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    display: none;
    animation: afzSpin .7s linear infinite;
}

.afzone-btn.is-loading .afzone-btn-spinner { display: inline-block; }
.afzone-btn.is-loading .afzone-btn-label { opacity: .8; }

@keyframes afzSpin { to { transform: rotate(360deg); } }

.afzone-code-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.afzone-code-top .afzone-label { margin-bottom: 0; }

.afzone-btn-resend {
    border: 0;
    background: none;
    color: var(--afzone-accent);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    transition: opacity .15s ease;
}

.afzone-btn-resend:hover:not(:disabled) { opacity: .75; }
.afzone-btn-resend:disabled { opacity: .5; cursor: default; }

/* ---------- پیام‌ها ---------- */

.afzone-form-message {
    margin: 16px 0 0;
    padding: 11px 14px;
    border-radius: 11px;
    font-size: 13.5px;
    line-height: 1.8;
    text-align: center;
}

.afzone-form-message.ok {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    animation: afzStepIn .35s ease both;
}

.afzone-form-message.err {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    animation: afzShake .45s ease;
}

@keyframes afzShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ---------- حالت موفقیت ---------- */

.afzone-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    padding: 18px 0 6px;
    animation: afzStepIn .4s ease both;
}

.afzone-success-icon { width: 68px; height: 68px; }

.afzone-success-circle {
    stroke: var(--afzone-accent);
    stroke-width: 3;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: afzDraw .6s ease forwards;
}

.afzone-success-check {
    stroke: var(--afzone-accent);
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: afzDraw .35s ease .5s forwards;
}

@keyframes afzDraw { to { stroke-dashoffset: 0; } }

.afzone-success-text {
    color: #15803d;
    font-size: 14.5px;
    font-weight: 600;
}

/* ---------- پاپ‌آپ ---------- */

.afzone-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
}

.afzone-modal.open { opacity: 1; visibility: visible; }

.afzone-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.afzone-modal-box {
    position: relative;
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 24px;
    padding: 42px 28px 32px;
    box-shadow: 0 34px 80px -28px rgba(2, 6, 23, .45);
    transform: translateY(24px) scale(.95);
    transition: transform .34s cubic-bezier(.22, 1, .36, 1);
    max-height: 92vh;
    overflow: auto;
}

.afzone-modal.open .afzone-modal-box { transform: none; }

.afzone-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #334155;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    z-index: 1;
}

.afzone-modal-close:hover {
    background: #fee2e2;
    color: #b91c1c;
    transform: rotate(90deg);
}

[dir="rtl"] .afzone-modal-close { right: auto; left: 16px; }

/* ---------- باکس لاگین‌شده ---------- */

.afzone-logged-in-box {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}

.afzone-logged-in-name { font-weight: 700; color: #0f172a; }

.afzone-logout-link { color: #dc2626; text-decoration: none; font-weight: 600; }
.afzone-logout-link:hover { text-decoration: underline; }

/* ---------- جایگزینی ورود ووکامرس ---------- */

.afzone-modal-open { overflow: hidden; }

.afzone-wc-login {
    max-width: 480px;
    margin: 0 auto;
}

.afzone-wc-hero {
    text-align: center;
    padding: 48px 32px 40px;
    background:
        radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--afzone-accent) 10%, #fff) 0%, #fff 55%);
    border: 1px solid #eef2f7;
}

.afzone-wc-hero-badge {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
    color: var(--afzone-accent);
    background: color-mix(in srgb, var(--afzone-accent) 12%, #fff);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--afzone-accent) 16%, transparent);
}

.afzone-wc-hero-badge svg { width: 34px; height: 34px; }

.afzone-wc-hero-title {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.5;
}

.afzone-wc-hero-sub {
    margin: 10px auto 26px;
    font-size: 14px;
    line-height: 1.9;
    color: #64748b;
    max-width: 300px;
}

.afzone-wc-hero .afzone-login-trigger { margin: 0 auto; }

/* ---------- غیرفعال‌سازی لایتباکس/فرم‌های ورود اختصاصی قالب (فلاتسام و مشابه) ---------- */

body:not(.logged-in) #login-lightbox,
body:not(.logged-in) #login-lightbox .ux-lightbox__content,
.header-account-login .woocommerce,
.header-account-login form.login,
.woocommerce-account-login:not(.afzone-wc-hero) form.login {
    display: none !important;
}

.afzone-wc-question {
    text-align: center;
    font-size: 13.5px;
    color: #64748b;
    margin: 0 0 12px;
}

.afzone-wc-register-section {
    margin-top: 30px;
}

.afzone-wc-register-title {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 18px;
}

.afzone-wc-register-title::before,
.afzone-wc-register-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

@media (max-width: 480px) {
    .afzone-modal-box { padding: 36px 18px 26px; }
    .afzone-inline { padding: 30px 20px 26px; }
}