/* ============================================================
   Finger Print Enrollment Modal — scoped, self-contained styles
   Scope:  everything under .fp-modal / .fp-modal-window
   Why self-contained: ui-bootstrap $modal mounts on <body>, OUTSIDE
   .main-estock, so the shared rw-* tokens (scoped to .main-estock)
   never reach it. All values are literal here on purpose.
   Brand primary mirrors --rw-primary (#0E52C1).
   ============================================================ */

/* ---- dialog frame (the ui-bootstrap window) ---- */
.fp-modal-window .modal-dialog {
  width: 880px;
  max-width: 95vw;
}
.fp-modal-window .modal-content {
  border: 0;
  border-radius: 14px;
  /* no overflow:hidden — the Sync split-button dropdown must escape the header */
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
}

/* ---- root + tokens ---- */
.fp-modal {
  --fp-primary: #0E52C1;
  --fp-primary-dark: #0A3F96;
  --fp-primary-soft: #EAF1FE;
  --fp-text: #243244;
  --fp-muted: #6B7280;
  --fp-border: #E3E8EF;
  --fp-surface: #FFFFFF;
  --fp-bg: #F5F7FA;
  --fp-success: #16A34A;
  --fp-success-soft: #E7F6EC;
  --fp-warning: #F39C12;
  --fp-warning-strong: #B26A00; /* AA-contrast amber for white text (timer pill) */
  --fp-danger: #E11D48;
  --fp-danger-soft: #FCE8EC;

  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fp-text);
  background: var(--fp-surface);
}
.fp-modal *,
.fp-modal *::before,
.fp-modal *::after { box-sizing: border-box; }

/* ---- header ---- */
.fp-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--fp-border);
}
.fp-modal__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--fp-text);
  min-width: 0;
}
.fp-modal__title .fp-modal__thumb { color: var(--fp-primary); font-size: 20px; flex: 0 0 auto; }
.fp-modal__title .fp-modal__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fp-modal__header-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* timer pill (Fortuna, counting down) */
.fp-pill-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--fp-warning-strong);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* close (x) */
.fp-modal__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fp-muted);
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.fp-modal__close:hover { background: var(--fp-bg); color: var(--fp-text); }
.fp-modal__close:focus-visible { outline: 2px solid var(--fp-primary); outline-offset: 2px; }

/* ---- body ---- */
.fp-modal__body { padding: 20px 24px 8px; background: var(--fp-surface); }

/* setup note (was alert-danger; demoted to calm info strip) */
.fp-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--fp-primary-soft);
  border: 1px solid #CFE0FB;
  color: #1B4FA8;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 20px;
}
.fp-note__icon { color: var(--fp-primary); font-size: 15px; margin-top: 1px; flex: 0 0 auto; }
.fp-note b { color: #16407F; }

/* two-panel grid */
.fp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

/* card */
.fp-card {
  background: var(--fp-surface);
  border: 1px solid var(--fp-border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
  display: flex;
  flex-direction: column;
}
.fp-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--fp-text);
}
.fp-card__title .fa { color: var(--fp-primary); font-size: 15px; }
.fp-card--capture { text-align: center; }
.fp-card--capture .fp-card__title { justify-content: center; }

/* ---- enrolled (left) states ---- */
.fp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 220px;
  color: var(--fp-primary);
}
.fp-loading .fa { font-size: 28px; }

.fp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1 1 auto;
  min-height: 220px;
  padding: 16px;
  border: 1px dashed var(--fp-border);
  border-radius: 10px;
  background: var(--fp-bg);
}
.fp-empty__icon {
  font-size: 34px;
  color: #B7C0CE;
  margin-bottom: 10px;
}
.fp-empty__title { font-size: 14px; font-weight: 600; color: var(--fp-text); margin-bottom: 4px; }
.fp-empty__hint { font-size: 13px; color: var(--fp-muted); max-width: 260px; }

.fp-print {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.fp-print__frame {
  width: 100%;
  max-width: 280px;
  background: var(--fp-bg);
  border: 1px solid var(--fp-border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fp-print__img {
  max-width: 100%;
  height: 240px;
  object-fit: contain;
  border-radius: 6px;
}

/* ---- capture (right) ---- */
.fp-quality {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.fp-quality__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.fp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fp-muted);
  background: var(--fp-bg);
  border: 1px solid var(--fp-border);
  border-radius: 999px;
  padding: 5px 12px;
}
.fp-chip--ok { color: var(--fp-success); background: var(--fp-success-soft); border-color: #BFE6CC; }
.fp-meter {
  position: relative;
  height: 6px;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  background: #EDF1F6;
  border-radius: 999px;
  overflow: hidden;
}
.fp-meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 0;
  background: var(--fp-warning);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.fp-meter__fill.fp-meter__fill--ok { background: var(--fp-success); }

/* status / message box (id #messgaeBox kept; controller writes innerText + color) */
.fp-status {
  min-height: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fp-primary);
  margin-bottom: 12px;
}

/* scan stage */
.fp-scan {
  width: 220px;
  height: 220px;
  margin: 0 auto 18px;
  background: var(--fp-bg);
  border: 2px dashed #BFD2EE;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.fp-scan__img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* DigitalPersona iframe mount (interior styled inside the iframe) */
.fp-dp-mount {
  width: 100%;
  height: 420px;
  border: 1px solid var(--fp-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--fp-bg);
}

/* ---- buttons ---- */
.fp-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.fp-btn:focus-visible { outline: 2px solid var(--fp-primary); outline-offset: 2px; }
.fp-btn[disabled],
.fp-btn.disabled { opacity: 0.55; cursor: not-allowed; }

.fp-btn--primary { background: var(--fp-primary); color: #fff; }
.fp-btn--primary:hover:not([disabled]) { background: var(--fp-primary-dark); }

.fp-btn--secondary { background: #fff; color: var(--fp-text); border-color: var(--fp-border); }
.fp-btn--secondary:hover:not([disabled]) { background: var(--fp-bg); border-color: #CBD3DF; }

.fp-btn--ghost { background: #fff; color: var(--fp-primary); border-color: #BFD2EE; }
.fp-btn--ghost:hover:not([disabled]) { background: var(--fp-primary-soft); }

.fp-btn--danger-soft { background: var(--fp-danger-soft); color: var(--fp-danger); border-color: #F6C6D1; }
.fp-btn--danger-soft:hover:not([disabled]) { background: #F9D6DE; }

.fp-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- footer ---- */
.fp-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--fp-border);
  background: var(--fp-surface);
  margin-top: 20px;
}

/* ---- responsive ---- */
@media (max-width: 768px) {
  .fp-grid { grid-template-columns: 1fr; }
  .fp-modal-window .modal-dialog { width: 95vw; }
  .fp-dp-mount { height: 360px; }
}

/* ============================================================
   Sync Finger Prints modal (same shell, sync-specific bits)
   ============================================================ */

/* descriptive helper line under the header */
.fp-subtext {
  margin: 0 0 20px;
  color: var(--fp-muted);
  font-size: 13px;
  line-height: 1.5;
}
.fp-subtext b { color: var(--fp-text); font-weight: 600; }

/* "N synced" count pill in the header */
.fp-pill-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--fp-success-soft);
  color: var(--fp-success);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
}

/* Sync split-button (primary action + dropdown caret) */
.fp-split { display: inline-flex; }
.fp-split .fp-split__main {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.fp-split .fp-split__toggle {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  padding-left: 12px;
  padding-right: 12px;
  min-width: 38px;
}
.fp-split .caret { margin: 0; }
/* dropdown menu polish (Bootstrap mechanics retained) */
.fp-modal .dropdown-menu {
  border: 1px solid var(--fp-border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.14);
  padding: 4px;
  min-width: 160px;
}
.fp-modal .dropdown-menu > li > a {
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--fp-text);
}
.fp-modal .dropdown-menu > li > a:hover {
  background: var(--fp-primary-soft);
  color: var(--fp-primary);
}

/* synced-users list */
.fp-synced {
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fp-synced__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--fp-border);
}
.fp-synced__item:last-child { border-bottom: 0; }
.fp-synced__avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--fp-primary-soft);
  color: var(--fp-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.fp-synced__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  color: var(--fp-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* user-type tag (Enterprise / Deployment) */
.fp-tag {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.fp-tag--ent { background: var(--fp-primary-soft); color: var(--fp-primary); }
.fp-tag--dep { background: var(--fp-bg); color: var(--fp-muted); border: 1px solid var(--fp-border); }

/* big centered state (syncing / fetching) reuses .fp-empty shell */
.fp-empty--busy .fp-empty__icon { color: var(--fp-primary); }

/* ============================================================
   Validate Finger Print modal (single-column, narrower)
   ============================================================ */

/* narrow variant for the single-column validate/auth modal */
.fp-modal-window.fp-modal-window--narrow .modal-dialog { width: 600px; } /* raised specificity so width wins regardless of source order */

/* collapsible CORS note (toggleCorsMsg / toggleCors) */
.fp-collapse {
  border: 1px solid var(--fp-border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}
.fp-collapse__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  cursor: pointer;
  background: var(--fp-bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--fp-text);
  user-select: none;
}
.fp-collapse__head:hover { background: #EEF2F7; }
.fp-collapse__head .fa { color: var(--fp-muted); }
.fp-collapse__body {
  padding: 13px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fp-muted);
  border-top: 1px solid var(--fp-border);
  background: var(--fp-surface);
}
.fp-collapse__body b { color: var(--fp-text); }

/* troubleshoot steps (VIEW 2) */
.fp-steps { margin: 0; padding-left: 18px; }
.fp-steps li {
  font-size: 13px;
  color: var(--fp-text);
  margin-bottom: 8px;
  line-height: 1.5;
}
.fp-steps li:last-child { margin-bottom: 0; }

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .fp-modal * { transition: none !important; }
  .fa-spin { animation: none !important; }
}
