/*
 * "Moderna" theme, wave 10 / W38: search, new topics, watch lists, bookmarks, team, moderators, online, stats, FAQ.
 * Needs tokens.css, components.css and forum.css first. Tokens only: no hex colors, no web fonts, no libraries.
 * Contents: search panel, result cards, grouped topic lists, watch rows, people lists, stats tables, FAQ accordion, responsive.
 */

/* ---- shared: quick filter, empty filter result, list rows ---- */
.list-rows { list-style: none; margin: 0; padding: 0; }
.list-group { padding: 0; overflow: hidden; margin-bottom: var(--space-4); }
.list-group-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 18px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: var(--fs-base); font-weight: 650;
}
.list-group-head a { color: var(--text); }
.list-group-head a:hover { color: var(--link); text-decoration: none; }
.list-group-head .sep { color: var(--muted); font-weight: 400; }
.list-group-head .count { margin-left: auto; }
.list-group .topic-row { border-top: 1px solid var(--border); }
.list-group .list-group-head + .list-rows > .topic-row:first-child { border-top: 0; }
.topic-authors { color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-head-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px 76px 170px; gap: var(--space-4); padding: 9px 18px; background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; border-bottom: 1px solid var(--border); }
.list-head-row span:nth-child(2), .list-head-row span:nth-child(3) { text-align: right; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: var(--space-4); }
.filter-bar .quick-filter { flex: 1 1 220px; max-width: 360px; }
.filter-bar .quick-filter input { width: 100%; min-height: var(--control-h); padding: 6px 12px; }
.no-match { color: var(--muted); padding: var(--space-4) 0; text-align: center; }
.page-intro .chips-inline { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- search panel ---- */
.search-panel { display: grid; gap: var(--space-4); padding: var(--space-5); }
.search-main { position: relative; display: flex; gap: 8px; align-items: stretch; }
.search-main .icon { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-main input[type=search] { flex: 1; min-width: 0; height: 48px; padding: 0 14px 0 42px; font-size: var(--fs-lg); border-radius: var(--radius); }
.search-main .btn { height: 48px; padding: 0 22px; font-size: var(--fs-md); }
.search-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-5); }
.search-options .field { flex: 1 1 240px; max-width: 360px; }
.search-panel .hint, .search-hint { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.search-panel-compact { padding: var(--space-4); margin-bottom: var(--space-4); }
.search-panel-compact .search-main input[type=search] { height: var(--control-h); font-size: var(--fs-md); padding-left: 38px; }
.search-panel-compact .search-main .btn { height: var(--control-h); padding: 0 16px; font-size: var(--fs-base); }
.search-panel-compact .search-main .icon { left: 12px; width: 16px; height: 16px; }
.quick-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.quick-links a { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: var(--radius-sm); color: var(--text); }
.quick-links a:hover { background: var(--surface-2); text-decoration: none; }
.quick-links .icon { color: var(--muted); }

/* ---- search results ---- */
.results { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: var(--space-3); }
.result { margin: 0; padding: var(--space-4) var(--space-5); }
.result:hover { border-color: var(--border-strong); }
.result-title { font-size: var(--fs-md); font-weight: 650; line-height: var(--lh-tight); margin: 0 0 4px; word-break: break-word; }
.result-title a { color: var(--link); }
.result-title a:visited { color: var(--text-2); }
.result-snippet { margin: 4px 0 8px; color: var(--text-2); font-size: var(--fs-base); line-height: 1.55; max-width: var(--read-w); word-break: break-word; }
.result mark, .result-title mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; }
.result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--muted); font-size: var(--fs-sm); }
.result-meta a { color: var(--text-2); }
.result-meta .poster { display: inline-flex; align-items: center; gap: 6px; }
.result-meta .avatar { width: 22px; height: 22px; font-size: 11px; }
.result-count { color: var(--muted); font-size: var(--fs-sm); }

/* ---- watch lists (forums by email, topics by email) ---- */
.watch-cat { padding: 0; overflow: hidden; margin-bottom: var(--space-4); }
.watch-cat > h2 { font-size: var(--fs-base); padding: 10px 18px; margin: 0; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.watch-cat > h2 a { color: var(--text); }
.watch-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px var(--space-4); align-items: center;
  padding: 10px 18px; border-top: 1px solid var(--border);
}
.watch-cat > h2 + .list-rows > .watch-row:first-child { border-top: 0; }
.watch-row:hover { background: var(--surface-2); }
.watch-name a { font-weight: 550; color: var(--text); }
.watch-name a:hover { color: var(--link); text-decoration: none; }
.watch-nntp { display: block; color: var(--muted); font-size: var(--fs-xs); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: flex-end; }
.btn.is-on { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 650; }
.btn.is-on:hover { background: var(--accent-soft); filter: brightness(.97); }
.btn.is-on .icon { color: var(--accent); }
.watch-row.is-watched { box-shadow: inset 3px 0 0 var(--accent); }
.rss-feed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.steps { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--text-2); font-size: var(--fs-base); }
.steps li::marker { color: var(--muted); }

.watch-topic-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 160px 112px; gap: 6px var(--space-4); align-items: center;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.watch-topic-row:hover { background: var(--surface-2); }
/* the last column is fixed (not auto) so the head row and the rows, separate grids, put their columns in the same place */
.list-head-row-3 { grid-template-columns: minmax(0, 1fr) 160px 112px; }
.list-head-row-3 span:nth-child(2), .list-head-row-3 span:nth-child(3) { text-align: left; }
.watch-topic-board { font-size: var(--fs-sm); }

/* ---- bookmarks ---- */
.bookmark-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 150px 104px; gap: 6px var(--space-4); align-items: center;
  padding: 10px 18px 10px 10px; border-top: 1px solid var(--border);
}
.bookmark-row:hover { background: var(--surface-2); }
.list-head-row-bm { grid-template-columns: 40px minmax(0, 1fr) 150px 104px; padding-left: 10px; }
.list-head-row-bm span:nth-child(2), .list-head-row-bm span:nth-child(3) { text-align: left; }
.bookmark-order { display: grid; justify-items: center; gap: 2px; }
.bookmark-order .btn-square { width: 26px; height: 22px; min-height: 22px; padding: 0; }
.bookmark-order .btn-square .icon { width: 14px; height: 14px; }
.bookmark-order .btn-square[aria-disabled=true] { visibility: hidden; }
.bookmark-up .icon { transform: rotate(180deg); }
.bookmark-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.bookmark-title > a:first-child { font-weight: 550; color: var(--text); word-break: break-word; }
.bookmark-title > a:first-child:hover { color: var(--link); text-decoration: none; }
.bookmark-when { color: var(--muted); font-size: var(--fs-sm); }

/* ---- people: team, moderators, online ---- */
.people-section { margin-bottom: var(--space-8); }
.people-section > h2 { margin-bottom: var(--space-3); display: flex; align-items: baseline; gap: 10px; }
.people-section > h2 .count { font-weight: 600; }
.board-mod-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-3); }
.board-mod { margin: 0; padding: var(--space-4); display: grid; gap: 8px; align-content: start; }
.board-mod h2 { font-size: var(--fs-base); margin: 0; word-break: break-word; }
.board-mod h2 a { color: var(--text); }
.board-mod h2 a:hover { color: var(--link); }
.mod-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.mod-list a { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 3px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text); font-size: var(--fs-sm); }
.mod-list a:hover { border-color: var(--border-strong); text-decoration: none; }
.mod-list .avatar { width: 22px; height: 22px; font-size: 11px; }
.online-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px var(--space-4); }
.online-list li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: var(--radius-sm); }
.online-list li:hover { background: var(--surface-2); }
.online-list a { color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online-list .level { flex: none; }
.guest-hosts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; }

/* ---- stats ---- */
.stat-section { padding: 0; overflow: hidden; margin-bottom: var(--space-4); }
.stat-section > summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none;
  font-size: var(--fs-md); font-weight: 650;
}
.stat-section > summary::-webkit-details-marker { display: none; }
.stat-section > summary .icon { color: var(--muted); transition: transform var(--dur-fast); }
.stat-section[open] > summary .icon { transform: rotate(90deg); }
.stat-section > summary .count { margin-left: auto; }
.stat-section > summary:hover { background: var(--surface-2); }
.stat-caption { padding: 0 18px 8px; color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.stat-section .table-wrap { margin: 0; padding: 0; border-top: 1px solid var(--border); }
.stat-section .table td, .stat-section .table th { padding-left: 18px; }
.stat-section .table td:last-child, .stat-section .table th:last-child { padding-right: 18px; }
.stat-section .table td { font-variant-numeric: tabular-nums; }
.stat-section .table .num { text-align: right; }
.stat-fallback { overflow-x: auto; }

/* ---- FAQ accordion ---- */
.faq-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: var(--space-4); }
.faq-tools .quick-filter { flex: 1 1 240px; max-width: 420px; }
.faq-tools .quick-filter input { width: 100%; min-height: var(--control-h); padding: 6px 12px; }
.faq-list { display: grid; gap: var(--space-2); margin-bottom: var(--space-6); }
.faq-item { padding: 0; margin: 0; overflow: hidden; scroll-margin-top: calc(var(--header-h) + 16px); }
.faq-item > summary {
  display: flex; align-items: baseline; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none;
  font-weight: 600; font-size: var(--fs-md); line-height: var(--lh-tight);
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary:hover { background: var(--surface-2); }
.faq-item > summary:focus-visible { outline-offset: -2px; }
.faq-num { flex: none; min-width: 2ch; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.faq-q { flex: 1; min-width: 0; word-break: break-word; }
.faq-item > summary .icon { flex: none; align-self: center; color: var(--muted); transition: transform var(--dur-fast); }
.faq-item[open] > summary .icon { transform: rotate(180deg); }
.faq-item[open] > summary { border-bottom: 1px solid var(--border); background: var(--surface-2); }
.faq-item:target { border-color: var(--accent); }
.faq-answer { padding: 16px 18px 18px 18px; max-width: var(--read-w); line-height: var(--lh-post); font-size: var(--fs-post); color: var(--text); word-break: break-word; }
.faq-answer img { max-width: 100%; height: auto; }
.faq-answer-foot { padding: 0 18px 14px; font-size: var(--fs-sm); }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .search-options .field { max-width: none; }
}
@media (max-width: 760px) {
  .list-head-row, .list-head-row-3, .list-head-row-bm { display: none; }
  .list-group-head { padding: 10px 14px; }
  .search-panel { padding: var(--space-4); }
  .search-main { flex-wrap: wrap; }
  .search-main input[type=search] { flex-basis: 100%; height: 44px; font-size: var(--fs-md); }
  .search-main .btn { width: 100%; justify-content: center; }
  .result { padding: var(--space-3) var(--space-4); }
  .watch-row { grid-template-columns: 1fr; padding: 12px 14px; }
  .watch-actions { justify-content: flex-start; }
  .watch-topic-row { grid-template-columns: 1fr; padding: 12px 14px; }
  .bookmark-row { grid-template-columns: 34px minmax(0, 1fr); padding: 12px 14px 12px 8px; }
  .bookmark-row .bookmark-when, .bookmark-row .bookmark-del { grid-column: 2; }
  .board-mod-grid { grid-template-columns: 1fr; }
  .online-list { grid-template-columns: 1fr; }
  .stat-section > summary { padding: 12px 14px; }
  .stat-section .table td, .stat-section .table th { padding-left: 14px; }
  .faq-item > summary { padding: 12px 14px; }
  .faq-answer { padding: 14px; }
  .faq-answer-foot { padding: 0 14px 12px; }
}

/* single-column .split: let the main column shrink below its widest child (the watch rows wrap instead) */
.split-main { min-width: 0; }
.watch-name, .watch-actions { min-width: 0; }

/* ---- FAQ editor (faq/admin) ---- */
.faq-admin-row { display: flex; align-items: center; gap: var(--space-3); padding: 8px 0; border-top: 1px solid var(--border); }
.faq-admin-row:first-child { border-top: 0; }
.faq-admin-q { flex: 1; min-width: 0; color: var(--text); font-weight: 550; word-break: break-word; }
.faq-admin-row .btn-group { flex: none; }
@media (max-width: 760px) {
  .faq-admin-row { flex-wrap: wrap; }
  .faq-admin-q { flex-basis: calc(100% - 3ch); }
}

/* /pracenje?tema=N: the topic from the notification mail, first and highlighted */
.watch-topic-row.is-focus { background: var(--accent-soft, #fff6d6); box-shadow: inset 3px 0 0 var(--accent, #c90); }
