/* =====================================================================
   InnTag — tela de login.

   Auto-suficiente: não depende de app.css nem dos temas (theme-*.css),
   só deste arquivo, de js/login.js e das fotos em img/login/. As fontes
   são as do sistema — a CSP (SecurityHeadersFilter) bloqueia fonte
   externa (font-src 'self').

   O tema é aplicado por js/login.js em <html data-theme="dark">, na
   mesma chave de localStorage usada pelo restante da aplicação
   ("inntag-theme"), então a escolha feita aqui já vale no shell.
   ===================================================================== */

:root {
    --color-bg: #f2f2f3;
    --color-surface: #e9e9ea;
    --color-text: #1d1f20;
    --color-accent: #12345b;
    --color-accent-600: #1b4677;
    --color-accent-700: #0b2340;
    --color-divider: rgba(29, 31, 32, 0.16);
    --color-error: #b4472f;
    --font-heading: "Segoe UI", Arial, sans-serif;
    --font-body: "Segoe UI", Arial, sans-serif;
}

/* Tema escuro: [data-theme] cobre a escolha do usuário; o @media cobre o
   primeiro paint, antes de o script rodar. */
[data-theme="dark"] {
    --color-bg: #12161a;
    --color-surface: #1a2026;
    --color-text: #e6ebf0;
    --color-accent: #94bce3;
    --color-accent-600: #7ba7d2;
    --color-accent-700: #b5d9fd;
    --color-divider: rgba(230, 235, 240, 0.20);
    --color-error: #ff8f78;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --color-bg: #12161a;
        --color-surface: #1a2026;
        --color-text: #e6ebf0;
        --color-accent: #94bce3;
        --color-accent-600: #7ba7d2;
        --color-accent-700: #b5d9fd;
        --color-divider: rgba(230, 235, 240, 0.20);
        --color-error: #ff8f78;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }

body.login-page {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    background: var(--color-bg);
    color: var(--color-text);
    transition: background 240ms linear, color 240ms linear;
}

.login-page h1 { font-family: var(--font-heading); font-weight: 600; line-height: 1.12; margin: 0; }
.login-page :focus { outline: none; }
.login-page :focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.login-page ::selection { background: rgba(89, 128, 166, 0.30); }

/* ── layout ─────────────────────────────────────────────────────────── */
.login { display: flex; align-items: stretch; min-height: 100vh; width: 100%; }

/* ── painel de fotos ────────────────────────────────────────────────── */
.visual { position: relative; flex: 1 1 0; min-width: 0; overflow: hidden; background: #101a24; isolation: isolate; }
.slide { position: absolute; inset: 0; opacity: 0; animation: fade 21s linear infinite; }
.slide > .frame {
    position: absolute; inset: 0; overflow: hidden;
    background-size: cover; background-position: center;
    animation: zoomA 21s linear infinite;
}
/* Duotone: a foto é lavada no acento, como no resto do sistema. */
.slide > .frame::after {
    content: ""; position: absolute; inset: 0; background: var(--color-accent); mix-blend-mode: color;
}
.slide-1 > .frame { background-image: url("../img/login/termoeletrica.jpg"); }
.slide-2 > .frame { background-image: url("../img/login/refinaria.jpg"); }
.slide-3 > .frame { background-image: url("../img/login/siderurgica.jpg"); }
/* Ciclo de 21s dividido entre as 3 cenas (7s cada); o zoom alterna o sentido. */
.slide:nth-child(1), .slide:nth-child(1) > .frame { animation-delay: -1s; }
.slide:nth-child(2), .slide:nth-child(2) > .frame { animation-delay: 6s; }
.slide:nth-child(3), .slide:nth-child(3) > .frame { animation-delay: 13s; }
.slide:nth-child(2) > .frame { animation-name: zoomB; }

.scrim {
    position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(180deg, rgba(9, 14, 19, .72) 0%, rgba(9, 14, 19, .18) 34%,
                                        rgba(9, 14, 19, .30) 62%, rgba(9, 14, 19, .88) 100%);
}
.grid-overlay {
    position: absolute; inset: 0; pointer-events: none; opacity: .20;
    background-image: linear-gradient(to right, rgba(233, 240, 246, .55) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(233, 240, 246, .55) 1px, transparent 1px);
    background-size: 96px 96px;
}
.sweep {
    position: absolute; left: 0; right: 0; top: 0; height: 8%; pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(148, 188, 227, .18), transparent);
    animation: sweep 9s linear infinite;
}

.brand {
    position: absolute; top: 34px; left: 38px; right: 38px; display: flex; align-items: center;
    gap: 14px; pointer-events: none; color: #eef4f9;
}
.brand img { display: block; border-radius: 8px; }
.brand-name { font-family: var(--font-heading); font-weight: 600; font-size: 23px; letter-spacing: .12em; line-height: 1; }
.brand-sub { font-size: 10px; letter-spacing: .30em; text-transform: uppercase; opacity: .72; margin-top: 4px; }

.ticks { position: absolute; left: 38px; right: 38px; bottom: 38px; display: flex; gap: 10px; pointer-events: none; }
.ticks > span { flex: 1; height: 2px; background: rgba(238, 244, 249, .24); overflow: hidden; display: block; }
.ticks > span > i {
    display: block; height: 100%; background: #94bce3; transform-origin: left; transform: scaleX(0);
    animation: tick 21s linear infinite;
}
.ticks > span:nth-child(1) > i { animation-delay: -1s; }
.ticks > span:nth-child(2) > i { animation-delay: 6s; }
.ticks > span:nth-child(3) > i { animation-delay: 13s; }

@keyframes fade { 0% { opacity: 0 } 2% { opacity: 1 } 31% { opacity: 1 } 35% { opacity: 0 } 100% { opacity: 0 } }
@keyframes tick { 0% { transform: scaleX(0) } 2% { transform: scaleX(0) } 32% { transform: scaleX(1) } 100% { transform: scaleX(1) } }
@keyframes zoomA { 0% { transform: scale(1.02) translate3d(0, 0, 0) } 100% { transform: scale(1.16) translate3d(-1.5%, -1%, 0) } }
@keyframes zoomB { 0% { transform: scale(1.16) translate3d(1.5%, 1%, 0) } 100% { transform: scale(1.02) translate3d(0, 0, 0) } }
@keyframes sweep { 0% { transform: translateY(-100%) } 100% { transform: translateY(1100%) } }
@keyframes login-spin { to { transform: rotate(360deg) } }

/* ── painel do formulário ───────────────────────────────────────────── */
.panel {
    flex: none; width: 520px; max-width: 52vw; min-width: 420px;
    display: flex; flex-direction: column; padding: 34px 46px 30px;
    background: var(--color-bg);
    background-image: linear-gradient(to right, rgba(128, 128, 128, .10) 1px, transparent 1px),
                      linear-gradient(to bottom, rgba(128, 128, 128, .10) 1px, transparent 1px);
    background-size: 48px 48px;
}
.panel-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kicker { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; opacity: .58; }
.panel-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 36px 0; }
.panel-body h1 { font-size: 42px; letter-spacing: -.015em; }
.lede { margin: 12px 0 0; font-size: 14px; line-height: 1.6; max-width: 36ch; opacity: .70; }

.login-page form { display: flex; flex-direction: column; gap: 16px; margin-top: 34px; }
.field > label { display: block; font-size: 12px; margin-bottom: 5px; opacity: .75; }
.input {
    width: 100%; height: 42px; padding: 6px 10px; font: inherit; font-size: 14px;
    color: var(--color-text); caret-color: var(--color-accent);
    background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: 0;
}
.input:hover { border-color: rgba(128, 128, 128, .70); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.pass-wrap { position: relative; display: flex; }
.pass-wrap .input { padding-right: 42px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
    font-family: var(--font-heading); font-weight: 600; font-size: 14px; line-height: 1.2;
    color: var(--color-text); background: transparent;
    border: 1px solid var(--color-divider); border-radius: 0; padding: 6.8px 12.2px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { display: block; }
.btn-primary {
    background: var(--color-accent); border-color: var(--color-accent); color: var(--color-bg);
    margin-top: 12px; height: 48px; font-size: 15px; letter-spacing: .10em; text-transform: uppercase; gap: 10px;
}
.btn-primary:hover:not(:disabled) { background: var(--color-accent-600); border-color: var(--color-accent-600); }
.btn-primary:active:not(:disabled) { background: var(--color-accent-700); border-color: var(--color-accent-700); }
.btn-eye {
    position: absolute; right: 1px; top: 1px; bottom: 1px; width: 38px; padding: 0;
    border: 0; color: var(--color-accent); background: transparent;
}
.btn-eye:hover { background: rgba(128, 128, 128, .14); }

/* Marcas de registro (planta técnica): o botão primário é o objeto sólido do quadro. */
.blueprint { position: relative; }
.blueprint > .corner { position: absolute; width: 11px; height: 11px; color: rgba(128, 128, 128, .75); }
.blueprint > .corner::before, .blueprint > .corner::after { content: ""; position: absolute; background: currentColor; }
.blueprint > .corner::before { left: 5px; top: 0; width: 1px; height: 100%; }
.blueprint > .corner::after { top: 5px; left: 0; width: 100%; height: 1px; }
.blueprint > .corner.tl { top: -6px; left: -6px; }
.blueprint > .corner.tr { top: -6px; right: -6px; }
.blueprint > .corner.bl { bottom: -6px; left: -6px; }
.blueprint > .corner.br { bottom: -6px; right: -6px; }

.status { min-height: 20px; font-size: 12.5px; opacity: .70; }
.status[data-kind="error"] { color: var(--color-error); opacity: 1; }

/* ── seletor de tema ────────────────────────────────────────────────── */
.seg { display: inline-flex; flex: none; overflow: hidden; border: 1px solid var(--color-divider); }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.seg label { display: inline-flex; align-items: center; padding: 6px 11px; font-size: 13px; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--color-divider); }
.seg label.is-active { background: var(--color-accent); color: var(--color-bg); }
.seg label:not(.is-active):hover { background: rgba(128, 128, 128, .14); }
.seg label:focus-within { outline: 2px solid var(--color-accent); outline-offset: -2px; }

.spinner {
    display: none; width: 14px; height: 14px; border: 1.5px solid currentColor;
    border-top-color: transparent; border-radius: 50%; animation: login-spin .7s linear infinite;
}
form[data-busy="true"] .spinner { display: inline-block; }

@media (max-width: 880px) {
    .login { flex-direction: column; }
    .visual { min-height: 300px; flex: none; }
    .panel { width: 100%; max-width: none; min-width: 0; padding: 28px 22px; }
    .panel-body h1 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
    .slide, .slide > .frame, .sweep, .ticks i { animation-duration: 0.01ms; animation-iteration-count: 1; }
    .slide:nth-child(1) { opacity: 1; }
}
