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

:root {
    --auth-bg: #070708;
    --auth-panel: rgba(14, 14, 16, 0.92);
    --auth-gold: #f0c14b;
    --auth-text: #f3f1ea;
    --auth-muted: #9b978c;
    --auth-line: rgba(255, 255, 255, 0.1);
}

html {
    -webkit-text-size-adjust: 100%;
}

.auth-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--auth-bg);
    color: var(--auth-text);
    font-family: "Vazirmatn", Tahoma, sans-serif;
}

.auth-page {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(0.75rem, env(safe-area-inset-top))
             max(0.75rem, env(safe-area-inset-right))
             max(0.75rem, env(safe-area-inset-bottom))
             max(0.75rem, env(safe-area-inset-left));
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--auth-bg);
    -webkit-overflow-scrolling: touch;
}

.auth-page--has-bg::before {
    content: "";
    position: fixed;
    inset: -15%;
    z-index: 0;
    background-image: var(--auth-poster-bg);
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    filter: blur(72px) saturate(1.3) brightness(0.75);
    opacity: 0.95;
    transform: scale(1.22);
    pointer-events: none;
}

.auth-page__overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 100% 80% at 50% 10%, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0.88) 100%),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.7) 55%, #000 100%);
}

.auth-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 10, 12, 0.72);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    animation: auth-card-in .5s ease both;
    margin-block: auto;
}

.auth-poster {
    position: relative;
    overflow: hidden;
    background: #111;
    width: 100%;
    height: 180px;
    flex: 0 0 auto;
    order: -1;
}

.auth-poster__media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.auth-poster__fallback {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(145deg, #1c1710, #0b0b0c 55%),
        radial-gradient(circle at 70% 20%, rgba(240, 193, 75, 0.2), transparent 45%);
}

.auth-poster__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.2) 42%, transparent 65%);
    pointer-events: none;
}

.auth-poster__meta {
    position: absolute;
    right: .75rem;
    bottom: .7rem;
    left: .75rem;
    z-index: 2;
    text-align: right;
    animation: auth-meta-in .55s .1s ease both;
}

.auth-poster__title {
    display: block;
    margin: 0;
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-poster__title:hover {
    color: var(--auth-gold);
}

.auth-poster__sub {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: .3rem;
    margin-top: .2rem;
    font-size: .7rem;
    color: #d7d2c5;
}

.auth-poster__year {
    opacity: .9;
}

.auth-poster__dot {
    opacity: .55;
}

.auth-poster__director {
    color: #e8e2d4;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.auth-poster__director:hover {
    color: var(--auth-gold);
}

.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    padding: 1.15rem 1rem 1.35rem;
    background:
        radial-gradient(ellipse 80% 50% at 100% 0%, rgba(240, 193, 75, 0.07), transparent 55%),
        linear-gradient(180deg, rgba(18, 18, 20, 0.96) 0%, var(--auth-panel) 55%, rgba(10, 10, 11, 0.98) 100%);
}

.auth-panel__inner {
    width: 100%;
    max-width: 22.5rem;
    margin-inline: auto;
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    text-decoration: none;
    color: var(--auth-gold);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -.02em;
    margin-bottom: 1.15rem;
}

.auth-brand img {
    height: 30px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 .35rem;
}

.auth-lead {
    margin: 0 0 1.1rem;
    color: var(--auth-muted);
    font-size: .88rem;
    line-height: 1.65;
}

.auth-alert {
    border-radius: .65rem;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    font-size: .86rem;
}

.auth-alert--ok {
    background: rgba(46, 160, 67, 0.15);
    border: 1px solid rgba(46, 160, 67, 0.35);
    color: #b7f0c2;
}

.auth-alert--err {
    background: rgba(180, 50, 50, 0.15);
    border: 1px solid rgba(180, 50, 50, 0.35);
    color: #f0b7b7;
}

.auth-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .86rem;
    color: #d6d2c8;
}

.auth-input {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--auth-line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--auth-text);
    border-radius: .65rem;
    padding: .8rem .95rem;
    margin-bottom: .25rem;
    outline: none;
    font-size: 16px; /* prevents iOS zoom */
    line-height: 1.4;
    transition: border-color .2s, box-shadow .2s;
}

.auth-input:focus {
    border-color: rgba(240, 193, 75, 0.55);
    box-shadow: 0 0 0 3px rgba(240, 193, 75, 0.12);
}

.auth-field {
    margin-bottom: .85rem;
}

.auth-field .invalid-feedback {
    display: block;
    color: #f0a0a0;
    font-size: .8rem;
    margin-top: .3rem;
}

.auth-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .65rem .9rem;
    margin: .1rem 0 1rem;
    font-size: .84rem;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    color: var(--auth-muted);
    cursor: pointer;
    user-select: none;
}

.auth-link {
    color: var(--auth-gold);
    text-decoration: none;
}

.auth-link:hover {
    text-decoration: underline;
}

.auth-submit,
.auth-google {
    width: 100%;
    min-height: 46px;
    -webkit-tap-highlight-color: transparent;
}

.auth-submit {
    border: 0;
    border-radius: .7rem;
    background: var(--auth-gold);
    color: #111;
    font-weight: 700;
    padding: .85rem 1rem;
    font-size: .95rem;
    transition: transform .2s ease, filter .2s;
}

.auth-submit:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .75rem;
    margin: 1rem 0;
    color: var(--auth-muted);
    font-size: .8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    background: var(--auth-line);
}

.auth-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    border-radius: .7rem;
    border: 1px solid var(--auth-line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--auth-text);
    text-decoration: none;
    padding: .8rem 1rem;
    font-weight: 600;
    font-size: .92rem;
    transition: background .2s, border-color .2s, transform .2s;
}

.auth-google:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
    transform: translateY(-1px);
}

.auth-google svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.auth-foot {
    margin-top: 1.1rem;
    text-align: center;
    color: var(--auth-muted);
    font-size: .86rem;
}

@keyframes auth-card-in {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

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

/* Tablet+ : side-by-side card */
@media (min-width: 768px) {
    .auth-page {
        padding: clamp(1rem, 3vw, 2rem);
    }

    .auth-card {
        max-width: 920px;
        display: grid;
        grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
        flex-direction: unset;
    }

    .auth-poster {
        order: 0;
        height: auto;
        min-height: 100%;
        aspect-ratio: 2 / 3;
        align-self: stretch;
    }

    .auth-panel {
        padding: clamp(1.25rem, 3vw, 2.25rem);
    }

    .auth-brand {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }

    .auth-brand img {
        height: 34px;
    }

    .auth-title {
        font-size: clamp(1.35rem, 2vw, 1.7rem);
    }

    .auth-lead {
        font-size: .9rem;
        margin-bottom: 1.25rem;
    }

    .auth-poster__meta {
        right: .85rem;
        bottom: .85rem;
        left: auto;
        max-width: calc(100% - 1.4rem);
    }

    .auth-poster__title {
        font-size: .82rem;
        white-space: normal;
    }

    .auth-poster__sub {
        font-size: .72rem;
    }
}

@media (min-width: 768px) and (max-height: 760px) {
    .auth-poster {
        aspect-ratio: auto;
        max-height: min(72vh, 560px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .auth-poster__meta {
        animation: none !important;
    }
}
