/* =====================================================================
   Bradley Farm Pool Pass — Design System
   Mirrors the bradleyfarm.org brand (Georgia headings, system sans body)
   ===================================================================== */

/* ----- Reset / Base -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #222;
  background: #f5f5f5;
}

a { color: #1480b0; text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.25;
  color: #17551e;
}

/* ----- Layout -------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.container--narrow { max-width: 720px; }
.container--wide   { max-width: 1300px; }

/* ----- Header -------------------------------------------------------- */
header {
  background: #17551e;
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,.25);
}

header .container {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.site-logo-link { display: flex; align-items: center; flex-shrink: 0; text-decoration: none; }
.site-logo      { height: 40px; width: auto; }

.site-brand {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.site-title {
  font-family: Georgia, serif;
  font-size: 0.95rem;
  font-weight: normal;
  color: #a8d5b5;
  border-left: 1px solid rgba(255,255,255,0.25);
  padding-left: 12px;
  margin-left: 4px;
  flex: 1;
}

header nav { display: flex; gap: 4px; margin-left: auto; }

header nav a {
  color: #d4edda;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.15s;
}

header nav a:hover,
header nav a.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  text-decoration: none;
}

.header-user {
  font-size: 0.8rem;
  color: #a8d5b5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* ----- Footer -------------------------------------------------------- */
footer {
  background: #0a3c52;
  color: #c8dce6;
  text-align: center;
  padding: 20px 16px;
  font-size: 0.85rem;
  margin-top: auto;
}

footer a { color: #7fc8d8; }

/* ----- Page shell ---------------------------------------------------- */
.page-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding: 24px 0 40px;
}

/* ----- Page header --------------------------------------------------- */
.page-header {
  background: #fff;
  border-bottom: 3px solid #17551e;
  padding: 20px 0;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 1.6rem; color: #17551e; }
.page-header p  { color: #555; margin-top: 4px; }

/* ----- Cards --------------------------------------------------------- */
.card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.card--accent { border-left: 4px solid #810d3f; }
.card--green  { border-left: 4px solid #17551e; }
.card--warn   { border-left: 4px solid #e07b00; }
.card--error  { border-left: 4px solid #c0392b; }

.card-title {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  color: #17551e;
  margin-bottom: 12px;
}

/* ----- Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover        { filter: brightness(1.1); text-decoration: none; }
.btn:active       { filter: brightness(0.95); }
.btn:disabled     { opacity: 0.55; cursor: not-allowed; }

.btn-primary   { background: #17551e; color: #fff; }
.btn-secondary { background: #0a3c52; color: #fff; }
.btn-accent    { background: #810d3f; color: #fff; }
.btn-danger    { background: #c0392b; color: #fff; }
.btn-outline   { background: transparent; color: #17551e; border: 2px solid #17551e; }
.btn-ghost     { background: transparent; color: #555; border: 2px solid #ccc; }
.btn-danger-ghost { background: transparent; color: #c0392b; border: 2px solid #c0392b; }
.btn-danger-ghost:hover { background: #c0392b; color: #fff; }
.btn-sm        { padding: 5px 12px; font-size: 0.85rem; }
.btn-lg        { padding: 12px 28px; font-size: 1.1rem; }
.btn-block     { display: flex; width: 100%; justify-content: center; }

/* ----- Signer button group (waiver step) ----------------------------- */
.signer-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.signer-btn {
  flex: 1 1 auto;
  min-width: 160px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  background: #fff;
  color: #17551e;
  border: 2px solid #17551e;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-align: center;
}
.signer-btn:hover  { background: #eaf3eb; }
.signer-btn.selected {
  background: #17551e;
  color: #fff;
  border-color: #17551e;
}

/* ----- Forms --------------------------------------------------------- */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 5px;
  color: #333;
}

label .required { color: #c0392b; margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #222;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #17551e;
  box-shadow: 0 0 0 3px rgba(23,85,30,.12);
}

.input-error { border-color: #c0392b !important; }
.form-error  { color: #c0392b; font-size: 0.85rem; margin-top: 4px; }
.form-hint   { color: #666; font-size: 0.85rem; margin-top: 4px; }

textarea { resize: vertical; min-height: 80px; }

.checkbox-group { display: flex; align-items: flex-start; gap: 10px; }
.checkbox-group input[type="checkbox"] { width: auto; margin-top: 3px; flex-shrink: 0; }

/* ----- Tables -------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: 6px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fff;
}

th {
  background: #17551e;
  color: #fff;
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  white-space: nowrap;
}

td { padding: 9px 12px; border-bottom: 1px solid #e8e8e8; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f0f7f0; }

/* ----- Status badges ------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-registered   { background: #e8f4fd; color: #1480b0; }
.badge-active       { background: #d4edda; color: #155724; }
.badge-pending      { background: #fff3cd; color: #7d5c00; }
.badge-approved     { background: #d4edda; color: #155724; }
.badge-suspended    { background: #f8d7da; color: #721c24; }
.badge-safety-hold  { background: #f8d7da; color: #721c24; }
.badge-ineligible   { background: #e2e3e5; color: #383d41; }
.badge-superseded   { background: #e2e3e5; color: #383d41; }
.badge-warning      { background: #fff3cd; color: #7d5c00; }
.badge-ejection     { background: #fde8d8; color: #8a3a00; }
.badge-temporary-exclusion { background: #fde8d8; color: #8a3a00; }
.badge-suspension   { background: #f8d7da; color: #721c24; }
.badge-revoked      { background: #e2e3e5; color: #383d41; text-decoration: line-through; }
.badge-standard     { background: #e8f4fd; color: #0a3c52; }
.badge-junior       { background: #fff4cc; color: #7a5800; }
.badge-caregiver    { background: #eee8f7; color: #4a0e8f; }

/* Enforcement history table — revoked rows are visually de-emphasized. */
.enf-revoked td { color: #888; }
.enf-revoked .enf-rule, .enf-revoked .enf-desc { text-decoration: line-through; }

/* Arms reach indicator */
.arms-reach {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fde8d8;
  color: #8a3a00;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Swim test required indicator */
.needs-swim-test {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Visited today indicator (card badge) */
.visited-today {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #dcfce7;
  color: #166534;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Today's visit list in member detail drawer */
.visit-list {
  margin: 0;
  padding: 0 0 0 1.2em;
  font-size: 0.88rem;
  color: #333;
  line-height: 1.8;
}

/* ----- Alerts / notices ------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.alert-info    { background: #e8f4fd; border-left: 4px solid #1480b0; color: #0a3c52; }
.alert-success { background: #d4edda; border-left: 4px solid #17551e; color: #155724; }
.alert-warning { background: #fff3cd; border-left: 4px solid #e07b00; color: #7d5c00; }
.alert-danger  { background: #f8d7da; border-left: 4px solid #c0392b; color: #721c24; }

/* ----- Search / filter bar ------------------------------------------- */
.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.search-bar input { flex: 1; }

/* ----- Member card (check-in UI) ------------------------------------- */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.member-card {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.member-card.selected {
  border-color: #17551e;
  border-width: 3px;
  box-shadow: 0 0 0 3px rgba(23,85,30,.2);
  background: #f4fbf5;
}

/* Check mark shown on selected cards (top-left corner, opposite the info icon) */
.card-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  background: #17551e;
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  pointer-events: none;
  line-height: 1;
}
.member-card.selected .card-check { display: flex; }

.member-card.denied {
  border-color: #c0392b;
  background: #fff5f5;
  cursor: not-allowed;
  opacity: 0.8;
}

/* Highlight junior pass holders so lifeguards can spot them easily */
.member-card[data-pass-type="junior"] {
  border-left-width: 6px;
  border-left-color: #f5b800;
}

.member-card .member-photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 8px;
  background: #e0e0e0;
}

.member-info-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #e8f3eb;
  border: 1px solid #a8cdb0;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: #17551e;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.member-info-btn::before {
  /* Invisible tap-area extension so near-misses don't toggle selection */
  content: '';
  position: absolute;
  inset: -8px;
}
.member-info-btn svg { pointer-events: none; }
.member-info-btn:hover { background: #17551e; color: #fff; border-color: #17551e; }

/* ----- Member detail drawer (check-in) ------------------------------ */
.detail-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.detail-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 100vw;
  background: #fff;
  z-index: 1000;
  padding: 24px 20px;
  overflow-y: auto;
  box-shadow: -4px 0 24px rgba(0,0,0,0.18);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.detail-drawer.open {
  transform: translateX(0);
}

.detail-drawer .drawer-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: #555;
  padding: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.detail-drawer .drawer-close:hover { color: #c0392b; background: #fef0f0; }

.member-detail-photo {
  width: 100%;
  max-height: 320px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  margin: 0 0 12px;
  background: #e0e0e0;
}

.detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 0.88rem;
  margin: 8px 0 0;
}
.detail-list dt { font-weight: 600; color: #555; white-space: nowrap; }
.detail-list dd { margin: 0; color: #222; }

.member-card .member-name {
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.member-card .member-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 6px;
}

.member-card .denial-reason {
  text-align: center;
  font-size: 0.8rem;
  color: #c0392b;
  font-weight: 600;
  margin-top: 4px;
}

/* ----- Check-in flow ------------------------------------------------- */
.checkin-summary {
  border: 2px solid #17551e;
  border-radius: 8px;
  padding: 16px;
  background: #f0f7f0;
  margin-top: 16px;
}

.guest-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.guest-input-row input[type="number"] {
  width: 80px;
}

.guest-remaining {
  font-size: 0.85rem;
  color: #555;
}

/* ----- Collapsible accordion ----------------------------------------- */
.accordion-toggle {
  width: 100%;
  text-align: left;
  background: #f0f7f0;
  border: 1px solid #c3e0c8;
  border-radius: 4px;
  padding: 10px 14px;
  font-weight: 600;
  color: #17551e;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-toggle::after { content: "▾"; font-size: 0.8em; }
.accordion-toggle.open::after { content: "▴"; }

.accordion-body {
  border: 1px solid #c3e0c8;
  border-top: none;
  border-radius: 0 0 4px 4px;
  padding: 14px;
  display: none;
}

.accordion-body.open { display: block; }

/* ----- Calendar (party reservations) --------------------------------- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #555;
  padding: 4px;
  text-transform: uppercase;
}

.calendar-day {
  border: 1px solid #ddd;
  border-radius: 4px;
  min-height: 72px;
  padding: 4px;
  background: #fff;
  font-size: 0.8rem;
}

.calendar-day.empty { background: transparent; border-color: transparent; }
.calendar-day.closed { background: #f0f0f0; color: #aaa; }
.calendar-day.past { background: #f8f8f8; color: #bbb; }

.calendar-day .day-num {
  font-weight: 700;
  margin-bottom: 2px;
  color: #333;
}

.time-block {
  display: block;
  padding: 1px 4px;
  border-radius: 3px;
  margin-bottom: 1px;
  font-size: 0.72rem;
  cursor: pointer;
}

.time-block.available { background: #d4edda; color: #155724; }
.time-block.booked    { background: #e2e3e5; color: #555; cursor: not-allowed; }

/* ----- Photo capture ------------------------------------------------- */
.photo-capture-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#camera-preview, #photo-canvas {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  object-fit: cover;
  background: #333;
  border: 3px solid #17551e;
}

/* ----- Loading spinner ----------------------------------------------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.spinner--green {
  border-color: rgba(23,85,30,.2);
  border-top-color: #17551e;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Utility ------------------------------------------------------- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: #888; }
.text-danger { color: #c0392b; }
.text-success{ color: #17551e; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

.hidden { display: none !important; }

/* ----- Touch / iPad optimisation (pointer: coarse = touch-primary) -- */
@media (pointer: coarse) {
  /* Buttons */
  .btn    { padding: 12px 24px; min-height: 44px; }
  .btn-sm { padding: 8px 16px;  min-height: 44px; }

  /* Signer buttons */
  .signer-btn { padding: 18px 20px; min-height: 56px; font-size: 1.1rem; }

  /* Form inputs */
  input[type="text"],
  input[type="email"],
  input[type="number"],
  input[type="date"],
  input[type="tel"],
  input[type="password"],
  select,
  textarea {
    padding: 12px 14px;
    min-height: 44px;
    font-size: 1rem;
  }

  /* Checkboxes and radios */
  .checkbox-group {
    min-height: 44px;
    align-items: center;
    gap: 12px;
  }
  .checkbox-group input[type="checkbox"],
  .checkbox-group input[type="radio"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }

  /* Search results */
  .search-bar { gap: 10px; }
  .result-item { padding: 14px 16px; }

  /* Check-in: member info button */
  .member-info-btn {
    width: 44px;
    height: 44px;
  }

  /* Check-in: fly-in drawer close button */
  .detail-drawer .drawer-close {
    width: 44px;
    height: 44px;
  }

  /* Check-in: back link */
  .back-link {
    min-height: 44px;
    padding: 8px 0;
    font-size: 1.05rem;
  }

  /* Activate: step indicator tabs */
  .step {
    padding: 14px 8px;
    font-size: 0.9rem;
  }
}

/* ----- Responsive ---------------------------------------------------- */
@media (max-width: 768px) {
  header nav a span { display: none; }
  .member-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .calendar-grid { font-size: 0.7rem; }
  .calendar-day { min-height: 56px; }
}

@media (max-width: 480px) {
  header nav { gap: 0; }
  header nav a { padding: 8px 8px; font-size: 0.82rem; }
  h1 { font-size: 1.3rem; }
  .card { padding: 14px 16px; }
}
