/* ═══════════════════════════════════════════════════════════════════════════
   PCAMS v2.0 — Authentication & Fingerprint Scanner Styles
   Police Certificate Application Management System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
.pcams-auth-page {
  --auth-bg:        #0a0f1e;
  --auth-panel-bg:  #ffffff;
  --auth-brand-bg:  #0d1426;
  --auth-primary:   #405189;
  --auth-accent:    #3577f1;
  --auth-success:   #0ab39c;
  --auth-danger:    #f06548;
  --auth-warning:   #f7b84b;
  --auth-text:      #343a40;
  --auth-muted:     #6c757d;
  --auth-border:    #e9ebec;
  --auth-input-bg:  #f8f9fa;
  --auth-radius:    10px;
  --auth-shadow:    0 20px 60px rgba(0,0,0,.15);

  /* Fingerprint colour states — changed by JS via class */
  --fp-color-1:     #3577f1;
  --fp-color-2:     #405189;
  --fp-glow:        rgba(53,119,241,.35);
  --fp-scan-color:  rgba(53,119,241,.7);
}

/* ── Page Layout ──────────────────────────────────────────────────────────── */
.pcams-auth-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  font-family: 'Nunito', sans-serif;
  overflow: hidden;
  background: var(--auth-bg);
}

/* ── Animated background ──────────────────────────────────────────────────── */
.pcams-auth-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.pcams-auth-bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(53,119,241,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53,119,241,.07) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridDrift 30s linear infinite;
}
@keyframes gridDrift {
  0%   { background-position: 0 0,    0 0; }
  100% { background-position: 40px 40px, 40px 40px; }
}
.pcams-auth-bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .18;
  animation: glowPulse 8s ease-in-out infinite;
}
.pcams-auth-bg-glow-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #3577f1, transparent 70%);
  top: -150px; left: -150px;
}
.pcams-auth-bg-glow-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #405189, transparent 70%);
  bottom: -100px; right: -100px;
  animation-delay: -4s;
}
@keyframes glowPulse {
  0%,100% { opacity:.18; transform: scale(1); }
  50%      { opacity:.28; transform: scale(1.08); }
}

/* ── Two-column wrap ─────────────────────────────────────────────────────── */
.pcams-auth-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 420px 1fr;
  min-height: 100vh;
  width: 100%;
}
@media (max-width: 900px) {
  .pcams-auth-wrap { grid-template-columns: 1fr; }
}

/* ── Brand / Left Panel ──────────────────────────────────────────────────── */
.pcams-auth-brand {
  background: var(--auth-brand-bg);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  position: relative;
  overflow: hidden;
}
.pcams-auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(64,81,137,.15), transparent 60%);
}
.pcams-brand-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
}
.pcams-brand-logo {
  display: flex;
  align-items: center;
  gap: .85rem;
  align-self: flex-start;
}
.pcams-brand-logo-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(53,119,241,.4));
}
.pcams-brand-logo-icon svg { width: 100%; height: 100%; }
.pcams-brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 2px;
}
.pcams-brand-tagline {
  font-size: .68rem;
  color: rgba(255,255,255,.45);
  line-height: 1.4;
  max-width: 180px;
}
.pcams-brand-footer {
  text-align: center;
}
.pcams-brand-org  { color: rgba(255,255,255,.65); font-size: .8rem; font-weight: 700; }
.pcams-brand-sub  { color: rgba(255,255,255,.3);  font-size: .7rem; margin-top: .2rem; }

/* ── Fingerprint Scanner ─────────────────────────────────────────────────── */
.pcams-fp-scanner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.pcams-fp-frame {
  position: relative;
  width: 200px; height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Corner bracket decorations */
.pcams-fp-corner {
  position: absolute;
  width: 22px; height: 22px;
  border-color: var(--fp-color-1);
  border-style: solid;
  transition: border-color .4s, box-shadow .4s;
}
.pcams-fp-corner-tl { top: 0;    left: 0;   border-width: 2.5px 0 0 2.5px; }
.pcams-fp-corner-tr { top: 0;    right: 0;  border-width: 2.5px 2.5px 0 0; }
.pcams-fp-corner-bl { bottom: 0; left: 0;   border-width: 0 0 2.5px 2.5px; }
.pcams-fp-corner-br { bottom: 0; right: 0;  border-width: 0 2.5px 2.5px 0; }

/* Scanning line */
.pcams-fp-scanline {
  position: absolute;
  left: 8px; right: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--fp-scan-color), transparent);
  box-shadow: 0 0 8px 2px var(--fp-glow);
  top: 8px;
  animation: scanMove 2.8s ease-in-out infinite;
  opacity: 0;
  transition: opacity .3s;
}
@keyframes scanMove {
  0%,100% { top: 8px;    opacity: 0; }
  5%       { opacity: 1; }
  95%      { opacity: 1; }
  50%      { top: calc(100% - 10px); }
}

/* ── Fingerprint SVG ─────────────────────────────────────────────────────── */
.pcams-fp-svg {
  width: 180px; height: 200px;
  filter: drop-shadow(0 0 6px var(--fp-glow));
  transition: filter .4s;
}
.pcams-fp-ridges {
  transition: stroke .5s;
}
.pcams-fp-core {
  animation: coreBlip 3s ease-in-out infinite;
}
@keyframes coreBlip {
  0%,100% { opacity: .6; r: 3; }
  50%      { opacity: 1;  r: 4.5; }
}

/* Pulse rings */
.pcams-fp-pulse {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--fp-color-1);
  opacity: 0;
  animation: pulseFP 3s ease-out infinite;
}
.pcams-fp-pulse-2 { animation-delay: 1.5s; }
@keyframes pulseFP {
  0%   { transform: scale(.7); opacity: 0; }
  40%  { opacity: .3; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* ── Scanner States via JS class on .pcams-fp-scanner ─────────────────────── */
/* SCANNING state */
.pcams-fp-scanner.scanning {
  --fp-color-1: #f7b84b;
  --fp-color-2: #e5a020;
  --fp-glow:    rgba(247,184,75,.4);
  --fp-scan-color: rgba(247,184,75,.8);
}
.pcams-fp-scanner.scanning .pcams-fp-scanline { opacity: 1; }
.pcams-fp-scanner.scanning .pcams-fp-svg {
  filter: drop-shadow(0 0 10px rgba(247,184,75,.5));
}
.pcams-fp-scanner.scanning .pcams-fp-ridges {
  animation: ridgePulse .3s ease-in-out infinite alternate;
}
@keyframes ridgePulse {
  from { opacity: .7; }
  to   { opacity: 1;  }
}

/* VERIFIED state */
.pcams-fp-scanner.verified {
  --fp-color-1: #0ab39c;
  --fp-color-2: #06896e;
  --fp-glow:    rgba(10,179,156,.45);
}
.pcams-fp-scanner.verified .pcams-fp-scanline { opacity: 0; animation: none; }
.pcams-fp-scanner.verified .pcams-fp-svg {
  filter: drop-shadow(0 0 16px rgba(10,179,156,.6));
}
.pcams-fp-scanner.verified .pcams-fp-check { opacity: 1 !important; animation: checkPop .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes checkPop {
  from { opacity: 0; transform: scale(.5); }
  to   { opacity: 1; transform: scale(1); }
}

/* FAILED state */
.pcams-fp-scanner.failed {
  --fp-color-1: #f06548;
  --fp-color-2: #d84332;
  --fp-glow:    rgba(240,101,72,.4);
}
.pcams-fp-scanner.failed .pcams-fp-scanline { opacity: 0; animation: none; }
.pcams-fp-scanner.failed .pcams-fp-svg {
  filter: drop-shadow(0 0 12px rgba(240,101,72,.5));
  animation: failShake .4s ease;
}
.pcams-fp-scanner.failed .pcams-fp-fail { opacity: 1 !important; }
@keyframes failShake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-5px); }
  40%,80% { transform: translateX(5px);  }
}

/* Status bar */
.pcams-fp-status {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .75rem;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  letter-spacing: .5px;
  text-transform: uppercase;
}
.pcams-fp-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  transition: background .4s;
  flex-shrink: 0;
}
.pcams-fp-scanner.scanning .pcams-fp-status-dot { background: #f7b84b; animation: dotBlink .6s ease-in-out infinite alternate; }
.pcams-fp-scanner.verified .pcams-fp-status-dot { background: #0ab39c; }
.pcams-fp-scanner.failed   .pcams-fp-status-dot { background: #f06548; }
@keyframes dotBlink { to { opacity: .3; } }

/* ── Registration step indicators ──────────────────────────────────────────── */
.pcams-reg-steps {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
}
.pcams-reg-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  flex: 1;
}
.pcams-reg-step-circle {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800;
  transition: all .3s;
}
.pcams-reg-step.active .pcams-reg-step-circle {
  background: var(--auth-accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(53,119,241,.5);
}
.pcams-reg-step.done .pcams-reg-step-circle {
  background: var(--auth-success);
  color: #fff;
}
.pcams-reg-step-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: rgba(255,255,255,.3);
}
.pcams-reg-step.active .pcams-reg-step-label { color: rgba(255,255,255,.75); }
.pcams-reg-step.done  .pcams-reg-step-label  { color: var(--auth-success); }
.pcams-reg-step-line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,.1);
  margin-top: -14px;
  margin-left: -5px;
  margin-right: -5px;
}

/* ── Right Panel: Form ────────────────────────────────────────────────────── */
.pcams-auth-form-panel {
  background: var(--auth-panel-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}
.pcams-auth-form-inner {
  width: 100%;
  max-width: 420px;
}
@media (max-width: 900px) {
  .pcams-auth-brand { min-height: 280px; padding: 2rem; }
  .pcams-auth-form-panel { padding: 2rem 1.25rem; }
  .pcams-fp-frame { width: 150px; height: 150px; }
  .pcams-fp-svg { width: 130px; height: 150px; }
}

/* ── Form Header ──────────────────────────────────────────────────────────── */
.pcams-auth-form-header { margin-bottom: 1.75rem; }
.pcams-auth-title {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--auth-text);
  margin: 0 0 .35rem;
  letter-spacing: -.3px;
}
.pcams-auth-subtitle {
  font-size: .875rem;
  color: var(--auth-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Alert banners ────────────────────────────────────────────────────────── */
.pcams-auth-alert {
  border-radius: 8px;
  padding: .75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-size: .83rem;
  margin-bottom: 1.25rem;
  border: 1px solid;
  animation: alertSlide .25s ease;
}
@keyframes alertSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pcams-auth-alert-error {
  background: rgba(240,101,72,.07);
  border-color: rgba(240,101,72,.25);
  color: #b83e26;
}
.pcams-auth-alert svg { flex-shrink: 0; margin-top: 1px; }

/* ── Input fields ─────────────────────────────────────────────────────────── */
.pcams-auth-field { margin-bottom: 1.1rem; }
.pcams-auth-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  font-weight: 700;
  color: #495057;
  margin-bottom: .4rem;
}
.pcams-auth-label svg { color: var(--auth-primary); opacity: .7; flex-shrink: 0; }
.pcams-auth-input {
  display: block;
  width: 100%;
  background: var(--auth-input-bg);
  border: 1.5px solid var(--auth-border);
  border-radius: 8px;
  padding: .65rem 1rem;
  font-size: .875rem;
  color: var(--auth-text);
  font-family: 'Nunito', sans-serif;
  transition: border-color .2s, box-shadow .2s, background .2s;
  box-sizing: border-box;
}
.pcams-auth-input:focus {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px rgba(53,119,241,.12);
  background: #fff;
}
.pcams-auth-input.is-invalid {
  border-color: var(--auth-danger);
  box-shadow: 0 0 0 3px rgba(240,101,72,.1);
}
.pcams-auth-input.is-valid {
  border-color: var(--auth-success);
}
.pcams-auth-input-wrap { position: relative; }
.pcams-auth-input-wrap .pcams-auth-input { padding-right: 2.75rem; }
.pcams-auth-eye {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #adb5bd;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color .2s;
}
.pcams-auth-eye:hover { color: var(--auth-primary); }
.pcams-auth-field-hint {
  font-size: .74rem;
  color: var(--auth-muted);
  margin-top: .3rem;
}
.pcams-auth-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

/* ── Remember / Links row ────────────────────────────────────────────────── */
.pcams-auth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: .8rem;
}
.pcams-auth-check {
  display: flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  color: var(--auth-muted);
}
.pcams-auth-check input { accent-color: var(--auth-accent); }
.pcams-auth-link {
  color: var(--auth-accent);
  text-decoration: none;
  font-weight: 600;
}
.pcams-auth-link:hover { text-decoration: underline; }
.pcams-auth-link-btn {
  background: none;
  border: none;
  font-family: 'Nunito', sans-serif;
  color: var(--auth-accent);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.pcams-auth-link-btn:disabled { color: #adb5bd; cursor: not-allowed; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.pcams-auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .8rem 1.5rem;
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-accent));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .2s, box-shadow .2s, transform .15s;
  box-shadow: 0 4px 16px rgba(64,81,137,.3);
  margin-bottom: .75rem;
}
.pcams-auth-btn:hover:not(:disabled) {
  opacity: .92;
  box-shadow: 0 6px 22px rgba(64,81,137,.4);
  transform: translateY(-1px);
}
.pcams-auth-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}
.pcams-auth-btn-outline {
  background: transparent;
  border: 1.5px solid var(--auth-border);
  color: var(--auth-text);
  box-shadow: none;
}
.pcams-auth-btn-outline:hover:not(:disabled) {
  border-color: var(--auth-accent);
  color: var(--auth-accent);
  background: rgba(53,119,241,.04);
  box-shadow: none;
}
.pcams-auth-btn-ghost {
  background: transparent;
  border: none;
  color: var(--auth-muted);
  box-shadow: none;
  font-weight: 600;
}
.pcams-auth-btn-ghost:hover:not(:disabled) {
  color: var(--auth-text);
  background: #f8f9fa;
}
.pcams-auth-btn-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pcams-spin .7s linear infinite;
  flex-shrink: 0;
}
.pcams-auth-btn-arrow { flex-shrink: 0; transition: transform .2s; }
.pcams-auth-btn:hover .pcams-auth-btn-arrow { transform: translateX(3px); }

/* ── Divider ──────────────────────────────────────────────────────────────── */
.pcams-auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1rem 0;
  color: #adb5bd;
  font-size: .78rem;
  font-weight: 600;
}
.pcams-auth-divider::before,
.pcams-auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-border);
}

/* ── Legal text ───────────────────────────────────────────────────────────── */
.pcams-auth-legal {
  text-align: center;
  font-size: .72rem;
  color: #adb5bd;
  line-height: 1.6;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   OTP Input
   ══════════════════════════════════════════════════════════════════════════ */
.pcams-otp-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  margin: 1.5rem 0 .75rem;
}
.pcams-otp-digit {
  width: 52px; height: 60px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--auth-text);
  background: var(--auth-input-bg);
  border: 2px solid var(--auth-border);
  border-radius: 10px;
  font-family: 'Nunito', monospace;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  caret-color: var(--auth-accent);
}
.pcams-otp-digit:focus {
  outline: none;
  border-color: var(--auth-accent);
  box-shadow: 0 0 0 3px rgba(53,119,241,.15);
  transform: scale(1.06);
  background: #fff;
}
.pcams-otp-digit.filled {
  border-color: var(--auth-accent);
  background: rgba(53,119,241,.04);
}
.pcams-otp-digit.invalid {
  border-color: var(--auth-danger);
  animation: failShake .35s ease;
}
.pcams-otp-digit.valid {
  border-color: var(--auth-success);
  background: rgba(10,179,156,.04);
}
.pcams-otp-dash {
  color: var(--auth-border);
  font-size: 1.2rem;
  font-weight: 300;
  user-select: none;
}
.pcams-otp-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .78rem;
  color: var(--auth-muted);
  margin-bottom: 1.25rem;
}

/* ══════════════════════════════════════════════════════════════════════════
   Password strength meter
   ══════════════════════════════════════════════════════════════════════════ */
.pcams-pw-strength {
  height: 4px;
  background: #e9ebec;
  border-radius: 2px;
  margin-top: .4rem;
  overflow: hidden;
}
.pcams-pw-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width .35s ease, background .35s;
}
.pcams-pw-label {
  font-size: .72rem;
  font-weight: 700;
  margin-top: .25rem;
  height: 1rem;
  transition: color .3s;
}

/* ══════════════════════════════════════════════════════════════════════════
   Registration screens (multi-step)
   ══════════════════════════════════════════════════════════════════════════ */
.pcams-reg-screen { display: none; }
.pcams-reg-screen.active {
  display: block;
  animation: screenIn .3s ease;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateX(18px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════════════════════════════════════════
   Success + redirect bar
   ══════════════════════════════════════════════════════════════════════════ */
.pcams-auth-success-icon {
  width: 80px; height: 80px;
  background: rgba(10,179,156,.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  animation: popIn .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.pcams-auth-redirect-bar {
  height: 4px;
  background: #e9ebec;
  border-radius: 2px;
  margin: 1.25rem auto 0;
  overflow: hidden;
  max-width: 280px;
}
.pcams-auth-redirect-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ab39c, #06896e);
  border-radius: 2px;
  transition: width linear;
}
.req { color: var(--auth-danger); margin-left: 2px; }
