/* ================================================================
   Smart Petitions & FAQs v4 — Frontend CSS
   Theme: Navy #0d2b5e + Gold #c9a84c
   FIXED IN 4.0.1: this file previously used the old "sfaq-" class
   names from v3, but the PHP/JS in v4 render "sp-" classes — so
   NONE of this CSS ever matched anything and the whole frontend
   rendered unstyled (accordion always "open", popup never hidden,
   badges/buttons with no layout). All selectors below now match
   includes/render.php and assets/js/frontend.js exactly.
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ── Variables (kept in sync with the --sp-* custom props that
      render.php writes inline on .sp-wrap and .sp-item) ── */
.sp-wrap {
  --sp-accent:  #c9a84c;
  --sp-navy:    #0d2b5e;
  --sp-head-c:  #0d2b5e;
  --sp-text:    #374151;
  --sp-bg:      #ffffff;
  --sp-soft:    #f4f6fb;
  --sp-bdr:     #dce3ef;
  --sp-rad:     6px;
  --sp-hs:      17px;
  --sp-ts:      15px;
  --sp-cols:    2;
  --sp-hbg:     transparent;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.sp-wrap *, .sp-wrap *::before, .sp-wrap *::after { box-sizing: border-box; }
.sp-empty { color: #9ca3af; text-align: center; padding: 2rem; font-size: 14px; }

/* ================================================================
   BADGES
   ================================================================ */
.sp-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 2px; margin-bottom: 8px; line-height: 1;
}
.sp-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.sp-b-open    { background: var(--sp-accent); color: #fff; }
.sp-b-open::before { background: rgba(255,255,255,.9); animation: sp-pulse 2s infinite; }
.sp-b-closed  { background: var(--sp-navy); color: #fff; }
.sp-b-closed::before { background: rgba(255,255,255,.4); }
.sp-b-soon    { background: #ebf1ff; color: #1a3a72; border: 1px solid #bfcfff; }
.sp-b-soon::before { background: #3b82f6; }
.sp-b-pending { background: #fff7ed; color: #9a3412; border: 1px solid #fdba74; }
.sp-b-pending::before { background: #ea580c; animation: sp-pulse 1.5s infinite; }

@keyframes sp-pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ================================================================
   CORNER RIBBON
   ================================================================ */
.sp-item { position: relative; overflow: hidden; }
.sp-ribbon {
  position: absolute; top: 16px; right: -32px;
  background: var(--sp-accent); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 5px 40px; transform: rotate(45deg); z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,.2); pointer-events: none;
}

/* ================================================================
   ACCORDION & MINIMAL
   ================================================================ */
.sp-accordion .sp-item,
.sp-minimal .sp-item {
  background: var(--sp-bg);
  border: 1px solid var(--sp-bdr);
  border-left: 5px solid transparent;
  border-radius: var(--sp-rad);
  margin-bottom: 10px;
  transition: border-color .2s, box-shadow .2s;
}

/* Status-coloured left border */
.sp-accordion .sp-s-open        { border-left-color: var(--sp-accent); }
.sp-accordion .sp-s-closed      { border-left-color: var(--sp-navy);  }
.sp-accordion .sp-s-coming_soon { border-left-color: #3b82f6; }
.sp-accordion .sp-s-pending     { border-left-color: #ea580c; }

.sp-accordion .sp-item:not([data-locked="1"]):hover {
  box-shadow: 0 4px 20px rgba(13,43,94,.1);
}
.sp-accordion .sp-item.sp-open {
  box-shadow: 0 6px 28px rgba(13,43,94,.13);
}

/* ── Locked item ── */
.sp-item[data-locked="1"] {
  opacity: .78;
  background: #fafbfe;
}

/* Not-allowed cursor on the whole header */
.sp-item[data-locked="1"] .sp-header {
  cursor: not-allowed !important;
}

/* Hide the normal chevron/arrow/plus icon on locked items */
.sp-item[data-locked="1"] .sp-icon {
  display: none !important;
}

/* Show a lock pill instead — always visible, communicates "can't expand" */
.sp-item[data-locked="1"] .sp-lock-pill {
  display: inline-flex !important;
}

/* Body can never open on locked items */
.sp-item[data-locked="1"] > .sp-body {
  max-height: 0 !important;
  overflow: hidden !important;
  pointer-events: none;
}

/* ── Header ── */
.sp-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 22px; cursor: pointer; user-select: none;
  background: var(--sp-hbg, transparent);
  transition: background .15s;
}
.sp-header:focus-visible { outline: 3px solid var(--sp-accent); outline-offset: -3px; }
.sp-item.sp-open > .sp-header { background: var(--sp-soft); border-bottom: 1px solid var(--sp-bdr); }
.sp-item[data-locked="1"] .sp-header { background: transparent !important; }

.sp-head-inner { flex: 1; min-width: 0; }

.sp-heading {
  font-family: 'Playfair Display', Georgia, serif !important;
  font-size: var(--sp-hs) !important; font-weight: 700 !important;
  color: var(--sp-head-c) !important; line-height: 1.35 !important; margin: 0 !important; padding: 0 !important;
}
.sp-meta {
  font-size: 12px !important; color: #64748b !important; margin: 5px 0 0 !important;
  line-height: 1.4 !important; font-style: italic;
}

/* ── Toggle icon ── */
.sp-icon {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--sp-soft); border: 1px solid var(--sp-bdr);
  color: var(--sp-navy);
  transition: transform .28s cubic-bezier(.4,0,.2,1), background .18s, color .18s, border-color .18s;
}
.sp-item.sp-open .sp-icon { background: var(--sp-accent); border-color: var(--sp-accent); color: #fff; }
/* chevron/plus/arrow rotation is applied via inline transform from JS */

/* ── Lock pill — shown instead of chevron on locked items ── */
.sp-lock-pill {
  display: none; /* hidden by default; shown on [data-locked="1"] via rule above */
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 3px;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
  user-select: none;
}
/* Status-specific lock pill colours */
.sp-s-closed .sp-lock-pill    { background: #eef1f8; color: var(--sp-navy); border-color: #dce3ef; }
.sp-s-coming_soon .sp-lock-pill { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.sp-s-pending .sp-lock-pill    { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }

/* ── Body (collapsed by default — JS toggles .sp-open) ── */
.sp-body { max-height: 0; overflow: hidden; transition: max-height .38s cubic-bezier(.4,0,.2,1); }
.sp-item.sp-open .sp-body { max-height: 3000px; }
.sp-body-in { padding: 20px 22px 22px; }

.sp-desc, .sp-desc p {
  font-size: var(--sp-ts) !important; color: var(--sp-text) !important;
  line-height: 1.8 !important; margin: 0 0 12px !important;
}
.sp-desc p:last-child { margin-bottom: 0 !important; }

/* ── Bullets ── */
.sp-bullets { list-style: none !important; margin: 14px 0 0 !important; padding: 0 !important; border-top: 1px solid var(--sp-bdr); padding-top: 12px !important; }
.sp-bullets li { font-size: var(--sp-ts) !important; color: var(--sp-text) !important; padding: 7px 0 7px 22px !important; position: relative !important; border-bottom: 1px solid #f1f5f9; line-height: 1.6 !important; }
.sp-bullets li:last-child { border-bottom: none; }
.sp-bullets li::before { content: ''; position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 8px; height: 3px; background: var(--sp-accent); border-radius: 2px; }

/* ── Optional note (below bullets, above buttons) ── */
.sp-note { margin-top: 14px; }
.sp-note p {
  font-size: calc(var(--sp-ts) - 1px) !important; color: #64748b !important;
  line-height: 1.6 !important; margin: 0 0 8px !important; font-style: italic;
}
.sp-note p:last-child { margin-bottom: 0 !important; }

/* ── Alignment — applied consistently to description, bullets,
      note and the button row, in every layout style ── */
.sp-align-center { text-align: center; }
.sp-align-right  { text-align: right; }
.sp-align-center .sp-actions { justify-content: center; }
.sp-align-right  .sp-actions { justify-content: flex-end; }
.sp-align-center .sp-bullets { display: inline-block; text-align: left; }
.sp-align-right  .sp-bullets { display: inline-block; text-align: left; }

/* ── Buttons ── */
.sp-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.sp-btn {
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  gap: 6px !important; font-family: 'Inter', sans-serif !important; font-size: 12px !important;
  font-weight: 700 !important; letter-spacing: .07em !important; text-transform: uppercase !important;
  padding: 10px 24px !important; border-radius: 3px !important; border: 2px solid transparent !important;
  cursor: pointer !important; text-decoration: none !important;
  transition: filter .18s, transform .12s, box-shadow .18s !important; line-height: 1 !important; white-space: nowrap !important;
}
.sp-btn:hover:not(.sp-btn-locked) {
  filter: brightness(.88); transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.18) !important;
}
.sp-btn:active:not(.sp-btn-locked) { transform: translateY(0) !important; }
.sp-btn-locked { opacity: .45 !important; cursor: not-allowed !important; pointer-events: none !important; }

/* ================================================================
   POPUP MODAL
   ================================================================ */
.sp-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 999999;
  background: rgba(5, 18, 45, .7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  align-items: center; justify-content: center;
  padding: 16px;
}
.sp-overlay.sp-visible { display: flex; animation: sp-fade-in .2s ease; }
@keyframes sp-fade-in { from{opacity:0} to{opacity:1} }

.sp-modal {
  --sp-navy: #0d2b5e;
  --sp-gold: #c9a84c;
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 32px 96px rgba(0,0,0,.4);
  animation: sp-modal-in .28s cubic-bezier(.34,1.56,.64,1);
  overflow: hidden;
}
@keyframes sp-modal-in {
  from { opacity: 0; transform: translateY(28px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* Modal header */
.sp-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px 24px;
  background: var(--sp-navy);
  border-bottom: 4px solid var(--sp-gold);
  flex-shrink: 0;
}
.sp-modal-title {
  font-family: 'Playfair Display', Georgia, serif !important;
  font-size: 17px !important; font-weight: 700 !important; color: #fff !important;
  margin: 0 !important; padding: 0 !important; line-height: 1.3 !important; flex: 1;
}
.sp-modal-close {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.14); border: 1.5px solid rgba(255,255,255,.25);
  color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .2s;
}
.sp-modal-close:hover { background: rgba(255,255,255,.25); transform: rotate(90deg); }
.sp-modal-close svg { display: block; pointer-events: none; }

/* Modal body */
.sp-modal-body {
  flex: 1; overflow-y: auto; padding: 28px 28px 24px;
  -webkit-overflow-scrolling: touch;
}

/* Body scroll lock */
body.sp-noscroll { overflow: hidden; }

/* ================================================================
   FORM STYLING INSIDE MODAL (CF7 / shortcode forms)
   ================================================================ */
.sp-modal-body .wpcf7 { margin: 0 !important; }

/* 2-column grid rows */
.sp-modal-body .cf7-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
.sp-modal-body .cf7-row:last-of-type { margin-bottom: 0; }
.sp-modal-body .cf7-row > label,
.sp-modal-body .cf7-row > .cf7-col { display: flex; flex-direction: column; }

.sp-modal-body label {
  display: flex !important; flex-direction: column !important; gap: 5px;
  font-size: 11px !important; font-weight: 700 !important; color: var(--sp-navy, #0d2b5e) !important;
  text-transform: uppercase !important; letter-spacing: .05em !important; margin-bottom: 0 !important;
}

.sp-modal-body input[type="text"],
.sp-modal-body input[type="email"],
.sp-modal-body input[type="tel"],
.sp-modal-body textarea,
.sp-modal-body select {
  width: 100% !important; padding: 11px 14px !important;
  border: 1.5px solid #dce3ef !important; border-radius: 4px !important;
  font-size: 14px !important; font-family: 'Inter', sans-serif !important;
  color: #1e293b !important; background: #fff !important;
  transition: border-color .15s, box-shadow .15s !important;
  box-shadow: none !important; outline: none !important; line-height: 1.5;
}
.sp-modal-body input:focus,
.sp-modal-body textarea:focus {
  border-color: var(--sp-gold, #c9a84c) !important;
  box-shadow: 0 0 0 3px rgba(201,168,76,.14) !important;
}
.sp-modal-body textarea { min-height: 110px !important; resize: vertical !important; }

.sp-modal-body .wpcf7-submit,
.sp-modal-body input[type="submit"],
.sp-modal-body button[type="submit"] {
  width: 100% !important; padding: 13px 24px !important;
  background: var(--sp-navy, #0d2b5e) !important; color: #fff !important;
  border: none !important; border-radius: 3px !important;
  font-size: 12px !important; font-weight: 700 !important;
  text-transform: uppercase !important; letter-spacing: .08em !important;
  cursor: pointer !important; transition: background .18s !important; margin-top: 8px !important;
  font-family: 'Inter', sans-serif !important;
}
.sp-modal-body .wpcf7-submit:hover,
.sp-modal-body input[type="submit"]:hover { background: var(--sp-gold, #c9a84c) !important; }

.sp-modal-body .wpcf7-spinner { display: none !important; }
.sp-modal-body .wpcf7.submitting .wpcf7-spinner { display: inline-block !important; }

.sp-modal-body .wpcf7-not-valid-tip { font-size: 11px !important; color: #dc2626 !important; margin-top: 3px !important; display: block; }
.sp-modal-body .wpcf7-response-output {
  border-radius: 4px !important; font-size: 13px !important; margin-top: 14px !important; padding: 12px 16px !important; border-width: 1px !important; border-style: solid !important;
}
.sp-modal-body .wpcf7-mail-sent-ok { background: #f0fdf4 !important; border-color: #86efac !important; color: #166534 !important; }
.sp-modal-body .wpcf7-validation-errors { background: #fef2f2 !important; border-color: #fca5a5 !important; color: #991b1b !important; }
.sp-modal-body .wpcf7-acceptance-missing { background: #fffbeb !important; border-color: #fde68a !important; color: #92400e !important; }

.sp-modal-body .wpcf7-recaptcha,
.sp-modal-body .g-recaptcha { margin: 12px 0 4px !important; }

/* iFrame embeds — GHL / HubSpot / Typeform / Google Forms / any iframe */
.sp-modal-body iframe { width: 100% !important; border: none !important; min-height: 480px; border-radius: 4px; display: block; }

/* ================================================================
   CARDS
   ================================================================ */
.sp-cards .sp-grid { display: grid; grid-template-columns: repeat(var(--sp-cols),minmax(0,1fr)); gap: 20px; }
.sp-cards .sp-item { background: var(--sp-bg); border: 1px solid var(--sp-bdr); border-radius: var(--sp-rad); border-left: none !important; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s; overflow: hidden; }
.sp-cards .sp-item::before { content: ''; height: 5px; display: block; background: var(--sp-accent); }
.sp-cards .sp-s-closed::before  { background: var(--sp-navy); }
.sp-cards .sp-s-coming_soon::before { background: #3b82f6; }
.sp-cards .sp-s-pending::before { background: #ea580c; }
.sp-cards .sp-item:hover { box-shadow: 0 10px 40px rgba(13,43,94,.13); transform: translateY(-3px); }
.sp-cards .sp-header { cursor: default; }
.sp-cards .sp-icon { display: none; }
.sp-cards .sp-item.sp-open .sp-header { border-bottom: none; background: transparent; }
.sp-cards .sp-body { max-height: none !important; overflow: visible !important; flex: 1; display: flex; flex-direction: column; }
.sp-cards .sp-body-in { flex: 1; display: flex; flex-direction: column; }
.sp-cards .sp-actions { margin-top: auto !important; padding-top: 14px; border-top: 1px solid var(--sp-bdr); }

/* ================================================================
   TIMELINE
   ================================================================ */
.sp-timeline { padding-left: 8px; }
.sp-tl-row { display: flex; align-items: flex-start; }
.sp-tl-col { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; padding-top: 14px; }
.sp-tl-dot { width: 36px; height: 36px; border-radius: 50%; background: var(--sp-navy); border: 3px solid var(--sp-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; box-shadow: 0 0 0 5px rgba(201,168,76,.15); }
.sp-s-closed .sp-tl-dot { background: #374151; border-color: #374151; box-shadow: none; }
.sp-s-coming_soon .sp-tl-dot { background: #fff; border-color: #3b82f6; color: #3b82f6; box-shadow: 0 0 0 4px rgba(59,130,246,.1); }
.sp-tl-line { width: 2px; flex: 1; min-height: 20px; background: linear-gradient(to bottom, var(--sp-accent), var(--sp-bdr)); margin: 4px 0; }
.sp-tl-row:last-child .sp-tl-line { display: none; }
.sp-timeline .sp-item { margin-left: 16px; flex: 1; margin-bottom: 14px; border-left: 5px solid var(--sp-accent) !important; }
.sp-timeline .sp-s-closed .sp-item { border-left-color: var(--sp-navy) !important; }
.sp-timeline .sp-s-coming_soon .sp-item { border-left-color: #3b82f6 !important; }

/* ================================================================
   MINIMAL
   ================================================================ */
.sp-minimal .sp-item { border: none !important; border-bottom: 1px solid var(--sp-bdr) !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; margin-bottom: 0 !important; }
.sp-minimal .sp-item:first-child { border-top: 1px solid var(--sp-bdr) !important; }
.sp-minimal .sp-item.sp-open > .sp-header { background: var(--sp-soft) !important; }
.sp-minimal .sp-header { padding: 16px 0; }
.sp-minimal .sp-body-in { padding-left: 0; padding-right: 0; }
.sp-minimal .sp-ribbon { display: none; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
  .sp-cards .sp-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 600px) {
  .sp-header { padding: 14px 16px; }
  .sp-body-in { padding: 16px 16px 18px; }
  .sp-modal { max-height: 96vh; border-radius: 6px 6px 0 0; align-self: flex-end; }
  .sp-modal-body { padding: 20px 18px 18px; }
  .sp-modal-body .cf7-row { grid-template-columns: 1fr !important; gap: 12px; }
  .sp-btn { font-size: 11px !important; padding: 9px 16px !important; }
  .sp-tl-dot { width: 28px; height: 28px; font-size: 11px; }
}
@media (max-width: 420px) {
  .sp-actions { flex-direction: column; }
  .sp-btn { width: 100%; }
  .sp-overlay { padding: 0; align-items: flex-end; }
  .sp-modal { border-radius: 12px 12px 0 0; }
}
