:root {
    --auth-bg: #eef5f1;
    --auth-bg-soft: #dceae3;
    --auth-panel: #ffffff;
    --auth-ink: #17211d;
    --auth-muted: #66756e;
    --auth-line: #dfe7e3;
    --auth-green: #0d6b4b;
    --auth-green-dark: #074a35;
    --auth-green-soft: #e9f5ef;
    --auth-red: #d61f26;
    --auth-red-dark: #ad141d;
    --auth-silver: #dce3e0;
    --auth-danger: #b42318;
    --auth-danger-bg: #fff2f0;
    --auth-shadow: 0 34px 90px rgba(10, 54, 38, .18);
    --auth-radius: 28px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    color: var(--auth-ink);
    background:
        radial-gradient(circle at 14% 16%, rgba(13, 107, 75, .18), transparent 24rem),
        radial-gradient(circle at 84% 84%, rgba(214, 31, 38, .14), transparent 22rem),
        linear-gradient(135deg, #f6faf8 0%, var(--auth-bg-soft) 42%, #f3f8f5 100%);
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .26;
    background-image:
        linear-gradient(rgba(13,107,75,.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(13,107,75,.045) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, #000, transparent 85%);
}

button, input { font: inherit; }

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: clamp(20px, 4vw, 52px);
}

.auth-card {
    position: relative;
    z-index: 1;
    width: min(1040px, 100%);
    min-height: 620px;
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(420px, 1.05fr);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: var(--auth-radius);
    background: var(--auth-panel);
    box-shadow: var(--auth-shadow);
}

.brand-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    padding: 52px 48px 34px;
    color: #fff;
    background:
        radial-gradient(circle at 16% 18%, rgba(255,255,255,.12), transparent 18rem),
        radial-gradient(circle at 84% 85%, rgba(214, 31, 38, .22), transparent 16rem),
        linear-gradient(160deg, rgba(7, 74, 53, .98) 0%, rgba(10, 95, 66, .96) 62%, rgba(9, 84, 59, .98) 100%);
}

.brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,.08) 0 10px, transparent 10px calc(100% - 10px), rgba(214,31,38,.72) calc(100% - 10px) 100%),
        url("../images/arak-football-board.jpg?v=20260825-3") center 44%/60% auto no-repeat;
    opacity: .18;
    pointer-events: none;
}

.brand-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 20, 13, .36), rgba(0, 20, 13, .12) 48%, rgba(255,255,255,.04));
    pointer-events: none;
}

.brand-glow {
    position: absolute;
    width: 420px;
    height: 420px;
    top: -180px;
    left: -160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.16), rgba(121,184,156,.10) 52%, transparent 72%);
}

.brand-content,
.brand-footer { position: relative; z-index: 1; }

.brand-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.emblem-frame {
    width: 184px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    padding: 7px;
    overflow: hidden;
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,.26);
    background: rgba(255,255,255,.08);
    box-shadow: 0 18px 44px rgba(0,0,0,.34);
    backdrop-filter: blur(10px);
}

.emblem-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 27px;
}

.brand-kicker {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 10px;
    padding: 6px 11px;
    border-radius: 999px;
    color: #ffffff;
    background: rgba(214,31,38,.18);
    border: 1px solid rgba(255,255,255,.12);
    font-size: .78rem;
    font-weight: 700;
}

.brand-copy h2 {
    margin: 0;
    font-size: clamp(1.75rem, 3vw, 2.45rem);
    line-height: 1.55;
    font-weight: 900;
    letter-spacing: -.02em;
}

.brand-copy p {
    max-width: 390px;
    margin: 14px 0 0;
    color: rgba(255,255,255,.82);
    font-size: .95rem;
    line-height: 2;
}

.brand-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 14px;
    color: rgba(255,255,255,.54);
    font-size: .72rem;
    letter-spacing: .18em;
    direction: ltr;
}

.brand-footer span:first-child,
.brand-footer span:last-child {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.26));
}
.brand-footer span:last-child { background: linear-gradient(90deg, rgba(255,255,255,.26), transparent); }

.form-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fff;
}

.form-wrap {
    width: min(440px, calc(100% - 64px));
    margin: auto;
    padding: 54px 0 34px;
}

.form-header { margin-bottom: 30px; }

.mobile-emblem { display: none; }

.security-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 18px;
    padding: 7px 10px;
    border-radius: 999px;
    color: #5e6d66;
    background: #f3f6f4;
    border: 1px solid #e3e9e6;
    font-size: .72rem;
    font-weight: 700;
}

.security-pill.is-secure {
    color: var(--auth-green-dark);
    background: var(--auth-green-soft);
    border-color: #cae7d9;
}

.security-pill svg { width: 16px; height: 16px; fill: currentColor; }

.eyebrow {
    margin: 0 0 5px;
    color: var(--auth-green);
    font-size: .85rem;
    font-weight: 800;
}

.form-header h1 {
    margin: 0;
    color: #132019;
    font-size: clamp(1.8rem, 3vw, 2.25rem);
    font-weight: 900;
    letter-spacing: -.025em;
}

.subtitle {
    margin: 10px 0 0;
    color: var(--auth-muted);
    font-size: .92rem;
    line-height: 1.9;
}

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 22px;
    padding: 13px 14px;
    color: var(--auth-danger);
    background: var(--auth-danger-bg);
    border: 1px solid #ffd5cf;
    border-radius: 14px;
    font-size: .84rem;
    line-height: 1.8;
}
.auth-alert svg { flex: 0 0 19px; width: 19px; height: 19px; margin-top: 3px; fill: currentColor; }

.login-form { display: grid; gap: 19px; }

.field-group { display: grid; gap: 8px; }
.field-group label { color: #26362f; font-size: .83rem; font-weight: 750; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.caps-warning {
    visibility: hidden;
    color: #9a6700;
    font-size: .7rem;
    font-weight: 700;
}
.caps-warning.is-visible { visibility: visible; }

.field-control { position: relative; }

.field-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    width: 19px;
    height: 19px;
    transform: translateY(-50%);
    color: #86958e;
    pointer-events: none;
}
.field-icon svg { width: 100%; height: 100%; fill: currentColor; }

.field-control input {
    width: 100%;
    min-height: 52px;
    padding: 0 46px 0 46px;
    color: #15231c;
    background: #fbfcfb;
    border: 1px solid #dce4e0;
    border-radius: 13px;
    outline: none;
    font-size: .93rem;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.field-control input::placeholder { color: #a3afa9; }
.field-control input:hover { border-color: #c7d2cd; }
.field-control input:focus {
    background: #fff;
    border-color: var(--auth-green);
    box-shadow: 0 0 0 4px rgba(13, 107, 75, .11);
}

.password-toggle {
    position: absolute;
    left: 11px;
    top: 50%;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: #74837c;
    background: transparent;
    cursor: pointer;
}
.password-toggle:hover { color: var(--auth-green); background: #edf5f1; }
.password-toggle:focus-visible { outline: 3px solid rgba(13, 107, 75, .2); outline-offset: 1px; }
.password-toggle svg { width: 19px; height: 19px; fill: currentColor; }
.password-toggle .eye-off { display: none; }
.password-toggle[aria-pressed="true"] .eye-open { display: none; }
.password-toggle[aria-pressed="true"] .eye-off { display: block; }

.submit-button {
    min-height: 54px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
    padding: 0 20px;
    color: #fff;
    background: linear-gradient(135deg, var(--auth-green), var(--auth-green-dark));
    border: 0;
    border-radius: 13px;
    box-shadow: 0 12px 24px rgba(7, 74, 53, .18);
    cursor: pointer;
    font-size: .94rem;
    font-weight: 800;
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.submit-button:hover { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(7, 74, 53, .23); filter: saturate(1.06); }
.submit-button:active { transform: translateY(0); }
.submit-button:focus-visible { outline: 4px solid rgba(13, 107, 75, .18); outline-offset: 3px; }
.submit-button:disabled { cursor: wait; opacity: .78; transform: none; }
.button-arrow { width: 20px; height: 20px; fill: currentColor; transform: scaleX(-1); }
.button-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin .7s linear infinite;
}
.submit-button.is-loading .button-arrow { display: none; }
.submit-button.is-loading .button-spinner { display: block; }

.form-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    color: #7b8982;
    font-size: .74rem;
    line-height: 1.7;
}
.form-note svg { width: 16px; height: 16px; flex: 0 0 16px; fill: currentColor; }

.auth-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    padding: 22px 28px 25px;
    color: #8a9790;
    border-top: 1px solid #edf1ef;
    font-size: .69rem;
}
.footer-separator { color: #c3ccc8; }

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

@media (max-width: 860px) {
    .auth-shell { padding: 18px; }
    .auth-card { min-height: auto; grid-template-columns: 1fr; max-width: 560px; }
    .brand-panel { display: none; }
    .form-wrap { width: min(100% - 48px, 430px); padding: 38px 0 30px; }
    .mobile-emblem {
        width: 84px;
        height: 84px;
        display: block;
        margin-bottom: 20px;
        padding: 4px;
        border-radius: 22px;
        background: linear-gradient(135deg, #0d6b4b, #d61f26);
        box-shadow: 0 10px 26px rgba(7, 31, 22, .16);
        overflow: hidden;
    }
    .mobile-emblem img { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; }
}

@media (max-width: 480px) {
    .auth-shell { display: block; min-height: 100dvh; padding: 0; background: #fff; }
    .auth-card { width: 100%; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
    .form-panel { min-height: 100dvh; }
    .form-wrap { width: calc(100% - 36px); padding: max(28px, env(safe-area-inset-top)) 0 26px; }
    .form-header { margin-bottom: 25px; }
    .mobile-emblem { width: 76px; height: 76px; border-radius: 20px; }
    .mobile-emblem img { border-radius: 16px; }
    .form-header h1 { font-size: 1.75rem; }
    .subtitle { font-size: .85rem; }
    .field-control input { min-height: 54px; font-size: 16px; }
    .submit-button { min-height: 56px; }
    .auth-footer { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media (prefers-color-scheme: dark) and (max-width: 480px) {
    /* Login intentionally stays light on mobile for readability and consistent brand presentation. */
}

/* v7.2 performance: avoid expensive compositing on the login screen. */
@media (prefers-reduced-motion: no-preference) {
    .auth-card { contain: layout paint; }
}
.emblem-frame { backdrop-filter: none; -webkit-backdrop-filter: none; }
.brand-glow { filter: none; opacity: .55; }
@media (max-width: 720px) {
    body::before { display: none; }
    .auth-card { box-shadow: 0 18px 46px rgba(1,16,10,.24); }
}
