/* ============================================================
   PillarPoint Tools — shared engine styles.
   Used by every tool under /tools/<slug>/, layered on top of
   civic.css + civic-pages.css.
   ============================================================ */

/* ---------- TOOL HERO (compact) ---------- */
.tool-hero {
  background: var(--navy);
  color: #fff;
  padding: clamp(40px, 6vw, 72px) 0 clamp(36px, 5vw, 56px);
  border-bottom: 4px solid var(--clay);
}
.tool-hero h1 { font-size: clamp(28px, 4vw, 44px); color: #fff; }
.tool-hero .breadcrumb a { color: #9eb0c7; text-decoration: none; }
.tool-hero .breadcrumb a:hover { color: #fff; text-decoration: underline; }
.tool-hero .tool-disclaimer {
  margin-top: 20px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--clay);
  font-size: 13px;
  line-height: 1.5;
  color: #c8d2e0;
  max-width: 780px;
}
.tool-hero .tool-disclaimer strong { color: #fff; }

/* ---------- DOC TYPE DESCRIPTION (helper under the dropdown) ---------- */
.doc-type-description {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-faint);
}
.doc-type-description .rcw-cite {
  display: inline-block;
  margin-left: 4px;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(15, 44, 74, 0.08);
  color: var(--navy);
}
#notice-type option:disabled,
#doc-type option:disabled { color: #999; }

/* ---------- REPEATING FIELD (line items, etc.) ---------- */
.repeating-field .repeating-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.repeating-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.repeating-row .repeating-cell {
  flex: 1;
  min-width: 0;
}
.repeating-row input {
  width: 100%;
}
.btn-remove-row {
  flex: 0 0 auto;
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-faint);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  border-radius: 4px;
  transition: color 120ms ease, border-color 120ms ease;
}
.btn-remove-row:hover {
  color: #b91c1c;
  border-color: #b91c1c;
}
.btn-add-row {
  margin-top: 10px;
  align-self: flex-start;
}

/* ---------- TEXT BLOCKS (social posts, multi-output) ---------- */
.text-block {
  background: #fff;
  border: 1px solid var(--rule);
  margin-bottom: 16px;
}
.text-block:last-child { margin-bottom: 0; }
.text-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: var(--bone);
  border-bottom: 1px solid var(--rule);
}
.text-block-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.text-block-body {
  padding: 18px 22px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
}

/* ---------- PLAN GEAR (manage subscription) ---------- */
.plan-cog {
  background: none;
  border: none;
  padding: 4px;
  margin-left: 6px;
  cursor: pointer;
  color: var(--ink-faint);
  vertical-align: middle;
  border-radius: 4px;
  transition: color 120ms ease, background 120ms ease;
}
.plan-cog:hover { color: var(--clay); background: rgba(0,0,0,0.04); }
.plan-cog:disabled { opacity: 0.5; cursor: wait; }

/* ---------- PRICING FAQ ---------- */
.pricing-faq {
  background: #fff;
  padding: clamp(48px, 6vw, 80px) 0;
  border-top: 1px solid var(--rule);
}
.pricing-faq h2 {
  font-size: clamp(24px, 3vw, 34px);
  margin-top: 14px;
  margin-bottom: 36px;
  color: var(--navy);
}
.pricing-faq .faq-item {
  border-top: 1px solid var(--rule);
  padding: 18px 0;
}
.pricing-faq .faq-item:last-child { border-bottom: 1px solid var(--rule); }
.pricing-faq .faq-item summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-size: 17px;
  color: var(--navy);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.pricing-faq .faq-item summary::-webkit-details-marker { display: none; }
.pricing-faq .faq-item summary::after {
  content: '+';
  font-size: 22px;
  font-weight: 400;
  color: var(--clay);
  transition: transform 120ms ease;
  line-height: 1;
}
.pricing-faq .faq-item[open] summary::after { content: '−'; }
.pricing-faq .faq-item p {
  margin-top: 14px;
  margin-bottom: 0;
  color: var(--ink);
  line-height: 1.6;
  max-width: 720px;
}

.field-help {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-faint);
  font-style: italic;
}

/* ---------- TOOL SECTION ---------- */
.tool-section { padding-top: clamp(32px, 5vw, 64px); padding-bottom: 80px; background: var(--bone); min-height: 70vh;}

/* ---------- AUTH BAR (top-right of tool body) ---------- */
.auth-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
#signin-btn { font-size: 14px; padding: 10px 20px; }

/* ---------- PLAN BADGE ---------- */
.plan-tag {
  display: inline-block;
  background: var(--clay);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 14px;
  margin-right: 16px;
}
.plan-tag.pro { background: var(--navy); }
.usage-count { font-size: 13px; color: var(--ink-faint); }

/* ---------- TOOL GRID (form left, output right) ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 560px) 1fr;
  gap: 48px;
  align-items: start;
}
@media (max-width: 960px) { .tool-grid { grid-template-columns: 1fr; } }

/* ---------- FIELDSET / LEGEND ---------- */
.tool-fieldset {
  border: none;
  padding: 0;
  margin-bottom: 32px;
}
.tool-fieldset legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--rule);
}
.legend-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 50%;
}

/* ---------- GENERATE BUTTON ---------- */
.btn-generate { width: 100%; justify-content: center; padding: 16px 28px; font-size: 16px; margin-top: 8px; }
.spinner { display: none; animation: spin 1s linear infinite; }
#generate-btn.loading .spinner { display: inline-block; }
#generate-btn.loading #generate-text::after { content: '…'; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- OUTPUT COLUMN ---------- */
.output-empty {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: clamp(48px, 6vw, 72px) 32px;
  text-align: center;
  color: var(--ink-faint);
  font-size: 15px;
}

.output-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  justify-content: flex-end;
}
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* Generated text area — looks like letterhead paper */
.output-content {
  background: #fff;
  border: 1px solid var(--rule);
  padding: clamp(28px, 4vw, 56px) clamp(24px, 3.5vw, 72px);
  font-family: 'Times New Roman', Times, serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  min-height: 300px;
}

/* Loading / error states */
.spinner-large { display:flex;justify-content:center;padding:48px 0; }
.spinner-large svg circle { stroke-dasharray:60;stroke-dashoffset:20;animation:dash 1.5s ease-in-out infinite;}
@keyframes dash{0%{stroke-dashoffset:60}50%{stroke-dashoffset:20}100%{stroke-dashoffset:60}}

.tool-error {
  background:#fef2f2;border-left:4px solid #dc2626;padding:18px 20px;margin-top:16px;font-size:15px;color:#991b1b;
}

/* ---------- MODAL (upgrade) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,44,74,0.6);
  display:flex; align-items:center; justify-content:center; padding:24px;
}
.modal-card {
  background:#fff;border-top:6px solid var(--clay);padding:clamp(32px,5vw,48px);max-width:520px;width:100%;position:relative;box-shadow:0 24px 64px rgba(0,0,0,.25);
}
.modal-close { position:absolute;top:16px;right:20px;background:none;border:none;font-size:28px;color:var(--ink-faint);cursor:pointer;line-height:1;}
.modal-close:hover{color:var(--navy);}

.upgrade-features { margin: 24px 0; }
.btn-upgrade { width:100%;justify-content:center;padding:16px;font-size:16px;margin-top:8px; }

/* ---------- RESPONSIVE FINE-TUNING ---------- */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
}
