/* Sign-in page. Built on the shared design system (static/css/blockgraf-ui.css):
   .bgf-input and .bgf-btn for the controls, --bgf-* tokens for everything else.
   Wide screens show the illustration beside the form; phones show the form only. */

.login-page {
    position: relative;
    margin: 0;
    min-height: 100vh;
    background: var(--bgf-bg);
    color: var(--bgf-text);
    font-family: var(--bgf-font);
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    min-height: 100vh;
}

.login-art {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.login-art img {
    width: 70%;
    height: 70%;
    object-fit: cover;
}

.login-panel {
    align-self: center;
    width: 100%;
    max-width: 34rem;
    padding: var(--bgf-space-6);
    box-sizing: border-box;
}

.login-logo {
    display: block;
    width: clamp(12rem, 60%, 16rem);
    height: auto;
    margin-bottom: var(--bgf-space-5);
}

.login-title {
    margin: 0 0 var(--bgf-space-2);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.login-lead {
    margin: 0 0 var(--bgf-space-5);
    color: var(--bgf-text-muted);
    font-size: var(--bgf-text-md);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--bgf-space-4);
}

.login-field label {
    display: block;
    margin-bottom: var(--bgf-space-2);
    color: var(--bgf-text);
    font-size: var(--bgf-text-sm);
    font-weight: 500;
}

.login-field .bgf-input {
    min-height: var(--bgf-control-h-touch);
}

.login-field .bgf-input[aria-invalid="true"] {
    border-color: var(--bgf-danger);
}

/* Password with a show/hide button inside the field */
.login-password {
    position: relative;
}

.login-password .bgf-input {
    padding-right: calc(var(--bgf-control-h-touch) + var(--bgf-space-1));
}

/* One reveal control only: Edge adds its own eye to password fields, outside
   the masking rules in login.js. */
.login-password .bgf-input::-ms-reveal,
.login-password .bgf-input::-ms-clear {
    display: none;
}

.login-password__toggle {
    position: absolute;
    top: 50%;
    right: var(--bgf-space-1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transform: translateY(-50%);
    color: var(--bgf-text-muted);
    background: transparent;
    border: 0;
    border-radius: var(--bgf-radius-sm);
    cursor: pointer;
}

.login-password__toggle:hover {
    color: var(--bgf-text);
    background: var(--bgf-surface);
}

.login-password__toggle:focus-visible {
    outline: var(--bgf-focus-ring);
    outline-offset: var(--bgf-focus-offset);
}

.login-caps {
    display: flex;
    align-items: center;
    gap: var(--bgf-space-2);
    margin: var(--bgf-space-2) 0 0;
    color: var(--bgf-warning);
    font-size: var(--bgf-text-sm);
}

.login-caps[hidden] {
    display: none;
}

.login-error {
    display: flex;
    align-items: center;
    gap: var(--bgf-space-2);
    margin: 0;
    padding: var(--bgf-space-3);
    background: var(--bgf-danger-soft);
    border: 1px solid var(--bgf-danger);
    border-radius: var(--bgf-radius-sm);
    color: var(--bgf-text);
    font-size: var(--bgf-text-sm);
}

.login-error i {
    color: var(--bgf-danger);
}

.login-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--bgf-space-3);
    margin-top: var(--bgf-space-2);
}

/* Top right corner: back to the landing */
.login-topbar {
    position: absolute;
    top: var(--bgf-space-4);
    right: var(--bgf-space-5);
    z-index: 1;
    display: flex;
    align-items: center;
    gap: var(--bgf-space-4);
}

.login-home {
    display: inline-flex;
    align-items: center;
    gap: var(--bgf-space-2);
    min-height: var(--bgf-control-h);
    padding: 0 var(--bgf-space-4) 0 var(--bgf-space-3);
    color: var(--bgf-text-muted);
    font-size: var(--bgf-text-sm);
    font-weight: 500;
    text-decoration: none;
    background: color-mix(in srgb, var(--bgf-surface-2) 60%, transparent);
    border: 1px solid var(--bgf-border);
    border-radius: 999px;
    backdrop-filter: blur(8px);
    transition: color var(--bgf-duration), background var(--bgf-duration), border-color var(--bgf-duration);
}

.login-home i {
    font-size: var(--bgf-text-xs);
    transition: transform var(--bgf-duration);
}

.login-home:hover {
    color: var(--bgf-text);
    background: var(--bgf-surface-2);
    border-color: var(--bgf-border-strong);
}

.login-home:hover i {
    transform: translateX(-3px);
}

.login-home:focus-visible {
    outline: var(--bgf-focus-ring);
    outline-offset: var(--bgf-focus-offset);
}

.login-btn {
    justify-content: center;
    min-height: var(--bgf-control-h-touch);
    text-decoration: none;
}

.login-btn.bgf-btn--secondary:hover {
    color: var(--bgf-text);
}

/* Narrow screens: the form alone, controls stacked */
@media (max-width: 991.98px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-art {
        display: none;
    }

    .login-panel {
        justify-self: center;
        padding: calc(var(--bgf-space-6) + var(--bgf-space-5)) var(--bgf-space-4) var(--bgf-space-5);
    }

    .login-topbar {
        right: var(--bgf-space-4);
    }
}

@media (max-width: 480px) {
    .login-actions {
        grid-template-columns: 1fr;
    }

    .login-title {
        font-size: 1.6rem;
    }
}
