/* The drone login: its base at the bottom left, the card on the right. The
   drone flies behind the card; its scan is drawn over it. Its lights and its
   scan take the colour of the moment: blue, then green or red. */
.auth-split:has(.auth-drone-side) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
}

.auth-split:has(.auth-drone-side) .auth-center {
  position: relative;
  z-index: 2;
  min-height: 100vh;
}

.auth-drone-side {
  position: relative;
  min-height: 100vh;
}

.drone-base {
  position: absolute;
  left: 10%;
  bottom: 9%;
  width: min(66%, 430px);
  height: auto;
  cursor: pointer;
}

.drone-base-shadow { fill: rgba(30, 41, 59, 0.16); filter: blur(4px); }

@media (max-width: 991.98px) {
  .auth-split:has(.auth-drone-side) {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-split:has(.auth-drone-side) .auth-center {
    min-height: 0;
  }
  .auth-drone-side {
    min-height: 0;
    height: 200px;
  }
  .drone-base {
    bottom: 6%;
  }
}

.auth-drone {
  --drone: #3b82f6;
  --ink: #1e293b;
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100vw;
  height: 100vh;
  overflow: visible;
  color: var(--drone);
  pointer-events: none;
}

.auth-drone.is-ok { --drone: #22c55e; }
.auth-drone.is-error { --drone: #ef4444; }

.auth-drone-3d {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.drone-scan { opacity: 0; color: var(--drone); transition: opacity 0.25s; }
.drone-scan.is-on { opacity: 1; }
.drone-beam { color: var(--drone); }
.drone-scanned { opacity: 0.6; }
.drone-brackets { fill: none; stroke: var(--drone); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.drone-readout { fill: var(--drone); font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.12em; }
.drone-result { opacity: 0; transform-box: fill-box; transform-origin: center; }
.drone-result circle { fill: var(--drone); stroke: #ffffff; stroke-width: 4; }
.drone-result path { fill: none; stroke: #ffffff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.drone-scan.is-result .drone-result { animation: drone-pop 0.45s cubic-bezier(0.34, 1.6, 0.64, 1) forwards; }

@keyframes drone-pop {
  0% { opacity: 0; transform: scale(0.3); }
  100% { opacity: 1; transform: scale(1); }
}
.drone-line { fill: var(--drone); }

/* Reading a field: a short beam onto it, its corners framed, a line going
   to and fro across it. */
.drone-read { opacity: 0; transition: opacity 0.25s; }
.drone-read.is-on { opacity: 1; }
.drone-read-box { fill: none; stroke: var(--drone); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.drone-read-line { fill: var(--drone); }

/* A field it found empty on "Entrar". */
.auth-card .form-floating > .form-control.is-drone-missing {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18) !important;
  animation: drone-shake 0.4s ease-in-out 2;
}
.drone-line-glow { fill: var(--drone); opacity: 0.8; }

/* The card answers the scan. */
.auth-card {
  transition: box-shadow 0.3s, border-color 0.3s;
}

.auth-card.is-scan-ok {
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25), 0 1.5rem 3.5rem rgba(15, 23, 42, 0.12);
}

.auth-card.is-scan-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.22), 0 1.5rem 3.5rem rgba(15, 23, 42, 0.12);
  animation: drone-shake 0.45s ease-in-out 2;
}

@keyframes drone-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card.is-scan-error { animation: none; }
}
