/*
 * New login screens (resources/views/riho/auth/{login,qr-login}.blade.php and the shared _brand-panel partial).
 * Loaded only by those views, after riho.css. Self-contained: it defines its own tokens and every class is prefixed vg-.
 */

/* =====================================================================================
 * Element 3 - Login (resources/views/riho/auth/login.blade.php). Split screen: dark brand panel +
 * white form panel. Every class is prefixed vg- so nothing collides with Bootstrap/Riho. The panel
 * uses the sidebar logo (white letters) when configured, else the site title, and the configured
 * app.background image under a dark overlay when there is one.
 * ===================================================================================== */
.vg-auth {
    --vg-white: #FFFFFF;
    --vg-ink: #141414;
    --vg-coral: #D93111;
    --vg-coral-hover: #C22B0E;
    --vg-coral-ink: #9F240B;
    --vg-coral-tint: #FCE9E3;
    --vg-peach-ink: #8A3A12;
    --vg-muted: #6B625C;
    --vg-soft: #8E847D;
    --vg-line: #E9E1DA;
    --vg-line-2: #F0EAE4;
    --vg-line-strong: #CFC5BD;
    --vg-wash: #FAF6F2;
    --vg-ink-tint: #EFEAE5;
    --vg-ctl: 44px;
    --vg-r-ctl: 6px;
    --vg-r-pill: 4px;
    --vg-sb-bg: #23272E;
    --vg-sb-line: #343A43;
    --vg-sb-text: #B7BDC7;
    --vg-sb-muted: #8B93A0;

    display: grid;
    grid-template-columns: minmax(380px, 44%) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--vg-white);
    color: var(--vg-ink);
    font-size: 14px;
    line-height: 1.45;
}

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

.vg-auth [hidden] {
    display: none !important;
}

/* ---------- Brand panel ---------- */
.vg-auth-side {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 32px 40px 36px;
    overflow: hidden;
    isolation: isolate;
    background: var(--vg-sb-bg);
    color: #fff;
}

.vg-auth-side.has-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background: linear-gradient(rgba(35, 39, 46, .84), rgba(35, 39, 46, .84)), var(--vg-auth-bg) center / cover;
}

.vg-auth-side::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 255, 255, .025) 22px 23px);
}

.vg-auth-side :focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.vg-auth-brand {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    border-radius: var(--vg-r-ctl);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.01em;
    text-decoration: none;
}

.vg-auth-brand img {
    display: block;
    width: auto;
    max-width: 180px;
    max-height: 44px;
}

.vg-auth-pitch {
    max-width: 420px;
    margin: auto 0 0;
}

.vg-auth-pitch-title {
    margin: 0;
    color: #fff;
    font-size: 32px;
    font-weight: 500;
    letter-spacing: -.025em;
    line-height: 1.12;
}

.vg-auth-pitch-title span {
    color: var(--vg-sb-text);
    font-weight: 400;
}

.vg-auth-pitch p {
    max-width: 38ch;
    margin: 14px 0 0;
    color: var(--vg-sb-text);
}

.vg-auth-codes {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 40px;
}

/* Decorative tick strips (same motif as the dashboard KPI cards): --r is the filled share. */
.vg-auth-bars {
    --r: .5;
    height: 14px;
    border-radius: 1px;
    opacity: .9;
    background:
        linear-gradient(90deg, var(--vg-coral), #FF9A6B) 0 0 / calc(var(--r) * 100%) 100% no-repeat,
        #2E333B;
    -webkit-mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px);
    mask: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 5px);
}

.vg-auth-sidefoot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--vg-sb-line);
    color: var(--vg-sb-muted);
    font-size: 12px;
}

/* ---------- Form panel ---------- */
.vg-auth-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 28px 40px;
}

.vg-auth-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 0;
}

.vg-auth-card {
    width: 100%;
    max-width: 392px;
}

@media (prefers-reduced-motion: no-preference) {
    .vg-auth-card {
        animation: vg-auth-up .45s cubic-bezier(.2, .7, .2, 1) both;
    }
}

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

.vg-auth-card h1 {
    margin: 0;
    color: var(--vg-ink);
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -.02em;
    line-height: 1.15;
}

.vg-auth-lead {
    margin: 8px 0 28px;
    color: var(--vg-muted);
}

.vg-auth-foot {
    padding-top: 16px;
    color: var(--vg-muted);
    font-size: 12px;
    text-align: center;
}

.vg-auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 0;
}

.vg-fld {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.vg-fld > label {
    margin: 0;
    color: var(--vg-ink);
    font-size: 12.5px;
    font-weight: 500;
}

.vg-input,
.vg-ig {
    width: 100%;
    height: var(--vg-ctl);
    min-width: 0;
    border: 1px solid var(--vg-line);
    border-radius: var(--vg-r-ctl);
    background: var(--vg-white);
    transition: border-color .15s, box-shadow .15s;
}

.vg-input {
    padding: 0 12px;
    color: var(--vg-ink);
    font: inherit;
}

.vg-input::placeholder,
.vg-ig input::placeholder {
    color: var(--vg-soft);
}

.vg-input:hover,
.vg-ig:hover {
    border-color: var(--vg-line-strong);
}

.vg-input:focus,
.vg-ig:focus-within {
    border-color: var(--vg-ink);
    outline: 0;
    box-shadow: 0 0 0 3px var(--vg-ink-tint);
}

.vg-input[aria-invalid="true"],
.vg-ig.is-invalid {
    border-color: var(--vg-coral);
}

.vg-input[aria-invalid="true"]:focus,
.vg-ig.is-invalid:focus-within {
    box-shadow: 0 0 0 3px var(--vg-coral-tint);
}

.vg-ig {
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

.vg-ig input {
    width: 100%;
    min-width: 0;
    padding: 0 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--vg-ink);
    font: inherit;
}

.vg-eye {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--vg-line-2);
    background: none;
    color: var(--vg-muted);
    cursor: pointer;
}

.vg-eye:hover {
    background: var(--vg-wash);
    color: var(--vg-ink);
}

.vg-eye:focus-visible {
    outline: 2px solid var(--vg-coral) !important;
    outline-offset: -3px;
}

.vg-eye .bi {
    font-size: 16px;
}

.vg-msg {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 0;
    font-size: 12px;
}

.vg-msg .bi {
    margin-top: 1px;
}

.vg-msg-err {
    color: var(--vg-coral-ink);
}

.vg-msg-warn {
    color: var(--vg-peach-ink);
}

.vg-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    flex-wrap: wrap;
}

.vg-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    color: var(--vg-ink);
    font-size: 13px;
    cursor: pointer;
}

.vg-chk {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1px solid var(--vg-muted);
    border-radius: var(--vg-r-pill);
    background: var(--vg-white);
    cursor: pointer;
    appearance: none;
}

.vg-chk:hover {
    border-color: var(--vg-ink);
}

.vg-chk:checked {
    border-color: var(--vg-coral);
    background: var(--vg-coral) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.2l2.6 2.6L12 5.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.vg-chk:focus-visible {
    outline: 2px solid var(--vg-coral);
    outline-offset: 2px;
}

.vg-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    border-radius: var(--vg-r-pill);
    color: var(--vg-coral-ink);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.vg-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.vg-link:focus-visible {
    outline: 2px solid var(--vg-coral);
    outline-offset: 2px;
}

.vg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--vg-ctl);
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--vg-r-ctl);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.vg-btn .bi {
    font-size: 15px;
    line-height: 1;
}

/* riho.css removes the outline of buttons with !important, so the focus ring needs it too. */
.vg-btn:focus-visible {
    outline: 2px solid var(--vg-coral) !important;
    outline-offset: 2px;
}

.vg-btn-primary {
    background: var(--vg-coral);
    color: #fff;
}

.vg-btn-primary:hover {
    background: var(--vg-coral-hover);
    color: #fff;
}

.vg-btn-primary:active {
    box-shadow: inset 0 1px 2px rgba(20, 20, 20, .25);
}

.vg-btn-primary.is-loading,
.vg-btn-primary:disabled {
    opacity: 1;
    background: var(--vg-coral);
    cursor: progress;
}

.vg-btn-secondary {
    border-color: var(--vg-line);
    background: var(--vg-white);
    color: var(--vg-ink);
}

.vg-btn-secondary:hover {
    border-color: var(--vg-line-strong);
    background: var(--vg-wash);
    color: var(--vg-ink);
}

.vg-spin {
    display: inline-block;
    flex: none;
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
    .vg-spin {
        animation: vg-auth-rot .7s linear infinite;
    }
}

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

.vg-or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--vg-muted);
    font-size: 12px;
}

.vg-or::before,
.vg-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--vg-line);
}

.vg-auth-alert {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 10px;
    padding: 12px 14px;
    border: 1px solid #FFDCC8;
    border-radius: var(--vg-r-ctl);
    background: #FFF0E7;
    color: var(--vg-peach-ink);
    font-size: 13px;
}

.vg-auth-alert .bi {
    font-size: 16px;
    line-height: 1.3;
}

/* ---------- Login responsive ---------- */
@media (min-width: 1700px) {
    .vg-auth {
        grid-template-columns: minmax(380px, 40%) minmax(0, 1fr);
    }

    .vg-auth-pitch-title {
        font-size: 38px;
    }
}

@media (max-width: 1100px) {
    .vg-auth-side {
        padding: 28px 32px;
    }

    .vg-auth-pitch-title {
        font-size: 28px;
    }

    .vg-auth-main {
        padding: 24px 32px;
    }
}

@media (max-width: 900px) {
    .vg-auth {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .vg-auth-side {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 0;
        padding: 14px 16px 0;
    }

    .vg-auth-pitch,
    .vg-auth-sidefoot {
        display: none;
    }

    .vg-auth-codes {
        width: calc(100% + 32px);
        margin: 12px -16px 0;
        gap: 0;
    }

    .vg-auth-codes .vg-auth-bars:not(:first-child) {
        display: none;
    }

    .vg-auth-codes .vg-auth-bars {
        height: 6px;
    }

    .vg-auth-main {
        padding: 8px 16px 24px;
    }

    .vg-auth-center {
        align-items: flex-start;
        padding: 28px 0 16px;
    }

    .vg-auth-card h1 {
        font-size: 24px;
    }
}

/* ---------- QR field and helper text ---------- */
.vg-ig-icon {
    display: flex;
    align-items: center;
    padding-left: 12px;
    color: var(--vg-soft);
}

.vg-ig-icon + input {
    padding-left: 10px;
}

.vg-help {
    margin: 0;
    color: var(--vg-muted);
    font-size: 12px;
}

/* ---------- Entrance: the brand panel builds up in stages (the form card already rises) ---------- */
@keyframes vg-auth-in-left {
    from { opacity: 0; transform: translateX(-14px); }
    to { opacity: 1; transform: none; }
}

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

@keyframes vg-auth-reveal {
    from { opacity: 0; clip-path: inset(0 100% 0 0); }
    to { opacity: .9; clip-path: inset(0 0 0 0); }
}

@keyframes vg-auth-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
    .vg-auth-side::before {
        animation: vg-auth-fade 1.4s ease both;
    }

    .vg-auth-brand {
        animation: vg-auth-in-left .6s cubic-bezier(.2, .7, .2, 1) .05s both;
    }

    .vg-auth-pitch-title {
        animation: vg-auth-in-up .7s cubic-bezier(.2, .7, .2, 1) .18s both;
    }

    .vg-auth-pitch p {
        animation: vg-auth-in-up .7s cubic-bezier(.2, .7, .2, 1) .32s both;
    }

    .vg-auth-bars {
        animation: vg-auth-reveal .9s cubic-bezier(.2, .7, .2, 1) both;
    }

    .vg-auth-bars:nth-child(1) { animation-delay: .45s; }
    .vg-auth-bars:nth-child(2) { animation-delay: .6s; }
    .vg-auth-bars:nth-child(3) { animation-delay: .75s; }

    .vg-auth-sidefoot {
        animation: vg-auth-in-up .6s cubic-bezier(.2, .7, .2, 1) 1s both;
    }
}

/* A client that only configures the regular (dark) app.logo gets it on a white chip so it stays visible on the dark panel. */
.vg-auth-brand.is-chip {
    padding: 8px 12px;
    background: var(--vg-white);
}

/* Short windows (small laptops, split screens): tighten the form so it fits without scrolling when it can. */
@media (max-height: 700px) and (min-width: 901px) {
    .vg-auth-center {
        padding: 12px 0;
    }

    .vg-auth-lead {
        margin-bottom: 18px;
    }

    .vg-auth-form {
        gap: 12px;
    }

    .vg-auth-side {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .vg-auth-codes {
        margin-top: 24px;
    }
}
