/* ورود با کد پیامکی — رنگ‌ها از تنظیمات (متغیرهای --ikco-p / --ikco-d / --ikco-l / --ikco-shadow) */

.ikco-otp {
    --ikco-p: #2f6bff;
    --ikco-d: #1d429e;
    --ikco-l: #eaf0ff;
    --ikco-shadow: rgba(47,107,255,.38);
    position: relative;
    max-width: 400px;
    margin: 0 auto;
    padding: 30px 26px 26px;
    background: #fff;
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(15,23,42,.28);
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
    overflow: hidden;
}

/* نوار رنگی بالای کارت */
.ikco-otp::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: linear-gradient(90deg, var(--ikco-p), var(--ikco-d));
}

.ikco-otp *, .ikco-otp *::before, .ikco-otp *::after { box-sizing: border-box; }

/* ---------- سرتیتر ---------- */
.ikco-otp-head { text-align: center; margin-bottom: 18px; }

.ikco-otp-badge {
    width: 68px;
    height: 68px;
    margin: 0 auto 12px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, var(--ikco-p), var(--ikco-d));
    box-shadow: 0 10px 24px var(--ikco-shadow);
}

.ikco-otp-logo { display: block; margin: 0 auto 12px; }
.ikco-otp-logo img { display: inline-block; max-width: 190px; max-height: 80px; width: auto; height: auto; }

.ikco-otp-title { margin: 0; font-size: 22px; font-weight: 800; color: #0f172a; }

.ikco-otp-hint { margin: 0 0 18px; font-size: 13.5px; color: #475569; line-height: 2; text-align: center; }
.ikco-otp-hint strong { color: var(--ikco-d); }

/* ---------- ورودی‌ها ---------- */
.ikco-otp-input {
    display: block;
    width: 100%;
    height: 54px;
    margin: 0 0 12px;
    padding: 0 16px;
    border: 2px solid #e5e9f0;
    border-radius: 15px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 15px;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s, background .2s;
    -webkit-appearance: none;
    appearance: none;
}

.ikco-otp-input::placeholder { color: #94a3b8; }

.ikco-otp-input:focus {
    outline: none;
    border-color: var(--ikco-p);
    background: #fff;
    box-shadow: 0 0 0 4px var(--ikco-l);
}

input[name="ikco_otp_mobile"] { font-size: 19px; letter-spacing: 2px; text-align: center; font-weight: 700; }
.ikco-otp-ltr { text-align: left; }

select.ikco-otp-input {
    padding-inline-end: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
}

.ikco-otp-textarea { height: auto; padding: 14px 16px; line-height: 1.8; resize: none; }

.ikco-otp-row { display: flex; gap: 10px; }
.ikco-otp-row .ikco-otp-input { flex: 1 1 0; min-width: 0; }

/* ---------- باکس‌های کد ---------- */
.ikco-otp-boxes {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 4px 0 18px;
}

.ikco-otp-box {
    width: 100%;
    max-width: 48px;
    height: 58px;
    padding: 0;
    border: 2px solid #e5e9f0;
    border-radius: 14px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    transition: border-color .15s, box-shadow .15s, background .15s, transform .15s;
    -webkit-appearance: none;
    appearance: none;
}

.ikco-otp-box:focus {
    outline: none;
    border-color: var(--ikco-p);
    background: #fff;
    box-shadow: 0 0 0 4px var(--ikco-l);
    transform: translateY(-2px);
}

.ikco-otp-box.is-filled { border-color: var(--ikco-p); background: var(--ikco-l); color: var(--ikco-d); }
.ikco-otp-boxes.is-error .ikco-otp-box { border-color: #ef4444; background: #fef2f2; animation: ikco-otp-shake .35s; }

@keyframes ikco-otp-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ---------- دکمه‌ها ---------- */
.ikco-otp-btn {
    display: block;
    width: 100%;
    height: 54px;
    margin-top: 4px;
    border: 0;
    border-radius: 15px !important;
    background: #529ae7 !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 10px 22px var(--ikco-shadow);
    transition: transform .15s, box-shadow .15s, opacity .2s;
}

.ikco-otp-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 28px var(--ikco-shadow); }
.ikco-otp-btn:active { transform: translateY(0); }
.ikco-otp-btn:disabled { opacity: .6; cursor: wait; transform: none; }

.ikco-otp-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }

.ikco-otp-link {
    padding: 0;
    border: 0;
    border-radius: 12px !important;
    background: none;
    color: var(--ikco-p);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.ikco-otp-link:disabled { color: #94a3b8; cursor: default; font-weight: 400; }

/* ---------- حالت بسته (کانال ارسال تنظیم نشده) ---------- */
.ikco-otp-closed { padding: 22px 16px 14px; text-align: center; }
.ikco-otp-closed-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b45309;
    background: #fef3c7;
}
.ikco-otp-closed p { margin: 0; font-size: 14.5px; line-height: 2.1; color: #475569; font-weight: 600; }

/* ---------- پیام ---------- */
.ikco-otp-msg { min-height: 24px; margin-top: 14px; font-size: 13px; text-align: center; font-weight: 600; }
.ikco-otp-msg.is-error { color: #dc2626; }
.ikco-otp-msg.is-ok { color: #16a34a; }

/* ---------- مخفی‌سازی ---------- */
.ikco-otp [hidden],
.ikco-otp-step[hidden] { display: none !important; }

/* ---------- حالت ترکیبی (کاربر جدید) ---------- */
/* کاربر جدید بعد از ارسال کد: فیلدهای مشخصات بالا می‌مانند و بخش کد زیرشان می‌آید */
.ikco-otp.is-combined [data-step="code"] { margin-top: 18px; padding-top: 20px; border-top: 2px dashed #e5e9f0; }
.ikco-otp.is-combined [data-step="code"] [data-action="edit"] { display: none; }
.ikco-otp.is-combined [data-step="profile"] .ikco-otp-hint { display: none; }

/* ===== صفحه مستقل ورود (بدون هدر و فوتر قالب) ===== */
body.ikco-otp-page {
    margin: 0;
    height: 100%;
    overflow: hidden;   /* اسکرول صفحه نداریم؛ اگر باکس بلندتر از پنجره شد، داخل .ikco-otp-page-wrap اسکرول می‌شود */
    /* پس‌زمینه از رنگ اصلیِ تنظیمات (متغیرها روی body تزریق می‌شوند) */
    background: var(--ikco-p, #2f6bff);
    font-family: inherit;
}

/* المان‌های قالب (نوار پایین موبایل، لینک‌های پرش) در صفحه‌ی ورود جایی ندارند و ارتفاع اضافه می‌سازند */
body.ikco-otp-page .wd-toolbar,
body.ikco-otp-page .wd-skip-links { display: none !important; }

.ikco-otp-page-wrap {
    position: fixed;
    inset: 0;
    display: flex;
    padding: 84px 16px 36px;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* margin:auto = وسط‌چین امن (اگر باکس بلندتر از پنجره شد، بالای آن بریده نمی‌شود) */
.ikco-otp-page-main { position: relative; z-index: 1; width: 100%; max-width: 400px; margin: auto; }

/* دکمه بازگشت: گوشه بالا (سمت شروع، یعنی راست در حالت راست‌به‌چپ) */
.ikco-otp-back {
    position: absolute;
    z-index: 2;
    top: 20px;
    inset-inline-start: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 12px;
    background: #529ae7;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 13.5px;
    font-weight: 700;
    text-decoration: none;
    transition: background .2s;
}

.ikco-otp-back:hover { background: #0d3e4c; color: #fff; }

@media (max-width: 420px) {
    .ikco-otp { padding: 26px 18px 22px; border-radius: 22px; }
    .ikco-otp-boxes { gap: 6px; }
    .ikco-otp-box { height: 54px; font-size: 22px; }
}

/* دکمه‌ی لینک (مثلاً «حساب کاربری من» در صفحه‌ی فروش بسته) */
a.ikco-otp-btn {
    height: auto;
    line-height: 54px;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}
.ikco-otp-closed + .ikco-otp-closed-actions { padding: 0 6px 6px; }
