/* Login estilo terminal — só esta página */

:root {
  --term-bg: #0a0b0d;
  --term-surface: #0f1114;
  --term-border: #1e3d2a;
  --term-green: #3ecf8e;
  --term-green-dim: #2a8f5f;
  --term-amber: #e8c547;
  --term-red: #ff6b6b;
  --term-muted: rgba(62, 207, 142, 0.45);
  --term-font: ui-monospace, "Cascadia Code", "SF Mono", "Menlo", Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body.login-shell {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  font-family: var(--term-font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--term-green);
  background: var(--term-bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(62, 207, 142, 0.06), transparent 55%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, transparent 40%);
  -webkit-font-smoothing: antialiased;
}

.term-window {
  width: 100%;
  max-width: min(52rem, 96vw);
  min-height: min(36rem, 72vh);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--term-border);
  border-radius: 4px;
  box-shadow:
    0 0 0 1px rgba(62, 207, 142, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(62, 207, 142, 0.06);
  background: var(--term-surface);
  overflow: hidden;
}

/* Página só de login: largura tipo terminal (≈80 cols), proporção larga como janela típica no Linux */
body.login-shell .term-window {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  width: min(88vw, 42rem);
  max-width: min(92vw, 44rem);
  min-height: unset;
  aspect-ratio: 1.78 / 1;
  max-height: min(62vh, 34rem);
}

body.login-shell .term-body {
  min-height: 0;
  position: relative;
}

/* Loader circuito (Uiverse — Vosoone / smooth-penguin-53, MIT) — overlay no login */
#login-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.5rem;
  background: rgba(10, 11, 13, 0.94);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

#login-loading-overlay[hidden] {
  display: none !important;
}

#login-loading-overlay .login-circuit-main {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 12rem;
}

#login-loading-overlay .login-circuit-loader {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  transform: scale(1.3);
  transform-origin: center center;
}

#login-loading-overlay .login-circuit-loader svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

#login-loading-overlay .trace-bg {
  stroke: #333;
  stroke-width: 2.2;
  fill: none;
}

#login-loading-overlay .trace-flow {
  stroke-width: 2.2;
  fill: none;
  stroke-dasharray: 40 400;
  stroke-dashoffset: 438;
  filter: drop-shadow(0 0 6px currentColor);
  animation: login-circuit-flow 3s cubic-bezier(0.5, 0, 0.9, 1) infinite;
}

#login-loading-overlay .circuit-yellow {
  stroke: #ffea00;
  color: #ffea00;
}

#login-loading-overlay .circuit-blue {
  stroke: #00ccff;
  color: #00ccff;
}

#login-loading-overlay .circuit-green {
  stroke: #00ff15;
  color: #00ff15;
}

#login-loading-overlay .circuit-purple {
  stroke: #9900ff;
  color: #9900ff;
}

#login-loading-overlay .circuit-red {
  stroke: #ff3300;
  color: #ff3300;
}

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

.term-window--embedded {
  min-height: auto;
  max-width: 100%;
}

.panel-wrap--term {
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem 1rem 2rem;
}

.term-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--term-muted);
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid var(--term-border);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

body.login-shell .term-chrome--dragging {
  cursor: grabbing;
}

.term-chrome-dots {
  display: flex;
  gap: 0.35rem;
}

.term-chrome-dots span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #333;
}

.term-chrome-dots span:nth-child(1) {
  background: #5c5c5c;
}
.term-chrome-dots span:nth-child(2) {
  background: #3d3d3d;
}
.term-chrome-dots span:nth-child(3) {
  background: #2a2a2a;
}

.term-body {
  flex: 1;
  padding: 1.15rem 1.1rem 1rem;
  min-height: 14rem;
  display: flex;
  flex-direction: column;
}

.term-fake-session {
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.term-shell-line {
  color: var(--term-green);
  word-break: break-all;
}

.term-fake-cmd {
  color: var(--term-muted);
}

.term-line--err {
  margin: 0 0 0.85rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  color: var(--term-red);
  background: rgba(255, 107, 107, 0.08);
  border-left: 2px solid var(--term-red);
}

.term-line--ok {
  margin: 0 0 1rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  color: var(--term-green);
  background: rgba(62, 207, 142, 0.08);
  border-left: 2px solid var(--term-green-dim);
}

.term-field-block {
  margin-bottom: 0.65rem;
}

.term-meta--form {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.term-footer--form {
  margin-top: 1rem;
}

.term-footer--standalone {
  margin-top: auto;
  padding-top: 1rem;
  justify-content: flex-start;
  border-top: none;
  background: transparent;
}

.term-prompt-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-top: 0.25rem;
}

.term-prompt {
  flex-shrink: 0;
  color: var(--term-amber);
  user-select: none;
}

.term-input {
  flex: 1;
  min-width: 8rem;
  border: none;
  background: transparent;
  font: inherit;
  color: transparent;
  caret-color: var(--term-green);
  -webkit-text-fill-color: transparent;
  padding: 0;
  margin: 0;
  outline: none;
}

.term-input:focus {
  outline: none;
}

.term-meta {
  margin: 1rem 0 0;
  font-size: 0.7rem;
  color: var(--term-muted);
}

.term-meta a {
  color: var(--term-green-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.term-meta a:hover {
  color: var(--term-green);
}

.term-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  padding: 0.65rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid var(--term-border);
}

body.login-shell .term-footer {
  justify-content: space-between;
  width: 100%;
}

.term-btn {
  font-family: inherit;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  padding: 0.45rem 1.1rem;
  cursor: pointer;
  color: var(--term-bg);
  background: var(--term-green);
  border: 1px solid var(--term-green-dim);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(62, 207, 142, 0.25);
}

.term-btn--run {
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.term-btn--back {
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.65rem;
  text-decoration: none;
  color: var(--term-muted);
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  opacity: 0.65;
}

.term-btn--back:hover {
  opacity: 1;
  color: var(--term-green);
  border-color: rgba(62, 207, 142, 0.25);
}

.term-btn:hover {
  filter: brightness(1.08);
}

.term-btn:active {
  transform: translateY(1px);
}

.term-btn--ghost {
  text-decoration: none;
  text-align: center;
  background: transparent;
  color: var(--term-green);
  border: 1px solid var(--term-green-dim);
  box-shadow: none;
}

.term-btn--ghost:hover {
  filter: brightness(1.12);
  background: rgba(62, 207, 142, 0.08);
}

.term-body code {
  font-size: 0.75em;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
