/**
 * ExcelMan Q&A front end styles.
 *
 * Tokens mirror the theme's (--accent #388E3C, Poppins via --font-base) so the Q&A
 * pages read as part of the site rather than as a plugin bolted onto it. Every rule is
 * scoped under .em-qa, because these pages also carry theme and Elementor CSS.
 */

.em-qa {
  --qa-green: #388E3C;
  --qa-green-dark: #2E7D32;
  --qa-green-soft: #e8f5e9;
  --qa-ink: #0f1f12;
  --qa-muted: #6b7c6e;
  --qa-border: #e0ede0;
  --qa-radius: 14px;

  font-family: var(--font-base, "Poppins", system-ui, sans-serif);
  color: var(--qa-ink);
}

.em-qa *,
.em-qa *::before,
.em-qa *::after { box-sizing: border-box; }

/* ---- Buttons ---- */

.em-qa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.em-qa-btn--primary { background: var(--qa-green); color: #fff; }
.em-qa-btn--primary:hover { background: var(--qa-green-dark); color: #fff; }

.em-qa-btn--ghost {
  background: #fff;
  border-color: var(--qa-border);
  color: var(--qa-ink);
}
.em-qa-btn--ghost:hover { border-color: var(--qa-green); color: var(--qa-green-dark); }

.em-qa-btn--sm { padding: 6px 12px; font-size: 0.82rem; }

/* ---- Toolbar and tabs ---- */

.em-qa-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.em-qa-searchbox { display: flex; gap: 8px; flex: 1 1 320px; }
.em-qa-searchbox--wide { margin-bottom: 20px; }

.em-qa-searchbox input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--qa-border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.92rem;
}

.em-qa-searchbox input[type="search"]:focus {
  outline: none;
  border-color: var(--qa-green);
  box-shadow: 0 0 0 3px rgba(56, 142, 60, .12);
}

.em-qa-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--qa-border);
}

.em-qa-tab {
  padding: 9px 14px;
  border-bottom: 2px solid transparent;
  color: var(--qa-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.em-qa-tab:hover { color: var(--qa-ink); }
.em-qa-tab.is-active { color: var(--qa-green-dark); border-bottom-color: var(--qa-green); font-weight: 600; }

.em-qa-resultcount { margin: 0 0 14px; color: var(--qa-muted); font-size: 0.9rem; }

/* ---- Question list ---- */

.em-qa-items { margin: 0; padding: 0; list-style: none; }

.em-qa-item {
  display: flex;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--qa-border);
}

.em-qa-item:last-child { border-bottom: 0; }

.em-qa-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 66px;
  text-align: center;
}

.em-qa-stat {
  display: flex;
  flex-direction: column;
  padding: 6px 4px;
  border: 1px solid var(--qa-border);
  border-radius: 10px;
  line-height: 1.15;
}

.em-qa-stat strong { font-size: 1rem; }
.em-qa-stat small { color: var(--qa-muted); font-size: 0.7rem; }
.em-qa-stat.is-accepted { background: var(--qa-green-soft); border-color: var(--qa-green); }

.em-qa-body { flex: 1; min-width: 0; }

.em-qa-title { margin: 0 0 6px; font-size: 1.08rem; line-height: 1.4; font-weight: 600; }
.em-qa-title a { color: var(--qa-ink); text-decoration: none; }
.em-qa-title a:hover { color: var(--qa-green-dark); }

.em-qa-excerpt { margin: 0 0 8px; color: var(--qa-muted); font-size: 0.9rem; line-height: 1.6; }

.em-qa-metaline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--qa-muted);
}

.em-qa-chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--qa-green-soft);
  color: var(--qa-green-dark);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
}

.em-qa-chip--tag { background: #f1f3f1; color: var(--qa-muted); }

.em-qa-badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f3f1;
  font-size: 0.72rem;
  font-weight: 600;
}

.em-qa-badge--ai { background: #e7f0fb; color: #1b4f8a; }
.em-qa-badge--accepted { background: var(--qa-green-soft); color: var(--qa-green-dark); }
.em-qa-badge--pending { background: #fdf3d8; color: #8a6a12; }
.em-qa-badge--archived { background: #fbe9e9; color: #8a1b1b; }
.em-qa-badge--related { background: #eee9fb; color: #4b2f8a; }

/* ---- Empty states ---- */

.em-qa-empty {
  padding: 36px 20px;
  text-align: center;
  border: 1px dashed var(--qa-border);
  border-radius: var(--qa-radius);
}

.em-qa-empty p { margin: 0 0 14px; color: var(--qa-muted); }

/* ---- Notices ---- */

.em-qa-notice {
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--qa-border);
  border-left: 3px solid var(--qa-green);
  border-radius: 10px;
  background: #fafdfa;
  font-size: 0.9rem;
}

.em-qa-notice--warn { border-left-color: #d9a406; background: #fffdf5; }
.em-qa-notice--ai { border-left-color: #1b4f8a; background: #f6f9fd; }
.em-qa-notice--signin { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.em-qa-notice p { margin: 0; }

/* ---- Single question ---- */

.em-qa-single-main { padding: 28px 16px 56px; }
.em-qa-single { max-width: 900px; margin: 0 auto; }

.em-qa-question,
.em-qa-answer {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--qa-border);
}

.em-qa-answer.is-ai { background: #f8fbff; border-radius: var(--qa-radius); padding: 20px 16px; }
.em-qa-answer.is-accepted { background: #f7fcf7; border-radius: var(--qa-radius); padding: 20px 16px; }

.em-qa-single-title { margin: 0 0 10px; font-size: 1.55rem; line-height: 1.3; font-weight: 700; }

.em-qa-content { flex: 1; min-width: 0; }

.em-qa-votecol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 0 0 48px;
}

.em-qa-vote { display: flex; flex-direction: column; align-items: center; gap: 2px; }

.em-qa-vote-btn {
  width: 36px;
  height: 30px;
  border: 1px solid var(--qa-border);
  border-radius: 8px;
  background: #fff;
  color: var(--qa-muted);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
}

.em-qa-vote-btn:hover:not(:disabled) { border-color: var(--qa-green); color: var(--qa-green-dark); }
.em-qa-vote-btn.is-active { background: var(--qa-green); border-color: var(--qa-green); color: #fff; }
.em-qa-vote-btn:disabled { opacity: .45; cursor: not-allowed; }

.em-qa-vote-score { font-size: 1rem; font-weight: 700; }

.em-qa-accept {
  width: 36px;
  height: 30px;
  margin-top: 4px;
  border: 1px solid var(--qa-border);
  border-radius: 8px;
  background: #fff;
  color: var(--qa-muted);
  cursor: pointer;
}

.em-qa-accept.is-accepted { background: var(--qa-green); border-color: var(--qa-green); color: #fff; }
.em-qa-accept.is-static { cursor: default; }

.em-qa-answers { margin-top: 28px; }
.em-qa-answers-title { margin: 0 0 14px; font-size: 1.15rem; font-weight: 700; }
.em-qa-answer-badges { display: flex; gap: 6px; margin-bottom: 8px; }

.em-qa-disclaimer {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--qa-border);
  color: var(--qa-muted);
  font-size: 0.78rem;
}

/* ---- Prose, including the code blocks answers depend on ---- */

.em-qa-prose { font-size: 0.97rem; line-height: 1.75; }
.em-qa-prose > *:first-child { margin-top: 0; }
.em-qa-prose > *:last-child { margin-bottom: 0; }
.em-qa-prose h3, .em-qa-prose h4 { margin: 1.4em 0 .5em; font-weight: 600; }
.em-qa-prose ul, .em-qa-prose ol { padding-left: 1.4em; }
.em-qa-prose li { margin-bottom: .35em; }

/* Formulas are the point of this site, so code has to be legible and selectable
   rather than wrapped into ambiguity. Horizontal scroll beats a broken formula. */
.em-qa-prose pre {
  margin: 1em 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: #0f1f12;
  border-radius: 10px;
  color: #eaf5ea;
  font-size: 0.85rem;
  line-height: 1.6;
}

.em-qa-prose pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  white-space: pre;
}

.em-qa-prose code {
  padding: 2px 6px;
  border-radius: 5px;
  background: #f1f3f1;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.86em;
}

/* ---- Comments ---- */

.em-qa-comments { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--qa-border); }
.em-qa-comment-list { margin: 0 0 8px; padding: 0; list-style: none; }

.em-qa-comment {
  padding: 6px 0;
  border-bottom: 1px solid #f2f6f2;
  font-size: 0.85rem;
  line-height: 1.55;
}

.em-qa-comment:last-child { border-bottom: 0; }
.em-qa-comment-meta { color: var(--qa-muted); font-size: 0.78rem; }

.em-qa-comment-form { display: flex; gap: 8px; margin-top: 6px; }

.em-qa-comment-form input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid var(--qa-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
}

/* ---- Forms ---- */

.em-qa-form { display: flex; flex-direction: column; gap: 16px; }
.em-qa-field { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.em-qa-field-row { display: flex; gap: 16px; flex-wrap: wrap; }

.em-qa-field label { font-size: 0.88rem; font-weight: 600; }

.em-qa-field input[type="text"],
.em-qa-field select,
.em-qa-form textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--qa-border);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 0.93rem;
  line-height: 1.6;
}

.em-qa-form textarea { resize: vertical; min-height: 140px; }

.em-qa-field input:focus,
.em-qa-field select:focus,
.em-qa-form textarea:focus {
  outline: none;
  border-color: var(--qa-green);
  box-shadow: 0 0 0 3px rgba(56, 142, 60, .12);
}

.em-qa-hint { color: var(--qa-muted); font-size: 0.78rem; }

.em-qa-form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.em-qa-form-msg { font-size: 0.85rem; color: var(--qa-muted); }
.em-qa-form-msg.is-error { color: #a01b1b; }

.em-qa-scopenote { margin: 0; color: var(--qa-muted); font-size: 0.78rem; line-height: 1.6; }

/* The honeypot must be unreachable for people and invisible to assistive tech, but
   still present and fillable for a bot. display:none would be too obvious a tell. */
.em-qa-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Duplicate suggestions ---- */

.em-qa-similar {
  padding: 14px 16px;
  border: 1px solid #f0e2b8;
  border-radius: var(--qa-radius);
  background: #fffdf5;
}

.em-qa-similar-title { margin: 0 0 8px; font-size: 0.95rem; font-weight: 600; }
.em-qa-similar-list { margin: 0 0 8px; padding-left: 1.2em; }
.em-qa-similar-list li { margin-bottom: 5px; font-size: 0.88rem; }
.em-qa-similar-list a { color: var(--qa-green-dark); }
.em-qa-similar-meta { color: var(--qa-muted); font-size: 0.78rem; }
.em-qa-similar-foot { margin: 0; color: var(--qa-muted); font-size: 0.8rem; }

/* ---- Categories ---- */

.em-qa-catgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.em-qa-catcard {
  border: 1px solid var(--qa-border);
  border-radius: var(--qa-radius);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.em-qa-catcard:hover { border-color: var(--qa-green); box-shadow: 0 4px 14px rgba(0,0,0,.05); }
.em-qa-catcard a { display: block; padding: 18px; text-decoration: none; color: inherit; }
.em-qa-catname { margin: 0 0 6px; font-size: 1rem; font-weight: 600; }
.em-qa-catdesc { margin: 0 0 8px; color: var(--qa-muted); font-size: 0.85rem; }
.em-qa-catcount { color: var(--qa-green-dark); font-size: 0.8rem; font-weight: 600; }

/* ---- My questions ---- */

.em-qa-mine-section { margin-bottom: 34px; }

/* ---- Pagination ---- */

.em-qa-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.em-qa-pagination .page-numbers {
  padding: 7px 13px;
  border: 1px solid var(--qa-border);
  border-radius: 8px;
  color: var(--qa-ink);
  font-size: 0.86rem;
  text-decoration: none;
}

.em-qa-pagination .page-numbers.current { background: var(--qa-green); border-color: var(--qa-green); color: #fff; }
.em-qa-pagination .page-numbers:hover:not(.current) { border-color: var(--qa-green); }

/* ---- Related ---- */

.em-qa-related { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--qa-border); }
.em-qa-related ul { margin: 0; padding-left: 1.2em; }
.em-qa-related li { margin-bottom: 7px; font-size: 0.9rem; }
.em-qa-related a { color: var(--qa-green-dark); text-decoration: none; }
.em-qa-related a:hover { text-decoration: underline; }

/* ---- Narrow screens ---- */

@media (max-width: 640px) {
  .em-qa-item,
  .em-qa-question,
  .em-qa-answer { flex-direction: column; gap: 10px; }

  .em-qa-stats { flex-direction: row; flex: 0 0 auto; }
  .em-qa-stat { flex: 1; }

  /* The vote column becomes a horizontal row above the content rather than a
     56px-wide rail that would squeeze the answer text on a phone. */
  .em-qa-votecol { flex: 0 0 auto; flex-direction: row; align-items: center; gap: 10px; }
  .em-qa-vote { flex-direction: row; align-items: center; gap: 8px; }
  .em-qa-accept { margin-top: 0; }

  .em-qa-field-row { flex-direction: column; gap: 16px; }
  .em-qa-single-title { font-size: 1.3rem; }
}
