/* ────────────────────────────────────────────────────────────────────────
   Forum thread row — shared styles for the .f2-thread* partial.

   Extracted from index.php so EVERY page that uses includes/forum-thread-row.php
   gets the same look: profile pages, /forum/, /city/{slug}, /country/{slug},
   and anywhere else the partial is included.

   Custom props (--f2-card-bg etc.) are defined in public/css/style.css.
   ──────────────────────────────────────────────────────────────────────── */

/* ── Thread list ───────────────────────────────────────────────────── */
.f2-threads {
  display: flex; flex-direction: column;
  gap: 8px;
  /* Pull rows out to the edges of the center column */
  margin: 0 -20px;
}
.f2-thread {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 22px;
  align-items: start;
  padding: 16px 20px;
  background: var(--f2-card-bg);
  border: 1px solid var(--f2-card-border);
  color: inherit; text-decoration: none;
  position: relative;
  transition: background .12s, border-color .12s;
}
.f2-thread:hover { background: var(--f2-row-hover); border-color: rgba(255,255,255,0.07); text-decoration: none; }
.f2-thread a, .f2-thread a:hover { text-decoration: none; }
.f2-thread-link { position: absolute; inset: 0; z-index: 0; }
.f2-thread--has-thumb { grid-template-columns: minmax(0, 1fr) 136px; }
.f2-thread-author-wrap { position: relative; z-index: 1; text-decoration: none; color: inherit; }
.f2-thread-author-wrap:hover .f2-thread-name-text { color: var(--gold); }
.f2-thread-loc { position: relative; z-index: 1; text-decoration: none; color: inherit; }

/* Pin icon used inline before the title for pinned threads */
.f2-title-pin {
  color: var(--gold);
  font-size: 0.85em;
  vertical-align: -2px;
  margin-right: 4px;
}

/* Guides sticky row */
.f2-thread--guides { background: rgba(233,200,152,0.03); }
.f2-thread--guides:hover { background: rgba(233,200,152,0.07); }
.f2-guides-icon {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(233,200,152,0.1); border: 1px solid rgba(233,200,152,0.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-size: 1.05rem;
  flex-shrink: 0;
}

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

/* Top header row — 4 fixed-width slots: [author][time][post-type][location] */
.f2-thread-top {
  display: flex; align-items: center;
  gap: 20px;
  margin-bottom: 12px;
}

/* Slot 1 — author wrap (avatar + name/handle stack). 240px so 21-char handles
   like @brianearlspilner1055 fit alongside 18-char names like "Rodney Dangerfield". */
.f2-thread-author-wrap {
  display: flex; align-items: center; gap: 10px;
  width: 240px; flex-shrink: 0; min-width: 0;
}
.f2-thread-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.f2-thread-author { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.f2-thread-name {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.92rem; font-weight: 700; color: var(--text-primary);
  line-height: 1.2; min-width: 0;
}
.f2-thread-name-text {
  display: inline-block; max-width: 184px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: bottom;
}
.f2-thread-name .elite-badge {
  display: inline-flex; align-items: center; flex-shrink: 0;
  color: var(--gold); font-size: 0.88em; line-height: 1;
}
.f2-thread-handle {
  font-size: 0.76rem; color: var(--text-muted); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Slot 2 — time, fixed 80px */
.f2-thread-time {
  width: 80px; flex-shrink: 0;
  font-size: 0.82rem; color: var(--text-muted);
}

/* Slot 3 — post-type badge, fixed 120px */
.f2-thread-tag-slot {
  width: 120px; flex-shrink: 0;
  display: inline-flex; align-items: center;
}

/* Slot 4 — location, fills remaining width */
.f2-thread-loc {
  flex: 1; min-width: 0;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 1rem; color: var(--gold); font-weight: 600;
}
.f2-thread-loc i { color: var(--gold); font-size: 0.95em; flex-shrink: 0; }
.f2-thread-loc-flag { font-size: 0.95em; flex-shrink: 0; }
.f2-thread-loc-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}

.f2-badge {
  display: inline-block; padding: 2px 7px;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.05em;
  border-radius: 3px; text-transform: uppercase; line-height: 1.5;
  flex-shrink: 0;
}

/* Title */
.thread-title {
  font-size: 1.25rem; font-weight: 600; line-height: 1.3;
  color: var(--text-primary); margin: 0 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.f2-thread:hover .thread-title { color: var(--gold); }

/* HOT pill inline with title */
.f2-title-hot {
  display: inline-block; padding: 1px 6px;
  font-size: 0.55em; font-weight: 800; letter-spacing: 0.06em;
  background: #c0392b; color: #fff;
  border-radius: 3px; vertical-align: middle;
  margin-right: 6px;
}

/* Body snippet — 2 lines max */
.f2-thread-snippet {
  color: var(--text-muted); line-height: 1.5;
  margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Right side: stacked last-reply (top) + stats (bottom) */
.f2-thread-side {
  display: flex; flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  text-align: right;
}
.f2-thread-lastreply { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }

/* Mobile-only Consult Calls in-feed promo */
.f2-thread--promo { display: none !important; }
@media (max-width: 640px) {
  .f2-thread--promo {
    display: grid !important;
    background: var(--bg-elevated);
    border-color: rgba(233,200,152,0.18);
  }
  .f2-thread--promo:hover {
    background: rgba(233,200,152,0.08);
    border-color: rgba(233,200,152,0.32);
  }
  .f2-thread--promo .f2-thread-time {
    color: var(--gold);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.7rem;
  }
  .f2-thread--promo .f2-thread-loc i,
  .f2-thread--promo .f2-thread-loc-name { color: var(--gold); }
}

/* Media thumbnail */
.f2-thread-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-elevated);
  position: relative;
  pointer-events: none;
}
.f2-thread-thumb > img:first-of-type {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.f2-thread-thumb--video::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(0,0,0,0.18);
  pointer-events: none;
}
.f2-thread-thumb-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.6rem;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 1;
}
.f2-thread-lastdate { font-size: 0.78rem; color: var(--text-muted); display: block; }
.f2-thread-lastago { display: none; }
.f2-stat-icon { display: none; }
.f2-thread-lastuser {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--text-body);
}
.f2-thread-lastuser-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.f2-thread-stats { display: flex; gap: 18px; }
.f2-stat { text-align: center; }
.f2-stat-num { font-size: 1.05rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.f2-stat-label {
  font-size: 0.6rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-top: 3px;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .f2-threads { margin: 0 -16px; }
  .f2-thread { grid-template-columns: minmax(0, 1fr) 140px; gap: 16px; }
  .f2-thread--has-thumb { grid-template-columns: minmax(0, 1fr) 124px; }
  .thread-title { font-size: 1.25rem; }
  .f2-thread-author-wrap { width: 210px; }
  .f2-thread-name-text { max-width: 160px; }
  .f2-thread-time { width: 72px; }
  .f2-thread-tag-slot { width: 110px; }
  .f2-thread-top { gap: 16px; }
}
@media (max-width: 900px) {
  .f2-thread { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .f2-thread-side {
    flex-direction: row; align-items: center; justify-content: space-between;
    text-align: left;
  }
  .f2-thread-lastreply { flex-direction: row; align-items: center; gap: 8px; }
  .f2-thread-lastreply .f2-thread-lastdate { order: 2; }
  .f2-thread-top { flex-wrap: wrap; gap: 8px 14px; }
  .f2-thread-author-wrap { width: auto; }
  .f2-thread-name-text { max-width: none; }
  .f2-thread-time,
  .f2-thread-tag-slot { width: auto; }
  .f2-thread-loc { flex: 0 0 auto; }
}
@media (max-width: 640px) {
  .f2-threads { margin: 0 -14px; }

  .f2-thread {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "title"
      "snippet";
    grid-auto-rows: min-content;
    align-content: start;
    padding: 12px 14px;
    gap: 6px;
  }
  .f2-thread--has-thumb {
    grid-template-areas:
      "header"
      "title"
      "thumb";
  }
  .f2-thread-main { display: contents; }
  .f2-thread-side { display: contents; }

  .f2-thread-top     { grid-area: header; }
  .thread-title      { grid-area: title; font-size: 1.2rem; }
  .f2-thread-snippet { grid-area: snippet; -webkit-line-clamp: 2; }
  .f2-thread-thumb   { grid-area: thumb; }

  .f2-thread--has-thumb .f2-thread-snippet { display: none !important; }

  .f2-thread-stats,
  .f2-thread-lastreply { display: none !important; }

  .f2-thread > *,
  .f2-thread-main > *,
  .f2-thread-side > * { margin: 0 !important; }

  .f2-thread-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "author location"
      "time   tag";
    column-gap: 10px;
    row-gap: 4px;
    align-items: center;
  }
  .f2-thread-author-wrap { grid-area: author; width: auto; }
  .f2-thread-loc { grid-area: location; flex: 0 0 auto; font-size: 0.82rem; justify-self: end; }
  .f2-thread-time { grid-area: time; width: auto; font-size: 0.72rem; }
  .f2-thread-tag-slot { grid-area: tag; width: auto; justify-content: flex-end; }

  .f2-thread-thumb { aspect-ratio: 16 / 9; max-height: 200px; border-radius: 6px; }
}
