/* ================================================
   Solarpunk Vegan Forum
   Earthy, warm, minimal — a community gathering place
   ================================================ */

:root {
  --bg:           #f0e9dc;
  --surface:      #faf5ed;
  --surface-2:    #fff;
  --border:       #d4c4a4;
  --border-light: #e4d8c0;

  --text:         #261a0c;
  --text-muted:   #7a6550;
  --text-light:   #a08870;

  --green:        #4a7c3f;
  --green-dark:   #396130;
  --green-pale:   #e8f0e5;
  --green-mid:    #c4d8be;

  --amber:        #b87830;
  --amber-pale:   #fdf3e3;

  --red:          #a83020;
  --red-pale:     #faeae7;

  --radius:       5px;
  --radius-lg:    8px;
  --shadow:       0 2px 8px rgba(38,26,12,0.10);
  --shadow-sm:    0 1px 3px rgba(38,26,12,0.07);

  --max-width:    860px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
button, input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

/* ---- Base ---- */
html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
}

/* ---- Layout ---- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-main {
  flex: 1;
  padding: 1.75rem 0 3.5rem;
}

/* ---- Header ---- */
.site-header {
  background: var(--green);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  text-decoration: none;
}
.site-logo:hover { opacity: 0.9; text-decoration: none; }

.logo-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.logo-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.logo-tagline {
  font-size: 0.68rem;
  opacity: 0.78;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.nav-link {
  color: rgba(255,255,255,0.88);
  font-size: 0.9rem;
}
.nav-link:hover { color: #fff; text-decoration: none; }

.nav-user {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.82);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.nav-user-icon { font-size: 0.9rem; }

.inline-form { display: inline; }

.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
  padding: 0;
  text-decoration: underline;
}
.btn-link:hover { color: #fff; }

.btn-header {
  display: inline-block;
  padding: 0.3em 0.85em;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.45);
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-header:hover { background: rgba(255,255,255,0.28); text-decoration: none; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 0.45em 1.05em;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }

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

.btn-outline {
  background: transparent;
  color: var(--green);
  border-color: var(--green-mid);
}
.btn-outline:hover { background: var(--green-pale); border-color: var(--green); }

.btn-sm { padding: 0.28em 0.7em; font-size: 0.82rem; }
.btn-full { width: 100%; }

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--green); text-decoration: none; }
.breadcrumb .sep { color: var(--border); }
.breadcrumb-current {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

/* ---- Page Hero ---- */
.page-hero {
  text-align: center;
  padding: 2.25rem 1rem 2.5rem;
  max-width: 580px;
  margin: 0 auto 2.25rem;
}
.page-hero h1 {
  font-size: 1.75rem;
  margin-bottom: 0.65rem;
  color: var(--text);
}
.page-hero p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
}

/* ---- Category List ---- */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.category-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.category-card:hover { box-shadow: var(--shadow); }

.category-main {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
}

.category-icon {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.category-info { flex: 1; min-width: 0; }

.category-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.category-name a { color: var(--text); }
.category-name a:hover { color: var(--green); text-decoration: none; }

.category-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.category-stats {
  flex-shrink: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.category-stats strong {
  display: block;
  font-size: 1.15rem;
  color: var(--text);
  font-weight: 600;
}

.category-latest {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.5rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg);
  border-top: 1px solid var(--border-light);
}
.latest-label { color: var(--text-light); flex-shrink: 0; }
.latest-title {
  color: var(--text-muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 340px;
}
.latest-title:hover { color: var(--green); text-decoration: none; }
.latest-meta { color: var(--text-light); flex-shrink: 0; }
.latest-empty { font-style: italic; color: var(--text-light); }

/* ---- Join Callout ---- */
.join-callout {
  margin-top: 2.5rem;
  padding: 2rem 1.75rem;
  background: var(--green-pale);
  border: 1px solid var(--green-mid);
  border-radius: var(--radius-lg);
  text-align: center;
}
.join-callout h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.join-callout p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.25rem; }
.join-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; }
.page-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* ---- Thread List ---- */
.thread-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.thread-list-header {
  display: grid;
  grid-template-columns: 1fr 72px 130px;
  padding: 0.5rem 1.1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.thread-row {
  display: grid;
  grid-template-columns: 1fr 72px 130px;
  align-items: center;
  padding: 0.85rem 1.1rem;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.thread-row:last-child { border-bottom: none; }
.thread-row:hover { background: var(--bg); }

.thread-main { min-width: 0; }

.thread-title {
  display: block;
  font-weight: 500;
  color: var(--text);
  font-size: 0.975rem;
  line-height: 1.4;
  margin-bottom: 0.2rem;
}
.thread-title:hover { color: var(--green); text-decoration: none; }

.thread-meta {
  display: block;
  font-size: 0.775rem;
  color: var(--text-muted);
}

.col-r {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.reply-count {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.col-a {
  display: flex;
  flex-direction: column;
  font-size: 0.775rem;
  color: var(--text-muted);
  gap: 0.1rem;
}
.last-user { font-weight: 500; color: var(--text); }

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.975rem; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}
.page-info { font-size: 0.875rem; color: var(--text-muted); }

/* ---- Thread View ---- */
.thread-heading {
  font-size: 1.5rem;
  line-height: 1.3;
  margin-bottom: 1.1rem;
}

.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 0.9rem;
  overflow: hidden;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.84rem;
  flex-wrap: wrap;
}

.post-author {
  font-weight: 600;
  color: var(--text);
}
.post-date { color: var(--text-muted); }
.post-num { color: var(--text-light); margin-left: auto; font-size: 0.78rem; }

.post-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.1em 0.45em;
  border-radius: 3px;
}
.op-badge {
  background: var(--green-pale);
  color: var(--green);
  border: 1px solid var(--green-mid);
}

.post-body {
  padding: 1rem 1.1rem;
  font-size: 0.975rem;
  line-height: 1.78;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.post-op {
  border-color: var(--green-mid);
}
.post-op .post-header {
  background: var(--green-pale);
}

/* ---- Replies ---- */
.replies-section { margin-top: 0.5rem; }

.replies-heading {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.75rem 0;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-light);
}

/* ---- Reply Form ---- */
.reply-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border-light);
}

.reply-heading {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.reply-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.95rem;
  line-height: 1.65;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 0.75rem;
  display: block;
}
.reply-form textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74,124,63,0.12);
}

.login-prompt {
  padding: 1.25rem 1.5rem;
  background: var(--amber-pale);
  border: 1px solid #e8d4a8;
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.login-prompt a { font-weight: 500; }

/* ---- Forms ---- */
.form-page {
  max-width: 660px;
}
.form-page h1 { font-size: 1.4rem; margin-bottom: 0.3rem; }
.form-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }

.main-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="email"] {
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.975rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74,124,63,0.12);
}

.main-form textarea {
  padding: 0.65rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.975rem;
  line-height: 1.65;
  resize: vertical;
  min-height: 220px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.main-form textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74,124,63,0.12);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 0.25rem;
}

/* ---- Alerts ---- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.alert-error {
  background: var(--red-pale);
  border-color: #e0b0a8;
  color: var(--red);
}

/* ---- Auth Pages ---- */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0 2rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.35rem; margin-bottom: 0.35rem; }
.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.auth-switch {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  text-align: center;
  color: var(--text-muted);
}
.auth-switch a { font-weight: 500; }

/* ---- Footer ---- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--green); }

/* ---- 404 ---- */
.error-page {
  text-align: center;
  padding: 4rem 1.5rem;
}
.error-icon { font-size: 3rem; margin-bottom: 1rem; }
.error-page h1 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.error-page p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ---- Mobile ---- */
@media (max-width: 620px) {
  .logo-tagline { display: none; }

  .category-stats { display: none; }

  .thread-list-header { display: none; }
  .thread-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .col-r { display: none; }
  .col-a {
    flex-direction: row;
    gap: 0.35rem;
    font-size: 0.75rem;
  }

  .page-header { flex-direction: column; gap: 0.75rem; }
  .page-header .btn { align-self: flex-start; }

  .thread-heading { font-size: 1.25rem; }

  .auth-card { padding: 1.5rem 1.1rem; }

  .join-callout { padding: 1.5rem 1rem; }

  .latest-title { max-width: 200px; }

  .breadcrumb-current { max-width: 180px; }
}

@media (max-width: 400px) {
  .site-header .container { gap: 0.5rem; }
  .logo-name { font-size: 0.9rem; }
}

/* ================================================
   Admin Panel
   ================================================ */

.nav-admin { font-weight: 600; color: var(--green-dark) !important; }

.btn-admin-delete {
  background: none;
  border: 1px solid #c0392b;
  color: #c0392b;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-admin-delete:hover { background: #c0392b; color: #fff; }

.admin-delete-form { margin-left: auto; }

.admin-panel { max-width: 900px; }

.admin-notice {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.admin-notice-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.admin-notice-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.admin-section { margin-bottom: 2.5rem; }

.admin-section-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--border);
}

.admin-subsection-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1.25rem 0 0.75rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.admin-table th {
  background: var(--bg);
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }
.edit-row:hover td { background: var(--surface-2) !important; }

.admin-desc { color: var(--text-muted); font-size: 0.8rem; max-width: 260px; }

.admin-actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

.btn-admin-sm {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.22rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-admin-sm:hover { background: var(--bg); border-color: var(--green); color: var(--green-dark); }

.btn-admin-delete-sm {
  background: none;
  border: 1px solid #c0392b;
  color: #c0392b;
  font-size: 0.78rem;
  padding: 0.22rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-admin-delete-sm:hover { background: #c0392b; color: #fff; }

.btn-admin-cancel {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.22rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
}

.admin-edit-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

.admin-input {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  background: var(--surface-2);
  color: var(--text);
  width: 160px;
}
.admin-input-sm  { width: 60px; }
.admin-input-wide { width: 280px; }

.admin-new-category { margin-top: 1rem; }
