/*
 * Portal login: brand aside on the left, sign-in form on the right.
 *
 * Used by admin-portal and branch-portal login views (login.php, new-password.php, login-brand.php).
 * branch-portal links this file through ../admin-portal/assets/css/pages/login/portal-login.css.
 *
 *   .ffl            base layout, light form panel
 *   .ffl--dark      admin: neutral dark gray aside
 *   .ffl--light     branch: pale aside
 *
 * Tenant colors: --custom-primary (accent) and --custom-primary-text (text on the accent)
 * come from css-config/<domain>-css.css and views/login/main.php.
 *
 * form-validation.login.js toggles login-signin-on / login-forgot-on on #kt_login;
 * the state rules at the bottom of this file show the matching form.
 */

.ffl {
  --ffl-accent: var(--custom-primary, #3699ff);
  --ffl-on-accent: var(--custom-primary-text, #ffffff);
  --ffl-ink: #111827;
  --ffl-ink-soft: #374151;
  --ffl-muted: #6b7280;
  --ffl-faint: #9ca3af;
  --ffl-border: #e5e7eb;
  --ffl-field-bg: #f9fafb;
  --ffl-danger: #dc2626;
  --ffl-radius: 12px;
  --ffl-aside-bg: #0d0d12;
  /* Accent for text and thin lines on the aside; .ffl--dark / .ffl--light adjust its lightness */
  --ffl-accent-lift: var(--ffl-accent);

  display: flex;
  min-height: 100vh;
  width: 100%;
  background: #ffffff;
  color: var(--ffl-ink);
  font-family: Poppins, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.ffl *,
.ffl *::before,
.ffl *::after {
  box-sizing: border-box;
}

.ffl svg {
  display: block;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Brand aside
   -------------------------------------------------------------------------- */

.ffl-aside {
  position: relative;
  z-index: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding: 56px clamp(40px, 5.5vw, 100px) 48px;
  overflow: hidden;
  background-color: var(--ffl-aside-bg);
}

/* Dot pattern, faded out toward the edges */
.ffl-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle, var(--ffl-dot) 1px, transparent 1.5px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 25% 50%, #000 15%, transparent 80%);
  mask-image: radial-gradient(ellipse 75% 65% at 25% 50%, #000 15%, transparent 80%);
}

/*
 * Card showcase: two tilted mini cards (.ffl-mcard) in the free space right of the aside text.
 * The left edge is the aside's left padding plus the text column (.ffl-aside-body max-width
 * 580px) and a 20px gap; the stack scales down with the free space and floats gently.
 * Used by the branch hub (admin and branch) and the member wallet (members).
 */
.ffl-showcase {
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: calc(clamp(40px, 5.5vw, 100px) + 600px);
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  container-type: inline-size;
}

.ffl-showcase-stack {
  position: relative;
  flex-shrink: 0;
  width: 420px;
  height: 360px;
  animation: ffl-showcase-float 7s ease-in-out infinite;
}

/* Shrink the stack to the free space (scale is separate from the float animation's transform) */
@container (max-width: 480px) {
  .ffl-showcase-stack { scale: 0.85; }
}
@container (max-width: 410px) {
  .ffl-showcase-stack { scale: 0.72; }
}
@container (max-width: 350px) {
  .ffl-showcase-stack { scale: 0.6; }
}
@container (max-width: 290px) {
  .ffl-showcase-stack { scale: 0.5; }
}
@container (max-width: 239px) {
  .ffl-showcase-stack { display: none; }
}

.ffl-mcard {
  position: absolute;
  border-radius: 20px;
  box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.25);
}

/*
 * Branch hub (admin-portal/views/login/login-hub.php, admin login): an "All branches" card in
 * front of a "Branch sales" card. Every branch reports to one dashboard: branch bars fill in
 * once, a live dot pulses and a segment runs along the sync track (data flowing between HQ
 * and the branches). Decorative only: no numbers or branch names.
 * The branch login has its own one-branch cards (.ffl-mcard--today / --stock, further down).
 */
/* Wider and taller than the wallet stack so the front card leaves the back card's chart visible */
.ffl-showcase-stack--hub {
  width: 460px;
  height: 420px;
}

.ffl-mcard--hq {
  top: 0;
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 214px;
  padding: 18px 20px 20px;
  background: #ffffff;
  transform: rotate(7deg);
}

.ffl-mcard--hq .ffl-mcard-label {
  color: var(--ffl-muted);
}

.ffl-mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 96px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--ffl-border);
}

.ffl-mini-chart span {
  flex: 1 1 0;
  height: var(--ffl-bar-h);
  border-radius: 4px 4px 2px 2px;
  background: var(--ffl-accent);
  opacity: 0.35;
  transform-origin: bottom;
  animation: ffl-grow-y 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--ffl-bar-i) * 0.07s + 0.3s);
}

.ffl-mini-chart span:last-child {
  opacity: 1;
}

.ffl-mcard--branches {
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 360px;
  padding: 20px 22px 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #2a2a30;
  transform: rotate(-4deg);
  --ffl-hub-line: rgba(255, 255, 255, 0.16);
  --ffl-hub-track: rgba(255, 255, 255, 0.1);
}

.ffl-live {
  position: relative;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ffl-accent-lift);
}

.ffl-live::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--ffl-accent-lift);
  animation: ffl-live 2s ease-out infinite;
}

.ffl-branch-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ffl-branch-row {
  display: grid;
  grid-template-columns: 32px 1fr 104px;
  align-items: center;
  gap: 12px;
}

.ffl-branch-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1.5px solid var(--ffl-accent-lift);
  color: var(--ffl-accent-lift);
}

.ffl-branch-icon svg {
  width: 16px;
  height: 16px;
}

.ffl-branch-name {
  width: var(--ffl-name-w);
  height: 8px;
  border-radius: 4px;
  background: var(--ffl-hub-line);
}

.ffl-branch-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--ffl-hub-track);
  overflow: hidden;
}

.ffl-branch-bar span {
  display: block;
  width: var(--ffl-bar-w);
  height: 100%;
  border-radius: inherit;
  background: var(--ffl-accent-lift);
  transform-origin: left;
  animation: ffl-grow-x 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--ffl-bar-i) * 0.1s + 0.4s);
}

.ffl-sync {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ffl-accent-lift);
}

.ffl-sync svg {
  width: 16px;
  height: 16px;
}

.ffl-sync-track {
  position: relative;
  flex: 1 1 auto;
  height: 4px;
  border-radius: 999px;
  background: var(--ffl-hub-track);
  overflow: hidden;
}

.ffl-sync-track::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 30%;
  border-radius: inherit;
  background: var(--ffl-accent-lift);
  animation: ffl-sync 2.4s ease-in-out infinite;
}

/*
 * Branch login (branch-portal/views/login/login-branch-hub.php): one branch's view, a "Your branch"
 * card (sales through the day, orders and stock tiles) in front of a "Stock" card with stock
 * levels and a delivery coming from head office. White cards on the light aside.
 */
.ffl-mcard--today,
.ffl-mcard--stock {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ffl-border);
  background: #ffffff;
  box-shadow: 0 24px 48px -24px rgba(17, 24, 39, 0.3), 0 2px 6px rgba(17, 24, 39, 0.06);
  --ffl-hub-line: rgba(17, 24, 39, 0.12);
  --ffl-hub-track: rgba(17, 24, 39, 0.08);
}

.ffl-mcard--today .ffl-mcard-label,
.ffl-mcard--stock .ffl-mcard-label {
  color: var(--ffl-ink-soft);
}

.ffl-mcard--stock {
  top: 0;
  right: 6px;
  gap: 14px;
  width: 236px;
  padding: 18px 20px 20px;
  transform: rotate(7deg);
}

.ffl-stock-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ffl-stock-row {
  display: grid;
  grid-template-columns: 1fr 76px;
  align-items: center;
  gap: 12px;
}

.ffl-mcard--today {
  left: 0;
  bottom: 0;
  gap: 16px;
  width: 360px;
  padding: 20px 22px 22px;
  transform: rotate(-4deg);
}

.ffl-mcard--today .ffl-mini-chart {
  height: 84px;
}

.ffl-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ffl-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ffl-border);
  border-radius: 12px;
}

.ffl-tile-lines {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
}

.ffl-tile-lines span {
  display: block;
  height: 7px;
  border-radius: 4px;
  background: var(--ffl-hub-line);
}

.ffl-tile-lines span + span {
  height: 5px;
  background: var(--ffl-hub-track);
}

@keyframes ffl-grow-y {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes ffl-grow-x {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes ffl-live {
  from {
    opacity: 0.6;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(2.6);
  }
}

@keyframes ffl-sync {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(340%);
  }
}

/* Member wallet (members-portal/views/members-wallet.php): stamp card in front of a member QR card.
   Stamps pop in once and the next empty stamp pulses. */

/* Back card: member QR */
.ffl-mcard--qr {
  top: 0;
  right: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 196px;
  padding: 22px 22px 18px;
  background: #ffffff;
  transform: rotate(8deg);
}

.ffl-mcard-qr {
  display: block;
  width: 140px;
  height: 140px;
}

.ffl-mcard-qr rect {
  fill: #111827;
}

.ffl-mcard-qr .ffl-mcard-qr-gap {
  fill: #ffffff;
}

.ffl-mcard-caption {
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Front card: loyalty stamps */
.ffl-mcard--stamps {
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 360px;
  padding: 22px 24px 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #2a2a30;
  transform: rotate(-5deg);
}

.ffl-mcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ffl-mcard-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ffl-mcard-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ffl-accent);
  color: var(--ffl-on-accent);
}

.ffl-mcard-badge svg {
  width: 16px;
  height: 16px;
}

.ffl-stamps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.ffl-stamp {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.34);
}

.ffl-stamp svg {
  width: 46%;
  height: 46%;
}

.ffl-stamp--on {
  border: 0;
  background: var(--ffl-accent);
  color: var(--ffl-on-accent);
  animation: ffl-stamp-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: calc(var(--ffl-stamp-i) * 0.12s + 0.3s);
}

.ffl-stamp--reward {
  border: 1.5px solid var(--ffl-accent-lift);
  color: var(--ffl-accent-lift);
}

/* The next visit: a soft ring pulsing out of the first empty stamp */
.ffl-stamp--next::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--ffl-accent-lift);
  animation: ffl-stamp-next 2.4s ease-out 1.4s infinite both;
}

.ffl-mcard-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.ffl-mcard-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ffl-accent-lift);
}

@keyframes ffl-showcase-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes ffl-stamp-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes ffl-stamp-next {
  from {
    opacity: 0.9;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.5);
  }
}

.ffl-aside-logo img {
  display: block;
  max-height: 88px;
  max-width: 240px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.ffl-aside-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 580px;
}

.ffl-chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--ffl-chip-border);
  background: var(--ffl-chip-bg);
  color: var(--ffl-aside-ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.ffl-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ffl-accent-lift);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ffl-accent-lift) 28%, transparent);
}

.ffl-hero {
  margin: 0 0 20px;
  color: var(--ffl-aside-ink);
  font-size: clamp(34px, 3.4vw, 56px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.ffl-hero-accent {
  display: block;
  color: var(--ffl-accent-lift);
}

.ffl-lead {
  max-width: 470px;
  margin: 0 0 36px;
  color: var(--ffl-aside-muted);
  font-size: 16px;
  line-height: 1.7;
}

.ffl-perks {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ffl-perk {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--ffl-card-border);
  background: var(--ffl-card-bg);
  box-shadow: var(--ffl-card-shadow);
}

.ffl-perk-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ffl-accent);
  color: var(--ffl-on-accent);
}

.ffl-perk-icon svg {
  width: 20px;
  height: 20px;
}

.ffl-perk-title {
  display: block;
  margin: 1px 0 3px;
  color: var(--ffl-aside-ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.ffl-perk-text {
  display: block;
  color: var(--ffl-aside-muted);
  font-size: 13.5px;
  line-height: 1.5;
}

.ffl-aside-foot {
  color: var(--ffl-aside-faint);
  font-size: 13px;
}

/* Admin: neutral dark gray aside, so any tenant accent sits well on it */
.ffl--dark {
  --ffl-aside-bg: #1f1f23;
  --ffl-aside-ink: #ffffff;
  --ffl-aside-muted: rgba(255, 255, 255, 0.7);
  --ffl-aside-faint: rgba(255, 255, 255, 0.5);
  --ffl-dot: rgba(255, 255, 255, 0.1);
  --ffl-chip-bg: rgba(255, 255, 255, 0.06);
  --ffl-chip-border: rgba(255, 255, 255, 0.16);
  --ffl-card-bg: rgba(255, 255, 255, 0.05);
  --ffl-card-border: rgba(255, 255, 255, 0.1);
  --ffl-card-shadow: none;
}

/*
 * Keep the tenant accent readable on the aside without changing its hue: on the dark aside a
 * dark accent (e.g. brown #856951) is lifted to at least 74% OKLCH lightness, on the light
 * aside a light accent (e.g. yellow) is lowered to at most 52%. Accents that already contrast
 * pass through unchanged. Used for text and thin lines only; filled shapes with text or icons
 * inside (buttons, perk icons, HQ node, filled stamps) keep the real accent and
 * --custom-primary-text. Browsers without relative colors keep the plain accent.
 */
@supports (color: oklch(from red l c h)) {
  .ffl--dark {
    --ffl-accent-lift: oklch(from var(--ffl-accent) max(l, 0.74) c h);
  }
  .ffl--light {
    --ffl-accent-lift: oklch(from var(--ffl-accent) min(l, 0.52) c h);
  }
  /* Dark surfaces inside a light page (member stamp card, QR camera box) keep the lifted accent */
  .ffl--light .ffl-mcard--stamps,
  .ffl--light .ffl-scan #ZXing_scanner > .d-flex:first-child > div {
    --ffl-accent-lift: oklch(from var(--ffl-accent) max(l, 0.74) c h);
  }
}

/*
 * Members portal (sign-in and both QR pages): a soft tint of the tenant accent on the light
 * theme, so customers see the brand and the page never looks like the admin (dark gray) or
 * branch (neutral light gray) sign-in.
 */
.ffl.ffl--members {
  --ffl-aside-bg: color-mix(in srgb, var(--ffl-accent) 12%, #ffffff);
  --ffl-dot: color-mix(in srgb, var(--ffl-accent) 24%, transparent);
  --ffl-chip-border: color-mix(in srgb, var(--ffl-accent) 22%, #e5e7eb);
  --ffl-card-border: color-mix(in srgb, var(--ffl-accent) 16%, #e5e7eb);
}

/* Same hue as the accent with a guaranteed bit of colour, so even greyish accents (e.g. brown)
   give a visibly tinted page next to the branch login's neutral gray */
@supports (color: oklch(from red l c h)) {
  .ffl.ffl--members {
    --ffl-aside-bg: oklch(from var(--ffl-accent) 0.955 clamp(0.03, calc(c * 0.35), 0.06) h);
  }
}

.ffl--members .ffl-mcard {
  box-shadow: 0 26px 50px -24px rgba(17, 24, 39, 0.4), 0 2px 6px rgba(17, 24, 39, 0.08);
}

/* Branch: pale aside */
.ffl--light {
  --ffl-aside-bg: #eceef2;
  --ffl-aside-ink: var(--ffl-ink);
  --ffl-aside-muted: #4b5563;
  --ffl-aside-faint: var(--ffl-faint);
  --ffl-dot: rgba(17, 24, 39, 0.09);
  --ffl-chip-bg: #ffffff;
  --ffl-chip-border: var(--ffl-border);
  --ffl-card-bg: #ffffff;
  --ffl-card-border: var(--ffl-border);
  --ffl-card-shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 4px 12px -6px rgba(17, 24, 39, 0.08);
}

/* --------------------------------------------------------------------------
   Form panel
   -------------------------------------------------------------------------- */

.ffl-main {
  position: relative;
  flex: 0 0 auto;
  width: clamp(440px, 33vw, 640px);
  display: flex;
  flex-direction: column;
  padding: 48px clamp(32px, 4vw, 80px) 32px;
  background: #ffffff;
}

.ffl-card {
  width: 100%;
  max-width: 400px;
  margin: auto;
  padding: 24px 0;
  animation: ffl-enter 0.45s ease-out both;
}

.ffl-head {
  margin-bottom: 32px;
}

.ffl-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid var(--ffl-border);
  background: #ffffff;
  color: var(--ffl-ink);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.05);
}

.ffl-badge svg {
  width: 22px;
  height: 22px;
}

.ffl-title {
  margin: 0 0 8px;
  color: var(--ffl-ink);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.ffl-subtitle {
  margin: 0;
  color: var(--ffl-muted);
  font-size: 15px;
  line-height: 1.6;
}

.ffl .form-group {
  margin: 0 0 20px;
}

.ffl-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.ffl-label {
  margin: 0;
  color: var(--ffl-ink-soft);
  font-size: 14px;
  font-weight: 500;
}

.ffl-link {
  color: var(--ffl-ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.ffl-link:hover,
.ffl-link:focus {
  color: var(--ffl-accent);
  text-decoration: none;
}

.ffl-field {
  position: relative;
}

.ffl-field-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--ffl-faint);
  transform: translateY(-50%);
  pointer-events: none;
  transition: color 0.15s ease;
}

.ffl-input {
  display: block;
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 16px 0 46px;
  border: 1px solid var(--ffl-border);
  border-radius: var(--ffl-radius);
  background: var(--ffl-field-bg);
  color: var(--ffl-ink);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.ffl-input::placeholder {
  color: var(--ffl-faint);
  opacity: 1;
}

.ffl-input:hover {
  border-color: #d1d5db;
}

.ffl-input:focus {
  border-color: var(--ffl-accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ffl-accent) 16%, transparent);
}

.ffl-field:focus-within .ffl-field-icon {
  color: var(--ffl-accent);
}

.ffl-input--reveal {
  padding-right: 52px;
}

/* Hide the browser's own reveal button so only ours shows */
.ffl-input::-ms-reveal,
.ffl-input::-ms-clear {
  display: none;
}

.ffl-reveal {
  position: absolute;
  top: 50%;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ffl-faint);
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.ffl-reveal:hover {
  color: var(--ffl-ink-soft);
  background: #f3f4f6;
}

.ffl-reveal:focus {
  outline: none;
}

.ffl-reveal:focus-visible {
  outline: 2px solid var(--ffl-accent);
  outline-offset: 1px;
}

.ffl-reveal svg {
  width: 19px;
  height: 19px;
}

.ffl-reveal .ffl-icon-hide,
.ffl-reveal[aria-pressed="true"] .ffl-icon-show {
  display: none;
}

.ffl-reveal[aria-pressed="true"] .ffl-icon-hide {
  display: block;
}

/* FormValidation (Bootstrap plugin) marks the input .is-invalid and adds a message to .form-group */
.ffl .ffl-input.is-invalid {
  border-color: var(--ffl-danger);
  background: #ffffff;
}

.ffl .ffl-input.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}

.ffl .form-group:has(.is-invalid) .ffl-field-icon {
  color: var(--ffl-danger);
}

/* Members login: its validator sets no input class, only .has-danger on the .form-group row */
.ffl .form-group.has-danger .ffl-input {
  border-color: var(--ffl-danger);
  background: #ffffff;
}

.ffl .form-group.has-danger .ffl-field-icon {
  color: var(--ffl-danger);
}

.ffl .fv-plugins-message-container {
  margin-top: 6px;
}

.ffl .fv-help-block {
  color: var(--ffl-danger);
  font-size: 13px;
  font-weight: 400;
}

/* Remember-me checkbox */
.ffl-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 28px;
  color: var(--ffl-ink-soft);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

.ffl-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ffl-check-box {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #ffffff;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ffl-check-box::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5.5px;
  width: 5px;
  height: 10px;
  border: solid var(--ffl-on-accent);
  border-width: 0 2px 2px 0;
  opacity: 0;
  transform: rotate(45deg);
}

.ffl-check input:checked + .ffl-check-box {
  border-color: var(--ffl-accent);
  background: var(--ffl-accent);
}

.ffl-check input:checked + .ffl-check-box::after {
  opacity: 1;
}

.ffl-check input:focus-visible + .ffl-check-box {
  outline: 2px solid var(--ffl-accent);
  outline-offset: 2px;
}

.ffl-check input:disabled + .ffl-check-box {
  background: #f3f4f6;
}

.ffl-check:has(input:disabled) {
  color: var(--ffl-faint);
  cursor: not-allowed;
}

/* Buttons */
.ffl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--ffl-radius);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.ffl-btn svg {
  width: 18px;
  height: 18px;
}

.ffl-btn:focus {
  outline: none;
}

.ffl-btn--primary {
  border-color: var(--ffl-accent);
  background: var(--ffl-accent);
  color: var(--ffl-on-accent);
  box-shadow: 0 10px 24px -12px var(--ffl-accent), 0 1px 2px rgba(17, 24, 39, 0.06);
}

.ffl-btn--primary:hover {
  filter: brightness(1.07);
}

.ffl-btn--primary:active {
  transform: translateY(1px);
}

.ffl-btn--primary:focus-visible {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ffl-accent) 28%, transparent);
}

.ffl-btn--primary:disabled {
  opacity: 0.6;
  filter: none;
  cursor: not-allowed;
}

.ffl-btn-arrow {
  transition: transform 0.15s ease;
}

.ffl-btn--primary:hover .ffl-btn-arrow {
  transform: translateX(3px);
}

.ffl-btn--quiet {
  margin-top: 12px;
  height: 46px;
  background: transparent;
  color: var(--ffl-muted);
  font-size: 15px;
  text-decoration: none;
}

.ffl-btn--quiet:hover,
.ffl-btn--quiet:focus-visible {
  background: #f3f4f6;
  color: var(--ffl-ink);
  text-decoration: none;
}

.ffl-help {
  margin: 24px 0 0;
  color: var(--ffl-faint);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* Members login: "or" divider, QR sign-in button and sign-up line */
.ffl-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--ffl-faint);
  font-size: 13px;
}

.ffl-divider::before,
.ffl-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--ffl-border);
}

.ffl-btn--outline,
.ffl-btn--outline:focus {
  border-color: var(--ffl-border);
  background: #ffffff;
  color: var(--ffl-ink);
  text-decoration: none;
}

.ffl-btn--outline:hover {
  border-color: #d1d5db;
  background: #f9fafb;
  color: var(--ffl-ink);
  text-decoration: none;
}

.ffl-btn--outline:focus-visible {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ffl-accent) 22%, transparent);
}

.ffl-btn--outline svg {
  width: 20px;
  height: 20px;
}

.ffl-signup {
  margin: 28px 0 0;
  color: var(--ffl-muted);
  font-size: 14px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Members QR pages (members-portal/views/signin-qr-scanner.php and signup-qr-scanner.php)
   The scanner markup inside #ZXing_scanner comes from my-script.js
   (_initZXingQRScanner) and is only restyled here, scoped to .ffl-scan.
   -------------------------------------------------------------------------- */

.ffl-scan {
  position: relative;
  z-index: 0;
  flex-direction: column;
  background: var(--ffl-aside-bg);
}

.ffl-scan::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle, var(--ffl-dot) 1px, transparent 1.5px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 10%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 10%, transparent 80%);
}

.ffl-scan-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(20px, 4vw, 56px);
}

.ffl-scan-logo {
  display: block;
  max-height: 56px;
  max-width: 180px;
  width: auto;
  height: auto;
}

.ffl-scan-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--ffl-chip-border);
  background: var(--ffl-chip-bg);
  color: var(--ffl-aside-ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.ffl-scan-back:hover,
.ffl-scan-back:focus {
  background: color-mix(in srgb, var(--ffl-chip-bg) 80%, var(--ffl-aside-ink) 8%);
  color: var(--ffl-aside-ink);
  text-decoration: none;
}

.ffl-scan-back svg {
  width: 16px;
  height: 16px;
}

.ffl-scan-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 16px 20px;
}

.ffl-scan-card {
  width: 100%;
  max-width: 520px;
  padding: 32px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.6);
  animation: ffl-enter 0.45s ease-out both;
}

.ffl-scan-card .ffl-head {
  margin-bottom: 24px;
}

.ffl-scan-card .ffl-title {
  font-size: 26px;
}

/* Injected camera box: full width, rounded, with a scan frame and a moving scan line */
.ffl-scan #ZXing_scanner > .d-flex:first-child {
  margin-bottom: 16px !important;
}

.ffl-scan #ZXing_scanner > .d-flex:first-child > div {
  position: relative;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 4 / 3;
  /* On short screens the camera gives up height first, so the page fits without scrolling */
  max-height: 38vh;
  border-radius: 16px;
  overflow: hidden;
  background: #0b0b0f;
}

.ffl-scan #qr_scanner_video {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  object-fit: cover;
}

/* Corner brackets */
.ffl-scan #ZXing_scanner > .d-flex:first-child > div::before {
  content: "";
  position: absolute;
  inset: 14%;
  z-index: 1;
  pointer-events: none;
  --ffl-corner: var(--ffl-accent-lift);
  background:
    linear-gradient(var(--ffl-corner), var(--ffl-corner)) top left / 32px 4px,
    linear-gradient(var(--ffl-corner), var(--ffl-corner)) top left / 4px 32px,
    linear-gradient(var(--ffl-corner), var(--ffl-corner)) top right / 32px 4px,
    linear-gradient(var(--ffl-corner), var(--ffl-corner)) top right / 4px 32px,
    linear-gradient(var(--ffl-corner), var(--ffl-corner)) bottom left / 32px 4px,
    linear-gradient(var(--ffl-corner), var(--ffl-corner)) bottom left / 4px 32px,
    linear-gradient(var(--ffl-corner), var(--ffl-corner)) bottom right / 32px 4px,
    linear-gradient(var(--ffl-corner), var(--ffl-corner)) bottom right / 4px 32px;
  background-repeat: no-repeat;
  border-radius: 6px;
}

/* Scan line sweeping inside the frame */
.ffl-scan #ZXing_scanner > .d-flex:first-child > div::after {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  top: 16%;
  z-index: 1;
  height: 2px;
  border-radius: 2px;
  background: var(--ffl-accent-lift);
  box-shadow: 0 0 12px 2px color-mix(in srgb, var(--ffl-accent-lift) 60%, transparent);
  pointer-events: none;
  animation: ffl-scan-line 2.6s ease-in-out infinite alternate;
}

@keyframes ffl-scan-line {
  from {
    top: 16%;
  }
  to {
    top: calc(84% - 2px);
  }
}

/* Injected camera select */
.ffl-scan #ZXing_scanner .w-500px {
  width: 100% !important;
}

.ffl-scan #ZXing_scanner > .d-flex.mb-5 {
  margin-bottom: 16px !important;
}

.ffl-scan #sourceSelect {
  height: 56px;
  border: 1px solid var(--ffl-border);
  border-radius: var(--ffl-radius);
  background-color: var(--ffl-field-bg);
  color: var(--ffl-ink);
  font-family: inherit;
  font-size: 15px;
  box-shadow: none;
}

.ffl-scan #sourceSelect:focus {
  border-color: var(--ffl-accent);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ffl-accent) 16%, transparent);
}

.ffl-scan #sourceSelect ~ label {
  color: var(--ffl-muted);
}

/* Injected Reset / Start buttons */
.ffl-scan #ZXing_scanner > .d-flex.mt-3 {
  gap: 12px;
  margin-top: 0 !important;
}

.ffl-scan #resetButton,
.ffl-scan #startButton {
  flex: 1 1 0;
  height: 52px;
  margin: 0 !important;
  padding: 0 20px !important;
  border-radius: var(--ffl-radius);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  box-shadow: none;
}

.ffl-scan #startButton,
.ffl-scan #startButton:hover,
.ffl-scan #startButton:focus,
.ffl-scan #startButton:active {
  border: 1px solid var(--ffl-accent) !important;
  background: var(--ffl-accent) !important;
  color: var(--ffl-on-accent) !important;
}

.ffl-scan #startButton:hover {
  filter: brightness(1.07);
}

.ffl-scan #resetButton,
.ffl-scan #resetButton:focus,
.ffl-scan #resetButton:active {
  border: 1px solid var(--ffl-border) !important;
  background: #ffffff !important;
  color: var(--ffl-ink) !important;
}

.ffl-scan #resetButton:hover {
  background: #f9fafb !important;
}

.ffl-scan-hint {
  margin: 16px 0 0;
  color: var(--ffl-faint);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.ffl-scan-main > .ffl-signup {
  margin-top: 20px;
  color: var(--ffl-aside-muted);
}

.ffl-scan-main > .ffl-signup .ffl-link {
  color: var(--ffl-aside-ink);
}

.ffl-scan-main > .ffl-signup .ffl-link:hover {
  color: var(--ffl-accent-lift);
}

.ffl-scan-foot {
  padding: 0 16px 16px;
  color: var(--ffl-aside-faint);
  font-size: 13px;
  text-align: center;
}

/* Short desktop screens (laptops): tighter spacing and a shorter camera so the card fits */
@media (min-width: 576px) and (max-height: 820px) {
  .ffl-scan-top {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .ffl-scan-logo {
    max-height: 44px;
  }
  .ffl-scan-card {
    padding: 24px 28px;
  }
  .ffl-scan-card .ffl-head {
    margin-bottom: 16px;
  }
  .ffl-scan-card .ffl-title {
    font-size: 22px;
  }
  .ffl-scan #ZXing_scanner > .d-flex:first-child > div {
    max-height: 30vh;
  }
  .ffl-scan-hint {
    margin-top: 12px;
  }
}

@media (max-width: 575.98px) {
  .ffl-scan-top {
    padding: 16px;
  }
  .ffl-scan-logo {
    max-height: 40px;
  }
  .ffl-scan-card {
    padding: 24px 20px;
    border-radius: 20px;
  }
  .ffl-scan #ZXing_scanner > .d-flex:first-child > div {
    aspect-ratio: 1 / 1;
  }
}

/* --------------------------------------------------------------------------
   Sign-in / forgot-password state (set by form-validation.login.js)
   -------------------------------------------------------------------------- */

.ffl .login-forgot,
.ffl.login-forgot-on .login-signin {
  display: none;
}

.ffl.login-forgot-on .login-forgot {
  display: block;
}

@keyframes ffl-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ffl-card {
    animation: none;
  }
  .ffl-showcase-stack,
  .ffl-stamp--on,
  .ffl-mini-chart span,
  .ffl-branch-bar span {
    animation: none;
  }
  .ffl-stamp--next::after,
  .ffl-live::after,
  .ffl-sync-track::after {
    display: none;
  }
  .ffl-scan #ZXing_scanner > .d-flex:first-child > div::after {
    animation: none;
  }
  .ffl *,
  .ffl *::before,
  .ffl *::after {
    transition: none !important;
  }
}

/* --------------------------------------------------------------------------
   Tablet and phone: aside becomes a header, the form slides over it
   -------------------------------------------------------------------------- */

/* Short desktop screens (laptops, or 125% display scaling): tighter aside so it fits without scrolling */
@media (min-width: 992px) and (max-height: 860px) {
  .ffl-aside {
    gap: 28px;
    padding-top: 32px;
    padding-bottom: 28px;
  }
  .ffl-aside-logo img {
    max-height: 72px;
  }
  .ffl-chip {
    margin-bottom: 18px;
  }
  .ffl-hero {
    margin-bottom: 14px;
  }
  .ffl-lead {
    margin-bottom: 24px;
  }
  .ffl-perks {
    gap: 10px;
  }
  .ffl-perk {
    padding: 12px 18px 12px 16px;
  }
  .ffl-main {
    padding-top: 28px;
    padding-bottom: 20px;
  }
  .ffl-card {
    padding: 8px 0;
  }
  .ffl-head {
    margin-bottom: 24px;
  }
  .ffl-help {
    margin-top: 16px;
  }
}

/* Very short desktop screens: drop the intro paragraph (the perk cards say the same) and shrink the headline */
@media (min-width: 992px) and (max-height: 700px) {
  .ffl-lead {
    display: none;
  }
  .ffl-hero {
    margin-bottom: 22px;
    font-size: clamp(30px, 3vw, 44px);
  }
}

/* Below 1360px there is no room right of the aside text for the card showcase */
@media (max-width: 1359.98px) {
  .ffl .ffl-showcase {
    display: none;
  }
}

@media (max-width: 1199.98px) {
  .ffl-main {
    width: 46%;
  }
  .ffl-perk-text {
    font-size: 13px;
  }
}

@media (max-width: 991.98px) {
  .ffl {
    flex-direction: column;
    background: var(--ffl-aside-bg);
  }

  .ffl-aside {
    flex: 0 0 auto;
    gap: 28px;
    padding: 32px 24px 72px;
  }

  .ffl-aside-logo img {
    max-height: 60px;
    max-width: 180px;
  }

  .ffl-chip {
    margin-bottom: 16px;
  }

  .ffl-hero {
    margin: 0;
    font-size: 30px;
  }

  .ffl-lead,
  .ffl-perks,
  .ffl-aside-foot {
    display: none;
  }

  .ffl-main {
    flex: 1 0 auto;
    width: 100%;
    margin-top: -36px;
    padding: 32px 24px 28px;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -12px 32px -20px rgba(0, 0, 0, 0.35);
  }

  .ffl-card {
    margin: 0 auto;
    padding: 0;
  }

  .ffl-head {
    margin-bottom: 28px;
  }

  .ffl-title {
    font-size: 26px;
  }
}

@media (max-width: 575.98px) {
  .ffl-aside {
    padding: 24px 20px 64px;
  }

  .ffl-hero {
    font-size: 26px;
  }

  .ffl-main {
    padding: 28px 20px 24px;
  }
}

/* Staff sign-in only: leave room for the form on small phones. Use the small
   viewport so browser chrome does not push the action below the screen.
   Content can still grow when validation, zoom or the keyboard needs a scroll. */
.ffl--staff-login {
  min-height: 100svh;
}

@media (max-width: 575.98px) {
  .ffl--staff-login .ffl-aside {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 48px;
  }

  .ffl--staff-login .ffl-aside-logo img {
    max-width: 140px;
    max-height: 40px;
  }

  .ffl--staff-login .ffl-aside-body {
    display: contents;
  }

  .ffl--staff-login .ffl-chip {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    margin: 0;
    padding: 7px 10px;
    font-size: 10px;
  }

  .ffl--staff-login .ffl-hero {
    grid-column: 1 / -1;
  }

  .ffl--staff-login .ffl-main {
    margin-top: -24px;
    padding: 20px 20px 16px;
  }

  .ffl--staff-login .ffl-head,
  .ffl--staff-login .form-group {
    margin-bottom: 16px;
  }

  .ffl--staff-login .ffl-subtitle {
    font-size: 14px;
    line-height: 1.5;
  }

  .ffl--staff-login .ffl-input {
    font-size: 16px;
  }

  .ffl--staff-login .ffl-check {
    min-height: 28px;
    margin: 0 0 16px;
  }

  .ffl--staff-login .ffl-help {
    margin-top: 16px;
    font-size: 12px;
  }
}

@media (max-width: 575.98px) and (max-height: 740px) {
  .ffl--staff-login .ffl-hero {
    display: none;
  }
}

@media (max-width: 575.98px) and (max-height: 600px) {
  .ffl--staff-login .ffl-aside {
    padding: 12px 20px 36px;
  }

  .ffl--staff-login .ffl-main {
    padding: 16px 20px 12px;
  }

  .ffl--staff-login .ffl-help {
    margin-top: 12px;
  }
}

/* Landscape phones: use the available width instead of stacking the brand
   above the form. Keep both fields and the primary action in normal flow. */
@media (max-width: 991.98px) and (max-height: 500px) and (orientation: landscape) {
  .ffl--staff-login {
    flex-direction: row;
  }

  .ffl--staff-login .ffl-aside {
    flex: 0 0 30%;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
  }

  .ffl--staff-login .ffl-aside-body {
    display: flex;
  }

  .ffl--staff-login .ffl-aside-logo img {
    max-width: 100%;
    max-height: 48px;
  }

  .ffl--staff-login .ffl-chip {
    margin: 0;
  }

  .ffl--staff-login .ffl-hero {
    display: none;
  }

  .ffl--staff-login .ffl-main {
    flex: 1 1 70%;
    min-width: 0;
    width: 70%;
    margin: 0;
    padding: 12px;
    border-radius: 24px 0 0 24px;
  }

  .ffl--staff-login .ffl-card {
    max-width: 100%;
    margin: auto;
  }

  .ffl--staff-login .ffl-head {
    margin-bottom: 8px;
  }

  .ffl--staff-login .ffl-head .ffl-subtitle {
    display: none;
  }

  .ffl--staff-login #kt_login_signin_form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .ffl--staff-login .form-group {
    min-width: 0;
    margin-bottom: 0;
  }

  .ffl--staff-login .ffl-label-row {
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
  }

  .ffl--staff-login .ffl-input,
  .ffl--staff-login .ffl-btn {
    height: 44px;
  }

  .ffl--staff-login .ffl-input {
    font-size: 16px;
  }

  .ffl--staff-login .ffl-check {
    grid-column: 1 / -1;
    min-height: 24px;
    margin: 0;
  }

  .ffl--staff-login #kt_login_signin_submit {
    grid-column: 1 / -1;
  }

  .ffl--staff-login #kt_login_signin_form > p {
    grid-column: 1 / -1;
  }

  .ffl--staff-login .ffl-help {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.4;
  }
}
