/* ═══════════════════════════════════════════════════════════════
   Account.css — Sirius Auth
   Login / Register / Two-factor modal

   Paleta alinhada ao resto do app (home, Query Studio, Saúde):
   violeta #7c3aed / #a78bfa + teal #2dd4bf. Antes esta tela usava um
   violeta e um CIANO próprios, e destoava de todas as outras.
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg: #02010a;
    --panel: #060318;
    --card: rgba(14, 11, 30, 0.78);
    --card-border: rgba(124, 58, 237, 0.22);
    --input-bg: rgba(6, 3, 24, 0.85);
    --input-border: rgba(124, 58, 237, 0.22);
    --text: #eeeaff;
    --text-dim: #9b8fc0;
    --text-faint: #6b6b9a;
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --accent-soft: rgba(124, 58, 237, 0.35);
    --accent-2: #2dd4bf;
    /* Só tons da paleta do app: violeta primário → violeta claro → teal. */
    --gradient: linear-gradient(135deg, #7c3aed 0%, #a78bfa 55%, #2dd4bf 100%);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.08);
    --danger-border: rgba(248, 113, 113, 0.28);
    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.08);
    --success-border: rgba(52, 211, 153, 0.28);
    --radius: 16px;
    --font: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Fira Code", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body.auth-page {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* ═══════════════════ SHELL ═══════════════════ */

.shell {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    height: 100dvh;
}

/* ═══════════════ LEFT — VISUAL PANEL ═══════════════ */

/* The canvas is a direct child of .shell and covers the WHOLE page,
   so both columns share exactly the same deep-space background. */
#galaxy-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 0;
}

/* Left column: decorative overlays only (brand, tagline, legend).
   pointer-events: none lets mouse hover reach the canvas below. */
.panel-visual {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.visual-brand {
    position: absolute;
    top: 32px;
    left: 36px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.brand-mark { width: 34px; height: 34px; }

.brand-name {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.42em;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.visual-footer {
    position: absolute;
    left: 36px;
    bottom: 34px;
    pointer-events: none;
}

.visual-tagline {
    font-size: clamp(22px, 2.4vw, 32px);
    font-weight: 600;
    line-height: 1.25;
}

.visual-tagline span {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.visual-sub {
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--text-faint);
    letter-spacing: 0.06em;
}

.visual-legend {
    display: flex;
    gap: 18px;
    margin-top: 22px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    letter-spacing: 0.05em;
    color: var(--text-dim);
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.legend-dot.star {
    background: #c4b5fd;
    box-shadow: 0 0 8px 2px rgba(184, 159, 255, 0.55);
}

.legend-dot.planet {
    background: #2dd4bf;
    box-shadow: 0 0 8px 1px rgba(45, 212, 191, 0.45);
}

.legend-line {
    width: 20px;
    height: 0;
    border-top: 1.5px dashed rgba(124, 58, 237, 0.65);
}

/* Tooltip for hovered tables (positioned by JS) */
.node-tooltip {
    position: fixed;
    z-index: 30;
    min-width: 200px;
    max-width: 250px;
    padding: 12px 14px;
    background: rgba(13, 9, 28, 0.95);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    pointer-events: none;
}

.node-tooltip.visible { opacity: 1; transform: translateY(0); }

.tooltip-name {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text);
}

.tooltip-type {
    margin-top: 2px;
    font-size: 10px;
    letter-spacing: 0.14em;
    color: var(--accent-2);
}

.tooltip-cols {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(124, 58, 237, 0.14);
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.8;
    color: var(--text-dim);
}

/* ═══════════════ RIGHT — FORM PANEL ═══════════════ */

/* Right column: transparent — the shared canvas shows through,
   and the glass card blurs the stars behind it. */
.panel-form {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    padding: 28px;
    overflow-y: auto;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: min(430px, 100%);
    padding: 38px 36px 30px;
    border: 1px solid transparent;
    background:
        linear-gradient(168deg, rgba(20, 14, 42, 0.86), rgba(12, 8, 27, 0.9)) padding-box,
        linear-gradient(150deg, rgba(124, 58, 237, 0.5), rgba(124, 58, 237, 0.1) 38%, rgba(45, 212, 191, 0.42)) border-box;
    border-radius: 20px;
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.5),
        0 0 80px -28px rgba(124, 58, 237, 0.4);
    backdrop-filter: blur(14px);
    animation: card-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* "Comet" accent line across the top edge */
.auth-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 16%;
    right: 16%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.9), rgba(45, 212, 191, 0.9), transparent);
}

/* Eyebrow row with system status chip */
.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--success-border);
    background: var(--success-bg);
    color: var(--success);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.card-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-2);
}

.card-title {
    margin-top: 10px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card-desc {
    margin-top: 8px;
    margin-bottom: 26px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-dim);
}

/* ─────────────── Flash messages (server-rendered) ─────────────── */

.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
}

.flash svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.flash-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
}

.flash-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
}

/* ─────────────── Fields ─────────────── */

.field { margin-bottom: 18px; }

.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.field-label label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.field-link {
    font-size: 12px;
    color: var(--accent-2);
    text-decoration: none;
    transition: color 0.15s ease;
}

.field-link:hover { color: #5eead4; text-decoration: underline; }

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

.control > svg {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-faint);
    pointer-events: none;
    transition: color 0.15s ease;
}

.control input {
    width: 100%;
    height: 48px;
    padding: 0 46px 0 44px;
    font-family: var(--font);
    font-size: 14.5px;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.control input::placeholder { color: var(--text-faint); }

.control input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.16);
}

.control:focus-within > svg { color: var(--accent); }

/* Autofill on dark background */
.control input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #0a0718 inset;
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
}

.field-hint {
    margin-top: 7px;
    font-size: 11.5px;
    color: var(--text-faint);
}

/* Password visibility toggle */
.pwd-toggle {
    position: absolute;
    right: 8px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.pwd-toggle:hover { color: var(--text); background: rgba(124, 58, 237, 0.12); }
.pwd-toggle svg { width: 18px; height: 18px; }
.pwd-toggle .eye-closed { display: none; }
.pwd-toggle.revealed .eye-open { display: none; }
.pwd-toggle.revealed .eye-closed { display: block; }

/* ─────────────── Inline alerts (AJAX feedback) ─────────────── */

.form-alert {
    padding: 11px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    animation: alert-in 0.2s ease;
}

.form-alert.success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}

@keyframes alert-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────── Buttons ─────────────── */

.btn-primary {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--radius);
    background: var(--gradient);
    color: #fff;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.38);
    filter: brightness(1.06);
}

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

.btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.75;
    transform: none;
    box-shadow: none;
}

.btn-arrow { transition: transform 0.16s ease; }
.btn-primary:hover .btn-arrow { transform: translateX(3px); }

/* Loading spinner inside the primary button */
.btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-primary.is-loading .btn-label,
.btn-primary.is-loading .btn-arrow { visibility: hidden; }

.btn-primary.is-loading .btn-spinner {
    display: block;
    position: absolute;
}

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

.btn-ghost {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.btn-ghost:hover {
    border-color: var(--accent-soft);
    color: var(--text);
    background: rgba(124, 58, 237, 0.07);
}

.btn-link {
    display: block;
    margin: 18px auto 0;
    border: none;
    background: none;
    color: var(--accent-2);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.btn-link:hover:not(:disabled) { color: #5eead4; text-decoration: underline; }
.btn-link:disabled { color: var(--text-faint); cursor: default; }

.btn-center { margin-top: 22px; }

/* ─────────────── Secure connection note ─────────────── */

.secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 14px;
    font-size: 11.5px;
    letter-spacing: 0.04em;
    color: var(--text-faint);
}

.secure-note svg {
    width: 13px;
    height: 13px;
    color: var(--success);
    flex-shrink: 0;
}

/* ─────────────── Feature highlights (register) ─────────────── */

.feature-list {
    list-style: none;
    display: grid;
    gap: 9px;
    margin: -10px 0 24px;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
    color: var(--text-dim);
}

.feature-list svg {
    width: 15px;
    height: 15px;
    color: var(--accent-2);
    flex-shrink: 0;
}

/* ─────────────── Supported engines (login) ─────────────── */

.engine-chips {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.engine-chips .chip {
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(124, 58, 237, 0.14);
    background: rgba(124, 58, 237, 0.06);
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--text-dim);
    transition: color 0.15s ease, border-color 0.15s ease;
}

.engine-chips .chip:hover {
    color: var(--text);
    border-color: var(--accent-soft);
}

/* ─────────────── Divider / footer ─────────────── */

.divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0;
}

.divider span { flex: 1; height: 1px; background: rgba(124, 58, 237, 0.14); }

.divider em {
    font-size: 12px;
    font-style: normal;
    color: var(--text-faint);
    white-space: nowrap;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(124, 58, 237, 0.1);
    font-size: 10.5px;
    letter-spacing: 0.14em;
    color: var(--text-faint);
}

.card-footer span { color: var(--text-dim); }

/* ═══════════════ 2FA MODAL ═══════════════ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(5, 3, 14, 0.72);
    backdrop-filter: blur(8px);
    animation: backdrop-in 0.22s ease;
}

@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
    position: relative;
    width: min(420px, 100%);
    padding: 40px 36px 32px;
    text-align: center;
    background: linear-gradient(160deg, rgba(24, 18, 48, 0.97), rgba(11, 8, 26, 0.97));
    border: 1px solid var(--card-border);
    border-radius: 22px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(124, 58, 237, 0.06);
    animation: modal-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.modal-close:hover { color: var(--text); background: rgba(124, 58, 237, 0.12); }
.modal-close svg { width: 17px; height: 17px; }

.modal-icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: var(--accent-2);
    box-shadow: 0 0 34px rgba(124, 58, 237, 0.25);
}

.modal-icon svg { width: 30px; height: 30px; }

.modal-title { font-size: 22px; font-weight: 700; }

.modal-desc {
    margin: 10px 0 24px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-dim);
}

.modal-desc strong { color: var(--text); word-break: break-all; }

/* Segmented code inputs */
.code-row {
    display: flex;
    justify-content: center;
    gap: 9px;
    margin-bottom: 18px;
}

.code-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-family: var(--mono);
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    outline: none;
    caret-color: var(--accent-2);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.code-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}

.code-input.filled { border-color: var(--accent-soft); }

.code-row.error .code-input {
    border-color: var(--danger-border);
    animation: shake 0.35s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

/* ─────────────── Register success state ─────────────── */

.register-success {
    text-align: center;
    padding: 18px 0 6px;
    animation: card-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.success-orbit {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    box-shadow: 0 0 40px rgba(52, 211, 153, 0.2);
}

.success-orbit svg { width: 34px; height: 34px; }

/* ═══════════════ RESPONSIVE ═══════════════ */

@media (max-width: 940px) {
    .shell { grid-template-columns: 1fr; }
    .panel-visual { display: none; }
    body.auth-page { overflow: auto; }
}

@media (max-width: 460px) {
    .auth-card { padding: 30px 22px 24px; border-radius: 16px; }
    .card-title { font-size: 27px; }
    .code-input { width: 42px; height: 52px; font-size: 21px; }
    .modal { padding: 34px 22px 26px; }
    .status-chip { display: none; }
}

/* ═══════════════ REDUCED MOTION ═══════════════ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════ CELULAR ═══════════
   Os blocos de 940px e 460px acima já escondem o painel visual e encolhem o
   cartão. O que faltava era o custo do toque: campo em 14.5px faz o Safari do
   iOS dar zoom ao focar — e num formulário de login o zoom cai justamente sobre
   o campo de senha, deixando o botão de entrar fora da área visível. O link
   "Esqueci minha senha" tinha 16px de altura, alvo pequeno demais ao lado do
   rótulo. Account tem Layout = null e NÃO carrega o site.css, então tudo o que
   vale para esta tela precisa estar aqui. */
@media (max-width: 940px) {
    .control input { font-size: 16px; }

    /* Área de toque sem mexer no tamanho do texto (o link fica colado no
       rótulo do campo; crescer a fonte desalinharia a linha). */
    .field-link { padding: 8px 0; }

    .pwd-toggle { width: 40px; height: 40px; }
}
