/* ── Login page ────────────────────────────────────────────────
   Concept: an inventory scanner. A dark "stage" of asset-tag chips that
   light up as a scanner beam sweeps over them, next to a calm paper-toned
   sign-in form. Tokens (--bg, --text, …) come from app.css so the form side
   follows the light/dark theme; the stage is always dark ink.
   ─────────────────────────────────────────────────────────────── */
/* Fonts (Fraunces, Hanken Grotesk, JetBrains Mono) come from app.css. */

.auth {
  --ink:   #0B1A16;
  --ink-2: #13261F;
  --glow:  #4FD0B0;  /* TICventari teal, bright variant for the dark stage */
  --amber: #FFB020;
  --coral: #FF5C3A;
  --display: 'Fraunces', Georgia, serif;
  --mono:    'JetBrains Mono', ui-monospace, Consolas, monospace;

  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, .8fr);
  background: var(--bg);
}

/* ═════════ Stage (left) ═════════ */
.stage {
  --mx: 30%;
  --my: 20%;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(26px, 4vw, 56px);
  color: #EDECE5;
  background: var(--ink);
}
/* Grid lines + cursor-following glow */
.stage::before {
  content: '';
  position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(520px circle at var(--mx) var(--my), rgba(79,208,176,.16), transparent 62%),
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 48px 48px;
  -webkit-mask-image: radial-gradient(120% 100% at 30% 30%, #000 40%, transparent 100%);
          mask-image: radial-gradient(120% 100% at 30% 30%, #000 40%, transparent 100%);
}
/* Film grain */
.stage::after {
  content: '';
  position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .09; mix-blend-mode: overlay;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; flex-shrink: 0; }
.brand-logo { width: 46px; height: 46px; object-fit: contain; background: #fff; padding: 4px; border-radius: 11px; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; line-height: 1.1; }
.brand-school { font-family: var(--mono); font-size: 12px; color: rgba(237,236,229,.55); letter-spacing: .04em; margin-top: 2px; }

.hero { max-width: 640px; }
.headline {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.5rem, 5.2vw, 4.6rem);
  line-height: .98;
  letter-spacing: -.035em;
}
.headline span { display: block; }
.headline .hl {
  display: inline;
  color: var(--ink);
  padding: 0 .14em;
  margin-left: -.14em;
  background: linear-gradient(var(--glow), var(--glow)) 0 88% / 0% 78% no-repeat;
  animation: hl-draw .9s .75s cubic-bezier(.65,0,.2,1) forwards;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.hero-sub { margin-top: 20px; max-width: 46ch; font-size: 15px; line-height: 1.6; color: rgba(237,236,229,.62); }

/* Scanner: chips + beam */
.scanner { position: relative; max-width: 540px; }
.tags {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.chip {
  --r: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .03em;
  color: rgba(237,236,229,.62);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  animation: chip-ping 7s linear infinite;
  animation-delay: calc((var(--r) + .5) * .7s);
}
.tdot { width: 6px; height: 6px; border-radius: 50%; background: var(--glow); flex-shrink: 0; transition: background .3s, box-shadow .3s; }
.chip.warn .tdot { background: var(--amber); }
.chip.fix  .tdot { background: var(--coral); }
.chip.blink .tdot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }

.beam {
  position: absolute; left: -3%; right: -3%; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--glow) 20%, var(--glow) 80%, transparent);
  box-shadow: 0 0 22px 5px rgba(79,208,176,.4);
  animation: beam-scan 7s linear infinite;
  pointer-events: none;
}
.beam::before { /* fading trail above the beam */
  content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 64px;
  background: linear-gradient(to top, rgba(79,208,176,.13), transparent);
}

/* Ticker */
.ticker { overflow: hidden; border-top: 1px solid rgba(255,255,255,.09); padding-top: 14px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.ticker-track { display: flex; width: max-content; animation: ticker 34s linear infinite; }
.ticker-track span {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(237,236,229,.45); white-space: nowrap; padding-right: 26px;
}
.ticker-track span::after { content: '/'; color: var(--glow); padding-left: 26px; }

/* ═════════ Form panel (right) ═════════ */
.panel { display: grid; place-items: center; padding: 32px clamp(20px, 4vw, 56px); }
.panel-inner { width: 100%; max-width: 384px; }
.greet { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.greet::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 0 3px rgba(79,208,176,.28); margin-right: 9px; vertical-align: 1px; }
.panel h1 { font-family: var(--display); font-weight: 800; font-size: 2.1rem; letter-spacing: -.03em; line-height: 1.05; margin: 12px 0 8px; }
.panel-sub { color: var(--text-2); font-size: 14px; margin-bottom: 28px; }

.auth-alert {
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 18px; padding: 12px 14px; border-radius: 12px;
  background: var(--red-bg); color: var(--red); border: 1px solid var(--red-bd);
  font-size: 13px; line-height: 1.45;
  animation: shake .45s cubic-bezier(.36,.07,.19,.97);
}
.auth-alert i { font-size: 17px; margin-top: 1px; }

.lf { position: relative; margin-bottom: 14px; }
.lf input {
  width: 100%; height: 58px; padding: 24px 16px 8px;
  font: 500 15px 'Hanken Grotesk', system-ui, sans-serif; color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border-dark); border-radius: 14px;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.lf input:hover { border-color: var(--text-3); }
.lf input:focus { border-color: var(--text); box-shadow: 0 0 0 4px rgba(190,235,40,.38); }
.lf input:-webkit-autofill { -webkit-box-shadow: 0 0 0 60px var(--bg-card) inset; -webkit-text-fill-color: var(--text); }
.lf label {
  position: absolute; left: 17px; top: 19px;
  color: var(--text-3); font-size: 15px; pointer-events: none;
  transform-origin: left top;
  transition: transform .18s ease, color .18s;
}
.lf input:focus + label,
.lf input:not(:placeholder-shown) + label { transform: translateY(-11px) scale(.76); color: var(--text-2); }
.lf.has-toggle input { padding-right: 52px; }
.toggle-pw {
  position: absolute; right: 8px; top: 9px; width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-3); cursor: pointer;
  font-size: 19px; transition: background .15s, color .15s;
}
.toggle-pw:hover { background: var(--bg-hover); color: var(--text); }
.toggle-pw:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.caps-hint { display: none; margin: -6px 0 12px 4px; font-size: 12px; color: var(--amber); align-items: center; gap: 6px; }
.caps-hint.on { display: flex; }

.btn-go {
  position: relative; overflow: hidden; isolation: isolate;
  width: 100%; height: 56px; margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 14px; cursor: pointer;
  font: 600 15px 'Hanken Grotesk', system-ui, sans-serif; letter-spacing: .01em;
  color: #fff; background: var(--ink);
  transition: color .25s, transform .12s;
}
[data-theme="dark"] .btn-go { color: var(--ink); background: #EDECE5; }
.btn-go::before {
  content: ''; position: absolute; inset: 0; z-index: -1; background: var(--glow);
  transform: translateX(-101%); transition: transform .38s cubic-bezier(.65,0,.2,1);
}
.btn-go:hover, .btn-go:focus-visible { color: var(--ink); }
.btn-go:hover::before, .btn-go:focus-visible::before { transform: none; }
.btn-go:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.btn-go:active { transform: scale(.985); }
.btn-go .arrow { transition: transform .25s; }
.btn-go:hover .arrow { transform: translateX(4px); }
.btn-go .spin { display: none; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-go.is-loading { pointer-events: none; }
.btn-go.is-loading .arrow, .btn-go.is-loading .label-idle { display: none; }
.btn-go.is-loading .spin { display: inline-block; }
.btn-go.is-loading::before { transform: none; }
.btn-go.is-loading { color: var(--ink); }

.or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-3); font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border-dark); }
.btn-google {
  width: 100%; height: 54px; display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 1px solid var(--border-dark); border-radius: 14px; background: var(--bg-card); color: var(--text);
  font: 600 14.5px 'Hanken Grotesk', system-ui, sans-serif; transition: border-color .18s, background .18s, transform .12s;
}
.btn-google:hover { border-color: var(--text); background: var(--bg-hover); }
.btn-google:active { transform: scale(.985); }
.btn-google:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.btn-google svg { width: 19px; height: 19px; }
.panel-foot { margin-top: 30px; font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }

/* ═════════ Motion ═════════ */
.rise { opacity: 0; transform: translateY(16px); animation: rise .8s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: calc(var(--d, 0) * 90ms); }

@keyframes rise     { to { opacity: 1; transform: none; } }
@keyframes hl-draw  { to { background-size: 100% 78%; } }
@keyframes beam-scan {
  0%   { top: 0;    opacity: 0; }
  4%   { opacity: 1; }
  66%  { opacity: 1; }
  70%  { top: 100%; opacity: 0; }
  100% { top: 100%; opacity: 0; }
}
@keyframes chip-ping {
  0%   { color: rgba(237,236,229,.62); border-color: rgba(255,255,255,.09); background: rgba(255,255,255,.03); }
  2%   { color: #fff; border-color: var(--glow); background: rgba(79,208,176,.16); box-shadow: 0 0 22px rgba(79,208,176,.25); }
  14%  { color: rgba(237,236,229,.8); border-color: rgba(79,208,176,.28); background: rgba(79,208,176,.06); box-shadow: none; }
  24%, 100% { color: rgba(237,236,229,.62); border-color: rgba(255,255,255,.09); background: rgba(255,255,255,.03); }
}
@keyframes ticker { to { transform: translateX(-50%); } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes shake  { 10%,90% { transform: translateX(-1px); } 20%,80% { transform: translateX(2px); } 30%,50%,70% { transform: translateX(-4px); } 40%,60% { transform: translateX(4px); } }

@media (prefers-reduced-motion: reduce) {
  .rise { opacity: 1; transform: none; animation: none; }
  .chip, .beam, .ticker-track, .auth-alert { animation: none; }
  .beam { display: none; }
  .headline .hl { animation: none; background-size: 100% 78%; }
}

/* ═════════ Responsive ═════════ */
@media (max-width: 899px) {
  .auth { grid-template-columns: 1fr; }
  .stage { gap: 16px; padding: 22px 22px 26px; }
  .scanner, .hero-sub, .ticker { display: none; }
  .headline { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .panel { padding: 34px 22px 44px; align-items: start; }
}
@media (max-height: 760px) and (min-width: 900px) { .hero-sub { display: none; } }
