/* /connect/admin/live-board/live-board.css — Attendance Live Board v3
 * Themed against the shared Bible Connect design system
 * (/connect/connect-tokens.css). Local --lb-* variables inherit the active
 * .bcc-app theme and accent through --bcc-* tokens.
 */

/* ── Reset / Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* Guard against any horizontal page scroll at 320px / 200% zoom. */
html { overflow-x: clip; }

.lb-body {
  --lb-bg: var(--bcc-bg);
  --lb-surface: var(--bcc-surface-1);
  --lb-surface-2: var(--bcc-surface-2);
  --lb-surface-3: var(--bcc-surface-3);
  --lb-ink: var(--bcc-ink);
  --lb-ink-2: var(--bcc-ink-2);
  --lb-ink-3: var(--bcc-ink-3);
  --lb-border: var(--bcc-border);
  --lb-border-soft: var(--bcc-border-soft);
  --lb-border-strong: var(--bcc-border-strong);
  --lb-primary: var(--bcc-primary);
  --lb-primary-hover: var(--bcc-primary-hover);
  --lb-primary-soft: var(--bcc-primary-soft);
  --lb-primary-tint: var(--bcc-primary-tint);
  --lb-secondary: var(--bcc-secondary);
  --lb-success: var(--bcc-success);
  --lb-success-soft: var(--bcc-success-soft);
  --lb-danger: var(--bcc-danger);
  --lb-accent: var(--bcc-accent);
  --lb-accent-ink: var(--bcc-bg);
  --lb-shadow-1: var(--bcc-shadow-1);
  --lb-shadow-2: var(--bcc-shadow-2);
  --lb-shadow-3: var(--bcc-shadow-3);
  --lb-shadow-glow: var(--bcc-shadow-glow);
  --lb-hero-h: 220px;
  --lb-r-full: 50%;
  margin: 0;
  padding: 0;
  background: var(--lb-bg);
  color: var(--lb-ink);
  font-family: var(--bcc-font);
  font-size: var(--bcc-t-md);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.lb-body.bcc-light,
.lb-body.theme-light,
.lb-body.bcc-theme-sanctuary,
.lb-body.bcc-theme-morning-light,
.lb-body.bcc-theme-garden {
  --lb-accent-ink: var(--bcc-ink);
}

.lb-body [hidden] { display: none !important; }

/* ── Full-screen centering utility ───────────────────────────────────────── */
.lb-fullscreen-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  gap: 12px;
  padding: 32px 24px;
  text-align: center;
  color: var(--lb-ink-2);
}

.lb-no-session-icon {
  font-size: 48px;
  margin-bottom: 4px;
}

.lb-fullscreen-center h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
  color: var(--lb-ink-2);
}

.lb-fullscreen-center p {
  margin: 0 0 16px;
  font-size: 15px;
}

/* Loading spinner */
.adm-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bcc-border-strong);
  border-top-color: var(--bcc-primary);
  border-radius: var(--lb-r-full);
  animation: lb-spin 0.7s linear infinite;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.lb-body .lb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--bcc-s2);
  height: 44px;
  padding: 0 var(--bcc-s5);
  border-radius: var(--bcc-r-md);
  border: 1px solid transparent;
  font-size: var(--bcc-t-sm);
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--bcc-dur-2) var(--bcc-ease),
              color var(--bcc-dur-2) var(--bcc-ease),
              border-color var(--bcc-dur-2) var(--bcc-ease),
              opacity var(--bcc-dur-2) var(--bcc-ease),
              box-shadow var(--bcc-dur-2) var(--bcc-ease),
              transform var(--bcc-dur-2) var(--bcc-ease);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  user-select: none;
}

.lb-body .lb-btn:focus-visible {
  outline: none;
  box-shadow: var(--bcc-focus);
}

.lb-body .lb-btn:active { transform: scale(0.97); }

.lb-body .lb-btn-primary {
  background: linear-gradient(180deg, var(--bcc-primary), var(--bcc-primary-hover));
  color: var(--lb-ink);
  box-shadow: var(--bcc-shadow-1);
}
.lb-body .lb-btn-primary:hover {
  background: linear-gradient(180deg, var(--bcc-primary-hover), var(--bcc-primary-hover));
  transform: translateY(-1px);
  box-shadow: var(--bcc-shadow-2);
}
.lb-body .lb-btn-primary:active { transform: translateY(0); box-shadow: var(--bcc-shadow-1); }

.lb-body .lb-btn-outline {
  background: var(--bcc-surface-3);
  color: var(--bcc-ink);
  border-color: var(--bcc-border-strong);
}
.lb-body .lb-btn-outline:hover {
  background: var(--bcc-surface-4);
  border-color: var(--bcc-border-strong);
}

.lb-body .lb-btn-danger {
  background: var(--bcc-danger);
  color: var(--lb-ink);
  border-color: var(--bcc-danger);
}
.lb-body .lb-btn-danger:hover { filter: brightness(1.1); }

.lb-body .lb-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Hero counter section ─────────────────────────────────────────────────── */
.lb-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--bcc-s3);
  padding: var(--bcc-s8) var(--bcc-s5) var(--bcc-s6);
  padding-top: max(var(--bcc-s8), env(safe-area-inset-top, 0px));
  background:
    radial-gradient(120% 140% at 50% -20%, var(--bcc-primary-soft), transparent 60%),
    var(--bcc-surface-1);
  border-bottom: 1px solid var(--bcc-border);
  text-align: center;
  min-height: var(--lb-hero-h);
}

.lb-hero-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 72rem;
  min-width: 0;
  gap: var(--bcc-s1);
}

.lb-hero-counter-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--bcc-s3);
}

.lb-hero-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 148px;
  height: 148px;
  border-radius: var(--lb-r-full);
  background: radial-gradient(circle at 50% 45%, var(--bcc-primary-soft), transparent 70%);
  border: 3px solid var(--bcc-success);
  box-shadow: 0 0 0 6px var(--bcc-success-soft), var(--bcc-shadow-glow);
  animation: lb-ring-pulse 2.5s ease-in-out infinite;
}

@keyframes lb-ring-pulse {
  0%, 100% {
    box-shadow: 0 0 0 6px var(--bcc-success-soft), var(--bcc-shadow-glow);
  }
  50% {
    box-shadow: 0 0 0 12px var(--bcc-success-soft), 0 0 44px var(--bcc-success-soft);
  }
}

.lb-hero-sub {
  display: flex;
  align-items: center;
  gap: var(--bcc-s2);
  font-size: var(--bcc-t-sm);
  color: var(--bcc-ink-2);
}

#lb-total-label {
  color: var(--bcc-ink-2);
  font-size: var(--bcc-t-sm);
}

.lb-church-name {
  font-family: var(--bcc-font-display);
  font-size: var(--bcc-t-2xl);
  font-weight: 600;
  color: var(--bcc-ink);
  letter-spacing: 0.005em;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-session-label {
  font-size: var(--bcc-t-sm);
  color: var(--bcc-ink-3);
  margin-top: 2px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--bcc-t-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bcc-success);
}

.lb-live-dot::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: var(--lb-r-full);
  background: var(--bcc-success);
  animation: lb-pulse 1.6s ease-in-out infinite;
}

@keyframes lb-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}

.lb-counter {
  font-family: var(--bcc-font-display);
  font-size: clamp(52px, 8vw, 88px);
  font-weight: 700;
  color: var(--bcc-ink);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* ── Toolbar: actions + filters + search ─────────────────────────────────── */
.lb-toolbar {
  position: sticky;
  top: 0;
  z-index: 90;
  min-width: 0;
  background: color-mix(in srgb, var(--lb-bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--lb-border);
  padding: var(--bcc-s3) var(--bcc-s4);
  padding-top: max(var(--bcc-s3), env(safe-area-inset-top, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--bcc-s3);
}

.lb-toolbar-actions {
  display: flex;
  gap: var(--bcc-s2);
  align-items: center;
  flex-wrap: wrap;
}

/* Reuse existing .lb-filter-bar styles but it's now inside .lb-toolbar */
.lb-toolbar .lb-filter-bar {
  position: static;
  top: unset;
  min-width: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
  padding: 0;
  margin-top: 0;
}

/* Search inside toolbar */
.lb-toolbar .lb-search {
  width: 100%;
  min-width: 0;
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.lb-filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.lb-filter-bar::-webkit-scrollbar { display: none; }

.lb-body .lb-filter-btn {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 var(--bcc-s4);
  border-radius: var(--bcc-r-pill);
  border: 1px solid var(--bcc-border-strong);
  background: var(--bcc-surface-2);
  color: var(--bcc-ink-3);
  font-size: var(--bcc-t-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--bcc-dur-2) var(--bcc-ease),
              color var(--bcc-dur-2) var(--bcc-ease),
              border-color var(--bcc-dur-2) var(--bcc-ease);
}

.lb-body .lb-filter-btn.active {
  background: var(--bcc-primary-soft);
  border-color: var(--bcc-primary);
  color: var(--bcc-primary);
}

.lb-body .lb-filter-btn:focus-visible {
  outline: none;
  box-shadow: var(--bcc-focus);
}

.lb-body .lb-filter-btn:hover:not(.active) {
  background: var(--bcc-surface-3);
  border-color: var(--bcc-border-strong);
  color: var(--bcc-ink);
}

/* ── Search bar ──────────────────────────────────────────────────────────── */
.lb-search {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--bcc-s4);
  border-radius: var(--bcc-r-pill);
  border: 1px solid var(--bcc-border-strong);
  background: var(--bcc-surface-2);
  color: var(--bcc-ink);
  font-size: var(--bcc-t-md);
  font-family: inherit;
  outline: none;
  transition: border-color var(--bcc-dur-1) var(--bcc-ease),
              box-shadow var(--bcc-dur-1) var(--bcc-ease);
  -webkit-appearance: none;
}

.lb-search::placeholder { color: var(--bcc-ink-3); }
.lb-search:focus {
  border-color: var(--bcc-primary);
  box-shadow: 0 0 0 3px var(--bcc-primary-tint);
}

/* ── Roster grid ─────────────────────────────────────────────────────────── */
.lb-roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: var(--bcc-s3);
  padding: var(--bcc-s3) var(--bcc-s3) var(--bcc-s20);
}

/* ── Member tile ─────────────────────────────────────────────────────────── */
.lb-body .lb-member-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--bcc-s2);
  min-height: 44px;
  background: var(--bcc-surface-1);
  border: 1px solid var(--bcc-border);
  padding: var(--bcc-s3) var(--bcc-s2);
  border-radius: var(--bcc-r-lg);
  cursor: pointer;
  transition: transform var(--bcc-dur-2) var(--bcc-ease),
              background var(--bcc-dur-2) var(--bcc-ease),
              border-color var(--bcc-dur-2) var(--bcc-ease),
              box-shadow var(--bcc-dur-2) var(--bcc-ease);
  color: var(--bcc-ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  box-shadow: var(--bcc-shadow-1);
}

.lb-body .lb-member-tile:hover {
  background: var(--bcc-surface-2);
  border-color: var(--bcc-border-strong);
  transform: translateY(-2px);
  box-shadow: var(--bcc-shadow-2);
}
.lb-body .lb-member-tile:active       { transform: scale(0.96); }
.lb-body .lb-member-tile:focus-visible {
  outline: none;
  box-shadow: var(--bcc-focus);
}

.lb-body .lb-member-tile.checked-in {
  opacity: 1;
  border-color: var(--bcc-success-soft);
  background: var(--bcc-surface-1);
}

.lb-body .lb-member-tile:not(.checked-in) {
  border: 1px solid var(--bcc-border);
  border-radius: var(--bcc-r-lg);
}

.lb-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--lb-r-full);
  flex-shrink: 0;
}

.lb-body .lb-avatar-img,
.lb-body .lb-avatar-initials {
  width: 80px;
  height: 80px;
  border-radius: var(--lb-r-full);
  object-fit: cover;
  font-size: var(--bcc-t-2xl);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lb-ink);
  box-shadow: 0 0 0 1px var(--bcc-border);
}

/* Success ring when checked in */
.lb-body .lb-member-tile.checked-in .lb-avatar-wrap {
  box-shadow: 0 0 0 3px var(--bcc-success), 0 0 0 6px var(--bcc-success-soft);
  border-radius: var(--lb-r-full);
}

/* Checkmark overlay */
.lb-check-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--lb-r-full);
  background: color-mix(in srgb, var(--bcc-success) 72%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--bcc-t-2xl);
  color: var(--lb-ink);
  font-weight: 900;
}

/* First-time badge */
.lb-ft-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--bcc-accent);
  color: var(--lb-accent-ink);
  font-size: var(--bcc-t-xs);
  font-weight: 700;
  border-radius: var(--bcc-r-pill);
  padding: 1px var(--bcc-s2);
  letter-spacing: 0.04em;
  line-height: 1.5;
  border: 2px solid var(--bcc-surface-1);
}

.lb-member-name {
  font-size: var(--bcc-t-sm);
  font-weight: 500;
  text-align: center;
  color: var(--bcc-ink-2);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

/* Success flash animation */
.lb-success-flash { animation: lb-flash 0.8s ease; }
@keyframes lb-flash {
  0%   { background: var(--bcc-success-soft); }
  100% { background: var(--bcc-surface-1); }
}

/* ── Walk-in / Close session modals ──────────────────────────────────────── */
.lb-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(var(--bcc-s5), env(safe-area-inset-top, 0px))
           max(var(--bcc-s5), env(safe-area-inset-right, 0px))
           max(var(--bcc-s5), env(safe-area-inset-bottom, 0px))
           max(var(--bcc-s5), env(safe-area-inset-left, 0px));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lb-modal {
  background: var(--bcc-surface-1);
  border: 1px solid var(--bcc-border-soft);
  border-radius: var(--bcc-r-lg);
  padding: var(--bcc-s6);
  width: 100%;
  max-width: 400px;
  max-height: calc(100dvh - 2 * var(--bcc-s5) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  box-shadow: var(--bcc-shadow-3);
  animation: lb-modal-in var(--bcc-dur-3) var(--bcc-ease-spring);
}

@keyframes lb-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lb-modal h3 {
  margin: 0 0 var(--bcc-s5);
  font-family: var(--bcc-font-display);
  font-size: var(--bcc-t-xl);
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--bcc-ink);
}

.lb-field { margin-bottom: var(--bcc-s4); }

.lb-field label {
  display: block;
  font-size: var(--bcc-t-xs);
  font-weight: 600;
  color: var(--bcc-ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--bcc-s2);
}

.lb-input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--bcc-s4);
  border-radius: var(--bcc-r-sm);
  border: 1px solid var(--bcc-border-strong);
  background: var(--bcc-surface-2);
  color: var(--bcc-ink);
  font-size: var(--bcc-t-md);
  font-family: inherit;
  outline: none;
  transition: border-color var(--bcc-dur-1) var(--bcc-ease),
              box-shadow var(--bcc-dur-1) var(--bcc-ease);
  -webkit-appearance: none;
}
.lb-input::placeholder { color: var(--bcc-ink-3); }
.lb-input:focus {
  border-color: var(--bcc-primary);
  box-shadow: 0 0 0 3px var(--bcc-primary-tint);
}

/* Native date input: restore the picker affordance (base .lb-input removes
   the native appearance) and keep a 44px tap target at every breakpoint. */
.lb-body .lb-input[type="date"] {
  -webkit-appearance: auto;
  appearance: auto;
  min-height: 44px;
  line-height: 1.2;
  cursor: pointer;
}
.lb-body .lb-input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.75;
}

.lb-check-row {
  display: flex;
  align-items: center;
  gap: var(--bcc-s3);
  min-height: 44px;
  margin-bottom: var(--bcc-s4);
  font-size: var(--bcc-t-sm);
  color: var(--bcc-ink-2);
  cursor: pointer;
  user-select: none;
}
.lb-check-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--bcc-primary);
  flex-shrink: 0;
}

.lb-modal-actions {
  display: flex;
  gap: var(--bcc-s3);
  margin-top: var(--bcc-s1);
}
.lb-body .lb-modal-actions .lb-btn { flex: 1; }

/* Error text used in walk-in modal */
.lb-pin-error {
  font-size: var(--bcc-t-sm);
  color: var(--bcc-danger);
  margin-top: var(--bcc-s1);
  min-height: 20px;
}

/* ── Main board layout ───────────────────────────────────────────────────── */
#lb-main {
  /* hero + toolbar flow naturally; grid below */
}

/* ── Safe area bottom padding for grid ───────────────────────────────────── */
.lb-roster-grid {
  padding-bottom: calc(var(--bcc-s20) + env(safe-area-inset-bottom, 0px));
}

/* ── Responsive: larger tiles on tablet+ ─────────────────────────────────── */
@media (min-width: 600px) {
  .lb-roster-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--bcc-s4);
    padding: var(--bcc-s4) var(--bcc-s5) var(--bcc-s20);
  }
  .lb-avatar-wrap,
  .lb-body .lb-avatar-img,
  .lb-body .lb-avatar-initials {
    width: 88px;
    height: 88px;
  }
  .lb-body .lb-avatar-initials { font-size: var(--bcc-t-2xl); }
  .lb-check-overlay   { font-size: var(--bcc-t-3xl); }
  .lb-member-name     { font-size: var(--bcc-t-sm); max-width: 96px; }
}

/* Tablet (768–1024): toolbar lays out horizontally to use the width */
@media (min-width: 768px) {
  .lb-hero { padding: var(--bcc-s10) var(--bcc-s6) var(--bcc-s8); }
  .lb-hero-ring { width: 160px; height: 160px; }
  .lb-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--bcc-s3);
    padding: var(--bcc-s3) var(--bcc-s6);
  }
  .lb-toolbar-actions { grid-column: 1; flex-shrink: 0; }
  .lb-toolbar .lb-filter-bar { grid-column: 1 / -1; }
  .lb-toolbar .lb-search {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    margin: 0;
  }
}

@media (min-width: 900px) {
  .lb-toolbar {
    grid-template-columns: auto minmax(0, 1fr) 220px;
    padding: var(--bcc-s3) var(--bcc-s8);
  }
  .lb-toolbar .lb-filter-bar { grid-column: 2; grid-row: 1; }
  .lb-toolbar .lb-search { grid-column: 3; grid-row: 1; }
  .lb-body .lb-filter-btn { padding: 0 var(--bcc-s3); }
  .lb-roster-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--bcc-s4);
    padding: var(--bcc-s4) var(--bcc-s6) var(--bcc-s20);
  }
}

/* Large desktop (>=1440): wider gutters + denser grid, no overflow */
@media (min-width: 1440px) {
  .lb-hero { padding: var(--bcc-s12) var(--bcc-s8) var(--bcc-s10); }
  .lb-hero-ring { width: 176px; height: 176px; }
  .lb-toolbar {
    grid-template-columns: auto minmax(0, 1fr) 280px;
    padding: var(--bcc-s3) var(--bcc-s12);
  }
  .lb-roster-grid {
    grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
    gap: var(--bcc-s5);
    padding: var(--bcc-s5) var(--bcc-s12) var(--bcc-s20);
  }
  .lb-avatar-wrap,
  .lb-body .lb-avatar-img,
  .lb-body .lb-avatar-initials {
    width: 96px;
    height: 96px;
  }
}

/* ── iOS focus zoom: keep inputs at >=16px on small screens ─────────────── */
@media (max-width: 767px) {
  .lb-body .lb-search,
  .lb-body .lb-input { font-size: 16px; }
}

