/* Reddit Thread Finder - tool-specific styles. Composes shared primitives
 * in tools.css (form card, mode toggle, results region, quota banner,
 * history, toasts); only this tool's layout lives here. */

:root {
    --rtf-accent: #d93a00;
    --rtf-accent-dark: #b33000;
    --rtf-accent-tint: #fff4ef;
    --rtf-border: #e6e8eb;
}

.rtf-intro { color: #475569; font-size: 0.95rem; margin: 0 0 14px; }
.rtf-mode { margin-bottom: 14px; }
/* Uniform tab widths so the shared 50% pill covers the longer second
 * label: an equal-column grid sizes BOTH tabs to the widest label (a
 * flex 1 1 0 split shrinks the long label into two lines instead), plus
 * the slide rule for this tool's second data-mode. */
.rtf-mode { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.rtf-mode .mode-btn { white-space: nowrap; }
.rtf-mode[data-mode="url"]::before { transform: translateX(100%); }

/* The hero lead is long here; let it run the full container width
 * instead of the shared 920px cap (operator request, 2026-09-03). */
.page-hero-description { max-width: none; }
.rtf-row { margin-bottom: 12px; }
.rtf-row .text-input { width: 100%; box-sizing: border-box; flex: 0 0 auto; }
.rtf-select { max-width: 320px; }
.rtf-submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 6px; }
.rtf-submit-row .form-hint { margin: 0; flex: 1 1 320px; }

/* Daily-limit banner: hidden by default, shown by JS. */
.rtf-daily-banner[hidden] { display: none; }

/* ---- Overview (summary, subreddits panel, related searches) ---- */
.rtf-overview {
    background: #fff;
    border: 1px solid var(--rtf-border);
    border-radius: 12px;
    padding: 18px 20px;
    margin: 18px 0;
}
.rtf-overview[hidden] { display: none; }
.rtf-overview-head { margin-bottom: 12px; }
.rtf-overview-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 4px; color: #1f2937; word-break: break-word; }
.rtf-overview-sub { margin: 0; color: #64748b; font-size: 0.9rem; }
.rtf-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.rtf-stat { background: #f8fafc; border: 1px solid var(--rtf-border); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.rtf-stat-num { display: block; font-size: 1.35rem; font-weight: 800; color: #1f2937; line-height: 1.15; font-variant-numeric: tabular-nums; }
.rtf-stat-label { display: block; font-size: 0.78rem; color: #64748b; margin-top: 2px; }
.rtf-panel-title { font-size: 0.95rem; font-weight: 700; margin: 12px 0 8px; color: #1f2937; }
.rtf-panel-hint { font-weight: 400; color: #94a3b8; font-size: 0.8rem; margin-left: 6px; }
.rtf-subs[hidden], .rtf-related[hidden] { display: none; }
.rtf-subs-list { display: flex; flex-wrap: wrap; gap: 8px; }
.rtf-sub {
    font: inherit;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px solid var(--rtf-border);
    border-radius: 999px;
    background: #fff;
    color: #1f2937;
    cursor: pointer;
}
.rtf-sub:hover { border-color: var(--rtf-accent); color: var(--rtf-accent); background: var(--rtf-accent-tint); }
.rtf-sub:focus-visible { outline: 2px solid var(--rtf-accent); outline-offset: 1px; }
.rtf-sub-name { font-weight: 700; }
.rtf-sub-meta { color: #64748b; font-size: 0.78rem; }
.rtf-sub:hover .rtf-sub-meta { color: inherit; }
.rtf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rtf-chip {
    font: inherit;
    font-size: 0.83rem;
    padding: 6px 12px;
    border: 1px solid var(--rtf-border);
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
}
.rtf-chip:hover { border-color: var(--rtf-accent); color: var(--rtf-accent); background: var(--rtf-accent-tint); }

/* ---- Results table ---- */
.results-table-wrap { position: relative; }
.results-table th.col-rank, .results-table td.col-rank { width: 64px; text-align: center; }
.results-table th.col-thread { width: 44%; }
.results-table th.col-sub { width: 150px; }
.results-table th.col-kind { width: 96px; }
.results-table th.col-etv { width: 120px; text-align: right; }
.results-table td.col-etv { text-align: right; font-variant-numeric: tabular-nums; }
.results-table th.col-kws { width: 150px; text-align: right; }
.results-table td.col-kws { text-align: right; }
.results-table th.col-keyword { width: 60%; }
.results-table th.col-pos { width: 110px; text-align: center; }
.results-table td.col-pos { text-align: center; font-variant-numeric: tabular-nums; }
.results-table th.sortable { cursor: pointer; user-select: none; }
.results-table th.sortable:hover { color: var(--rtf-accent); }
.results-table th .sort-mark { font-size: 0.7rem; margin-left: 4px; color: #94a3b8; }
.rtf-thread-title { font-weight: 600; color: #1f2937; word-break: break-word; }
.rtf-thread-title a { color: #1f2937; text-decoration: none; }
.rtf-thread-title a:hover { color: var(--rtf-accent); text-decoration: underline; }
.rtf-thread-url { display: block; color: #94a3b8; font-size: 0.78rem; margin-top: 2px; word-break: break-all; }
.rtf-snippet { display: block; color: #64748b; font-size: 0.82rem; margin-top: 4px; }
.rtf-kind {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
}
.rtf-kind-post { background: var(--rtf-accent-tint); color: var(--rtf-accent-dark); }
.rtf-kind-wiki { background: #eef2ff; color: #4338ca; }
.rtf-kind-community { background: #ecfdf5; color: #047857; }
.rtf-sub-cell { font: inherit; font-size: inherit; background: none; border: 0; padding: 0; color: #0f766e; cursor: pointer; text-align: left; }
.rtf-sub-cell:hover { text-decoration: underline; color: var(--rtf-accent); }
.rtf-muted { color: #94a3b8; }
.rtf-kws-btn { font: inherit; font-size: 0.8rem; padding: 4px 10px; margin-left: 6px; }
.rtf-kws-btn[disabled] { opacity: 0.6; cursor: default; }

/* Expanded keyword list under a thread row. */
.rtf-expand td { background: #fbfbfc; padding: 8px 14px 14px; }
.rtf-expand-inner { border: 1px solid var(--rtf-border); border-radius: 10px; background: #fff; padding: 10px 12px; }
.rtf-expand-title { font-size: 0.82rem; color: #64748b; margin: 0 0 8px; }
.rtf-kw-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.rtf-kw-table th, .rtf-kw-table td { padding: 6px 8px; border-bottom: 1px solid #f1f5f9; text-align: left; }
.rtf-kw-table th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.03em; color: #64748b; }
.rtf-kw-table td.num, .rtf-kw-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rtf-kw-table tr:last-child td { border-bottom: 0; }

@media (max-width: 640px) {
    .rtf-overview { padding: 14px; }
    .rtf-stat-row { grid-template-columns: 1fr 1fr; }
    .results-table th.col-thread { width: auto; }
}
