/* ==========================================================
   VN Solution Branding — GLPI 11
   ========================================================== */

/* Fundo da tela de autenticação */
body.welcome-anonymous {
    min-height: 100vh !important;
    background:
        linear-gradient(
            rgba(1, 52, 83, 0.42),
            rgba(1, 52, 83, 0.42)
        ),
        url("/branding/fundo-login.png") center center / cover fixed no-repeat
        !important;
}

/* Remove os fundos claros colocados pelos containers do GLPI */
body.welcome-anonymous .page,
body.welcome-anonymous .page-wrapper,
body.welcome-anonymous .page-center {
    background: transparent !important;
}

/* Permite que o cartão tenha a largura personalizada */
body.welcome-anonymous .container-tight {
    max-width: 780px !important;
}

/* Substitui a logo padrão do GLPI */
body.welcome-anonymous .glpi-logo {
    display: block !important;
    width: 300px !important;
    height: 165px !important;
    margin: 0 auto 1.25rem !important;

    background-image: url("/branding/logo-login.png") !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
}

/* Cartão de login */
body.welcome-anonymous .main-content-card {
    width: 720px !important;
    max-width: 90vw !important;
    margin-left: auto !important;
    margin-right: auto !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.24) !important;
}

/* Espaçamento interno */
body.welcome-anonymous .main-content-card > .card-body {
    padding: 2.25rem 3rem !important;
}

/* Título */
body.welcome-anonymous .main-content-card h2 {
    font-size: 1.35rem !important;
    margin-bottom: 1.25rem !important;
}

/* Campos */
body.welcome-anonymous .main-content-card input[type="text"],
body.welcome-anonymous .main-content-card input[type="password"] {
    min-height: 44px !important;
    font-size: 1rem !important;
}

/* Botão */
body.welcome-anonymous .main-content-card .btn {
    min-height: 44px !important;
    font-weight: 600 !important;
}

/* Rodapé com melhor contraste sobre a imagem */
body.welcome-anonymous footer,
body.welcome-anonymous .copyright {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
}

body.welcome-anonymous footer a,
body.welcome-anonymous .copyright a {
    color: #ffffff !important;
}

/* Responsividade */
@media (max-width: 768px) {
    body.welcome-anonymous .container-tight {
        max-width: 96vw !important;
    }

    body.welcome-anonymous .main-content-card {
        width: 92vw !important;
        max-width: 92vw !important;
    }

    body.welcome-anonymous .main-content-card > .card-body {
        padding: 1.25rem !important;
    }

    body.welcome-anonymous .glpi-logo {
        width: 240px !important;
        height: 132px !important;
    }
}

/* ==========================================================
   Correções da logo e do rodapé
   ========================================================== */

/* Remove completamente a marca nativa do GLPI */
body.welcome-anonymous .glpi-logo {
    background:
        url("/branding/logo-login.png")
        center center / contain no-repeat
        !important;

    -webkit-mask: none !important;
    mask: none !important;

    color: transparent !important;
    font-size: 0 !important;
}

/* A logo nativa também pode ser desenhada em pseudo-elementos */
body.welcome-anonymous .glpi-logo::before,
body.welcome-anonymous .glpi-logo::after {
    content: none !important;
    display: none !important;
    background: none !important;
    -webkit-mask: none !important;
    mask: none !important;
}

/* Substitui o copyright padrão */
body.welcome-anonymous .copyright {
    font-size: 0 !important;
    color: #ffffff !important;
    text-align: center !important;
}

/* Oculta links e textos originais internos */
body.welcome-anonymous .copyright > * {
    display: none !important;
}

/* Rodapé personalizado */
body.welcome-anonymous .copyright::after {
    content: "VN Solution Tecnologia\A Powered by GLPI";
    display: block;
    white-space: pre-line;
    font-size: 14px;
    line-height: 1.5;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* Remove definitivamente o componente nativo do GLPI */
body.welcome-anonymous span.glpi-logo {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: none !important;
    background-image: none !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
}

/* Insere apenas a logo VN Solution no elemento pai */
body.welcome-anonymous .container-tight > .text-center .col-md::before {
    content: "";
    display: block;
    width: 300px;
    height: 165px;
    margin: 0 auto 1.25rem;

    background-image: url("/branding/logo-login.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

@media (max-width: 768px) {
    body.welcome-anonymous .container-tight > .text-center .col-md::before {
        width: 240px;
        height: 132px;
    }
}

/* Título customizado da tela de login */
body.welcome-anonymous .main-content-card h2 {
    font-size: 0 !important;
    line-height: 0 !important;
}

body.welcome-anonymous .main-content-card h2::after {
    content: "Entre com suas credenciais";
    display: block;
    font-size: 1.35rem;
    line-height: 1.3;
    font-weight: 700;
    color: #243b63;
}

/* ==========================================================
   Ajuste fino de largura e alinhamento
   ========================================================== */

/* Limita a largura de todo o conjunto */
body.welcome-anonymous .container-tight {
    max-width: 680px !important;
}

/* Cartão um pouco mais compacto */
body.welcome-anonymous .main-content-card {
    width: 620px !important;
    max-width: 90vw !important;
}

/* Reduz o espaço ocupado pela logo */
body.welcome-anonymous
.container-tight > .text-center .col-md::before {
    width: 300px !important;
    height: 100px !important;
    margin: 0 auto 1.5rem !important;
}

/* Centraliza melhor o conjunto na página */
body.welcome-anonymous
.page-anonymous > .flex-fill {
    margin-top: 0 !important;
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
}

/* Mantém boa aparência em telas menores */
@media (max-width: 768px) {
    body.welcome-anonymous .container-tight {
        max-width: 96vw !important;
    }

    body.welcome-anonymous .main-content-card {
        width: 92vw !important;
    }

    body.welcome-anonymous
    .container-tight > .text-center .col-md::before {
        width: 240px !important;
        height: 85px !important;
        margin-bottom: 1rem !important;
    }
}

/* Cartão estreito, baseado no recorte de referência */
body.welcome-anonymous .container-tight {
    max-width: 460px !important;
}

body.welcome-anonymous .main-content-card {
    width: 420px !important;
    max-width: 92vw !important;
}

/* Mantém um bom espaçamento interno */
body.welcome-anonymous .main-content-card > .card-body {
    padding: 2.5rem 3.5rem !important;
}

@media (max-width: 480px) {
    body.welcome-anonymous .container-tight {
        max-width: 100vw !important;
    }

    body.welcome-anonymous .main-content-card {
        width: 92vw !important;
    }

    body.welcome-anonymous .main-content-card > .card-body {
        padding: 2rem 2rem !important;
    }
}

/* ==========================================================
   Corrige largura interna do formulário no cartão estreito
   ========================================================== */

body.welcome-anonymous .main-content-card {
    width: 420px !important;
}

/* Menos padding lateral para sobrar espaço aos campos */
body.welcome-anonymous .main-content-card > .card-body {
    padding: 2.5rem 3rem !important;
}

/* Impede o formulário interno do GLPI de ficar comprimido */
body.welcome-anonymous .main-content-card form {
    width: 100% !important;
    max-width: 300px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Cabeçalho e campos ocupam toda a largura disponível */
body.welcome-anonymous .main-content-card form .card-header,
body.welcome-anonymous .main-content-card form .form-control,
body.welcome-anonymous .main-content-card form .btn {
    width: 100% !important;
    max-width: none !important;
}

/* Evita quebra no "Lembrar de mim" */
body.welcome-anonymous .main-content-card .form-check {
    white-space: nowrap !important;
}

/* Título volta a quebrar em no máximo duas linhas */
body.welcome-anonymous .main-content-card h2::after {
    display: block !important;
    width: 300px !important;
    max-width: 100% !important;
}

@media (max-width: 480px) {
    body.welcome-anonymous .main-content-card > .card-body {
        padding: 2rem 2.25rem !important;
    }

    body.welcome-anonymous .main-content-card form {
        max-width: 100% !important;
    }

    body.welcome-anonymous .main-content-card h2::after {
        width: 100% !important;
    }
}

/* ==========================================================
   Corrige grid interno do formulário
   ========================================================== */

body.welcome-anonymous .main-content-card > .card-body form {
    width: 100% !important;
    max-width: 300px !important;
    margin: 0 auto !important;
}

/* Remove a divisão em colunas usada pelo layout original */
body.welcome-anonymous .main-content-card form .row {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

body.welcome-anonymous .main-content-card form .row > [class*="col-"],
body.welcome-anonymous .main-content-card form [class*="col-md-"],
body.welcome-anonymous .main-content-card form [class*="col-lg-"] {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Cabeçalho e título contidos dentro do formulário */
body.welcome-anonymous .main-content-card form .card-header {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    text-align: center !important;
}

body.welcome-anonymous .main-content-card h2 {
    width: 100% !important;
    max-width: 100% !important;
    text-align: center !important;
    white-space: normal !important;
}

body.welcome-anonymous .main-content-card h2::after {
    width: auto !important;
    max-width: 100% !important;
    white-space: normal !important;
}

/* Campos e botão usando toda a largura */
body.welcome-anonymous .main-content-card .form-control,
body.welcome-anonymous .main-content-card .btn {
    width: 100% !important;
    max-width: 100% !important;
}

body.welcome-anonymous .main-content-card .form-check {
    width: 100% !important;
    white-space: nowrap !important;
}

/* Restaura o tamanho original da logo */
body.welcome-anonymous
.container-tight > .text-center .col-md::before {
    width: 300px !important;
    height: 165px !important;
    margin: 0 auto 1rem !important;
}

@media (max-width: 480px) {
    body.welcome-anonymous
    .container-tight > .text-center .col-md::before {
        width: 260px !important;
        height: 143px !important;
    }
}

/* ==========================================================
   Logo do painel lateral autenticado
   ========================================================== */

/* Área da marca no menu lateral aberto */
body:not(.welcome-anonymous) aside.sidebar .navbar-brand {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-height: 54px !important;
    padding: 5px 0 !important;
}

/* Substitui a marca padrão pela logo VN Solution */
body:not(.welcome-anonymous)
aside.sidebar .navbar-brand span.glpi-logo {
    display: block !important;
    width: 225px !important;
    max-width: calc(100% - 16px) !important;
    height: 45px !important;

    background:
        url("/branding/logo-interna.png")
        center center / contain no-repeat
        !important;

    -webkit-mask: none !important;
    mask: none !important;
    color: transparent !important;
    font-size: 0 !important;
}

/* Remove qualquer desenho nativo residual */
body:not(.welcome-anonymous)
aside.sidebar .navbar-brand span.glpi-logo::before,
body:not(.welcome-anonymous)
aside.sidebar .navbar-brand span.glpi-logo::after {
    content: none !important;
    display: none !important;
}

/* Menu recolhido: mantém a área, mas sem nenhuma logo */
body.navbar-collapsed
aside.sidebar .navbar-brand span.glpi-logo {
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Ajuste final da logo lateral */
body:not(.welcome-anonymous)
aside.sidebar .navbar-brand span.glpi-logo {
    width: 230px !important;
    height: 46px !important;
}

body:not(.welcome-anonymous)
aside.sidebar .navbar-brand {
    min-height: 56px !important;
}

/* Título do login conforme o idioma da sessão/navegador */
html[lang^="pt"] body.welcome-anonymous
.main-content-card h2::after {
    content: "Entre com suas credenciais" !important;
}

html[lang^="en"] body.welcome-anonymous
.main-content-card h2::after {
    content: "Sign in with your credentials" !important;
}
