/* ============================================================
   Prayer Engine — Public Widget Stylesheet
   Scoped under .pe-wall to avoid conflicts with host page CSS
   Colors are injected dynamically by prayerwall.js from API
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fustat:wght@400;600;700;800&display=swap');

.pe-wall *,
.pe-wall *::before,
.pe-wall *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.pe-wall {
  font-family: 'Fustat', Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--pe-text, #111111);
  background: var(--pe-wall-bg, #ffffff);
  border-radius: 8px;
  max-width: 700px;
  margin: 0 auto;
}

/* ---- Header ----------------------------------------------- */
.pe-header {
  background: var(--pe-header-bg, #088597);
  color: var(--pe-header-text, #ffffff);
  padding: 20px 24px;
  border-radius: 8px 8px 0 0;
}
.pe-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.pe-instructions {
  font-size: 13.5px;
  opacity: .88;
}
.pe-wall-logo {
  display: block;
  max-height: 52px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  margin-bottom: 10px;
}

/* ---- Submission Form -------------------------------------- */
.pe-form-wrap {
  background: var(--pe-form-bg, #f5f7fa);
  border: 1px solid #e0e8ef;
  border-radius: 8px 8px 0 0;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pe-form-instructions {
  font-size: 14px;
  line-height: 1.6;
  color: #444;
}
.pe-form-instructions.hidden { display: none; }
.pe-form-title {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  background: var(--pe-submit-bg, #088597);
  color: var(--pe-submit-text, #ffffff);
  border-radius: 50px;
  padding: 10px 22px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .15s;
  user-select: none;
}
.pe-form-title:hover { opacity: .85; }

.pe-form { display: flex; flex-direction: column; gap: 12px; }
.pe-form.hidden { display: none; }

.pe-form label, .pe-share-group-label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 3px; }
.pe-form input,
.pe-form textarea,
.pe-form select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccd6e0;
  border-radius: 5px;
  font-size: 14px;
  color: #111111;
  background: #fff;
  font-family: inherit;
  transition: border-color .15s;
}
.pe-form input:focus,
.pe-form textarea:focus,
.pe-form select:focus {
  outline: none;
  border-color: var(--pe-header-bg, #088597);
  box-shadow: 0 0 0 3px rgba(26,107,138,.1);
}
.pe-form textarea { resize: vertical; min-height: 100px; }

.pe-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .pe-form-row { grid-template-columns: 1fr; } }

.pe-share-options { display: flex; flex-direction: column; gap: 6px; }
.pe-share-label   {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 400;
  padding: 7px 10px;
  border: 1px solid #dde5ed;
  border-radius: 5px;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.pe-share-label:hover        { border-color: var(--pe-header-bg, #088597); }
.pe-share-label input        { width: 16px; height: 16px; accent-color: var(--pe-header-bg, #088597); }
.pe-share-label.selected     { border-color: var(--pe-header-bg, #088597); background: #f0f8fc; }

.pe-permission-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.pe-permission-check input { width: 16px; height: 16px; margin-top: 2px; }

.pe-notify-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.pe-notify-check input { width: 16px; height: 16px; }

.pe-charlimit-hint { font-size: 12px; color: #888; text-align: right; }
.pe-charlimit-hint.over { color: #e74c3c; }

.pe-submit-btn {
  background: var(--pe-submit-bg, #088597);
  color: var(--pe-submit-text, #ffffff);
  border: none;
  border-radius: 50px;
  padding: 11px 28px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .15s;
  font-family: inherit;
  align-self: flex-end;
}
.pe-submit-btn:hover    { opacity: .88; }
.pe-submit-btn:disabled { opacity: .55; cursor: not-allowed; }

.pe-recaptcha-wrap { margin: 4px 0; }

/* ---- Status Messages -------------------------------------- */
.pe-alert {
  padding: 12px 16px;
  border-radius: 5px;
  font-size: 14px;
  margin-bottom: 10px;
}
.pe-alert-success { background: #eafaf1; border: 1px solid #a9dfbf; color: #1a6b3a; }
.pe-alert-error   { background: #fdf0f0; border: 1px solid #f5c6c6; color: #c0392b; }
.pe-alert ul      { padding-left: 18px; margin: 4px 0 0; }
.pe-alert ul li   { margin: 2px 0; }

/* ---- Prayer List ------------------------------------------ */
.pe-list-wrap {
  border: 1px solid #e0e8ef;
  border-top: none;
  border-radius: 0 0 8px 8px;
}
.pe-list-header {
  padding: 14px 24px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #666;
  border-bottom: 1px solid #e0e8ef;
  background: #fafbfc;
}

.pe-loading, .pe-empty {
  padding: 32px;
  text-align: center;
  color: #888;
  font-size: 14px;
}

/* Prayer card */
.pe-card {
  background: var(--pe-card-bg, #ffffff);
  border-bottom: 1px solid var(--pe-card-border, #e0e8ef);
  padding: 16px 24px;
  transition: background .15s;
}
.pe-card:last-child   { border-bottom: none; border-radius: 0 0 8px 8px; }
.pe-card:hover        { background: #f9fbfc; }
.pe-card-head         { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 12px; }
.pe-card-name         { font-weight: 700; font-size: 14px; }
.pe-card-date         { font-size: 12px; color: #888; white-space: nowrap; }
.pe-card-text         { font-size: 14px; line-height: 1.65; color: #111111; margin-bottom: 10px; white-space: pre-wrap; }
.pe-card-footer       { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pe-answered-tag {
  font-size: 11px;
  font-weight: 700;
  background: #d4edda;
  color: #155724;
  padding: 2px 8px;
  border-radius: 20px;
}

/* Prayed-for counter */
.pe-pray-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid #ccd6e0;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #555;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.pe-pray-btn:hover  { background: #eafaf1; border-color: #a9dfbf; color: #1a6b3a; }
.pe-pray-btn.prayed { background: #eafaf1; border-color: #a9dfbf; color: #1a6b3a; font-weight: 600; }
.pe-pray-count      { font-weight: 700; }

/* Team replies (public view — read only) */
.pe-replies      { margin-top: 8px; border-top: 1px solid #f0f0f0; padding-top: 8px; }
.pe-reply        { display: flex; gap: 8px; padding: 5px 0; font-size: 13px; border-bottom: 1px solid #f5f5f5; }
.pe-reply:last-child { border-bottom: none; }
.pe-reply-author { font-weight: 700; color: var(--pe-header-bg, #088597); min-width: 70px; }
.pe-reply-text   { flex: 1; color: #444; }
.pe-reply-date   { color: #aaa; font-size: 11.5px; white-space: nowrap; }

/* ---- Scrollable prayer list ------------------------------- */
.pe-list-scroll {
  max-height: 520px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pe-list-scroll::-webkit-scrollbar { width: 6px; }
.pe-list-scroll::-webkit-scrollbar-track { background: transparent; }
.pe-list-scroll::-webkit-scrollbar-thumb { background: #ccd6e0; border-radius: 3px; }
.pe-list-scroll::-webkit-scrollbar-thumb:hover { background: #aab8c2; }

.pe-scroll-loader {
  padding: 16px;
  text-align: center;
  color: #888;
  font-size: 13px;
}

/* ---- Credits --------------------------------------------- */
.pe-credits {
  text-align: center;
  padding: 10px;
  font-size: 11px;
  color: #bbb;
}
.pe-credits a { color: #bbb; }

/* ---- "Did He Answer?" button ------------------------------ */
.pe-answer-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid #d4b040;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #7a5500;
  font-family: inherit;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.pe-answer-btn:hover { background: #fff8e1; border-color: #b8860b; }

/* ---- Answered-prayer testimony modal --------------------- */
.pe-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .52);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.pe-modal-box {
  background: #fff;
  border-radius: 10px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.pe-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 0;
}
.pe-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #111111;
  line-height: 1.3;
}
.pe-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: #999;
  padding: 0;
  flex-shrink: 0;
  margin-top: -2px;
}
.pe-modal-close:hover { color: #333; }
.pe-modal-body {
  padding: 14px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pe-modal-desc {
  font-size: 13.5px;
  color: #555;
  line-height: 1.6;
  margin: 0;
}
.pe-modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pe-modal-form label   { font-size: 13px; font-weight: 600; display: block; margin-bottom: 3px; }
.pe-modal-form input,
.pe-modal-form textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccd6e0;
  border-radius: 5px;
  font-size: 14px;
  color: #111111;
  background: #fff;
  font-family: inherit;
  transition: border-color .15s;
}
.pe-modal-form input:focus,
.pe-modal-form textarea:focus {
  outline: none;
  border-color: var(--pe-header-bg, #088597);
  box-shadow: 0 0 0 3px rgba(26,107,138,.1);
}
.pe-modal-form textarea { resize: vertical; min-height: 120px; }
