/* ============================================================
   Login / Auth — "Vitrine editorial"
   Lado claro: formulário · Lado escuro: prova do produto ao vivo
   Cores: --ln-brand-1/2/ink vindas do branding do cliente (ThemeService)
   ============================================================ */

.login-page {
    --ln-paper: #f6f5f1;
    --ln-ink: var(--ln-text, #1d1b26);
    --ln-muted: color-mix(in oklab, var(--ln-text, #1d1b26) 55%, transparent);
    --ln-border: #e6e3da;
    --ln-ease: cubic-bezier(.22, 1, .36, 1);
    --ln-panel: #0d0e13;
    --ln-panel-2: #13151c;
    --ln-panel-line: rgba(255, 255, 255, .08);
    --ln-panel-text: #eef0f4;
    --ln-panel-muted: #8d93a3;
    margin: 0;
    min-height: 100vh;
    font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--ln-ink);
    -webkit-font-smoothing: antialiased;
}

.login-page *, .login-page *::before, .login-page *::after { box-sizing: border-box; }

.login-page ::selection { background: var(--ln-brand-1); color: var(--ln-brand-ink); }

.login-page a { color: var(--ln-brand-1); text-decoration: none; }

.mono { font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace; }

/* ---------------- Estrutura ---------------- */

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

/* ============================================================
   LADO CLARO — formulário
   ============================================================ */

.login-form-side {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: clamp(1.5rem, 4vw, 3rem);
    overflow: hidden;
    background:
        linear-gradient(rgba(17, 16, 13, .03) 1px, transparent 1px) 0 0 / 100% 44px,
        linear-gradient(90deg, rgba(17, 16, 13, .03) 1px, transparent 1px) 0 0 / 44px 100%,
        radial-gradient(1000px 620px at 10% -12%, color-mix(in oklab, var(--ln-brand-1) 8%, transparent), transparent 62%),
        radial-gradient(820px 520px at 108% 112%, color-mix(in oklab, var(--ln-brand-2) 7%, transparent), transparent 58%),
        var(--ln-paper);
}

.login-form-side::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.login-form-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2.2rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    flex: 1;
}

/* Marca */
.login-brand {
    display: flex;
    align-items: center;
    gap: .8rem;
    animation: ln-rise .7s var(--ln-ease) .05s both;
}

.login-logo-box {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--ln-brand-1), var(--ln-brand-2));
    color: var(--ln-brand-ink);
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -.02em;
    overflow: hidden;
    box-shadow: 0 10px 24px -10px color-mix(in oklab, var(--ln-brand-1) 70%, transparent);
}

.login-logo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    padding: 5px;
}

.login-brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--ln-ink);
}

.login-brand-tag {
    font-size: .76rem;
    color: var(--ln-muted);
    font-weight: 500;
    margin-top: 1px;
}

/* Formulário */
.login-form-block {
    animation: ln-rise .7s var(--ln-ease) .16s both;
}

.login-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.5rem, 2.4vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -.025em;
    margin: 0 0 .45rem;
    color: var(--ln-ink);
}

.login-sub {
    margin: 0 0 1.6rem;
    font-size: .95rem;
    line-height: 1.6;
    color: var(--ln-muted);
    max-width: 36ch;
}

/* Alertas */
.login-alert {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    padding: .72rem .9rem;
    border-radius: 11px;
    font-size: .85rem;
    line-height: 1.5;
    margin-bottom: 1.1rem;
    border: 1px solid transparent;
}

.login-alert svg { flex-shrink: 0; margin-top: 2px; }

.login-alert-list { margin: 0; padding-left: 1.1rem; }

.login-alert.is-success { background: #edf7ef; border-color: #d3e8d7; color: #1f5c33; }
.login-alert.is-danger  { background: #fdf0ee; border-color: #f5d9d5; color: #8f2f26; }

/* Campos */
.ln-field { margin-bottom: 1.05rem; }

.ln-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .4rem;
}

.ln-label {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--ln-ink);
}

.ln-forgot {
    font-size: .78rem;
    font-weight: 600;
    color: var(--ln-muted);
    transition: color .15s ease;
}

.ln-forgot:hover { color: var(--ln-brand-1); }

.ln-control { position: relative; }

.ln-control-ico {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #a29e94;
    pointer-events: none;
    transition: color .15s ease;
}

.ln-input {
    width: 100%;
    padding: .8rem 2.6rem .8rem 2.5rem;
    font-size: .95rem;
    font-family: inherit;
    color: var(--ln-ink);
    background: rgba(255, 255, 255, .82);
    border: 1.5px solid var(--ln-border);
    border-radius: 12px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.ln-input::placeholder { color: #b0aca2; }

.ln-input:hover { border-color: #d9d5c9; }

.ln-input:focus {
    border-color: var(--ln-brand-1);
    background: #fff;
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--ln-brand-1) 16%, transparent);
}

.ln-input:focus ~ .ln-control-ico,
.ln-control:focus-within .ln-control-ico { color: var(--ln-brand-1); }

.ln-eye {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    border-radius: 9px;
    color: #a29e94;
    cursor: pointer;
    transition: color .15s ease, background .15s ease;
}

.ln-eye:hover { color: var(--ln-ink); background: rgba(17, 16, 13, .05); }

.ln-eye .ln-eye-off { display: none; }
.ln-eye.is-visible .ln-eye-off { display: block; }
.ln-eye.is-visible .ln-eye-on { display: none; }

/* Botão */
.ln-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: .45rem;
    padding: .86rem 1.2rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(120deg, var(--ln-brand-1), color-mix(in oklab, var(--ln-brand-2) 78%, var(--ln-brand-1) 22%));
    color: var(--ln-brand-ink);
    font-family: 'Outfit', sans-serif;
    font-size: .98rem;
    font-weight: 700;
    letter-spacing: -.01em;
    cursor: pointer;
    box-shadow: 0 14px 28px -12px color-mix(in oklab, var(--ln-brand-1) 65%, transparent);
    transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}

.ln-btn:hover {
    filter: brightness(1.05);
    box-shadow: 0 18px 34px -12px color-mix(in oklab, var(--ln-brand-1) 75%, transparent);
    transform: translateY(-1px);
}

.ln-btn:active { transform: translateY(0); }

.ln-btn-label { display: inline-flex; align-items: center; gap: .55rem; }

.ln-btn-label svg { transition: transform .16s ease; }

.ln-btn:hover .ln-btn-label svg { transform: translateX(3px); }

.ln-btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid color-mix(in oklab, var(--ln-brand-ink) 35%, transparent);
    border-top-color: var(--ln-brand-ink);
    animation: ln-spin .7s linear infinite;
}

.ln-btn.is-loading { pointer-events: none; filter: saturate(.85); }
.ln-btn.is-loading .ln-btn-label { display: none; }
.ln-btn.is-loading .ln-btn-spinner { display: block; }

/* Rodapé do formulário */
.login-foot {
    display: flex;
    align-items: center;
    animation: ln-rise .7s var(--ln-ease) .28s both;
}

.login-secure-note {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .76rem;
    color: var(--ln-muted);
}

/* ============================================================
   LADO ESCURO — vitrine do produto (mock ao vivo)
   ============================================================ */

.login-showcase {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
    background: var(--ln-panel);
    color: var(--ln-panel-text);
    overflow: hidden;
    pointer-events: none;
}

.showcase-bg { position: absolute; inset: 0; }

.showcase-grid {
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, .032) 0 1px, transparent 1px 64px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, .032) 0 1px, transparent 1px 64px);
    -webkit-mask-image: radial-gradient(120% 120% at 32% 18%, #000 30%, transparent 82%);
    mask-image: radial-gradient(120% 120% at 32% 18%, #000 30%, transparent 82%);
}

.showcase-glow { position: absolute; border-radius: 50%; filter: blur(70px); }

.showcase-glow.is-a {
    width: 540px;
    height: 540px;
    left: -200px;
    bottom: -160px;
    background: radial-gradient(circle, color-mix(in oklab, var(--ln-brand-1) 50%, transparent), transparent 66%);
    animation: ln-drift 38s var(--ln-ease) infinite alternate;
}

.showcase-glow.is-b {
    width: 480px;
    height: 480px;
    top: -180px;
    right: -180px;
    background: radial-gradient(circle, color-mix(in oklab, var(--ln-brand-2) 42%, transparent), transparent 66%);
    animation: ln-drift 46s var(--ln-ease) infinite alternate-reverse;
}

.showcase-noise {
    position: absolute;
    inset: 0;
    opacity: .045;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.showcase-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    max-width: 540px;
    margin: 0 auto;
    padding: 3.5rem clamp(1.5rem, 3.5vw, 3rem);
    flex: 1;
    animation: ln-rise .9s var(--ln-ease) .22s both;
}

.showcase-kicker {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: .7rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ln-panel-muted);
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2bd576;
    box-shadow: 0 0 0 0 rgba(43, 213, 118, .45);
    animation: ln-pulse 2.2s var(--ln-ease) infinite;
    flex-shrink: 0;
}

.showcase-title {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 3.3vw, 2.9rem);
    font-weight: 600;
    letter-spacing: -.03em;
    line-height: 1.08;
    max-width: 16ch;
    color: #f5f6fa;
}

.showcase-title em {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    color: var(--ln-brand-2);
}

.showcase-sub {
    margin: 0 0 .9rem;
    font-size: .95rem;
    line-height: 1.6;
    color: var(--ln-panel-muted);
    max-width: 44ch;
}

/* --- Palco: thread + estatísticas --- */
.showcase-stage {
    display: flex;
    flex-direction: column;
    gap: .8rem;
    margin-top: .6rem;
}

.stage-thread {
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--ln-panel-line);
    background: rgba(255, 255, 255, .03);
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6);
}

.thread-head {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .85rem 1.05rem;
    border-bottom: 1px solid var(--ln-panel-line);
}

.thread-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--ln-brand-1), var(--ln-brand-2));
    color: var(--ln-brand-ink);
    font-family: 'Outfit', sans-serif;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.thread-meta { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }

.thread-meta strong {
    font-size: .84rem;
    font-weight: 700;
    color: #f0f1f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-meta span {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .72rem;
    color: var(--ln-panel-muted);
}

.thread-meta .live-dot { width: 6px; height: 6px; }

.thread-checks { color: #53bdeb; font-family: 'JetBrains Mono', monospace; font-size: .72rem; }

.thread-body {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    padding: 1.05rem;
}

/* Bolhas */
.t-msg {
    max-width: 84%;
    padding: .68rem .85rem;
    font-size: .83rem;
    line-height: 1.5;
    border-radius: 6px 18px 18px 18px;
}

.t-in {
    background: #fff;
    color: #1a1c22;
    box-shadow: 0 12px 26px -14px rgba(0, 0, 0, .5);
}

.t-in strong { font-weight: 700; }

.t-out {
    align-self: flex-end;
    background: #d9fdd3;
    color: #0c3328;
    border-radius: 18px 6px 18px 18px;
}

.t-actions { display: flex; gap: .5rem; margin-top: .6rem; }

.t-btn {
    padding: .4rem .8rem;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-size: .73rem;
    font-weight: 700;
    cursor: default;
}

.t-btn.is-yes { background: #e5f8ec; color: #0d6b3f; }
.t-btn.is-no  { background: #f2f2f1; color: #5b5e66; }

.t-time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    margin-top: .3rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: .64rem;
}

.t-in .t-time { color: #9aa0ab; }
.t-out .t-time { color: #2d8a62; }

.t-checks { font-style: normal; color: #53bdeb; }

/* Cartão de sistema */
.t-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem .95rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--ln-panel-line);
}

.t-card-ico {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--ln-brand-1), var(--ln-brand-2));
    color: var(--ln-brand-ink);
}

.t-card > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.t-card strong { font-size: .82rem; font-weight: 700; color: #eef0f4; }

.t-card span { font-size: .71rem; color: var(--ln-panel-muted); }

/* Estatísticas */
.stage-stats {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 1px;
    background: var(--ln-panel-line);
    border: 1px solid var(--ln-panel-line);
    border-radius: 14px;
    overflow: hidden;
}

.stat-main,
.stat-side-item {
    background: var(--ln-panel-2);
    padding: .85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.stat-row { display: flex; align-items: baseline; justify-content: space-between; }

.stat-label { font-size: .7rem; font-weight: 600; color: var(--ln-panel-muted); text-transform: uppercase; letter-spacing: .08em; }

.stat-value { font-size: 1.45rem; font-weight: 600; color: #fff; line-height: 1; }

.stat-track {
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
    margin-top: .45rem;
}

.stat-track i {
    display: block;
    height: 100%;
    width: 62%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--ln-brand-1), var(--ln-brand-2));
    transition: width .5s var(--ln-ease);
}

.stat-side-item { justify-content: center; }

.stat-num { font-size: 1.02rem; font-weight: 600; color: #f0f1f5; }

.stat-side-label { font-size: .7rem; color: var(--ln-panel-muted); }

/* Rodapé da vitrine */
.showcase-foot {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: 1.1rem clamp(1.5rem, 3.5vw, 3rem);
    border-top: 1px solid rgba(255, 255, 255, .06);
    font-size: .75rem;
    color: var(--ln-panel-muted);
    animation: ln-fade 1s ease .5s both;
}

/* ---------------- Estados do mock ---------------- */

html.js .t-1,
html.js .t-actions,
html.js .t-2,
html.js .t-card {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .5s var(--ln-ease), transform .5s var(--ln-ease);
}

html.js .t-msg.is-in,
html.js .t-actions.is-in,
html.js .t-card.is-in,
html.js .is-static .t-msg,
html.js .is-static .t-actions,
html.js .is-static .t-card {
    opacity: 1;
    transform: none;
}

html.js .is-static .t-1 { transition-delay: .1s; }
html.js .is-static .t-actions { transition-delay: .2s; }
html.js .is-static .t-2 { transition-delay: .3s; }
html.js .is-static .t-card { transition-delay: .4s; }

/* ---------------- Animações ---------------- */

@keyframes ln-rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

@keyframes ln-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

@keyframes ln-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(43, 213, 118, .4); }
    70%  { box-shadow: 0 0 0 8px rgba(43, 213, 118, 0); }
    100% { box-shadow: 0 0 0 0 rgba(43, 213, 118, 0); }
}

@keyframes ln-drift {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(56px, 42px, 0); }
}

/* ---------------- Responsivo ---------------- */

@media (max-width: 1159.98px) {
    .login-shell { display: block; }

    .login-showcase { display: none; }

    .login-form-side {
        min-height: 100vh;
        min-height: 100svh;
        padding: clamp(1.25rem, 5vw, 2.5rem);
    }
}

@media (max-width: 480px) {
    .login-form-inner { gap: 1.6rem; }

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

    .ln-btn { padding: .82rem 1rem; }
}

/* ---------------- Acessibilidade ---------------- */

@media (prefers-reduced-motion: reduce) {
    .login-page *,
    .login-page *::before,
    .login-page *::after {
        animation-duration: .001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001s !important;
    }
}
