/* Skenora — auth (prijava/2FA) vizuelni identitet.
   Pastelni gradijenti + "scan" motiv (skener prelazi preko papira). Sistemski font zbog CSP font-src 'self'. */

:root {
    --ink: #1e2748;
    --muted: #6b7391;
    --indigo: #6366f1;
    --violet: #8b5cf6;
    --sky: #38bdf8;
    --lav: #eceeff;
    --line: #e7e9f5;
    --card: rgba(255, 255, 255, 0.74);
    --ring: rgba(99, 102, 241, 0.28);
    --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

.auth-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--ink);
    background: #f4f5ff;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ---- Pastelni gradijentni fon: mesh radijala + spori drift ---- */
.auth-bg {
    position: fixed;
    inset: -25%;
    z-index: -2;
    background:
        radial-gradient(38% 44% at 18% 22%, #e6e9ff 0%, rgba(230, 233, 255, 0) 60%),
        radial-gradient(34% 40% at 82% 18%, #d9f5ec 0%, rgba(217, 245, 236, 0) 62%),
        radial-gradient(42% 46% at 78% 82%, #ffe8e0 0%, rgba(255, 232, 224, 0) 60%),
        radial-gradient(40% 44% at 22% 84%, #ece0ff 0%, rgba(236, 224, 255, 0) 62%),
        linear-gradient(120deg, #f3f4ff 0%, #eefbf6 50%, #fff2ec 100%);
    animation: auth-drift 26s ease-in-out infinite alternate;
}

.auth-bg::after { /* fina zrnasta tekstura da gradijent ne bude "plastičan" */
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(99, 102, 241, 0.05) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: .5;
}

@keyframes auth-drift {
    from { transform: translate3d(-2.5%, -1.5%, 0) scale(1.02); }
    to   { transform: translate3d(2.5%, 2%, 0) scale(1.06); }
}

/* ---- Raspored: split brand | kartica ---- */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.02fr 0.98fr;
}

/* ===================== BRAND PANEL ===================== */
.auth-brand {
    position: relative;
    overflow: hidden;
    padding: 3.4rem 3.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background: linear-gradient(150deg, #7c83ff 0%, #9a7cff 45%, #6ea8ff 100%);
    margin: 1.1rem 0 1.1rem 1.1rem;
    border-radius: 28px;
    box-shadow: 0 30px 70px -30px rgba(99, 102, 241, 0.55);
}

.auth-brand::before { /* meki svijetli oreol u uglu */
    content: "";
    position: absolute;
    width: 460px; height: 460px;
    top: -160px; right: -120px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 68%);
    pointer-events: none;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    font-weight: 800;
    font-size: 1.32rem;
    letter-spacing: -0.02em;
}

.auth-logo-tile {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
    font-size: 1.35rem;
}

.auth-brand-copy { max-width: 26rem; }

.auth-eyebrow {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 1rem;
}

.auth-headline {
    font-size: clamp(1.9rem, 2.6vw, 2.6rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 .9rem;
}
.auth-headline em { font-style: normal; color: #eafff6; }

.auth-sub {
    font-size: 1.02rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.auth-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: 1.6rem;
}
.auth-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .82rem;
    font-weight: 600;
    padding: .42rem .8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(6px);
}

/* ---- "Scan" signature: skener prelazi preko papira ---- */
.auth-scan {
    position: relative;
    align-self: center;
    width: 210px;
    height: 258px;
    border-radius: 18px;
    background: #fdfdff;
    box-shadow: 0 24px 55px -22px rgba(30, 27, 75, 0.5);
    padding: 26px 22px;
    overflow: hidden;
}
.auth-scan-line-row {
    height: 11px;
    border-radius: 6px;
    background: #e9ebf7;
    margin-bottom: 13px;
}
.auth-scan-line-row.short { width: 55%; }
.auth-scan-line-row.mid { width: 78%; }
.auth-scan-beam {
    position: absolute;
    left: 0; right: 0;
    height: 40px;
    top: -40px;
    background: linear-gradient(180deg, rgba(56, 189, 248, 0) 0%, rgba(56, 189, 248, 0.28) 55%, rgba(99, 102, 241, 0.14) 100%);
    border-bottom: 2px solid #5ed0ff;
    box-shadow: 0 0 22px 4px rgba(94, 208, 255, 0.55);
    animation: auth-scan 3.6s cubic-bezier(.66, 0, .34, 1) infinite;
}
@keyframes auth-scan {
    0% { top: -40px; opacity: 0; }
    12% { opacity: 1; }
    88% { opacity: 1; }
    100% { top: 258px; opacity: 0; }
}

/* ===================== KARTICA ===================== */
.auth-card-wrap {
    display: grid;
    place-items: center;
    padding: 2rem 1.5rem;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    box-shadow: 0 30px 60px -28px rgba(50, 50, 120, 0.32);
    padding: 2.6rem 2.4rem;
}

.auth-card-head { margin-bottom: 1.7rem; }
.auth-card-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin: 0 0 .3rem;
}
.auth-card-note {
    font-size: .92rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.45;
}

/* mobilni brend header (skriven na desktopu) */
.auth-mini-brand { display: none; }

/* ---- polja ---- */
.auth-field { margin-bottom: 1.15rem; }
.auth-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: #46507a;
    margin-bottom: .4rem;
}
.auth-input-wrap { position: relative; }
.auth-input-wrap > .bi {
    position: absolute;
    left: 15px; top: 50%;
    transform: translateY(-50%);
    color: #9aa1c4;
    font-size: 1rem;
    pointer-events: none;
    transition: color .18s ease;
}
.auth-input {
    width: 100%;
    height: 52px;
    padding: 0 16px 0 44px;
    font-size: .96rem;
    color: var(--ink);
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.auth-input::placeholder { color: #b6bcd8; }
.auth-input:focus {
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px var(--ring);
}
.auth-input-wrap:focus-within > .bi { color: var(--indigo); }

/* ---- red: zapamti me + link ---- */
.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -.15rem 0 1.4rem;
}
.auth-check {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
    color: #46507a;
    cursor: pointer;
    user-select: none;
}
.auth-check input {
    width: 18px; height: 18px;
    accent-color: var(--indigo);
    cursor: pointer;
}
.auth-link {
    font-size: .86rem;
    font-weight: 600;
    color: var(--indigo);
    text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }

/* ---- dugme ---- */
.auth-btn {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: linear-gradient(120deg, #6366f1 0%, #8b5cf6 55%, #7aa8ff 100%);
    background-size: 160% 160%;
    box-shadow: 0 14px 26px -10px rgba(99, 102, 241, 0.65);
    transition: transform .16s ease, box-shadow .16s ease, background-position .4s ease;
}
.auth-btn:hover {
    transform: translateY(-2px);
    background-position: 100% 0;
    box-shadow: 0 20px 34px -12px rgba(99, 102, 241, 0.7);
}
.auth-btn:active { transform: translateY(0); }
.auth-btn .bi { font-size: 1.05rem; }

/* ---- validacija / greške ---- */
.auth-alert {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    border-radius: 14px;
    padding: .8rem 1rem;
    font-size: .88rem;
    line-height: 1.4;
    margin-bottom: 1.3rem;
}
.auth-alert .bi { margin-top: 1px; }
.auth-alert ul { margin: 0; padding-left: 1rem; }
.auth-field-error {
    display: block;
    color: #e11d48;
    font-size: .8rem;
    margin-top: .35rem;
}

.auth-info {
    background: #eef2ff;
    border: 1px solid #d7dcff;
    color: #4338ca;
    border-radius: 14px;
    padding: .8rem 1rem;
    font-size: .88rem;
    line-height: 1.45;
    margin-bottom: 1.3rem;
}

.auth-help {
    text-align: center;
    font-size: .86rem;
    color: var(--muted);
    margin: 1.5rem 0 0;
}
.auth-help a { color: var(--indigo); font-weight: 600; text-decoration: none; }
.auth-help a:hover { text-decoration: underline; }

/* ---- 2FA: kod, QR, kodovi za oporavak ---- */
.auth-code-input {
    width: 100%;
    height: 60px;
    text-align: center;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: .45em;
    text-indent: .45em;
    color: var(--ink);
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.auth-code-input:focus { border-color: var(--indigo); box-shadow: 0 0 0 4px var(--ring); }

.auth-qr {
    display: inline-block;
    padding: 12px;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 12px 26px -16px rgba(50, 50, 120, 0.3);
}
.auth-qr img { display: block; width: 200px; height: 200px; }

.auth-key {
    display: inline-block;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: .95rem;
    letter-spacing: .04em;
    color: #4338ca;
    background: #eef2ff;
    border: 1px solid #d7dcff;
    border-radius: 10px;
    padding: .35rem .7rem;
    user-select: all;
    word-break: break-all;
}

.auth-steps {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 0 0 1.4rem;
}
.auth-steps li {
    counter-increment: step;
    position: relative;
    padding: 0 0 1rem 2.4rem;
    font-size: .92rem;
    color: #46507a;
    line-height: 1.5;
}
.auth-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0; top: -2px;
    width: 26px; height: 26px;
    display: grid; place-items: center;
    font-size: .8rem; font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 8px;
}

.auth-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    margin: 1rem 0 1.4rem;
}
.auth-code-cell {
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-align: center;
    color: #3730a3;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: 10px;
    padding: .5rem 0;
    user-select: all;
}

.auth-success {
    display: flex; gap: .6rem; align-items: flex-start;
    background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857;
    border-radius: 14px; padding: .8rem 1rem;
    font-size: .9rem; line-height: 1.45; margin-bottom: 1rem;
}
.auth-warn {
    display: flex; gap: .6rem; align-items: flex-start;
    background: #fffbeb; border: 1px solid #fde68a; color: #b45309;
    border-radius: 14px; padding: .8rem 1rem;
    font-size: .9rem; line-height: 1.45; margin-bottom: 1.3rem;
}
.auth-success .bi, .auth-warn .bi { margin-top: 1px; font-size: 1rem; }

.auth-footnote {
    text-align: center;
    font-size: .78rem;
    color: #98a0c2;
    margin-top: 1.6rem;
}

/* ---- ulazna animacija (stagger) ---- */
.auth-rise { opacity: 0; transform: translateY(14px); animation: auth-rise .6s cubic-bezier(.22, 1, .36, 1) forwards; }
.auth-rise.d1 { animation-delay: .06s; }
.auth-rise.d2 { animation-delay: .14s; }
.auth-rise.d3 { animation-delay: .22s; }
.auth-rise.d4 { animation-delay: .3s; }
.auth-rise.d5 { animation-delay: .38s; }
@keyframes auth-rise { to { opacity: 1; transform: none; } }

/* ---- responsivno ---- */
@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-mini-brand {
        display: inline-flex;
        align-items: center;
        gap: .6rem;
        font-weight: 800;
        font-size: 1.15rem;
        letter-spacing: -0.02em;
        color: var(--ink);
        margin-bottom: 1.5rem;
        justify-content: center;
    }
    .auth-mini-brand .auth-logo-tile {
        background: linear-gradient(135deg, #6366f1, #8b5cf6);
        color: #fff;
        border: none;
    }
    .auth-card-wrap { padding: 2.5rem 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-bg, .auth-scan-beam, .auth-rise { animation: none !important; }
    .auth-rise { opacity: 1; transform: none; }
    .auth-scan-beam { display: none; }
}
