/* =========================================================
   247Prayer — Kiosk / Browser Check-In
   Clean, organized stylesheet (mobile breakpoint at 900px)
   ========================================================= */

/* =========
   Fonts & Variables
   ========= */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  /* Theme */
  --brand-header: #0f172a;   /* top bar background */
  --brand-button: #0f172a;   /* primary buttons/links */
  --app-bg: #f4f5f7;

  /* Fields */
  --field-border: #ccc;
  --field-focus: #333;

  /* Pairing */
  --pair-box-size: 56px;
  --pair-box-radius: 12px;
  --pair-box-border: #d8d5cf;
  --pair-box-focus: #b7b2ab;
}

/* =========
   Base
   ========= */
html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--app-bg);
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Hide header img until it has a real src (prevents broken icon) */
#churchLogo:not([src]), #churchLogo[src=""] { display: none; }

/* Links & utility buttons pick up brand button color */
a { color: var(--brand-button); }
.button, .primary { background: var(--brand-button); border-color: var(--brand-button); }

/* =========
   Header
   ========= */
.header {
  position: relative;
  background: var(--brand-header);
  color: #fff;
  /* thicker band w/ top+bottom padding (restored) */
  padding: 80px 0px 0px;
  /* keep a steady vertical band so logo doesn't pogo */
  min-height: 140px;
}

/* Constrain header CONTENT like the forms: width 80% up to 1200px */
.header-inner {
  width: 80%;
  max-width: 1300px;
  margin: 0 auto;
  /* restore generous side padding left of logo / right of subtitle */
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative; /* for centered clock */
}

/* Left: logo */
.header-left { flex: 0 0 auto; }
.header-left img {
  height: 60px;
  max-width: 40vw;
  object-fit: contain;
}

/* Center: clock (centered to container) */
.header-clock {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 2.8rem;
  font-weight: 300;
  letter-spacing: -0.03em;
  color: #fff;
  white-space: nowrap;
  z-index: 1;
}

/* Right: subtitle/title */
.header-title {
  margin: 0 0 0 auto;         /* push to far right */
  text-align: right;
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: -0.01em;
}

/* Optional extension bar behind cards (kept) */
.header-extension {
  background: var(--brand-header);
  height: 200px;
  position: absolute;
  bottom: -200px;
  left: 0; right: 0;
  z-index: -1;
}

/* ≤900px: hide clock + subtitle, center logo and keep nice band */
@media (max-width: 900px) {
  .header { padding: 24px 0; min-height: 140px; }
  .header-inner {
    justify-content: center;
    padding: 80px 0px 0px;
  }
  .header-clock,
  .header-title { display: none !important; }
  .header-left { flex: none; }
  .header-left img {
    display: block !important;
    margin: 0 auto !important;
    max-height: 56px;
    max-width: 70vw;
  }
}

/* =========
   Section Headings
   ========= */
h2 {
  margin: 0 0 15px;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* =========
   Recent Prayer Requests (matches existing components)
   ========= */

/* Card wrapper (same chrome as .right-column/.form) */
#recent-requests {
  flex: 0 0 100%;          /* span the full row inside #prayer-forms */
  margin: 20px 0 0;        /* consistent top spacing */
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 rgba(0,0,0,0.05);
  box-sizing: border-box;
}

/* Heading matches h2 scale already used */
#recent-requests > h2 {
  margin: 0 0 15px;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

/* Ensure stacked mobile layout still looks good */
@media (max-width: 900px) {
  #recent-requests {
    margin-top: 20px;
  }
}


/* List reset matches #activeSessionsList */
#prayerRequestsList {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Item row styling, visually consistent with session rows */
#prayerRequestsList li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 1rem;
  color: #333;
}
#prayerRequestsList li:last-child {
  border-bottom: none;
}

/* Text + meta (time) */
#prayerRequestsList .req-text {
  flex: 1 1 auto;
  line-height: 1.35;
  word-break: break-word;
}
#prayerRequestsList .req-when {
  flex: 0 0 auto;
  white-space: nowrap;
  color: #6b7280;
  font-size: 0.9rem;
  margin-left: 6px;
}

/* Mobile: stack text above timestamp neatly */
@media (max-width: 900px) {
  #prayerRequestsList li {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  #prayerRequestsList .req-when {
    white-space: normal;
    margin-left: 0;
    font-size: 0.875rem;
  }
}

.request-list {
  margin: 24px 0 0;
  padding: 16px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
}
.request-list h2 { margin: 0 0 10px; }
.request-list ul { list-style: none; margin: 0; padding: 0; }
.request-list li { padding: 8px 10px; border-bottom: 1px solid #f1f1f1; }
.request-list li:last-child { border-bottom: 0; }
.req-text { font-weight: 600; }
.req-when { opacity: .7; margin-left: 6px; font-size: .9em; }

/* Lighter weight for long prayer request text */
#prayerRequestsList .req-text {
  font-weight: 400;   /* light weight */
  line-height: 1.4;
}

/* ======================================================
   Recent Prayer Requests — sticky header + scrolling list
   ====================================================== */
#recent-requests {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 0 0 rgba(0,0,0,0.05);
}

/* Sticky heading */
#recent-requests > h2 {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  padding: 12px 0;
  margin: 0 0 8px;
  border-bottom: 1px solid #e5e7eb;
}

/* The LIST is the scroller */
#prayerRequestsList {
  max-height: 380px;            /* ≈ 8–10 items; adjust as needed */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 8px;           /* tiny cushion for scrollbar */
  margin: 0;                    /* ensure no extra space */
}

/* Row styling (unchanged) */
#prayerRequestsList li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 1rem;
  color: #333;
}
#prayerRequestsList li:last-child { border-bottom: none; }

/* Softer weight for long request text */
#prayerRequestsList .req-text { font-weight: 400; }

/* Timestamp */
#prayerRequestsList .req-when {
  flex: 0 0 auto;
  white-space: nowrap;
  color: #6b7280;
  font-size: 0.9rem;
  margin-left: 6px;
}

/* Mobile stack */
@media (max-width: 900px) {
  #prayerRequestsList { max-height: 320px; }
  #prayerRequestsList li { flex-direction: column; gap: 4px; }
  #prayerRequestsList .req-when { white-space: normal; margin-left: 0; }
}

#recent-requests {
  position: relative;
}

#recent-requests::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  height: 40px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
}

.scroll-hint {
  display: none;
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 6px;
}

/* When parent adds the class "has-overflow", reveal it */
#recent-requests.has-overflow .scroll-hint {
  display: block;
}

#prayerRequestsList {
  max-height: 380px;
  overflow-y: scroll;      /* force a scrollbar even if not needed */
  scrollbar-gutter: stable; /* keeps layout from jumping */
}

/* =========
   Main Forms Layout
   ========= */
#prayer-forms {
  display: flex;
  gap: 20px;
  padding: 160px 40px 40px;
  margin: -120px auto 0;
  width: 80%;
  max-width: 1200px;
  background: transparent;
  border-radius: 10px;
  flex-wrap: wrap;
}

.left-column { flex: 2; display: flex; flex-direction: column; gap: 20px; }

.form {
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 rgba(0,0,0,0.05);
}
.form h2 { margin: 0 0 15px; font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; }

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border: 2px solid var(--field-focus);
  transition: border-color .2s ease;
}
textarea { resize: none; }

/* Right column (active sessions) */
.right-column {
  flex: 1;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 rgba(0,0,0,0.05);
  overflow-y: auto;
}
.session-list h3 { margin-top: 0; font-size: 1.5rem; font-weight: 400; }

#activeSessionsList { list-style: none; padding: 0; margin: 0; }
#activeSessionsList li {
  margin-bottom: 10px;
  font-size: 1rem;
  color: #333;
  display: flex;
  align-items: center;
}

/* =========
   Buttons
   ========= */
.button {
  padding: 10px 20px;
  background: var(--brand-button);
  color: #fff;
  border: 1px solid var(--brand-button);
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  transition: filter .2s ease, transform .1s ease;
}
.button:hover { filter: brightness(.92); }
.button:active { transform: translateY(0); }
form .button:hover { transform: translateY(-2px); }

/* Check-Out buttons in list */
#activeSessionsList li .button {
  margin-left: 10px;
  padding: 4px 10px;
  font-size: .85rem;
  max-width: 120px;
  white-space: nowrap;
}
#activeSessionsList li .button:hover { transform: translateY(-1px); }

/* =========
   Response Message Popup
   ========= */
.response-message {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 300px;
  padding: 20px;
  font-size: 16px;
  text-align: center;
  border: 2px solid #ccc;
  border-radius: 8px;
  background: #f1f1f1;
  box-shadow: 0 4px 8px rgba(0,0,0,.2);
  display: none;
  z-index: 1000;
}
.response-message.processing { background: #e0e0e0; color: #000; }
.response-message.success     { background: #4caf50; color: #fff; }

/* =========
   Optional: Prayer Request Box
   ========= */
#prayer-request-box {
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 rgba(0,0,0,0.05);
  margin-top: 20px;
}

/* =========
   Responsive: portrait/vertical
   ========= */
@media (max-aspect-ratio: 1/1) {
  #prayer-forms { flex-direction: column; }
  .right-column { margin-top: 20px; }
}

/* =========================================================
   Pairing Overlay (scoped so it won't affect the app)
   ========================================================= */
.pairing-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
}

.pairing-card {
  width: 100%;
  max-width: 680px;
  background: #fff;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 28px;
  text-align: center;
}

/* Brand lockup (image only) */
.brand-lockup { margin-bottom: 28px; }
.brand-mark {
  display: inline-block;
  height: 44px;
  width: auto;
  margin-bottom: 8px;
  background: none;
}
.brand-text { display: none; }

/* Titles */
.pairing-title {
  font-size: 48px;
  line-height: 1.1;
  margin: 0 0 20px;
  font-weight: 700;
  color: #111;
}
.pairing-sub {
  color: #444;
  margin: 14px auto 0;
  max-width: 560px;
  font-size: 18px;
  line-height: 1.35;
}
.pairing-label { display: block; }

/* Code boxes (desktop/tablet) */
.code-boxes {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 12px;
  margin: 14px auto 12px;
  max-width: 100%;
  padding: 0;
}
.code-box {
  width: var(--pair-box-size);
  height: var(--pair-box-size);
  border-radius: var(--pair-box-radius);
  border: 2px solid var(--pair-box-border);
  background: #fff;
  text-align: center;
  font-size: 30px;
  line-height: var(--pair-box-size);
  outline: none;
  box-shadow: none;
}
.code-box:focus {
  border-color: var(--pair-box-focus);
  box-shadow: 0 0 0 4px rgba(183,178,171,0.25);
}

/* Single wide input (mobile) — hidden by default */
.code-input {
  display: none;
  width: min(560px, 90vw);
  height: 56px;
  line-height: 56px;
  padding: 0 14px;
  font-size: 28px;
  letter-spacing: .2em;
  text-align: center;
  border: 2px solid var(--pair-box-border);
  border-radius: var(--pair-box-radius);
  outline: none;
  box-sizing: border-box;
}
.code-input:focus {
  border-color: var(--pair-box-focus);
  box-shadow: 0 0 0 4px rgba(183,178,171,0.25);
}

.pairing-button {
  display: inline-block;
  margin-top: 12px;
  border: none;
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 16px;
  font-weight: 600;
  background: #111827;
  color: #fff;
  cursor: pointer;
}
.pairing-button:disabled { opacity: .5; cursor: not-allowed; }

/* Pairing — responsive at 900px */
@media (max-width: 900px) {
  .pairing-title { font-size: 36px; }
  .pairing-sub   { margin: 10px auto 16px !important; }
  #enter-form    { margin: 0 auto; }

  .code-input { display: block; }
  .code-boxes { display: none; }
}
@media (min-width: 901px) {
  .code-input { display: none; }
  .code-boxes { display: flex; }
}


/* Allow rows to wrap so a full-width section can sit under the columns */
#prayer-forms { flex-wrap: wrap; }

/* Make the requests panel span the full width of the #prayer-forms container */
#recent-requests.full-width {
  flex: 0 0 100%;
  margin-top: 20px;            /* breathing room below the forms */
  padding: 20px;               /* it already has in your CSS; keep if you like */
  box-sizing: border-box;
}

/* Make full-width sections span both columns in the flex layout */
#prayer-forms { flex-wrap: wrap; }          /* you already have this—kept for clarity */
#prayer-focus.full-width {                   /* same treatment as recent-requests */
  flex: 0 0 100%;
  margin-top: 20px;
  box-sizing: border-box;
}

/* “Card” styling used by the Prayer Focus renderer */
#prayer-focus .card,
#prayer-focus .focus-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 0 0 rgba(0,0,0,0.05);
  box-sizing: border-box;
  margin-top: 20px;              /* consistent spacing above */
}

/* Title — reuse your h2 scale */
#prayer-focus h2,
#prayer-focus .card-title,
#prayer-focus .focus-title {
  margin: 0 0 15px;
  font-size: 1.5rem;             /* matches other section headers */
  font-weight: 500;
  letter-spacing: -0.02em;
  font-family: inherit;
}

/* Body text */
#prayer-focus p,
#prayer-focus .focus-body {
  font-size: 1rem;
  line-height: 1.5;
  color: #111;
  margin: 0 0 6px;
  font-weight: 400;
}

/* Meta line (hint text) */
#prayer-focus .card-meta,
#prayer-focus .focus-meta {
  color: #6b7280;
  font-size: 0.875rem;
  margin-top: 4px;
}

/* === Kiosk spacing tweaks (place at END of style.css) ==================== */
/* Use a single, consistent vertical gap between stacked cards */
#prayer-focus.full-width,
#recent-requests.full-width { 
  margin-top: 20px;      /* match the left-column card gap */
}

/* Remove the extra top margin on the inner Prayer Focus card so it doesn't double-stack */
#prayer-focus .focus-card {
  margin-top: 0;         /* it already sits inside a container that has the 20px gap */
}

/* If you ever stack more full-width cards, keep the same rhythm */
.full-width + .full-width {
  margin-top: 20px;
}

/* === Spacing fix for full-width cards (override) ===================== */
/* Rely on the flex row gap only; remove extra top margins */
#recent-requests,
#recent-requests.full-width,
#prayer-focus,
#prayer-focus.full-width {
  margin-top: 0 !important;
}

/* The inner Prayer Focus card shouldn't add extra gaps either */
#prayer-focus .focus-card {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* (optional) define the vertical rhythm here if you want a different size) */
#prayer-forms {
  row-gap: 20px; /* matches column gap; change to 16px or 12px if you want it tighter */
}

/* === Fix stacked gap between "Submit a Prayer Request" and "Currently Checked-In" === */
@media (max-aspect-ratio: 1/1) {
  .right-column { margin-top: 0 !important; }  /* rely on row-gap only */
  #prayer-forms { row-gap: 20px; }             /* keep the vertical rhythm */
}


