/* ============================================================
   forum.css – Feder und Tinte Forum
   Design: dark mystic, gold accent, bordeaux gradient
   ============================================================ */

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #07060d;
  --text:        #f8f2ea;
  --text-muted:  #a89880;
  --gold:        #f4cf86;
  --gold-dim:    rgba(244, 207, 134, .55);
  --gold-border: rgba(244, 207, 134, .18);
  --bx1:         #6f203f;
  --bx2:         #4b1f38;
  --bx3:         #2a1622;
  --card-bg:     rgba(255, 255, 255, .04);
  --card-border: rgba(244, 207, 134, .14);
  --card-hover:  rgba(244, 207, 134, .22);
  --radius:      10px;
  --radius-sm:   6px;
  --font:        'Inter', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; }

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(111, 32, 63, .28) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(75, 31, 56, .22) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(42, 22, 34, .18) 0%, transparent 70%);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Wrapper ─────────────────────────────────────────────── */
.f-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* ── Header ──────────────────────────────────────────────── */
.f-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 12px;
}

.f-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.f-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #f0e8ff;
  letter-spacing: -.02em;
  line-height: 1.2;
}

/* ── Back link ───────────────────────────────────────────── */
.f-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .85rem;
  padding: 5px 10px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  transition: color .2s, border-color .2s;
  margin-bottom: 20px;
}

.f-back:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ── Buttons ─────────────────────────────────────────────── */
.f-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 22px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font);
}

.f-btn:active { transform: scale(.97); }

.f-btn-primary {
  background: linear-gradient(135deg, var(--bx1) 0%, var(--bx2) 50%, var(--bx3) 100%);
  color: #fff0da;
  border: 1px solid rgba(244,207,134,.35);
  box-shadow: 0 2px 14px rgba(111, 32, 63, .35);
}

.f-btn-primary:hover:not(:disabled) {
  opacity: .88;
  box-shadow: 0 4px 22px rgba(111, 32, 63, .55);
}

.f-btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.f-btn-ghost {
  background: transparent;
  color: #c9bde0;
  border: 1px solid rgba(200,180,255,.2);
}

.f-btn-ghost:hover { border-color: rgba(200,180,255,.38); background: rgba(200,180,255,.05); color: #e8daf5; }

/* ── Toolbar ─────────────────────────────────────────────── */
.f-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.f-search {
  width: 100%;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: .95rem;
  padding: 10px 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.f-search::placeholder { color: var(--text-muted); }

.f-search:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(244, 207, 134, .1);
}

/* ── Tag filter bar ──────────────────────────────────────── */
.f-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.f-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 14px;
  border: 1px solid rgba(200,180,255,.2);
  background: transparent;
  color: #b0a3c2;
  font-size: .78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
  font-family: var(--font);
}

.f-tag:hover { border-color: rgba(200,180,255,.38); background: rgba(200,180,255,.07); color: #d4c8ea; }

.f-tag.active {
  background: linear-gradient(135deg, var(--bx1), var(--bx2));
  color: #ffe8b8;
  border-color: rgba(244,207,134,.4);
  font-weight: 700;
}

/* ── Tag badges inside cards ─────────────────────────────── */
.f-tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 12px;
  border: 1px solid rgba(200,180,255,.2);
  background: rgba(200,180,255,.06);
  color: #b0a3c2;
  font-size: .72rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}

.f-tag-link:hover { border-color: rgba(200,180,255,.38); background: rgba(200,180,255,.12); color: #d4c8ea; }

/* ── Thread list ─────────────────────────────────────────── */
.f-thread-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Thread card ─────────────────────────────────────────── */
.f-thread-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, background .2s;
  text-decoration: none;
  display: block;
}

.f-thread-card:hover {
  border-color: var(--card-hover);
  box-shadow: 0 4px 24px rgba(111, 32, 63, .22), 0 0 0 1px rgba(244, 207, 134, .08);
  background: rgba(255, 255, 255, .07);
}

.f-thread-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.f-thread-excerpt {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.f-thread-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.f-thread-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--text-muted);
}

.f-thread-author { color: var(--text); font-weight: 500; }
.f-thread-dot { color: rgba(168, 152, 128, .4); }
.f-thread-time { color: var(--text-muted); }
.f-thread-replies { color: var(--text-muted); }

/* ── Avatars ─────────────────────────────────────────────── */
.f-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.f-avatar-placeholder {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bx1), var(--bx2));
  color: var(--gold);
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--gold-border);
}

/* ── Empty / loading states ──────────────────────────────── */
.f-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 48px 20px;
  font-size: .95rem;
}

/* ── Modal (dialog) ──────────────────────────────────────── */
.f-modal:not([open]) { display: none; }

.f-modal[open] {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  background: #110d1c;
  border: 1px solid rgba(244, 207, 134, .22);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0, 0, 0, .7), 0 0 0 1px rgba(244, 207, 134, .06);
  z-index: 100;
}

.f-modal::backdrop {
  background: rgba(7, 6, 13, .75);
  backdrop-filter: blur(6px);
}

.f-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid rgba(244, 207, 134, .1);
  flex-shrink: 0;
}

.f-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f0e8ff;
}

.f-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  font-family: var(--font);
}

.f-modal-close:hover { color: var(--text); background: rgba(255, 255, 255, .06); }

.f-modal-body {
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.f-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

/* ── Form elements ───────────────────────────────────────── */
.f-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.f-hint {
  font-size: .78rem;
  font-weight: 400;
  color: rgba(168, 152, 128, .7);
}

.f-input,
.f-textarea {
  width: 100%;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: .92rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  resize: vertical;
}

.f-input::placeholder,
.f-textarea::placeholder { color: var(--text-muted); }

.f-input:focus,
.f-textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(244, 207, 134, .1);
}

.f-form-error {
  color: #e07070;
  font-size: .85rem;
  padding: 8px 12px;
  background: rgba(224, 80, 80, .1);
  border: 1px solid rgba(224, 80, 80, .25);
  border-radius: var(--radius-sm);
}

/* ── Thread full view (thread.html) ──────────────────────── */
.f-thread-full {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  margin-bottom: 32px;
}

.f-thread-full-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 16px;
}

.f-thread-full-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.f-thread-full-meta-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.f-thread-body {
  color: var(--text);
  font-size: .975rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* ── Replies section ─────────────────────────────────────── */
.f-replies-section {
  margin-top: 8px;
}

.f-replies-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e8daf5;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--card-border);
}

.f-reply-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
}

.f-reply-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: .82rem;
}

.f-reply-body {
  color: var(--text);
  font-size: .925rem;
  line-height: 1.7;
  word-wrap: break-word;
}

/* ── Reply form ──────────────────────────────────────────── */
#fReplyForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}

/* ── Login hint ──────────────────────────────────────────── */
.f-login-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 12px;
  font-style: italic;
}

#fLoginHint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 24px;
  border-top: 1px solid var(--card-border);
}

/* ── Owner actions (edit/delete) ────────────────────────── */
.f-owner-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}
.f-btn-sm { padding: 5px 12px; font-size: .8rem; }
.f-btn-danger {
  background: rgba(200,60,60,.15);
  color: #f08080;
  border: 1px solid rgba(200,60,60,.3);
}
.f-btn-danger:hover { background: rgba(200,60,60,.25); border-color: rgba(200,60,60,.5); }
.f-edit-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.f-edited-hint {
  font-size: .78rem;
  color: rgba(168,152,128,.55);
  font-style: italic;
  margin-top: 12px;
  text-align: right;
}

.f-reply-del {
  all: unset;
  box-sizing: border-box;
  margin-left: auto;
  cursor: pointer;
  font-size: 13px;
  opacity: .3;
  transition: opacity .15s ease;
  padding: 2px 4px;
  border-radius: 4px;
}
.f-reply-del:hover { opacity: 1; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .f-wrap { padding: 20px 14px 60px; }

  .f-title { font-size: 1.4rem; }

  .f-header { margin-bottom: 20px; }

  .f-thread-full { padding: 20px 16px 18px; }
  .f-thread-full-title { font-size: 1.25rem; }

  .f-modal[open] { border-radius: 12px 12px 0 0; align-self: flex-end; width: 100%; max-height: 85vh; }

  .f-modal-body { padding: 16px; }
  .f-modal-head { padding: 14px 16px 12px; }

  .f-thread-card { padding: 14px 16px; }
  .f-btn { padding: 7px 14px; font-size: .85rem; }
  .f-modal-actions { flex-direction: column-reverse; }
  .f-modal-actions .f-btn { width: 100%; justify-content: center; }
}
