/*
 * Airdrop login modal.
 *
 * Rebuilt from the wallgold.ir LoginModal so the two look the same: monogram
 * header, circular person illustration, mobile + password, captcha per the
 * backend's chosen strategy, then the OTP dialog.
 *
 * Scoped under .wgxal- so nothing here can reach the rest of the page, and
 * written without a framework because it has to sit inside whatever theme the
 * airdrop box happens to be on.
 */

:root {
    /* Sampled from the live modal so the two cannot drift apart. */
    --wgxal-ink:      #14161d;   /* the sign-in button, and body text */
    --wgxal-line:     #e6e6e8;   /* field and button borders */
    --wgxal-field:    #f5f5f6;   /* field background */
    --wgxal-muted:    #8a8a8f;   /* placeholders and the subtitle */
    --wgxal-hover:    #dfdfdf73; /* the only hover the outlined button has */
}

.wgxal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .5);
    direction: rtl;
}

.wgxal-overlay.is-open { display: flex; }

.wgxal-modal {
    position: relative;
    width: 100%;
    max-width: 444px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 16px 24px 24px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 11px 15px -7px rgba(0, 0, 0, .2), 0 24px 38px 3px rgba(0, 0, 0, .14);
    font-family: inherit;
    color: #1c1c1c;
    text-align: center;
}

/* --- header ---------------------------------------------------------- */

.wgxal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.wgxal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #5c5c5c;
    cursor: pointer;
}

.wgxal-close:hover { background: rgba(0, 0, 0, .04); }

.wgxal-logo { width: 40px; height: 30px; object-fit: contain; }

/* Keeps the logo centred: the close button on the right needs a twin on the
 * left, and an empty box is cheaper than a flex trick that breaks in RTL. */
.wgxal-spacer { width: 40px; height: 40px; }

/* --- person + titles -------------------------------------------------- */

.wgxal-person {
    /* No disc behind the artwork — the image carries its own backdrop. The
     * box is only here to reserve the space and centre it. */
    width: 88px;
    height: 88px;
    margin: 4px auto 14px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.wgxal-person img {
    width: 76px;
    height: 76px;
    object-fit: contain;
    object-position: center bottom;
}

.wgxal-title  { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: var(--wgxal-ink); }
.wgxal-sub    { margin: 0 0 20px; font-size: 13px; font-weight: 400; color: var(--wgxal-muted); line-height: 1.9; }

/* --- fields ----------------------------------------------------------- */

.wgxal-fields {
    border: 1px solid var(--wgxal-line);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
    background: var(--wgxal-field);
    transition: border-color .15s;
}

.wgxal-fields.has-error { border-color: #d32f2f; }

/* Left to right, so the row reads eye · input · icon: the icon tile lands on
 * the right and the eye on the left, as on the site. The `order` values below
 * assume this. */
.wgxal-field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 6px 6px 12px;
    background: transparent;
    direction: ltr;
}

.wgxal-field + .wgxal-field { border-top: 1px solid var(--wgxal-line); }

/* The icon sits in its own pale tile at the leading edge, as on the site. */
.wgxal-field .wgxal-icon {
    flex: 0 0 auto;
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--wgxal-line);
    color: var(--wgxal-ink);
}

.wgxal-field input {
    flex: 1 1 auto;
    order: 1;
    min-width: 0;
    height: 44px;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--wgxal-ink);
    text-align: right;
}

.wgxal-field input::placeholder { color: var(--wgxal-muted); font-weight: 400; }

/* Numbers read left to right even inside an RTL form. */
.wgxal-field input[dir="ltr"] { text-align: right; direction: ltr; }

.wgxal-eye {
    flex: 0 0 auto;
    order: 0;
    border: 0;
    background: transparent;
    padding: 4px;
    color: var(--wgxal-ink);
    cursor: pointer;
    display: flex;
}

/* --- error ------------------------------------------------------------ */

.wgxal-error {
    display: none;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    margin: 0 0 12px;
    font-size: 12px;
    color: #d32f2f;
    text-align: right;
}

.wgxal-error.show { display: flex; }
.wgxal-error svg  { flex: 0 0 auto; }

/* --- captcha ---------------------------------------------------------- */

.wgxal-captcha {
    display: none;
    gap: 10px;
    align-items: stretch;
    margin: 12px 0 16px;
}

.wgxal-captcha.show { display: flex; }

.wgxal-captcha-input {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border: 1px solid var(--wgxal-line);
    border-radius: 12px;
    background: var(--wgxal-field);
}

.wgxal-captcha-input input {
    flex: 1 1 auto;
    min-width: 0;
    height: 52px;
    border: 0;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--wgxal-ink);
    text-align: right;
    direction: ltr;
}

.wgxal-captcha-input input::placeholder { color: var(--wgxal-muted); font-weight: 400; }

.wgxal-reload {
    border: 0;
    background: transparent;
    color: var(--wgxal-ink);
    cursor: pointer;
    padding: 4px;
    display: flex;
}

.wgxal-captcha-img {
    flex: 0 0 44%;
    min-height: 52px;
    border-radius: 12px;
    background: #f0f0f0 center/cover no-repeat;
}

/* --- buttons ---------------------------------------------------------- */

.wgxal-submit,
.wgxal-signup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    height: 52px;
    border-radius: 50px;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .15s;
}

/* Dark, and the same on hover — the live button does not lighten. */
.wgxal-submit {
    border: 1px solid var(--wgxal-ink);
    margin-bottom: 12px;
    background: var(--wgxal-ink);
    color: #fff;
}

.wgxal-submit:hover { background: var(--wgxal-ink); }

.wgxal-submit:disabled {
    border-color: #ececec;
    background: #ececec;
    color: #b0b0b0;
    cursor: default;
}

/* White until it is hovered, then the one translucent grey. */
.wgxal-signup {
    border: 1px solid var(--wgxal-line);
    background: #fff;
    color: var(--wgxal-ink);
    text-decoration: none;
    text-align: center;
}

.wgxal-signup:hover { background: var(--wgxal-hover); }

.wgxal-forgot {
    display: inline-block;
    margin-top: 16px;
    font-size: 12px;
    font-weight: 400;
    color: var(--wgxal-muted);
    text-decoration: none;
    background: none;
    border: 0;
    cursor: pointer;
}

.wgxal-forgot:hover { color: var(--wgxal-ink); }

/* --- OTP step --------------------------------------------------------- */

.wgxal-step-otp { display: none; }
.wgxal-modal.step-otp .wgxal-step-login { display: none; }
.wgxal-modal.step-otp .wgxal-step-otp   { display: block; }

.wgxal-otp-input {
    display: flex;
    align-items: center;
    padding: 0 12px;
    margin-bottom: 14px;
    border: 1px solid var(--wgxal-line);
    border-radius: 12px;
    background: var(--wgxal-field);
}

.wgxal-otp-input input {
    width: 100%;
    height: 52px;
    border: 0;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 18px;
    letter-spacing: 6px;
    text-align: center;
    direction: ltr;
}

.wgxal-resend {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--wgxal-muted);
    background: none;
    border: 0;
    cursor: pointer;
}

.wgxal-resend:disabled { cursor: default; opacity: .6; }

/* --- while a request is out -------------------------------------------- */

/* Not dimmed any more. A greyed-out modal reads as "switched off"; what it
 * needs to say is "working". Clicks are still refused. */
.wgxal-busy { pointer-events: none; }

/* The submit keeps its dark fill instead of going to the disabled grey, so the
 * spinner is legible and the button still looks alive. */
.wgxal-busy .wgxal-submit:disabled {
    border-color: var(--wgxal-ink);
    background: var(--wgxal-ink);
    color: #fff;
}

.wgxal-busy .wgxal-submit::after {
    content: '';
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .28);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wgxal-spin .7s linear infinite;
}

@keyframes wgxal-spin { to { transform: rotate(360deg); } }

/* The step that is hidden must not spin: only one button is on screen. */
.wgxal-modal.step-otp .wgxal-step-login .wgxal-submit::after,
.wgxal-modal:not(.step-otp) .wgxal-step-otp .wgxal-submit::after { content: none; }

.wgxal-wait {
    display: none;
    margin: 14px 0 0;
    font-size: 12px;
    font-weight: 400;
    color: var(--wgxal-muted);
    animation: wgxal-fade .25s ease;
}

.wgxal-wait.show { display: block; }

@keyframes wgxal-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .wgxal-busy .wgxal-submit::after { animation-duration: 2.4s; }
}

@media (max-width: 480px) {
    .wgxal-modal { padding: 12px 16px 20px; }
}
