/* =====================================================================
   Tela de login — somente apresentação.
   Mesma identidade das telas redesenhadas. Escopo .lg-page.
   ===================================================================== */

.lg-page {
    --white: #ffffff;
    --surface: #f5f8fc;
    --line: #e2e8f2;
    --line-strong: #c9d3e3;
    --ink: #0f2447;
    --ink-2: #34425e;
    --muted: #5b6b85;
    --faint: #7d8aa3;
    --blue: #1d4ed8;
    --blue-700: #1a3f9e;
    --blue-50: #eef3ff;
    --blue-100: #dbe6ff;
    --danger: #c62828;
    --danger-bg: #fdecec;
    --nav: #0d2146;
    --nav-ink: #c9d4ea;
    --brand-yellow: #f5b914;
    --lg-font: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;

    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    min-height: 100vh;
    width: 100%;
    font-family: var(--lg-font);
    font-size: 14px;
    line-height: 1.45;
    color: var(--ink);
    background: var(--white);
}

/* A página ocupa a tela toda: neutraliza o .container do _ExternalLayout */
html:has(.lg-page),
body:has(.lg-page) {
    height: 100%;
    margin: 0;
    background: #ffffff !important;
    overflow-x: hidden;
}

body:has(.lg-page) > .container {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
}

.lg-page *,
.lg-page *::before,
.lg-page *::after {
    box-sizing: border-box;
}

/* O tema global usa Poppins no body: nesta tela tudo usa Roboto */
.lg-page,
.lg-page h1,
.lg-page h2,
.lg-page p,
.lg-page label,
.lg-page small,
.lg-page b {
    font-family: var(--lg-font);
}

.lg-page button,
.lg-page input {
    font: inherit;
    color: inherit;
}

.lg-page .hidden {
    display: none !important;
}

.lg-page button:focus-visible,
.lg-page input:focus-visible,
.lg-page a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

/* ---------- Painel esquerdo ---------- */
.lg-page .lg-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 40px 48px;
    background: var(--nav);
    color: var(--white);
    overflow: hidden;
}

/* Foto de fundo (a mesma do login antigo: bandeira Gerdau + gasômetro), bem apagada.
   Camadas decorativas: sem texto alternativo. */
.lg-page .lg-panel::before,
.lg-page .lg-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.lg-page .lg-panel::before {
    background: url("../assets/images/BackgroundHome.jpg") center 40% / cover no-repeat;
    filter: grayscale(.35) saturate(.8);
    opacity: .9;
}

/* Máscara azul: mais escura embaixo, para o contraste do título branco */
.lg-page .lg-panel::after {
    background:
        linear-gradient(180deg, rgba(13, 33, 70, .86) 0%, rgba(13, 33, 70, .90) 45%, rgba(13, 33, 70, .96) 100%),
        rgba(29, 78, 216, .18);
}

.lg-page .lg-panel > * {
    position: relative;
    z-index: 1;
}

/* Logo: o mesmo asset do menu lateral (fundo transparente, para fundo marinho) */
.lg-page .lg-logo {
    display: block;
    height: 44px;
    width: auto;
    align-self: flex-start;
}

.lg-page .lg-mini {
    position: relative;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 14px;
    background: rgba(13, 33, 70, .55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.lg-page .lg-mini-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--nav-ink);
}

.lg-page .lg-mini-grid {
    position: relative;
    display: grid;
    grid-template-columns: 72px repeat(6, 1fr);
    row-gap: 8px;
    font-size: 11px;
    color: var(--nav-ink);
}

.lg-page .lg-mini-grid .h {
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    font-variant-numeric: tabular-nums;
}

.lg-page .lg-mini-grid .dk {
    display: flex;
    align-items: center;
    height: 28px;
    color: rgba(255, 255, 255, .72);
}

.lg-page .lg-mini-grid .lane {
    grid-column: 2 / -1;
    position: relative;
    height: 28px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, .07) 1px, transparent 1px);
    background-size: calc(100% / 6) 100%;
}

.lg-page .lg-mini-grid .blk {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 6px;
    background: #1f3f86;
}

.lg-page .lg-mini-grid .blk.b2 { background: #2a56b8; }
.lg-page .lg-mini-grid .blk.b3 { background: #dbe6ff; }
.lg-page .lg-mini-grid .blk.b4 {
    background: rgba(255, 255, 255, .1);
    border: 1px dashed rgba(255, 255, 255, .25);
}

.lg-page .lg-mini-grid .now {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    border-radius: 1px;
    background: var(--brand-yellow);
}

.lg-page .lg-mini-grid .now::before {
    content: "";
    position: absolute;
    top: -4px;
    left: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-yellow);
}

.lg-page .lg-claim h2 {
    max-width: 18ch;
    margin: 0 0 10px;
    font-family: var(--lg-font);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--white);
    text-wrap: balance;
}

.lg-page .lg-claim p {
    max-width: 44ch;
    margin: 0;
    font-size: 15px;
    color: var(--nav-ink);
}

/* ---------- Formulário ---------- */
.lg-page .lg-side {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 40px 24px;
    background: var(--white);
}

.lg-page .lg-box {
    display: grid;
    gap: 24px;
    width: 100%;
    max-width: 480px;
    min-width: 0;
}

.lg-page .lg-m-brand {
    display: none;
}

.lg-page .lg-title {
    margin: 0;
    font-family: var(--lg-font);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.2;
    color: var(--ink);
}

.lg-page .lg-lead {
    margin: 8px 0 0;
    font-size: 15px;
    color: var(--muted);
}

/* Seletor de perfil (os antigos #box1..#box5) */
.lg-page .lg-profiles {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.lg-page .lg-prof,
.lg-page .lg-prof.login-opt-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 80px;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0 2px;
    background: var(--white);
    /* site.css (.login-opt-box.inactive) remove bordas e aplica opacidade: neutraliza */
    border: 1px solid var(--line) !important;
    border-radius: 10px;
    box-shadow: none;
    opacity: 1 !important;
    font-family: var(--lg-font);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -.005em;
    white-space: nowrap;
    color: var(--ink-2);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background-color .15s, color .15s;
}

.lg-page .lg-prof span {
    max-width: 100%;
    white-space: nowrap;
}

.lg-page .lg-prof svg {
    width: 20px;
    height: 20px;
    flex: none;
    color: var(--muted);
}

.lg-page .lg-prof:hover {
    border-color: var(--line-strong) !important;
    color: var(--ink);
}

.lg-page .lg-prof.active,
.lg-page .lg-prof[aria-checked="true"] {
    background: var(--blue-50);
    border-color: var(--blue) !important;
    color: var(--blue-700);
    box-shadow: 0 0 0 1px var(--blue);
}

.lg-page .lg-prof.active svg,
.lg-page .lg-prof[aria-checked="true"] svg {
    color: var(--blue);
}

/* Formulário */
.lg-page .lg-form {
    display: grid;
    gap: 14px;
    margin: 0;
}

.lg-page .lg-form > .form-group {
    margin: 0;
}

.lg-page .lg-field {
    display: grid;
    gap: 6px;
}

.lg-page .lg-field label {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
}

.lg-page .lg-input,
.lg-page .form-control.lg-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: none;
    font-family: var(--lg-font);
    font-size: 15px;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.lg-page .lg-input::placeholder {
    color: var(--faint);
}

.lg-page .lg-input:hover {
    border-color: var(--line-strong);
}

.lg-page .lg-input:focus,
.lg-page .form-control.lg-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-50);
    outline: none;
}

.lg-page .lg-input[aria-invalid="true"] {
    border-color: var(--danger);
}

.lg-page .lg-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px var(--danger-bg);
}

.lg-page .lg-err {
    font-size: 12.5px;
    color: var(--danger);
}

.lg-page .lg-pw {
    position: relative;
}

.lg-page .lg-pw .lg-input {
    padding-right: 46px;
}

.lg-page .lg-eye {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 38px;
    height: 38px;
    padding: 0;
    display: grid;
    place-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
}

.lg-page .lg-eye:hover {
    background: var(--surface);
    color: var(--ink);
}

.lg-page .lg-eye svg {
    width: 18px;
    height: 18px;
}

.lg-page .lg-eye .lg-eye-off,
.lg-page .lg-eye[aria-pressed="true"] .lg-eye-on {
    display: none;
}

.lg-page .lg-eye[aria-pressed="true"] .lg-eye-off {
    display: block;
}

/* Botões */
.lg-page .lg-btn,
.lg-page .btn.lg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    margin: 0;
    padding: 0 16px;
    /* O tema global pinta .btn-primary de índigo (#556ee6): sobrescrito só nesta tela */
    background: var(--blue) !important;
    border: 1px solid var(--blue) !important;
    border-radius: 8px;
    box-shadow: none !important;
    font-family: var(--lg-font);
    font-size: 15px;
    font-weight: 500;
    color: var(--white) !important;
    cursor: pointer;
}

.lg-page .btn.lg-btn.hidden {
    display: none !important;
}

.lg-page .lg-btn:hover,
.lg-page .lg-btn:active,
.lg-page .btn.lg-btn:not(:disabled):not(.disabled):active {
    background: var(--blue-700) !important;
    border-color: var(--blue-700) !important;
    color: var(--white) !important;
    box-shadow: none !important;
}

.lg-page .lg-btn[disabled]:hover {
    background: var(--blue) !important;
}

.lg-page .lg-btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.lg-page .lg-btn[disabled] {
    opacity: .7;
    cursor: progress;
}

.lg-page .lg-btn svg {
    width: 18px;
    height: 18px;
}

.lg-page .lg-spin {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: var(--white);
    animation: lg-spin .8s linear infinite;
}

@keyframes lg-spin {
    to { transform: rotate(360deg); }
}

/* Perfil Gerdau */
.lg-page .lg-azure {
    display: grid;
    gap: 14px;
}

.lg-page .lg-hint {
    margin: 4px 0 0;
    font-size: 14px;
    color: var(--ink-2);
}

.lg-page .lg-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 2px 0;
    font-size: 12.5px;
    color: var(--faint);
}

.lg-page .lg-or::before,
.lg-page .lg-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.lg-page .lg-alt {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin: 0;
    padding: 14px 16px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-family: var(--lg-font);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.lg-page .lg-alt:hover {
    background: var(--blue-50);
    border-color: var(--blue-100);
}

.lg-page .lg-alt-ic {
    flex: none;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--blue-50);
    color: var(--blue);
}

.lg-page .lg-alt:hover .lg-alt-ic {
    background: var(--white);
}

.lg-page .lg-alt-ic svg {
    width: 19px;
    height: 19px;
}

.lg-page .lg-alt-t {
    flex: 1;
    min-width: 0;
}

.lg-page .lg-alt-t b {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
}

.lg-page .lg-alt-t small {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.lg-page .lg-chev {
    flex: none;
    color: var(--faint);
}

/* Alerta de erro da API */
.lg-page .lg-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--danger-bg);
    border-radius: 8px;
    font-size: 13px;
    color: var(--danger);
}

.lg-page .lg-alert svg {
    flex: none;
    width: 16px;
    height: 16px;
    margin-top: 1px;
}

/* Esqueci minha senha (links já existentes) */
.lg-page .lg-reset {
    text-align: center;
    font-size: 13px;
}

.lg-page .lg-reset a {
    color: var(--blue);
    font-weight: 500;
    text-decoration: none;
}

.lg-page .lg-reset a:hover {
    color: var(--blue-700);
    text-decoration: underline;
}

.lg-page .lg-help {
    margin: 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
    .lg-page {
        grid-template-columns: minmax(0, 1fr);
    }

    .lg-page .lg-panel {
        display: none;
    }

    /* O logo só existe para fundo escuro: bloco marinho, sem mudar as cores */
    .lg-page .lg-m-brand {
        display: inline-flex;
        justify-self: start;
        padding: 8px;
        border-radius: 10px;
        background: var(--nav);
    }

    .lg-page .lg-m-brand img {
        display: block;
        height: 38px;
        width: auto;
    }

    .lg-page .lg-side {
        align-items: flex-start;
        padding: 28px 24px;
    }
}

@media (max-width: 480px) {
    .lg-page .lg-profiles {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .lg-page .lg-title {
        font-size: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lg-page .lg-spin { animation-duration: 2s; }
    .lg-page * { transition: none !important; }
}
