/* ─── community.css ─────────────────────────────────────────────────────────
   Public community page styles.
   Appended: community-progress-divider (.cpd__*)
──────────────────────────────────────────────────────────────────────────── */

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
}

.page-header {
  background: #1e293b;
  color: #f8fafc;
  padding: 2rem 1.5rem 1.5rem;
  text-align: center;
}
.page-header h1 { margin: 0 0 0.25rem; font-size: 1.75rem; }
.page-header p  { margin: 0; opacity: .75; font-size: 0.95rem; }

.page-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

/* ── Loading / empty states ───────────────────────────────────────────────── */
#community-loading,
#community-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
  font-size: 1rem;
}

/* ── Community card ───────────────────────────────────────────────────────── */
.community-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.community-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}
.community-card__header h3 {
  margin: 0 0 0.2rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}
.community-card__meta {
  margin: 0;
  font-size: 0.82rem;
  color: #64748b;
}

/* ── Card sections ────────────────────────────────────────────────────────── */
.community-card__section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid #f1f5f9;
}
.community-card__section:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.community-card__section h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.section-desc {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: #64748b;
}

/* ── Community fields ─────────────────────────────────────────────────────── */
.community-card__fields { display: flex; flex-direction: column; gap: 0.75rem; }
.community-field__label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 0.15rem;
}
.community-field__value {
  margin: 0;
  font-size: 0.95rem;
  color: #1e293b;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */
.csv-table-wrap { overflow-x: auto; }
.csv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.csv-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.csv-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}
.csv-table tbody tr:last-child td { border-bottom: none; }
.csv-table tbody tr:hover td { background: #f8fafc; }

/* ── Donation method cards ────────────────────────────────────────────────── */
.donation-methods { display: flex; flex-direction: column; gap: 0.75rem; }
.donation-method-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.9rem 1rem;
}
.donation-method-card p {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  color: #334155;
}
.donation-method-card__actions { margin-top: 0.6rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: opacity .15s, box-shadow .15s;
}
.btn:hover { opacity: .88; }
.btn--primary   { background: #3b82f6; color: #fff; }
.btn--intent    { background: #0f172a; color: #fff; }
.btn--small     { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn--paypal    { background: #003087; color: #fff; }
.btn--stripe    { background: #635bff; color: #fff; }
.btn--instructions { background: #64748b; color: #fff; }

/* ── Intent / donation modal ─────────────────────────────────────────────── */
.donation-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.donation-modal[hidden] { display: none; }
.donation-modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
}
.donation-modal__dialog {
  position: relative;
  background: #fff;
  border-radius: 12px;
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  padding: 1.75rem;
}
.donation-modal__close {
  position: absolute; top: 0.9rem; right: 1rem;
  background: none; border: none;
  font-size: 1.4rem; color: #64748b;
  cursor: pointer; line-height: 1;
}
.donation-modal__close:hover { color: #0f172a; }
.donation-modal__content h3 { margin: 0 0 0.4rem; font-size: 1.15rem; }

.donation-form { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 1rem; }
.donation-form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; font-weight: 500; color: #475569; }
.donation-form input,
.donation-form textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #0f172a;
  transition: border-color .15s;
}
.donation-form input:focus,
.donation-form textarea:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.donation-form__hint { font-size: 0.78rem; color: #94a3b8; font-weight: 400; }
.donation-form__checkbox { flex-direction: row !important; align-items: center; gap: 0.5rem !important; }
.donation-form__checkbox input { width: auto; }
.donation-note { font-size: 0.85rem; color: #64748b; margin: 0; }

.donation-message--error {
  background: #fef2f2; color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
}

.donation-confirm { text-align: center; padding: 1rem 0; }
.donation-confirm__icon {
  width: 56px; height: 56px;
  background: #dcfce7; color: #16a34a;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 1rem;
}
.donation-confirm__title { margin: 0 0 0.5rem; font-size: 1.15rem; }
.donation-confirm__message { color: #475569; font-size: 0.9rem; margin: 0 0 1rem; }
.donation-confirm__payment { margin-bottom: 1rem; }
.donation-confirm__closing { font-size: 0.82rem; color: #94a3b8; margin: 0; }

body.modal-open { overflow: hidden; }

/* ════════════════════════════════════════════════════════════════════════════
   PROGRESS DIVIDER  (.community-progress-divider / .cpd__*)
   Appears between community cards — shows allocation bars per budget tier.
   Percentages by default; dollar amounts when budget_amounts_visible = true.
════════════════════════════════════════════════════════════════════════════ */

.community-progress-divider {
  margin: 1.5rem 0;
  padding: 0 0.25rem;
}

.cpd__inner {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #3b82f6;
  border-radius: 10px;
  padding: 1.25rem 1.5rem 1.1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.cpd__inner--empty {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-left-color: #cbd5e1;
  padding: 0.85rem 1.25rem;
}

/* Header row */
.cpd__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.cpd__name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.cpd__no-budget {
  font-size: 0.8rem;
  color: #94a3b8;
}
.cpd__overall-pct {
  font-size: 0.8rem;
  color: #64748b;
  white-space: nowrap;
}

/* Overall progress track */
.cpd__overall-track {
  height: 10px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.cpd__overall-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 99px;
  transition: width .4s ease;
  min-width: 2px;
}

/* Tiers container */
.cpd__tiers {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.9rem;
}

.cpd__tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.cpd__tier-label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.cpd__tier-pct {
  font-size: 0.76rem;
  color: #64748b;
}

/* Individual budget items inside a tier */
.cpd__item {
  margin-bottom: 0.35rem;
}
.cpd__item:last-child { margin-bottom: 0; }

.cpd__item-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.2rem;
  gap: 0.5rem;
}
.cpd__item-label {
  font-size: 0.82rem;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.cpd__item-pct {
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
}

.cpd__item-track {
  height: 6px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}
.cpd__item-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .4s ease;
  min-width: 2px;
}

/* Donate nudge */
.cpd__donate-nudge {
  margin: 0;
  font-size: 0.82rem;
  color: #94a3b8;
  border-top: 1px solid #f1f5f9;
  padding-top: 0.75rem;
}
.cpd__donate-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-weight: 600;
  color: #3b82f6;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.cpd__donate-link:hover { color: #1d4ed8; }

/* Responsive */
@media (max-width: 540px) {
  .cpd__inner { padding: 1rem 1rem 0.9rem; }
  .cpd__item-label { max-width: 60%; }
}
