/* =====================================================
   Safhe-ye login / khata — WebTools
   ===================================================== */
@font-face {
    font-family: "IRANSans";
    src: url("/AdminTemplate/fonts/IRANSansWeb.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "IRANSans";
    src: url("/AdminTemplate/fonts/IRANSansWeb_Bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: #0b1020;
    --card: rgba(17, 24, 45, .62);
    --card-border: rgba(255, 255, 255, .09);
    --text: #e6e9f2;
    --muted: #8d97b5;
    --input: rgba(255, 255, 255, .04);
    --input-border: rgba(255, 255, 255, .12);
    --accent: #22d3ee;
    --accent-2: #a78bfa;
    --danger: #fb7185;
    --success: #34d399;
    --radius: 14px;
}

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

html, body { height: 100%; }

body.auth {
    margin: 0;
    font-family: "IRANSans", Tahoma, sans-serif;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Pas-zamine ---------- */
.auth-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.auth-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .55;
    animation: blob-move 18s ease-in-out infinite alternate;
}
.auth-blob--1 { width: 460px; height: 460px; background: #2563eb; top: -120px; right: -100px; }
.auth-blob--2 { width: 380px; height: 380px; background: #7c3aed; bottom: -120px; left: -80px; animation-delay: -6s; }
.auth-blob--3 { width: 300px; height: 300px; background: #0891b2; top: 40%; left: 45%; animation-delay: -12s; opacity: .35; }

@keyframes blob-move {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-60px, 40px) scale(1.12); }
    100% { transform: translate(40px, -50px) scale(.95); }
}

.auth-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    animation: grid-pan 30s linear infinite;
}
@keyframes grid-pan { to { background-position: 44px 44px, 44px 44px; } }

.auth-chart {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 38vh;
    opacity: .7;
}
.auth-chart__line {
    stroke-dasharray: 900;
    stroke-dashoffset: 900;
    animation: chart-draw 3.2s .4s cubic-bezier(.65, 0, .35, 1) forwards;
}
.auth-chart__fill {
    opacity: 0;
    animation: fade-in 1.6s 2.4s ease forwards;
}
@keyframes chart-draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }

.auth-float {
    position: absolute;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .5px;
    color: rgba(255, 255, 255, .5);
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .04);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: float 9s ease-in-out infinite;
    direction: ltr;
}
.auth-float--1 { top: 16%; left: 12%; color: var(--success); }
.auth-float--2 { top: 24%; right: 14%; animation-delay: -3s; }
.auth-float--3 { bottom: 30%; left: 20%; animation-delay: -5s; color: var(--accent); }
.auth-float--4 { bottom: 42%; right: 10%; animation-delay: -7s; color: var(--accent-2); }
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0); }
    50%      { transform: translateY(-18px) rotate(-3deg); }
}

/* ---------- Kart ---------- */
.auth-main {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 36px 32px 24px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    animation: card-in .8s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes card-in {
    from { opacity: 0; transform: translateY(28px) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.auth-card.is-shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
    20%, 80% { transform: translateX(-3px); }
    30%, 50%, 70% { transform: translateX(6px); }
    40%, 60% { transform: translateX(-6px); }
}

.auth-card.is-success { animation: card-out .55s .35s cubic-bezier(.6, 0, .8, .2) forwards; }
@keyframes card-out { to { opacity: 0; transform: translateY(-16px) scale(.97); } }

/* Hame-ye bache-ha posht-e ham vared mishan */
.auth-brand, .auth-form > *, .auth-foot {
    animation: rise .6s cubic-bezier(.2, .8, .2, 1) both;
}
.auth-brand { animation-delay: .15s; }
.auth-form > :nth-child(2) { animation-delay: .25s; }
.auth-form > :nth-child(3) { animation-delay: .32s; }
.auth-form > :nth-child(4) { animation-delay: .39s; }
.auth-form > :nth-child(5) { animation-delay: .44s; }
.auth-form > :nth-child(6) { animation-delay: .46s; }
.auth-foot { animation-delay: .55s; }
@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- Brand ---------- */
.auth-brand { text-align: center; margin-bottom: 28px; }

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 10px 30px -8px rgba(34, 211, 238, .6);
    animation: logo-glow 3.5s ease-in-out infinite;
}
.auth-logo svg { width: 38px; height: 38px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; }
.auth-logo__ring  { stroke-dasharray: 82; stroke-dashoffset: 82; animation: draw .9s .35s ease forwards; }
.auth-logo__handle { stroke-dasharray: 15; stroke-dashoffset: 15; animation: draw .35s 1.15s ease forwards; }
.auth-logo__bars  { stroke-width: 2.6; stroke-dasharray: 10; stroke-dashoffset: 10; animation: draw .5s 1.4s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes logo-glow {
    0%, 100% { box-shadow: 0 10px 30px -8px rgba(34, 211, 238, .6); }
    50%      { box-shadow: 0 10px 40px -4px rgba(167, 139, 250, .75); }
}

.auth-title {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #c7d2fe);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.auth-subtitle { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.9; }

/* ---------- Field-ha ---------- */
.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-field { position: relative; }

.auth-input {
    width: 100%;
    height: 54px;
    padding: 18px 46px 6px 46px;
    font: inherit;
    font-size: 16px;
    letter-spacing: .5px;
    color: var(--text);
    text-align: right;
    background: var(--input);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color .25s, box-shadow .25s, background .25s;
}
.auth-input:hover { border-color: rgba(255, 255, 255, .2); }
.auth-input:focus {
    border-color: var(--accent);
    background: rgba(34, 211, 238, .05);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, .15);
}
.auth-input:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 100px #141c33 inset;
    transition: background-color 9999s;
}
.auth-field.is-invalid .auth-input { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(251, 113, 133, .14); }

.auth-label {
    position: absolute;
    right: 46px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
    transition: top .2s ease, font-size .2s ease, color .2s ease;
}
.auth-input:focus + .auth-label,
.auth-input:not(:placeholder-shown) + .auth-label {
    top: 14px;
    font-size: 11px;
    color: var(--accent);
}
.auth-field.is-invalid .auth-label { color: var(--danger); }

.auth-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.8;
    stroke-linecap: round;
    transition: stroke .25s;
}
.auth-field:focus-within .auth-icon { stroke: var(--accent); }

.auth-eye {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    transition: background .2s;
}
.auth-eye:hover, .auth-eye:focus-visible { background: rgba(255, 255, 255, .07); outline: none; }
.auth-eye svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }
.auth-eye__slash { stroke-dasharray: 23; stroke-dashoffset: 0; transition: stroke-dashoffset .3s ease; }
.auth-eye[aria-pressed="true"] .auth-eye__slash { stroke-dashoffset: 23; }
.auth-eye[aria-pressed="true"] svg { stroke: var(--accent); }

/* ---------- Checkbox ---------- */
.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    width: fit-content;
}
.auth-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.auth-check__box {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid var(--input-border);
    display: grid;
    place-items: center;
    transition: background .2s, border-color .2s;
}
.auth-check__box svg { width: 14px; height: 14px; fill: none; stroke: #0b1020; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset .25s ease; }
.auth-check input:checked + .auth-check__box { background: var(--accent); border-color: var(--accent); }
.auth-check input:checked + .auth-check__box svg { stroke-dashoffset: 0; }
.auth-check input:focus-visible + .auth-check__box { box-shadow: 0 0 0 4px rgba(34, 211, 238, .2); }

/* ---------- Khata ---------- */
.auth-error {
    margin: -4px 0 0;
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    font-size: 13px;
    color: var(--danger);
    opacity: 0;
    transition: max-height .3s ease, opacity .3s ease, margin .3s ease;
}
.auth-error.is-visible { max-height: 60px; opacity: 1; margin: 0; }

/* ---------- Dokme ---------- */
.auth-btn {
    position: relative;
    height: 52px;
    margin-top: 4px;
    border: 0;
    border-radius: var(--radius);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    color: #0b1020;
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent));
    background-size: 200% 100%;
    box-shadow: 0 12px 30px -10px rgba(34, 211, 238, .55);
    transition: transform .15s ease, box-shadow .25s ease, background-position .6s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.auth-btn:hover { background-position: 100% 0; box-shadow: 0 16px 36px -10px rgba(167, 139, 250, .6); }
.auth-btn:active { transform: scale(.98); }
.auth-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(34, 211, 238, .3); }

/* Bargh-e ru-ye dokme */
.auth-btn::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent);
    transform: skewX(-20deg);
    animation: shine 4s 1.5s ease-in-out infinite;
}
@keyframes shine { 0% { left: -60%; } 30%, 100% { left: 130%; } }

.auth-btn__spinner {
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(11, 16, 32, .25);
    border-top-color: #0b1020;
    border-radius: 50%;
    opacity: 0;
    transform: scale(.5);
    transition: opacity .2s, transform .2s;
}
.auth-btn__done {
    position: absolute;
    width: 26px;
    height: 26px;
    fill: none;
    stroke: #0b1020;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 22;
    stroke-dashoffset: 22;
}
.auth-btn__text { transition: opacity .2s, transform .2s; }

.auth-btn.is-loading { pointer-events: none; }
.auth-btn.is-loading .auth-btn__text { opacity: 0; transform: translateY(-8px); }
.auth-btn.is-loading .auth-btn__spinner { opacity: 1; transform: scale(1); animation: spin .7s linear infinite; }
.auth-btn.is-done { pointer-events: none; background: var(--success); }
.auth-btn.is-done .auth-btn__text { opacity: 0; }
.auth-btn.is-done .auth-btn__done { animation: draw .35s ease forwards; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-foot { margin: 22px 0 0; text-align: center; font-size: 12px; color: rgba(141, 151, 181, .6); }

/* ---------- Safhe-ye khata ---------- */
.auth-card--error { text-align: center; }
.auth-card--error .auth-subtitle { margin-bottom: 24px; }
.auth-code {
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: float 6s ease-in-out infinite;
}
.auth-btn--link { width: 100%; }

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
    .auth-card { padding: 28px 20px 20px; border-radius: 18px; }
    .auth-float { display: none; }
    .auth-blob { filter: blur(60px); }
}

/* ---------- Kahesh-e harekat ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
