/* ============================================================
   LOGIN — tela de acesso (futurista, marca Contamac)
   ============================================================ */

/* Enquanto travado, esconde o app por baixo */
html.is-locked { overflow: hidden; }
html.is-locked .app { visibility: hidden; }

.login {
  position: fixed; inset: 0; z-index: 2000;
  display: flex;
  background: var(--ink-900);
  color: var(--tx-on-dark);
  font-family: var(--font-sans);
  overflow: hidden;
  animation: loginIn .5s var(--ease-out) both;
}
.login.is-out { animation: loginOut .6s var(--ease) forwards; }
@keyframes loginIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes loginOut { to { opacity: 0; transform: scale(1.04); filter: blur(6px); } }

/* ---------- Divisão da tela ------------------------------ */
.login__pane {
  position: relative; flex: 0 0 44%; max-width: 560px;
  display: grid; place-items: center; padding: 24px; overflow: hidden;
}
.login__visual {
  position: relative; flex: 1 1 56%; overflow: hidden;
  background:
    radial-gradient(130% 120% at 70% 30%, #1b140d 0%, var(--ink-900) 60%),
    var(--ink-900);
  border-left: 1px solid var(--line-dark);
  display: grid; place-items: center; padding-bottom: 120px;
}
/* recorte diagonal estilo "onda" entre os dois lados */
.login__visual::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 60px;
  background: var(--ink-900);
  clip-path: polygon(0 0, 100% 0, 40% 50%, 100% 100%, 0 100%);
  z-index: 3; pointer-events: none;
}

.login__globe {
  width: min(94%, 680px); aspect-ratio: 1;
  cursor: grab; touch-action: none;
  filter: drop-shadow(0 0 60px var(--orange-glow));
  transform-origin: center; will-change: transform;
}
.login__globe.is-grabbing { cursor: grabbing; }
.login__globe { position: relative; }

.login__cap {
  position: absolute; left: 48px; right: 48px; bottom: 54px; z-index: 4; pointer-events: none;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}
.login__cap-kick {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 14px;
  padding: 6px 13px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--tx-on-dark); background: rgba(255,255,255,.06);
  border: 1px solid var(--line-dark); backdrop-filter: blur(8px);
  text-shadow: none;
}
.login__cap-kick svg { width: 14px; height: 14px; color: var(--orange); }
.login__cap h2 { font-family: var(--font-display); font-size: clamp(26px, 2.8vw, 38px); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; color: var(--tx-on-dark); }
.login__cap h2 em { font-style: normal; color: var(--orange); }
.login__cap p { color: var(--tx-on-dark-mut); font-size: 15px; line-height: 1.5; margin-top: 10px; max-width: 42ch; }
.login__cap p strong { color: var(--tx-on-dark); font-weight: 700; }

.login__hint {
  position: absolute; right: 24px; bottom: 22px; z-index: 4; pointer-events: none;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--tx-on-dark-mut);
  background: rgba(255,255,255,.05); border: 1px solid var(--line-dark);
  padding: 7px 13px; border-radius: var(--r-pill); backdrop-filter: blur(8px);
}
.login__hint svg { width: 15px; height: 15px; color: var(--orange); }

/* ---------- Fundo animado -------------------------------- */
.login__bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.login__bg .orb {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55;
}
.orb--1 {
  width: 50vw; height: 50vw; top: -16vw; right: -12vw;
  background: radial-gradient(circle, var(--orange-glow), transparent 68%);
  animation: orbFloat1 18s var(--ease-in-out) infinite;
}
.orb--2 {
  width: 42vw; height: 42vw; bottom: -16vw; left: -12vw;
  background: radial-gradient(circle, rgba(245,134,52,.22), transparent 70%);
  animation: orbFloat2 22s var(--ease-in-out) infinite;
}
@keyframes orbFloat1 { 50% { transform: translate(-5vw, 6vw) scale(1.12); } }
@keyframes orbFloat2 { 50% { transform: translate(6vw, -4vw) scale(1.1); } }

/* Malha futurista deslizando */
.login__grid {
  position: absolute; inset: -2px;
  background-image:
    linear-gradient(rgba(245,134,52,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,134,52,.07) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 45%, #000 40%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 45%, #000 40%, transparent 85%);
  animation: gridMove 24s linear infinite;
}
@keyframes gridMove { to { background-position: 46px 46px; } }

/* Linha de varredura (scan) */
.login__scan {
  position: absolute; left: 0; right: 0; height: 160px;
  background: linear-gradient(to bottom, transparent, rgba(245,134,52,.10), transparent);
  animation: scan 7s linear infinite;
}
@keyframes scan { 0% { top: -160px; } 100% { top: 100%; } }

/* ---------- Cartão --------------------------------------- */
.login__card {
  position: relative; z-index: 2; width: 100%; max-width: 400px;
  padding: 40px 34px 30px; text-align: center;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid var(--line-dark);
  border-radius: var(--r-xl);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.08);
}
/* Borda superior com brilho da marca */
.login__card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, var(--orange), transparent 40%, transparent 60%, rgba(245,134,52,.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .5; pointer-events: none;
}
.login__card.shake { animation: shake .4s var(--ease); }
@keyframes shake {
  10%,90% { transform: translateX(-2px); }
  20%,80% { transform: translateX(4px); }
  30%,50%,70% { transform: translateX(-8px); }
  40%,60% { transform: translateX(8px); }
}

/* Logo (wordmark oficial) */
.login__logo {
  display: flex; justify-content: center; margin: 2px auto 20px;
}
.login__logo img {
  width: min(196px, 74%); height: auto;
  filter: drop-shadow(0 6px 22px rgba(245,134,52,.28));
}

/* Etiqueta acima do título */
.login__kicker {
  display: inline-flex; align-items: center; align-self: center;
  padding: 5px 13px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--orange);
  background: rgba(245,134,52,.1); border: 1px solid rgba(245,134,52,.28);
}

.login__title { font-family: var(--font-display); font-size: 27px; font-weight: 800; letter-spacing: -.02em; margin-top: 14px; color: var(--tx-on-dark); }
.login__sub { color: var(--tx-on-dark-mut); font-size: 14px; line-height: 1.5; margin-top: 8px; margin-bottom: 26px; max-width: 30ch; margin-left: auto; margin-right: auto; }

/* ---------- Campos --------------------------------------- */
.login__form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login__field {
  position: relative; display: flex; align-items: center;
  background: rgba(255,255,255,.04); border: 1px solid var(--line-dark);
  border-radius: var(--r-md); transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
}
.login__field:focus-within {
  border-color: var(--orange);
  background: rgba(245,134,52,.06);
  box-shadow: 0 0 0 4px rgba(245,134,52,.14);
}
.login__fico { display: grid; place-items: center; width: 44px; height: 48px; color: var(--tx-on-dark-mut); flex: none; }
.login__fico svg { width: 18px; height: 18px; }
.login__field:focus-within .login__fico { color: var(--orange); }
.login__field input {
  flex: 1; min-width: 0; height: 48px; padding: 0 8px 0 0;
  background: none; border: none; outline: none;
  color: var(--tx-on-dark); font-size: 15px; font-family: var(--font-sans);
}
/* Anula o anel de foco global (base.css) no input — o anel fica só no campo */
.login__field input:focus,
.login__field input:focus-visible { outline: none; box-shadow: none; }
.login__field input::placeholder { color: var(--tx-on-dark-mut); }
.login__field input:-webkit-autofill { -webkit-text-fill-color: var(--tx-on-dark); -webkit-box-shadow: 0 0 0 100px #1a1712 inset; }
.login__ftoggle { width: 44px; height: 48px; flex: none; display: grid; place-items: center;
  color: var(--tx-on-dark-mut); transition: color var(--dur-fast); }
.login__ftoggle:hover { color: var(--orange); }
.login__ftoggle svg { width: 18px; height: 18px; }

.login__row { display: flex; align-items: center; justify-content: space-between; margin: 2px 2px 4px; }
.login__check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 13px; color: var(--tx-on-dark-mut); user-select: none; }
.login__check input { position: absolute; opacity: 0; width: 0; height: 0; }
.login__check span {
  width: 18px; height: 18px; border-radius: 6px; border: 1px solid var(--line-dark);
  background: rgba(255,255,255,.04); display: inline-grid; place-items: center; transition: all var(--dur-fast);
}
.login__check span::after { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--orange);
  transform: scale(0); transition: transform var(--dur-fast); }
.login__check input:checked + span { border-color: var(--orange); background: rgba(245,134,52,.12); }
.login__check input:checked + span::after { transform: scale(1); }
.login__check input:focus-visible + span { box-shadow: 0 0 0 3px rgba(245,134,52,.3); }

.login__error { color: #ff8f6b; font-size: 13px; min-height: 18px; margin: 2px 2px 0; font-weight: 600; }

/* ---------- Botão ---------------------------------------- */
.login__btn {
  position: relative; overflow: hidden; margin-top: 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 50px; border-radius: var(--r-md); font-size: 15.5px; font-weight: 700;
  color: #fff; background: linear-gradient(120deg, var(--orange), var(--orange-700));
  box-shadow: 0 14px 30px -12px var(--orange-glow);
  transition: transform var(--dur-fast), box-shadow var(--dur-fast);
}
.login__btn svg { width: 19px; height: 19px; transition: transform var(--dur-fast); }
.login__btn:hover { transform: translateY(-2px); box-shadow: 0 18px 38px -12px rgba(245,134,52,.65); }
.login__btn:hover svg { transform: translateX(3px); }
.login__btn:active { transform: translateY(0); }
/* Brilho que varre o botão */
.login__btn::after {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-18deg); animation: sheen 3.6s ease-in-out infinite;
}
@keyframes sheen { 0%, 60% { left: -120%; } 100% { left: 130%; } }
.login__btn.is-ok { background: linear-gradient(120deg, #1f9d57, #157a42); pointer-events: none; }

.login__foot { margin-top: 24px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; font-size: 12px; color: var(--tx-on-dark-mut); letter-spacing: .02em; }
.login__foot strong { color: var(--orange); }
.login__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange);
  box-shadow: 0 0 10px var(--orange); animation: footPulse 2.4s var(--ease-in-out) infinite; }
@keyframes footPulse { 50% { opacity: .35; transform: scale(.82); } }

/* ---------- Entrada escalonada --------------------------- */
.login__card.reveal > * { opacity: 0; transform: translateY(14px); animation: upIn .6s var(--ease-out) forwards; }
.login__card.reveal > .login__logo   { animation-delay: .08s; }
.login__card.reveal > .login__kicker { animation-delay: .14s; }
.login__card.reveal > .login__title  { animation-delay: .20s; }
.login__card.reveal > .login__sub    { animation-delay: .26s; }
.login__card.reveal > .login__form   { animation-delay: .34s; }
.login__card.reveal > .login__foot   { animation-delay: .44s; }
@keyframes upIn { to { opacity: 1; transform: none; } }

/* ---------- Globo (arte igual à da proposta) ------------- */
.globe__halo {
  fill: none; stroke: var(--orange); stroke-width: 1; opacity: .18;
  stroke-dasharray: 3 9; animation: globeHalo 40s linear infinite; transform-origin: center;
}
.globe__glow { animation: globePulse 7s var(--ease-in-out) infinite; transform-origin: center; }
.globe__rim { fill: none; stroke: var(--orange); stroke-width: 1.4; opacity: .55; }
.globe__grid ellipse, .globe__grid line {
  fill: none; stroke: #ffb37a; stroke-width: 1; opacity: .32;
}
.globe__land {
  stroke: #fff2e0; stroke-width: .4; stroke-opacity: .4;
  filter: drop-shadow(0 0 2px var(--orange-glow));
}
.globe__links path {
  stroke: var(--orange); stroke-width: 1; stroke-opacity: .7;
  stroke-dasharray: 3 5; stroke-linecap: round;
  filter: drop-shadow(0 0 2px var(--orange));
  animation: linkFlow 3.5s linear infinite;
}
@keyframes linkFlow { to { stroke-dashoffset: -16; } }
.globe__pin .pin-dot {
  fill: #fff; stroke: var(--orange); stroke-width: 1.3;
  filter: drop-shadow(0 0 4px var(--orange));
}
.globe__pin .pin-pulse { fill: var(--orange); transform-origin: center; animation: pinPulse 2.6s var(--ease-out) infinite; }
@keyframes pinPulse { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(2.8); opacity: 0; } }
@keyframes globePulse { 50% { opacity: .78; transform: scale(1.04); } }
@keyframes globeHalo { to { transform: rotate(360deg); } }

/* ---------- Responsivo ----------------------------------- */
@media (max-width: 860px) {
  .login { flex-direction: column; }
  .login__visual { flex: 0 0 38vh; min-height: 220px; border-left: none; border-bottom: 1px solid var(--line-dark); order: -1; }
  .login__visual::before { display: none; }
  .login__pane { flex: 1 1 auto; max-width: none; width: 100%; }
  .login__globe { width: min(60%, 300px); }
  .login__cap { left: 24px; bottom: 18px; }
  .login__cap h2 { font-size: 24px; }
  .login__cap p, .login__hint { display: none; }
}
@media (max-width: 440px) {
  .login__card { padding: 34px 22px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .login, .login__card.reveal > *, .orb, .login__grid, .login__scan,
  .login__dot, .login__btn::after,
  .globe__halo, .globe__glow, .globe__links path, .globe__pin .pin-pulse { animation: none !important; }
  .login__card.reveal > * { opacity: 1; transform: none; }
}
