/* ===================== Welcome overlay (Cyber Mesh & Neon Glow) ===================== */
.welcome {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    background: rgba(9, 8, 16, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: none; /* trade.js sets display:flex when needed */
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 40px 12px;
    box-sizing: border-box;
}

.welcome-step { width: 100%; display: flex; flex-direction: column; }
.check-phone { width: 100%; display: none; color: #fff; flex-direction: column; }

@keyframes welcome-pop {
    0%   { opacity: 0; transform: translateY(14px) scale(0.975); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes welcome-beam {
    0%   { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}
@keyframes welcome-spin { to { transform: rotate(360deg); } }

/* ===================== Card ===================== */
.welcome-card {
    width: 500px;
    max-width: 100%;
    background:
        radial-gradient(circle at 85% 5%, rgba(143, 132, 230, 0.24) 0%, transparent 48%),
        radial-gradient(circle at 10% 95%, rgba(107, 94, 196, 0.18) 0%, transparent 45%),
        #161424;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    direction: rtl;
    padding: 28px 25px;
    box-sizing: border-box;
    font-family: 'Vazirmatn', iransans, Tahoma, sans-serif;
    border: 1px solid rgba(143, 132, 230, 0.35);
    box-shadow:
        0 25px 65px rgba(0, 0, 0, 0.8),
        0 0 35px rgba(143, 132, 230, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    animation: welcome-pop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Animated top beam */
.welcome-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #8f84e6 50%, #38bdf8 75%, transparent 100%);
    animation: welcome-beam 3.2s infinite linear;
}

/* ===================== Header ===================== */
.welcome-header {
    display: flex;
    align-items: center;
    gap: 13px;
}

.welcome-badge {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(145deg, #8f84e6 0%, #5c4eb8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    box-shadow: 0 0 20px rgba(143, 132, 230, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.welcome-title {
    font-size: 19px;
    font-weight: 800;
    color: #fff;
    line-height: 1.5;
}
.welcome-title .brand { display: inline-block; direction: ltr; }
.welcome-title .brand span {
    color: #aba1f7;
    text-shadow: 0 0 16px rgba(143, 132, 230, 0.6);
}

/* ===================== Copy ===================== */
.welcome-desc {
    font-size: 12.5px;
    line-height: 1.9;
    color: #c5c2dc;
    margin-top: 15px;
    background: rgba(33, 30, 51, 0.72);
    border: 1px solid rgba(143, 132, 230, 0.18);
    padding: 12px 14px;
    border-radius: 8px;
}

.welcome-subtitle {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: #aba1f7;
    margin-top: 18px;
}

/* ===================== Fields ===================== */
.welcome-field {
    width: 100%;
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.welcome-field-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
    font-weight: 700;
    color: #ebe9f7;
}

.welcome-hint-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #aba1f7;
    background: rgba(143, 132, 230, 0.16);
    padding: 3px 9px;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.2s;
}
.welcome-hint-link:hover { background: rgba(143, 132, 230, 0.3); color: #fff; }

.welcome-input-wrap,
.welcome-phone-wrap {
    width: 100%;
    height: 45px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(38, 34, 59, 0.92) 0%, rgba(31, 28, 49, 0.92) 100%);
    border: 1px solid rgba(143, 132, 230, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: 0.2s all;
}
.welcome-input-wrap { gap: 10px; padding: 0 13px; }
.welcome-phone-wrap { overflow: hidden; flex-direction: row; }

.welcome-input-wrap:focus-within,
.welcome-phone-wrap:focus-within {
    background: linear-gradient(180deg, rgba(46, 41, 71, 0.96) 0%, rgba(37, 33, 59, 0.96) 100%);
    border-color: #aba1f7;
    box-shadow: 0 0 0 3px rgba(143, 132, 230, 0.22), 0 0 18px rgba(143, 132, 230, 0.2);
}
.welcome-input-wrap > i { color: #aba1f7; font-size: 16px; }

.welcome-input-wrap > input,
.welcome-phone-wrap > input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    direction: ltr;
    text-align: left;
    font-family: Tahoma, sans-serif;
    color: #fff;
    font-size: 13.5px;
}
.welcome-phone-wrap > input { padding: 0 13px; }
.welcome-card input::placeholder { color: rgba(215, 210, 245, 0.38); }

.welcome-country-code {
    flex-shrink: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    background: linear-gradient(135deg, rgba(143, 132, 230, 0.26) 0%, rgba(109, 94, 207, 0.2) 100%);
    border-right: 1px solid rgba(143, 132, 230, 0.32);
    color: #d6d0ff;
    font-size: 13.5px;
    font-weight: 800;
    direction: ltr;
}

.welcome-note {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #9e9ab8;
    margin-top: 3px;
}
.welcome-note i { color: #8f84e6; }

/* ===================== Primary button ===================== */
.welcome-btn {
    color: #fff;
    margin-right: auto;
    margin-top: 22px;
    height: 44px;
    background: linear-gradient(135deg, #988df2 0%, #6d5ed1 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 0 26px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 8px 25px rgba(143, 132, 230, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: 0.2s all;
    position: relative;
    overflow: hidden;
    user-select: none;
}
.welcome-btn::after {
    content: "";
    position: absolute;
    top: 0; left: -100%;
    width: 55%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
    transition: 0.55s;
}
.welcome-btn:hover::after { left: 135%; }
.welcome-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(143, 132, 230, 0.58); }
.welcome-btn:active { transform: scale(0.97); }
.welcome-btn > div:first-child { display: flex; align-items: center; gap: 7px; }

/* Spinner */
.welcome-spinner {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.28);
    border-top-color: #fff;
    display: none;
    flex-shrink: 0;
    box-sizing: border-box;
    animation: welcome-spin 0.75s linear infinite;
}

/* ===================== OTP step ===================== */
.otp-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 16.5px;
    font-weight: 800;
    line-height: 1.6;
    color: #fff;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(143, 132, 230, 0.22);
}
.otp-header i { color: #aba1f7; font-size: 19px; }
.otp-header #number {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
    white-space: nowrap;
    color: #aba1f7;
    background: rgba(143, 132, 230, 0.16);
    padding: 2px 9px;
    border-radius: 5px;
}

.otp-inputs {
    width: 100%;
    display: flex;
    flex-direction: row-reverse;
    gap: 10px;
    align-items: center;
    justify-content: center;
    margin-top: 26px;
}
.otp-inputs > input {
    width: 52px;
    height: 56px;
    box-sizing: border-box;
    border-radius: 9px;
    text-align: center;
    border: 1.5px solid rgba(143, 132, 230, 0.36);
    outline: none;
    background: linear-gradient(180deg, rgba(38, 34, 59, 0.94) 0%, rgba(31, 28, 49, 0.94) 100%);
    color: #fff;
    font-family: Tahoma, sans-serif;
    font-size: 22px;
    direction: ltr;
    font-weight: 800;
    transition: 0.18s all;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.otp-inputs > input:focus {
    background: linear-gradient(180deg, rgba(48, 43, 74, 0.98) 0%, rgba(39, 35, 62, 0.98) 100%);
    border-color: #aba1f7;
    box-shadow: 0 0 18px rgba(143, 132, 230, 0.35);
    transform: translateY(-2px);
}

.otp-actions {
    width: 100%;
    display: flex;
    align-items: center;
    margin-top: 26px;
    flex-wrap: wrap;
    gap: 12px 0;
}
.otp-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #aba1f7;
    direction: ltr;
    user-select: none;
}
.otp-link {
    margin-right: 18px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: #c5c2dc;
    transition: 0.2s color;
}
.otp-link:hover { color: #fff; text-decoration: underline; }

.otp-confirm {
    margin-right: auto;
    margin-top: 0;
    height: 41px;
    padding: 0 24px;
    opacity: 0.65;
}

/* ===================== Responsive ===================== */
@media (max-width: 600px) {
    .welcome-card { padding: 22px 16px; }
}
@media (max-width: 440px) {
    .welcome-title { font-size: 16px; }
    .welcome-desc { font-size: 11.5px; }
    .otp-header { font-size: 14px; }
    .otp-inputs { gap: 6px; margin-top: 20px; }
    .otp-inputs > input { width: 41px; height: 48px; font-size: 18px; border-radius: 8px; }
    .otp-actions { margin-top: 18px; }
}
@media (max-width: 340px) {
    .otp-inputs > input { width: 34px; height: 42px; font-size: 16px; }
    .otp-actions { justify-content: flex-start; }
    .otp-confirm { margin-right: 0; margin-top: 12px; width: 100%; }
}

/* ===================== Browser autofill override ===================== */
/* Chrome paints autofilled inputs white; keep them matching the theme */
.welcome-card input:-webkit-autofill,
.welcome-card input:-webkit-autofill:hover,
.welcome-card input:-webkit-autofill:focus,
.welcome-card input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #221f37 inset !important;
    box-shadow: 0 0 0 1000px #221f37 inset !important;
    -webkit-text-fill-color: #fff !important;
    caret-color: #fff;
    border-radius: 0;
    transition: background-color 600000s 0s, color 600000s 0s;
}
.welcome-card input:autofill {
    box-shadow: 0 0 0 1000px #221f37 inset !important;
    -webkit-text-fill-color: #fff !important;
}