/* ===================================================================
   AgroNet Forward — Fórum. Paleta inspirada no site principal
   (verde AgroNet, azul "Forward", tipos Poppins / Work Sans).
   =================================================================== */
:root {
  --green: #2f7d33;
  --green-dark: #1e5a24;
  --green-soft: #eaf3ea;
  --blue: #2f6db0;
  --ink: #2c2c2c;
  --muted: #7a7a7a;
  --line: #e6e6e6;
  --bg: #fcfcfc;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .05);
  --maxw: 780px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: "Work Sans", "Poppins", sans-serif;
  color: var(--green-dark);
  line-height: 1.25;
  margin: 0 0 .5rem;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---- Header ---- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 36px; width: auto; display: block; }
.brand-sub {
  font-family: "Work Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.header-nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }

/* ---- Buttons ---- */
.btn {
  font: inherit;
  font-weight: 500;
  border-radius: 8px;
  padding: 8px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--green-soft); border-color: var(--green); }
.btn-link {
  background: none; border: none; color: var(--blue); cursor: pointer;
  padding: 2px 4px; font: inherit; font-size: 13px;
}
.btn-link:hover { text-decoration: underline; }
.btn-danger { color: #b3261e; }
.btn:disabled { opacity: .55; cursor: default; }
button[data-busy] { cursor: progress; opacity: .8; }

/* Bolinha a rodar dentro de um botão enquanto a ação decorre */
.spinner {
  display: inline-block;
  width: .85em;
  height: .85em;
  margin-left: .5em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -.15em;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.6s; } }

/* ---- Layout blocks ---- */
main.wrap { padding-top: 32px; padding-bottom: 64px; min-height: 60vh; }
.loading { color: var(--muted); }
.muted { color: var(--muted); }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.back-link { display: inline-block; margin-bottom: 16px; font-size: 14px; }

/* ---- Topic list ---- */
.topic-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  color: var(--ink);
}
.topic-card:hover { text-decoration: none; border-color: var(--green); }
.topic-card h3 { margin-bottom: 6px; }
.topic-card .excerpt { color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic-meta { font-size: 13px; color: var(--muted); margin-top: 10px; display: flex; gap: 14px; flex-wrap: wrap; }
.pill { background: var(--green-soft); color: var(--green-dark); border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 500; }
.pill-lock { background: #fdeceb; color: #b3261e; }

/* ---- Single topic ---- */
.topic-full {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.topic-full h1 { font-size: 26px; }
.topic-full .body { white-space: pre-wrap; word-wrap: break-word; margin-top: 12px; }
.admin-tools { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Comments ---- */
.comments-head { margin: 24px 0 12px; }
.comment {
  border-left: 2px solid var(--line);
  padding: 10px 0 0 14px;
  margin-top: 14px;
}
.comment.is-deleted > .comment-body { color: var(--muted); font-style: italic; }
.comment-head { font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.comment-author { font-weight: 600; color: var(--green-dark); }
.comment-author.anon { color: var(--muted); font-weight: 500; }
.comment-body { white-space: pre-wrap; word-wrap: break-word; margin: 4px 0 6px; }
.edited-tag { color: var(--muted); font-size: 12px; font-style: italic; }
.comment-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.children { margin-left: 2px; }

/* ---- Forms ---- */
.comment-form, .reply-form, #new-topic-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}
.reply-form { padding: 12px; margin-top: 10px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 10px; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%;
  font: inherit;
  margin-top: 4px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--green-soft); border-color: var(--green); }
textarea { resize: vertical; min-height: 90px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row label { flex: 1; min-width: 180px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.form-error { color: #b3261e; font-size: 13px; margin: 6px 0; }
.form-ok { color: var(--green-dark); font-size: 13px; margin: 6px 0; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Footer (fundo escuro, igual ao site oficial) ---- */
.site-footer { background: #34343a; padding: 38px 0 32px; margin-top: 48px; }
.footer-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 22px; }
.footer-logo { height: 84px; width: auto; display: block; }
.footer-note { color: rgba(255, 255, 255, .72); font-size: 13px; margin: 0; max-width: 560px; }
.footer-prr { width: 100%; max-width: 720px; height: auto; }
.footer-copy { color: rgba(255, 255, 255, .5); font-size: 12px; margin: 0; }

/* ---- Área de administração (/admin) ---- */
.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  max-width: 460px;
  margin-top: 16px;
}
.auth-card h1, .auth-card h2 { margin-top: 0; }
.auth-card button[type=submit] { margin-top: 4px; }

.admin-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.admin-row-title { font-family: "Work Sans", sans-serif; font-weight: 600; color: var(--green-dark); }
.admin-row-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ---- Sessão / registo ---- */
.user-status { display: flex; align-items: center; gap: 8px; }
.user-status:empty { display: none; }
.user-chip {
  background: var(--green-soft); color: var(--green-dark);
  border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 600;
}
.auth-card.reply-form { padding: 14px; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.auth-tabs .btn-link { padding: 4px 10px; border-radius: 6px; }
.auth-tabs .btn-link.active { background: var(--green-soft); color: var(--green-dark); font-weight: 600; text-decoration: none; }
.pill-mod { background: var(--blue); color: #fff; }
.comment-company { color: var(--muted); font-size: 12px; }

@media (max-width: 560px) {
  .brand-sub { display: none; }
  .header-inner { gap: 10px; }
}
