/* ============================================================================
   ZakERP site - the Login dialog (company code -> that company's ERP).
   Behaviour in assets/js/login.js. Colours are the site's own tokens, so both
   themes come for free; site.css's reduced-motion rule stills every animation.
   ========================================================================== */

/* ---------------------------------------------------------- nav entry -- */
.nav-links a.nav-login {
    display: inline-flex; align-items: center; gap: .42rem;
    margin-left: .35rem; color: var(--ink);
    border: 1px solid var(--border-strong);
}
.nav-links a.nav-login i { color: var(--brand-light); transition: transform .25s var(--ease); }
:root[data-theme="light"] .nav-links a.nav-login i { color: var(--brand-dark); }
.nav-links a.nav-login:hover { border-color: var(--brand); }
.nav-links a.nav-login:hover i { transform: translateX(2px); }
@media (max-width: 1180px) {
    .nav-links a.nav-login { margin: .4rem 0 0; justify-content: flex-start; }
}
/* A sixth item made "Why ZakERP" and "User Manual" break onto two lines on
   laptop-width screens, just above where the bar turns into the drawer. Keep
   every label on one line and give back the width there instead. */
.nav-links a { white-space: nowrap; }
/* The page is never wider than 1180px of content, so this holds at any screen
   width above the drawer, not only on laptops. */
@media (min-width: 1181px) {
    .nav-links a { padding-inline: .56rem; font-size: .9rem; }
    .nav-links a.nav-login i { display: none; }
}

/* ------------------------------------------------------------- overlay -- */
.lg-overlay {
    position: fixed; inset: 0; z-index: 1000;
    display: grid; place-items: center; padding: 1.2rem;
    background: rgba(6, 5, 14, .74);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    opacity: 0; pointer-events: none; transition: opacity .3s var(--ease);
}
.lg-overlay.open { opacity: 1; pointer-events: auto; }
.lg-overlay[hidden] { display: none; }

/* -------------------------------------------------------------- dialog -- */
.lg {
    position: relative; overflow: hidden; isolation: isolate;
    width: min(100%, 430px);
    padding: 2.4rem 2rem 1.6rem; text-align: center;
    background: var(--surface-solid); border: 1px solid var(--border-strong);
    border-radius: var(--r-xl); box-shadow: var(--shadow-lg), 0 0 0 1px rgba(108, 99, 255, .08);
    transform: translateY(26px) scale(.94); opacity: 0;
    transition: transform .55s cubic-bezier(.34, 1.56, .64, 1), opacity .3s var(--ease);
}
:root[data-theme="light"] .lg { background: #fff; }
.lg-overlay.open .lg { transform: none; opacity: 1; }

/* drifting colour behind the glass */
.lg-orb {
    position: absolute; z-index: -1; border-radius: 50%; filter: blur(46px); opacity: .55;
    pointer-events: none;
}
.lg-orb-1 { width: 220px; height: 220px; background: #6c63ff; top: -110px; left: -70px; animation: lgDrift 9s ease-in-out infinite alternate; }
.lg-orb-2 { width: 200px; height: 200px; background: #a855f7; bottom: -120px; right: -60px; animation: lgDrift 11s ease-in-out infinite alternate-reverse; }
:root[data-theme="light"] .lg-orb { opacity: .18; }
@keyframes lgDrift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(40px, 24px) scale(1.15); }
}

.lg-close {
    position: absolute; top: .9rem; right: .9rem;
    width: 34px; height: 34px; border-radius: var(--r-sm);
    display: grid; place-items: center; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2);
    transition: color .2s, border-color .2s, transform .3s var(--ease);
}
.lg-close:hover { color: var(--ink); border-color: var(--border-strong); transform: rotate(90deg); }

/* --------------------------------------------------- the animated badge -- */
.lg-badge {
    position: relative; width: 84px; height: 84px; margin: 0 auto 1.2rem;
    display: grid; place-items: center;
}
.lg-ring {
    position: absolute; inset: 0; border-radius: 50%;
    background: conic-gradient(from 0deg, #6c63ff, #a855f7, #4facfe, #6c63ff);
    animation: lgSpin 3.2s linear infinite;
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}
.lg-core {
    width: 66px; height: 66px; border-radius: 50%;
    display: grid; place-items: center; font-size: 1.7rem; color: #fff;
    background: var(--grad-brand); box-shadow: var(--glow);
    transform: scale(.4); opacity: 0;
    transition: background .4s var(--ease), box-shadow .4s var(--ease);
}
.lg-overlay.open .lg-core { animation: lgPop .6s .12s cubic-bezier(.34, 1.56, .64, 1) forwards; }
@keyframes lgSpin { to { transform: rotate(360deg); } }
@keyframes lgPop  { to { transform: scale(1); opacity: 1; } }

/* ---------------------------------------------------------------- text -- */
.lg h2 { font-size: 1.55rem; margin: 0 0 .45rem; }
.lg-lead { font-size: .93rem; margin: 0 auto 1.5rem; max-width: 22rem; line-height: 1.6; }

/* staggered entrance for everything under the badge */
.lg h2, .lg-lead, .lg-form, .lg-help { opacity: 0; transform: translateY(10px); }
.lg-overlay.open .lg h2     { animation: lgRise .5s .18s var(--ease) forwards; }
.lg-overlay.open .lg-lead   { animation: lgRise .5s .24s var(--ease) forwards; }
.lg-overlay.open .lg-form   { animation: lgRise .5s .30s var(--ease) forwards; }
.lg-overlay.open .lg-help   { animation: lgRise .5s .36s var(--ease) forwards; }
@keyframes lgRise { to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- form -- */
.lg-form { text-align: left; }
.lg-label { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: .4rem; }

.lg-field { position: relative; }
.lg-field > i {
    position: absolute; left: .95rem; top: 50%; transform: translateY(-50%);
    color: var(--ink-3); font-size: 1.05rem; pointer-events: none; transition: color .2s;
}
.lg-input {
    width: 100%; padding: .9rem 1rem .9rem 2.7rem; border-radius: var(--r);
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
    font-size: 1.05rem; font-weight: 600; letter-spacing: .04em;
    transition: border-color .2s, box-shadow .25s, background .2s;
}
:root[data-theme="light"] .lg-input { background: var(--bg-2); }
.lg-input::placeholder { color: var(--ink-3); font-weight: 400; letter-spacing: 0; }
.lg-input:focus {
    outline: none; border-color: var(--brand); background: var(--surface-2);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent);
}
.lg-field:focus-within > i { color: var(--brand-light); }

/* remember checkbox */
.lg-check {
    display: flex; align-items: center; gap: .55rem; margin-top: .85rem;
    font-size: .85rem; color: var(--ink-2); cursor: pointer; user-select: none;
}
.lg-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lg-box {
    width: 18px; height: 18px; flex-shrink: 0; border-radius: 5px;
    display: grid; place-items: center; font-size: .95rem; color: #fff;
    border: 1px solid var(--border-strong); background: var(--surface);
    transition: background .2s, border-color .2s;
}
.lg-box i { transform: scale(0); transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.lg-check input:checked + .lg-box { background: var(--brand); border-color: var(--brand); }
.lg-check input:checked + .lg-box i { transform: scale(1); }
.lg-check input:focus-visible + .lg-box { outline: 2px solid var(--brand-light); outline-offset: 2px; }

/* message line */
.lg-msg {
    min-height: 1.35rem; margin: .7rem 0 .2rem;
    display: flex; align-items: center; gap: .4rem;
    font-size: .85rem; font-weight: 600; line-height: 1.4;
}
.lg-msg:empty { visibility: hidden; }
.is-error .lg-msg { color: var(--rose); }
.is-done  .lg-msg { color: var(--mint); }
:root[data-theme="light"] .is-done .lg-msg { color: #16a34a; }

/* submit */
.lg-go { position: relative; width: 100%; margin-top: .4rem; padding-block: .95rem; }
.lg-go-arrow { transition: transform .25s var(--ease); }
.lg-go:hover .lg-go-arrow { transform: translateX(4px); }
.lg-go[disabled] { cursor: default; }
.lg-spin {
    display: none; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
    animation: lgSpin .7s linear infinite;
}
.is-busy .lg-go-arrow { display: none; }
.is-busy .lg-spin { display: inline-block; }

/* redirect progress */
.lg-bar { height: 3px; margin-top: .9rem; border-radius: 3px; overflow: hidden; background: transparent; }
.lg-bar span { display: block; height: 100%; width: 0; background: var(--grad-mint); border-radius: inherit; }
.is-done .lg-bar { background: var(--surface-2); }
.is-done .lg-bar span { animation: lgFill 1.05s var(--ease) forwards; }
@keyframes lgFill { to { width: 100%; } }

.lg-help {
    margin: 1.1rem 0 0; font-size: .8rem; color: var(--ink-3);
    display: flex; align-items: center; justify-content: center; gap: .4rem;
}

/* ------------------------------------------------------------- states -- */
.is-error .lg-input { border-color: var(--rose); box-shadow: 0 0 0 4px color-mix(in srgb, var(--rose) 18%, transparent); }
.is-error .lg-field { animation: lgShake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes lgShake {
    15%, 85% { transform: translateX(-2px); }
    30%, 70% { transform: translateX(5px); }
    45%, 55% { transform: translateX(-7px); }
}

.is-done .lg-core { background: var(--grad-mint); box-shadow: 0 14px 44px rgba(67, 233, 123, .42); }
.is-done .lg-core i { animation: lgPop .5s cubic-bezier(.34, 1.56, .64, 1) both; }
.is-done .lg-ring { animation-duration: .9s; }

/* --------------------------------------------------------------- phone -- */
@media (max-width: 560px) {
    .lg-overlay { padding: 0; align-items: end; }
    .lg {
        width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0;
        padding: 2.2rem 1.25rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
        transform: translateY(100%);
        transition: transform .45s var(--ease), opacity .3s var(--ease);
    }
}
