/* MH Login - front form */
@font-face {
    font-family: "MHL Vazirmatn";
    src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "MHL Vazirmatn";
    src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 600 700;
    font-display: swap;
}

.mhl {
    --mhl-bg: #ffffff;
    --mhl-primary: #5498fa;
    --mhl-primary-hover: #2c61a6;
    --mhl-text: #0f172a;
    --mhl-muted: #64748b;
    --mhl-border: #e2e8f0;
    --mhl-field: #f1f5f9;
    --mhl-danger: #dc2626;
    --mhl-success: #16a34a;
    --mhl-radius: 12px;
    box-sizing: border-box;
    color: var(--mhl-text);
    font-size: 16px;
    line-height: 1.8;
    letter-spacing: normal;
    text-align: start;
}

.mhl *,
.mhl *::before,
.mhl *::after {
    box-sizing: border-box;
}

.mhl--vazir,
.mhl--vazir input,
.mhl--vazir button {
    font-family: "MHL Vazirmatn", Tahoma, system-ui, sans-serif;
}

.mhl:not(.mhl--vazir) input,
.mhl:not(.mhl--vazir) button {
    font-family: inherit;
}

/* Layout */
.mhl--standalone {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    min-height: 100svh;
    background-color: var(--mhl-bg);
    background-image: var(--mhl-bg-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.mhl--standalone.mhl--has-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgb(15 23 42 / var(--mhl-bg-overlay, 0));
    pointer-events: none;
}

body.mhl-page {
    margin: 0;
    background: var(--mhl-bg, #fff);
}

.mhl--embedded {
    padding: 8px 0;
}

.mhl__wrapper {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.mhl--card .mhl__card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 6px 28px rgb(15 23 42 / 0.08);
    padding: 32px;
}

.mhl--outline .mhl__card {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    padding: 32px;
}

.mhl--outline .mhl__input {
    background: #fff;
    border-color: #cbd5e1;
}

.mhl--split .mhl__card {
    background: #fff;
    padding: 32px;
}

@media (min-width: 992px) {
    .mhl--split .mhl__wrapper {
        max-width: 980px;
        display: flex;
        border-radius: 16px;
        overflow: hidden;
        background: #fff;
        box-shadow: 0 8px 30px rgb(15 23 42 / 0.08);
    }

    .mhl--split .mhl__main {
        flex: 0 0 440px;
        max-width: 440px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .mhl--split .mhl__aside {
        flex: 1;
        min-height: 520px;
        background: var(--mhl-primary);
    }

    .mhl--split .mhl__aside img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
}

@media (max-width: 991.98px) {
    .mhl__aside {
        display: none;
    }

    .mhl--split .mhl__card {
        border-radius: 16px;
        box-shadow: 0 6px 28px rgb(15 23 42 / 0.08);
    }
}

/* Head */
.mhl__head {
    position: relative;
    min-height: 32px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mhl__head:not(:has(.mhl__logo)):has(> [data-step-back][hidden]) {
    display: none;
}

.mhl__logo img {
    display: block;
    max-width: 160px;
    height: 64px;
    width: auto;
    object-fit: contain;
}

.mhl__step-back {
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    padding: 6px;
    margin: 0;
    cursor: pointer;
    color: var(--mhl-text);
    border-radius: 8px;
    display: inline-flex;
}

.mhl__step-back:hover,
.mhl__step-back:focus-visible {
    background: var(--mhl-field);
}

.mhl__site-back {
    position: fixed;
    inset-inline-start: 12px;
    top: 12px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--mhl-text);
    background: #fff;
    border: 1px solid var(--mhl-border);
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 4px 16px rgb(15 23 42 / 0.06);
    transition: background 0.2s, color 0.2s;
}

.mhl__site-back:hover {
    background: var(--mhl-text);
    color: #fff;
}

/* Text */
.mhl__title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 12px;
    color: var(--mhl-text);
    letter-spacing: normal;
}

.mhl__desc {
    font-size: 14px;
    color: var(--mhl-muted);
    margin: 0 0 16px;
}

.mhl__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin: 0 0 8px;
}

.mhl__label--center {
    text-align: center;
    margin-top: 4px;
}

/* Fields */
.mhl__field {
    margin-bottom: 16px;
}

.mhl .mhl__input {
    display: block;
    width: 100%;
    height: 52px;
    margin: 0;
    padding: 0 14px;
    font-size: 16px;
    line-height: normal;
    color: var(--mhl-text);
    background: var(--mhl-field);
    border: 1px solid var(--mhl-border);
    border-radius: var(--mhl-radius);
    box-shadow: none;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.mhl .mhl__input:focus {
    border-color: var(--mhl-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mhl-primary) 18%, transparent);
}

.mhl .mhl__input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.mhl .mhl__input[dir="ltr"]::placeholder,
.mhl .mhl__input[dir="auto"]:placeholder-shown {
    direction: rtl;
    text-align: right;
}

.mhl .mhl__input--otp {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.5em;
}

.mhl .mhl__input--otp::placeholder {
    letter-spacing: 0.3em;
    text-align: center;
    direction: ltr;
}

.mhl__row {
    display: flex;
    gap: 10px;
}

.mhl__row .mhl__input {
    flex: 1;
    min-width: 0;
}

.mhl__register > .mhl__row,
.mhl__register > .mhl__input {
    margin-bottom: 12px;
}

.mhl__register > .mhl__input[hidden] {
    display: none;
}

.mhl__password {
    position: relative;
}

.mhl .mhl__password .mhl__input {
    padding-inline-end: 46px;
}

.mhl__reveal {
    position: absolute;
    inset-inline-end: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    padding: 8px;
    cursor: pointer;
    color: var(--mhl-muted);
    display: inline-flex;
}

/* OTP boxes */
.mhl__otp-boxes {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 8px;
    direction: ltr;
}

.mhl .mhl__otp-box {
    width: 100%;
    height: 54px;
    padding: 0;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--mhl-text);
    background: var(--mhl-field);
    border: 1px solid var(--mhl-border);
    border-radius: var(--mhl-radius);
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.mhl .mhl__otp-box:focus {
    border-color: var(--mhl-primary);
}

/* Validation */
.mhl .mhl--invalid,
.mhl .mhl--invalid .mhl__otp-box {
    border-color: var(--mhl-danger) !important;
}

.mhl__error {
    display: block;
    font-size: 13px;
    color: var(--mhl-danger);
    margin: 6px 0 10px;
}

/* Captcha */
.mhl__captcha-question {
    display: inline-block;
    unicode-bidi: isolate;
    font-weight: 700;
    color: var(--mhl-text);
}

.mhl__captcha .mhl__input {
    text-align: center;
}

.mhl .mhl__hp {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Buttons and links */
.mhl .mhl__button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    margin: 0;
    padding: 0 16px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: var(--mhl-primary);
    border: 0;
    border-radius: var(--mhl-radius);
    cursor: pointer;
    box-shadow: none;
    transition: background 0.2s, opacity 0.2s;
}

.mhl .mhl__button:hover,
.mhl .mhl__button:focus-visible {
    background: var(--mhl-primary-hover);
    color: #fff;
}

.mhl .mhl__button:disabled {
    cursor: wait;
    opacity: 0.8;
}

.mhl__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 4px 0 16px;
}

.mhl__actions[hidden],
.mhl__link[hidden],
.mhl__timer [hidden] {
    display: none !important;
}

.mhl .mhl__link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin: 0;
    font-size: 13px;
    color: var(--mhl-primary);
    background: none;
    border: 0;
    cursor: pointer;
    text-decoration: none;
}

.mhl .mhl__link:hover {
    color: var(--mhl-primary-hover);
    background: none;
}

.mhl .mhl__link:disabled {
    opacity: 0.6;
}

.mhl__timer {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 26px;
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--mhl-muted);
}

.mhl__timer[hidden] {
    display: none;
}

.mhl__timer-count [data-timer-text] {
    display: inline-block;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.mhl__spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgb(255 255 255 / 0.35);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: mhl-spin 0.7s linear infinite;
}

.mhl__link .mhl__spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
    border-color: color-mix(in srgb, currentColor 30%, transparent);
    border-top-color: currentColor;
}

.mhl__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@keyframes mhl-spin {
    to {
        transform: rotate(360deg);
    }
}

.mhl__terms {
    margin-top: 12px;
    font-size: 12px;
    text-align: center;
    color: var(--mhl-muted);
}

.mhl__terms p {
    margin: 0;
}

.mhl__terms a {
    color: var(--mhl-primary);
}

/* Messages */
.mhl-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.8;
    border-radius: var(--mhl-radius, 12px);
    border: 1px solid transparent;
}

.mhl-notice--error {
    color: var(--mhl-danger, #dc2626);
    background: #fef2f2;
    border-color: #fecaca;
}

.mhl-notice--success {
    color: var(--mhl-success, #16a34a);
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.mhl-notice::before {
    content: "";
    flex: 0 0 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.mhl__toasts {
    position: fixed;
    z-index: 99999;
    width: min(360px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.mhl__toasts--top { top: 16px; }
.mhl__toasts--bottom { bottom: 16px; }
.mhl__toasts--right { right: 16px; }
.mhl__toasts--left { left: 16px; }

.mhl-toast {
    position: relative;
    overflow: hidden;
    margin: 0;
    pointer-events: auto;
    box-shadow: 0 12px 30px rgb(15 23 42 / 0.14);
    animation: mhl-toast-in 0.22s ease-out both;
}

.mhl-toast::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.35;
    transform-origin: right center;
    animation: mhl-toast-progress var(--mhl-toast-duration, 5000ms) linear forwards;
}

.mhl-toast--hide {
    animation: mhl-toast-out 0.22s ease-in both;
}

@keyframes mhl-toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

@keyframes mhl-toast-out {
    to { opacity: 0; transform: translateY(-8px); }
}

@keyframes mhl-toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.mhl [hidden] {
    display: none !important;
}

/* Small screens */
@media (max-width: 575.98px) {
    .mhl--standalone {
        justify-content: flex-start;
        padding: 16px 16px 24px;
    }

    .mhl__site-back {
        position: static;
        align-self: flex-start;
        margin-bottom: 12px;
        box-shadow: none;
    }

    .mhl--card .mhl__card,
    .mhl--outline .mhl__card,
    .mhl--split .mhl__card {
        padding: 24px 20px;
    }

    .mhl__toasts {
        left: 16px;
        right: 16px;
        width: auto;
    }
}

@media (max-width: 360px) {
    .mhl__otp-boxes {
        gap: 5px;
    }

    .mhl .mhl__otp-box {
        height: 46px;
        font-size: 18px;
    }

    .mhl__row {
        flex-direction: column;
        gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mhl *,
    .mhl-toast {
        animation-duration: 0.01ms !important;
        transition: none !important;
    }
}

/* ------------------------------------------------------------------
   Effects
   ------------------------------------------------------------------ */

/* Step entrance */
.mhl__step:not([hidden]) {
    animation: mhl-step-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes mhl-step-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

/* Primary button */
.mhl .mhl__button {
    gap: 8px;
    position: relative;
    overflow: hidden;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 8px 20px -10px var(--mhl-primary);
}

.mhl .mhl__button:active {
    transform: scale(0.985);
}

.mhl .mhl__button .mhl__chevron {
    transition: transform 0.25s;
}

.mhl .mhl__button:hover .mhl__chevron {
    transform: translateX(-4px);
}

.mhl__dots {
    display: inline-flex;
    gap: 5px;
}

.mhl__dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: mhl-dot 0.9s infinite ease-in-out;
}

.mhl__dots i:nth-child(2) { animation-delay: 0.15s; }
.mhl__dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes mhl-dot {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Identifier field with live icon, progress line and check mark */
.mhl__idfield {
    position: relative;
    --mhl-progress: 0;
}

.mhl .mhl__idfield .mhl__input {
    padding-inline-start: 46px;
    padding-inline-end: 44px;
}

.mhl__idfield-icon {
    position: absolute;
    inset-inline-start: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    color: #94a3b8;
    transition: color 0.2s;
    pointer-events: none;
}

.mhl__idfield-icon svg {
    display: none;
}

.mhl__idfield[data-kind="mobile"] [data-icon="mobile"],
.mhl__idfield[data-kind="email"] [data-icon="email"],
.mhl__idfield[data-kind="username"] [data-icon="username"] {
    display: block;
    animation: mhl-icon-in 0.25s ease-out;
}

@keyframes mhl-icon-in {
    from { opacity: 0; transform: scale(0.6) rotate(-12deg); }
    to { opacity: 1; transform: none; }
}

.mhl__idfield:focus-within .mhl__idfield-icon,
.mhl__idfield.is-valid .mhl__idfield-icon {
    color: var(--mhl-primary);
}

.mhl__idfield-ok {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    width: 26px;
    height: 26px;
    margin-top: -13px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--mhl-success);
    transform: scale(0);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.mhl__idfield.is-valid .mhl__idfield-ok {
    transform: scale(1);
}

.mhl__idfield-progress {
    position: absolute;
    inset-inline: 12px;
    bottom: 0;
    height: 2px;
    overflow: hidden;
    border-radius: 2px;
    pointer-events: none;
}

.mhl__idfield-progress span {
    display: block;
    height: 100%;
    background: var(--mhl-primary);
    transform: scaleX(var(--mhl-progress));
    transform-origin: right center;
    transition: transform 0.25s ease-out, background 0.25s;
}

.mhl__idfield.is-valid .mhl__idfield-progress span {
    background: var(--mhl-success);
}

/* One-time code */
.mhl .mhl__otp-box {
    transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.mhl .mhl__otp-box:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mhl-primary) 20%, transparent);
    transform: translateY(-2px);
}

.mhl .mhl__otp-box.is-filled {
    background: #fff;
    border-color: var(--mhl-primary);
    animation: mhl-pop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes mhl-pop {
    0% { transform: scale(0.8); }
    60% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.mhl__otp-boxes.is-checking .mhl__otp-box {
    animation: mhl-wave 0.9s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.08s);
}

@keyframes mhl-wave {
    0%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

.mhl .mhl__otp-boxes.is-success .mhl__otp-box {
    color: #fff;
    border-color: var(--mhl-success) !important;
    background: var(--mhl-success);
    animation: mhl-flip 0.45s ease-out both;
    animation-delay: calc(var(--i) * 0.08s);
}

@keyframes mhl-flip {
    0% { transform: rotateX(0); background: #fff; color: var(--mhl-text); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0); }
}

.mhl--shake {
    animation: mhl-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.mhl .mhl--shake .mhl__otp-box,
.mhl .mhl__input--otp.mhl--shake {
    border-color: var(--mhl-danger) !important;
}

@keyframes mhl-shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(3px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

/* Success celebration */
.mhl__card {
    position: relative;
}

.mhl--done .mhl__card > :not(.mhl__success) {
    animation: none;
    transition: opacity 0.3s, filter 0.3s;
    opacity: 0;
    filter: blur(4px);
    pointer-events: none;
}

.mhl__success {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    animation: mhl-fade 0.3s ease-out both;
}

.mhl__success[hidden] {
    display: none !important;
}

@keyframes mhl-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mhl__success-badge {
    position: relative;
    width: 88px;
    height: 88px;
    margin-bottom: 18px;
}

.mhl__success-badge svg {
    position: relative;
    z-index: 1;
    border-radius: 50%;
    background: var(--mhl-success);
    animation: mhl-badge 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes mhl-badge {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.mhl__success-circle {
    stroke: rgb(255 255 255 / 0.5);
    stroke-width: 2;
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
    animation: mhl-draw 0.6s 0.15s ease-out forwards;
}

.mhl__success-check {
    stroke: #fff;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 36;
    stroke-dashoffset: 36;
    animation: mhl-draw 0.4s 0.4s ease-out forwards;
}

@keyframes mhl-draw {
    to { stroke-dashoffset: 0; }
}

.mhl__success-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--mhl-success);
    animation: mhl-ring 1.1s 0.2s ease-out both;
}

.mhl__success-ring--late {
    animation-delay: 0.45s;
}

@keyframes mhl-ring {
    from { transform: scale(1); opacity: 0.7; }
    to { transform: scale(2.1); opacity: 0; }
}

.mhl__confetti {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 2px;
    background: var(--mhl-primary);
    opacity: 0;
    transform: rotate(calc(var(--n) * 36deg)) translateY(0);
    animation: mhl-confetti 0.9s 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.mhl__confetti:nth-child(odd) {
    background: var(--mhl-success);
    border-radius: 50%;
}

.mhl__confetti:nth-child(3n) {
    background: #f59e0b;
}

@keyframes mhl-confetti {
    0% { opacity: 1; transform: rotate(calc(var(--n) * 36deg)) translateY(0) scale(1); }
    100% { opacity: 0; transform: rotate(calc(var(--n) * 36deg)) translateY(-78px) scale(0.4); }
}

.mhl__success-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--mhl-text);
    animation: mhl-step-in 0.4s 0.5s both;
}

.mhl__success-text {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--mhl-muted);
    animation: mhl-step-in 0.4s 0.6s both;
}

/* Admin live preview: the side image is always printed there, shown only for the split template. */
.mhl--preview .mhl__aside {
    display: none;
}

.mhl--preview.mhl--split .mhl__aside {
    display: block;
}

@media (prefers-reduced-motion: reduce) {
    .mhl__success,
    .mhl__success * {
        animation: none !important;
        stroke-dashoffset: 0 !important;
    }

    .mhl__confetti,
    .mhl__success-ring {
        display: none;
    }
}
