/* ==========================================================================
   Tela de login — Engemat Conecta
   Folha autossuficiente: não depende de Bootstrap nem do material-dashboard.
   Só é carregada por app/Views/login.php.

   Cores, tipografia e tagline seguem o manual de marca:
   https://www.engematsistema.com.br/manual-de-marca/
   ========================================================================== */

:root {
    /* primárias */
    --amarelo: #FAB400;
    /* Amarelo Engemat */
    --amarelo-claro: #FFC634;
    --preto: #000000;
    --branco: #FFFFFF;

    /* secundárias */
    --ocre: #7A5C00;
    --chumbo: #1A1A1A;
    --terracota: #C44A1A;

    /* escala chumbo (quente) */
    --chumbo-950: #0F0D0C;
    --chumbo-900: #171412;
    --chumbo-800: #221E1A;
    --chumbo-100: #EDEAE6;

    /* apoio */
    --sucesso: #22C55E;
    --alerta: #F59E0B;
    --erro: #EF4444;

    /* texto */
    --ink: var(--branco);
    --ink-2: #CFC9C2;
    --ink-3: #918879;

    --glass: rgba(26, 26, 26, .74);
    --stroke: rgba(255, 255, 255, .10);
    --r: 12px;

    --fonte-marca: "Roboto Slab", Georgia, serif;
    --fonte-ui: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    color: var(--ink);
    background: var(--chumbo-950);
    font-family: var(--fonte-ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
}

/* O palco centraliza, mas cede espaço e rola quando a tela é baixa. */
.palco {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
}

/* ==========================================================================
   Fundo
   ========================================================================== */

.bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: var(--chumbo-950);
    overflow: hidden;
}

.bg svg {
    position: absolute;
    inset: -4%;
    width: 108%;
    height: 108%;
    animation: deriva 46s ease-in-out infinite alternate;
}

/* Deriva lenta da malha inteira: dá vida ao fundo sem competir com o cartão.
   A folga de 4% em .bg svg existe para nenhuma borda aparecer no percurso. */
@keyframes deriva {
    0% {
        transform: translate3d(-1.4%, -0.9%, 0) scale(1);
    }

    100% {
        transform: translate3d(1.4%, 0.9%, 0) scale(1.045);
    }
}

.bg .trilha {
    stroke: #453A2E;
    stroke-width: 1.4;
    fill: none;
}

.bg .malha {
    stroke: #5E5142;
    stroke-width: 1.2;
    fill: none;
    opacity: .95;
}

.bg .aneis {
    stroke: #3A3128;
    fill: none;
    opacity: .55;
}

.bg .n circle {
    fill: #8A7B67;
}

/* brilhos ambientes respirando fora de fase */
.bg .brilho {
    transform-origin: center;
}

.bg .b1 {
    animation: brilho 17s ease-in-out infinite;
}

.bg .b2 {
    animation: brilho 21s ease-in-out infinite 5s;
}

@keyframes brilho {

    0%,
    100% {
        opacity: .75;
    }

    50% {
        opacity: 1;
    }
}

/* nós em destaque */
.bg .hub {
    fill: var(--amarelo);
    opacity: .5;
}

.bg .h1 {
    animation: hub 3.6s ease-in-out infinite;
}

.bg .h2 {
    animation: hub 3.6s ease-in-out infinite .9s;
}

.bg .h3 {
    animation: hub 3.6s ease-in-out infinite 1.8s;
}

.bg .h4 {
    animation: hub 3.6s ease-in-out infinite 2.4s;
}

.bg .h5 {
    animation: hub 3.6s ease-in-out infinite 1.3s;
}

.bg .h6 {
    animation: hub 3.6s ease-in-out infinite 3s;
}

@keyframes hub {

    0%,
    100% {
        opacity: .2;
        r: 4;
    }

    50% {
        opacity: 1;
        r: 11;
    }
}

/* pulsos percorrendo a malha */
.bg .pulse {
    stroke-dasharray: 260 900;
    stroke-dashoffset: 1160;
    opacity: .95;
}

.bg .p1 {
    animation: flow 5s linear infinite;
}

.bg .p2 {
    animation: flow 6.2s linear infinite 1.2s;
}

.bg .p3 {
    animation: flow 7s linear infinite 2.4s;
}

.bg .p4 {
    animation: flow 5.6s linear infinite 3.4s;
}

.bg .p5 {
    animation: flow 8s linear infinite .6s;
}

.bg .p6 {
    animation: flow 6.6s linear infinite 4.2s;
}

@keyframes flow {
    to {
        stroke-dashoffset: 0;
    }
}

.veil {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(980px 560px at 50% 46%, rgba(10, 8, 7, .12), rgba(10, 8, 7, .66) 76%),
        linear-gradient(180deg, rgba(10, 8, 7, .42), rgba(10, 8, 7, .22) 42%, rgba(10, 8, 7, .68));
}

/* ==========================================================================
   Marca
   ========================================================================== */

.brand {
    text-align: center;
    /* Respiro do manual: margem equivalente à altura do "E" de ENGEMAT
       (~29px com o logo em 300px). */
    margin: 0 0 34px;
}

.brand img {
    width: 300px;
    /* mínimo digital do manual é 160px */
    min-width: 160px;
    max-width: 76vw;
    height: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 6px 22px rgba(0, 0, 0, .5));
}

/* Tagline do Engemat Conecta — não traduzir, abreviar nem reordenar.
   "Tecnologia que move sua frota" é a tagline da marca-mãe (Engemat Sistema),
   não a deste produto. */
.brand .tag {
    margin: 20px 0 0;
    font-family: var(--fonte-marca);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .01em;
    color: rgba(255, 255, 255, .82);
}

.brand .tag span {
    color: var(--amarelo);
}

/* ==========================================================================
   Cartão
   ========================================================================== */

.card {
    width: 100%;
    max-width: 404px;
    background: var(--glass);
    border: 1px solid var(--stroke);
    border-radius: 18px;
    padding: 30px 30px 26px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

.card h1 {
    font-family: var(--fonte-marca);
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 5px;
    text-align: center;
    letter-spacing: -.01em;
}

.card .lead {
    color: var(--ink-3);
    margin: 0 0 24px;
    text-align: center;
    font-size: 13.5px;
}

/* ---------- campos ---------- */

label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-2);
    margin-bottom: 7px;
}

.fg {
    margin-bottom: 16px;
}

.ip {
    position: relative;
    display: flex;
    align-items: center;
}

.ip .ic {
    position: absolute;
    left: 13px;
    color: var(--ink-3);
    line-height: 0;
    pointer-events: none;
}

.ip input {
    width: 100%;
    height: 46px;
    padding: 0 13px 0 40px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: var(--r);
    background: rgba(255, 255, 255, .06);
    font: inherit;
    font-size: 14.5px;
    color: var(--branco);
    outline: none;
    transition: border-color .12s, box-shadow .12s, background .12s;
}

#password {
    padding-right: 44px;
}

.ip input::placeholder {
    color: #7C7369;
}

.ip input:hover {
    background: rgba(255, 255, 255, .09);
}

.ip input:focus {
    border-color: var(--amarelo);
    box-shadow: 0 0 0 3px rgba(250, 180, 0, .18);
    background: rgba(255, 255, 255, .09);
}

.ip input:-webkit-autofill,
.ip input:-webkit-autofill:hover,
.ip input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--branco);
    -webkit-box-shadow: 0 0 0 40px #241F1B inset;
    caret-color: var(--branco);
}

.eye {
    position: absolute;
    right: 6px;
    border: 0;
    background: none;
    color: var(--ink-3);
    cursor: pointer;
    padding: 9px;
    border-radius: 8px;
    line-height: 0;
}

.eye:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--ink-2);
}

.eye:focus-visible {
    outline: 2px solid var(--amarelo);
    outline-offset: 1px;
}

.eye .olho-off {
    display: none;
}

.eye[aria-pressed="true"] .olho-on {
    display: none;
}

.eye[aria-pressed="true"] .olho-off {
    display: block;
}

.caps {
    display: none;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--alerta);
    margin: 8px 0 0;
}

.caps.on {
    display: flex;
}

/* ---------- botão ---------- */

.btn {
    width: 100%;
    height: 47px;
    margin-top: 6px;
    border: 0;
    border-radius: var(--r);
    background: var(--amarelo);
    color: var(--preto);
    font-family: var(--fonte-marca);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: background .12s;
}

.btn:hover {
    background: var(--amarelo-claro);
}

.btn:focus-visible {
    outline: 2px solid var(--amarelo-claro);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: .8;
    cursor: default;
}

.sp {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(0, 0, 0, .28);
    border-top-color: var(--preto);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn.load .sp {
    display: block;
}

/* ==========================================================================
   Retorno do servidor
   O bloco vem pronto de app/Views/alert_validation.php, com as classes do
   Bootstrap. Aqui essa marcação é reescrita para o tema escuro — o Bootstrap
   não é carregado nesta tela. Se aquele template mudar, mexer aqui também.
   ========================================================================== */

.retorno {
    margin-bottom: 18px;
}

.retorno .container-fluid {
    padding: 0;
}

.retorno .alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    background: rgba(239, 68, 68, .16);
    color: #FFCFCB;
    border: 1px solid rgba(239, 68, 68, .40);
    border-radius: var(--r);
    padding: 10px 12px;
    font-size: 13px;
    margin: 0 0 8px;
}

.retorno .alert:last-child {
    margin-bottom: 0;
}

.retorno .alert-success {
    background: rgba(34, 197, 94, .16);
    color: #C6F2D8;
    border-color: rgba(34, 197, 94, .40);
}

.retorno .alert-warning {
    background: rgba(245, 158, 11, .16);
    color: #FFE3B8;
    border-color: rgba(245, 158, 11, .40);
}

.retorno .alert-info,
.retorno .alert-primary {
    background: rgba(196, 74, 26, .16);
    color: #FDE4D8;
    border-color: rgba(196, 74, 26, .40);
}

/* A fonte de ícones do Material não existe aqui: o nome do ícone sairia como
   texto cru. Some com ele e desenha um marcador no lugar. */
.retorno .alert-icon {
    display: none;
}

.retorno .alert::before {
    content: "";
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    background: currentColor;
    opacity: .85;
    -webkit-mask: no-repeat center/16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
    mask: no-repeat center/16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
}

.retorno .alert-text {
    flex: 1 1 auto;
    min-width: 0;
}

.retorno .btn-close {
    flex: 0 0 auto;
    border: 0;
    background: none;
    color: inherit;
    opacity: .6;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 2px;
}

.retorno .btn-close:hover {
    opacity: 1;
}

/* ==========================================================================
   Selo de ambiente
   ========================================================================== */

.env {
    position: fixed;
    top: 18px;
    right: 20px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--fonte-marca);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    background: rgba(245, 158, 11, .18);
    color: var(--alerta);
    border: 1px solid rgba(245, 158, 11, .35);
    border-radius: 99px;
    padding: 5px 12px;
    backdrop-filter: blur(8px);
}

.env .p {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--alerta);
}

/* ==========================================================================
   Rodapé
   ========================================================================== */

.foot {
    margin-top: 24px;
    font-size: 11.5px;
    color: var(--ink-3);
    text-align: center;
}

.foot p {
    margin: 0;
}

.foot p+p {
    margin-top: 5px;
}

.foot a {
    color: var(--ink-2);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .12s, border-color .12s;
}

.foot a:hover,
.foot a:focus-visible {
    color: var(--amarelo);
    border-bottom-color: rgba(250, 180, 0, .5);
}

.foot .abe {
    font-family: var(--fonte-marca);
    letter-spacing: .1em;
    color: rgba(250, 180, 0, .85);
    font-weight: 600;
}

.foot .abe:hover,
.foot .abe:focus-visible {
    color: var(--amarelo-claro);
    border-bottom-color: rgba(255, 198, 52, .5);
}

.foot .eco {
    font-family: var(--fonte-marca);
    letter-spacing: .1em;
    text-transform: uppercase;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--ink-3);
}

/* ==========================================================================
   Telas estreitas
   ========================================================================== */

@media (max-width: 520px) {
    .brand img {
        width: 238px;
    }

    .brand {
        margin-bottom: 26px;
    }

    .brand .tag {
        font-size: 13px;
    }

    .card {
        padding: 26px 22px 22px;
    }

    .env {
        top: 12px;
        right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .bg svg,
    .bg .brilho,
    .bg .hub,
    .bg .pulse,
    .sp {
        animation: none;
    }
}
