/* TruthBear Components */

/* ===== PAGE ELEMENTS ===== */
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 3px; }
.page-subtitle { font-size: 13px; color: var(--tb-text-secondary); margin-bottom: 16px; }
.section-header { font-size: 15px; font-weight: 600; margin-bottom: 12px; margin-top: 24px; }

/* ===== CARDS ===== */
.card {
  background: var(--tb-card);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-card-radius);
  padding: var(--tb-card-padding);
  box-shadow: var(--tb-shadow);
}
.card + .card { margin-top: 12px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn-primary {
  background: var(--tb-interactive);
  color: white;
}
.btn-primary:hover { background: var(--tb-interactive-hover); color: white; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--tb-interactive);
  color: var(--tb-interactive);
}
.btn-outline:hover { background: rgba(79,70,229,0.06); }
.btn-agree {
  background: transparent;
  border: 1px solid var(--tb-agree);
  color: var(--tb-agree);
}
.btn-agree:hover { background: var(--tb-agree-bg); }
.btn-disagree {
  background: transparent;
  border: 1px solid var(--tb-disagree);
  color: var(--tb-disagree);
}
.btn-disagree:hover { background: var(--tb-disagree-bg); }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--tb-text-secondary);
  margin-bottom: 4px;
}
.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--tb-border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--tb-text);
  background: var(--tb-card);
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--tb-interactive); }
.form-input::placeholder { color: var(--tb-text-tertiary); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* ===== FLASH MESSAGES ===== */
.flash {
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 6px;
  font-size: 13px;
}
.flash-error {
  background: var(--tb-disagree-bg);
  color: var(--tb-disagree);
  border: 1px solid rgba(220,38,38,0.15);
}
.flash-success {
  background: var(--tb-agree-bg);
  color: var(--tb-agree);
  border: 1px solid rgba(22,163,74,0.15);
}

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}
.badge-amber { background: var(--tb-accent-bg); color: var(--tb-accent); }
.badge-indigo { background: rgba(79,70,229,0.08); color: var(--tb-interactive); }
.badge-bear {
  display: inline-block;
  padding: 1px 6px;
  background: var(--tb-accent-bg);
  color: var(--tb-accent);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
}

/* ===== FILTER PILLS ===== */
.filter-pills { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.pill {
  padding: 4px 11px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--tb-border);
  background: var(--tb-card);
  color: var(--tb-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.pill.active { background: var(--tb-interactive); color: white; border-color: var(--tb-interactive); }
.pill:hover:not(.active) { border-color: var(--tb-interactive); color: var(--tb-interactive); }

/* ===== TABS ===== */
.tab-bar { display: flex; border-bottom: 1px solid var(--tb-border); margin: 20px 0; }
.tab {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tb-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
  text-decoration: none;
}
.tab:hover { color: var(--tb-text); }
.tab.active { color: var(--tb-interactive); border-bottom-color: var(--tb-interactive); }

/* ===== STRENGTH BAR ===== */
.strength-container { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.strength-track {
  flex: 1; height: 6px; background: var(--tb-border-subtle);
  border-radius: 3px; position: relative; overflow: hidden;
}
.strength-track.bi::before {
  content: ''; position: absolute; top: 0; bottom: 0;
  width: 1px; left: 50%; background: var(--tb-border); z-index: 1;
}
.strength-fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.strength-fill.positive { left: 50%; background: var(--tb-agree); }
.strength-fill.negative { right: 50%; background: var(--tb-disagree); }
.strength-track.uni .strength-fill { left: 0; background: linear-gradient(90deg, var(--tb-agree-light), var(--tb-agree)); }
.strength-value { font-size: 14px; font-weight: 600; min-width: 40px; text-align: right; }

/* Mini strength (for compact rows) */
.strength-ind { min-width: 42px; padding-top: 1px; text-align: right; flex-shrink: 0; }
.strength-num { font-size: 13px; font-weight: 700; line-height: 1; }
.strength-num.pos { color: var(--tb-agree); }
.strength-num.neg { color: var(--tb-disagree); }
.strength-num.neu { color: var(--tb-neutral); }
.mini-bar {
  width: 36px; height: 3px; background: var(--tb-border);
  border-radius: 2px; margin-top: 5px; margin-left: auto;
  position: relative; overflow: hidden;
}
.mini-fill { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.mini-fill.p { left: 50%; background: var(--tb-agree); }
.mini-fill.n { right: 50%; background: var(--tb-disagree); }

/* ===== CREDIBILITY SIGNAL BARS ===== */
.cred-bars {
  display: inline-flex; align-items: flex-end; gap: 1px;
  height: 12px; vertical-align: middle; margin-left: 3px;
}
.cred-bars .bar {
  width: 3px; border-radius: 1px;
  background: var(--tb-border);
}
.cred-bars .bar.filled { background: var(--tb-text-tertiary); }
.cred-bars .bar:nth-child(1) { height: 4px; }
.cred-bars .bar:nth-child(2) { height: 6px; }
.cred-bars .bar:nth-child(3) { height: 9px; }
.cred-bars .bar:nth-child(4) { height: 12px; }

/* ===== EXPLORE: TOPIC GRID ===== */
.topic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.topic-card {
  background: var(--tb-card); border: 1px solid var(--tb-border); border-radius: var(--tb-card-radius);
  padding: 12px; cursor: pointer; transition: border-color 0.15s; text-decoration: none; color: inherit; display: block;
}
.topic-card:hover { border-color: var(--tb-interactive); }
.topic-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.topic-count { font-size: 11px; color: var(--tb-text-secondary); margin-bottom: 6px; }
.topic-avatars { display: flex; }
.topic-avatars .avatar { width: 20px; height: 20px; font-size: 8px; margin-right: -2px; border: 2px solid white; }

/* ===== EXPLORE: PEOPLE GRID ===== */
.people-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 8px; }
.person-card {
  background: var(--tb-card); border: 1px solid var(--tb-border); border-radius: var(--tb-card-radius);
  padding: 12px; text-align: center; cursor: pointer; transition: border-color 0.15s;
  text-decoration: none; color: inherit; display: block;
}
.person-card:hover { border-color: var(--tb-interactive); }
.person-card .avatar { margin: 0 auto 6px; }
.person-handle { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.person-desc { font-size: 11px; color: var(--tb-text-secondary); margin-bottom: 4px; line-height: 1.3; }
.person-cred { font-size: 10px; color: var(--tb-text-tertiary); margin-bottom: 4px; }
.follow-btn {
  padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500;
  border: 1px solid var(--tb-interactive); color: var(--tb-interactive); background: transparent; cursor: pointer;
}
.follow-btn:hover { background: rgba(79,70,229,0.06); }
.follow-btn.following { border-color: var(--tb-border); color: var(--tb-text-tertiary); }

/* Section headers */
.section-header { font-size: 15px; font-weight: 600; margin-bottom: 12px; margin-top: 24px; }
.section-header:first-child { margin-top: 0; }

/* Belief topic label (above belief row in explore) */
.belief-topic-label { font-size: 10px; color: var(--tb-accent); font-weight: 600; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

@media (max-width: 1023px) { .people-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 767px) { .topic-grid { grid-template-columns: 1fr; } .people-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== FEED LAYOUT ===== */
.feed-layout { display: flex; gap: 20px; }
.feed-main { flex: 1; min-width: 0; }
.feed-aside { width: 220px; flex-shrink: 0; }
@media (max-width: 767px) { .feed-layout { flex-direction: column; } .feed-aside { width: 100%; } }

/* Metadata icons in belief rows */
.bfm img.meta-icon { width: 11px; height: 11px; vertical-align: middle; opacity: 0.5; }

/* ===== BELIEF ROW (compact, feed/lists) ===== */
.belief-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--tb-border-subtle);
  cursor: pointer; transition: background 0.1s; text-decoration: none; color: inherit;
}
.belief-row:hover { background: rgba(79,70,229,0.02); }
.belief-row:first-child { border-top: 1px solid var(--tb-border); }
.belief-row:last-child { border-bottom: 1px solid var(--tb-border); }
.belief-row-body { flex: 1; min-width: 0; }
.belief-flow {
  font-size: 13px; line-height: 1.5; color: var(--tb-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.belief-flow .bfm { font-size: 11px; color: var(--tb-text-tertiary); white-space: nowrap; }
.belief-flow .bfm svg {
  width: 11px; height: 11px; stroke: var(--tb-text-tertiary);
  fill: none; stroke-width: 2; vertical-align: middle;
}
.belief-flow .bfm .sep { margin: 0 3px; }
.belief-flow .bfm .mi { display: inline-flex; align-items: center; gap: 1px; vertical-align: middle; }
.belief-row-chevron {
  color: var(--tb-border); font-size: 16px; padding-top: 2px;
  flex-shrink: 0; line-height: 1;
}
.belief-row:hover .belief-row-chevron { color: var(--tb-text-tertiary); }

/* Row badge (inline in belief text) */
.row-badge {
  display: inline-block; padding: 1px 5px; border-radius: 3px;
  font-size: 10px; font-weight: 600; margin-left: 4px; vertical-align: middle;
}
.row-badge.amber { background: var(--tb-accent-bg); color: var(--tb-accent); }
.row-badge.indigo { background: rgba(79,70,229,0.08); color: var(--tb-interactive); }

/* ===== ANNOTATION (position change / prediction) ===== */
.annotation {
  margin-top: 6px; padding: 8px 12px;
  background: rgba(217,119,6,0.04); border-left: 3px solid var(--tb-accent);
  border-radius: 0 4px 4px 0; font-size: 12px; color: var(--tb-text-secondary); line-height: 1.4;
}
.annotation strong { color: var(--tb-text); }
.prediction-status { margin-top: 4px; font-size: 11px; color: var(--tb-accent); font-weight: 500; }

/* ===== AVATARS ===== */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: white; flex-shrink: 0;
}
.avatar-sm { width: 22px; height: 22px; font-size: 9px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }
.avatar-human { background: linear-gradient(135deg, #6366F1, #8B5CF6); }
.avatar-bear { background: linear-gradient(135deg, var(--tb-primary), var(--tb-accent)); position: relative; }
.avatar-bear::after {
  content: ''; position: absolute; inset: 3px;
  border: 1.5px solid rgba(255,255,255,0.3);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* ===== IDENTITY CARD (explore page) ===== */
.identity-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--tb-border-subtle);
}
.identity-card:last-child { border-bottom: none; }
.identity-info { flex: 1; min-width: 0; }
.identity-handle { font-size: 14px; font-weight: 600; }
.identity-meta { font-size: 12px; color: var(--tb-text-secondary); }

/* ===== STRENGTH DETENTS (post/believe forms) ===== */
.strength-detents {
  display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
}
.strength-detent {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--tb-border);
  background: var(--tb-card);
  color: var(--tb-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.strength-detent.active {
  border-color: var(--tb-interactive);
  background: rgba(79,70,229,0.06);
  color: var(--tb-interactive);
}
.strength-detent:hover:not(.active) { border-color: var(--tb-text-tertiary); }

/* ===== EVIDENCE LIST (post form) ===== */
.evidence-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.evidence-row .form-input { flex: 1; }
.evidence-remove {
  background: none; border: none; color: var(--tb-text-tertiary);
  cursor: pointer; font-size: 18px; padding: 4px;
}
.evidence-remove:hover { color: var(--tb-disagree); }
.evidence-add {
  font-size: 13px; color: var(--tb-interactive); cursor: pointer;
  background: none; border: none; padding: 4px 0;
}

/* ===== EVIDENCE SPLIT (belief detail pro/con) ===== */
.evidence-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.evidence-col {
  border: 1px solid var(--tb-border); border-radius: var(--tb-card-radius);
  overflow: hidden; background: var(--tb-card);
}
.evidence-col-header {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 8px 14px;
  border-bottom: 1px solid var(--tb-border-subtle);
}
.evidence-col-header.pro { color: var(--tb-agree); background: var(--tb-agree-bg); }
.evidence-col-header.con { color: var(--tb-disagree); background: var(--tb-disagree-bg); }
.evidence-item {
  padding: 10px 14px; border-bottom: 1px solid var(--tb-border-subtle);
}
.evidence-item:last-child { border-bottom: none; }
@media (max-width: 767px) { .evidence-split { grid-template-columns: 1fr; } }

/* ===== POSITIONS MASTER-DETAIL ===== */
.positions-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 16px;
  min-height: 200px;
}
.positions-list {
  border: 1px solid var(--tb-border); border-radius: var(--tb-card-radius);
  overflow: hidden; background: var(--tb-card);
}
.position-person {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--tb-border-subtle);
  cursor: pointer; transition: background 0.1s;
}
.position-person:last-child { border-bottom: none; }
.position-person:hover { background: rgba(79,70,229,0.02); }
.position-person.selected {
  background: rgba(79,70,229,0.06);
  border-left: 3px solid var(--tb-interactive);
  padding-left: 9px;
}
.positions-detail {
  border: 1px solid var(--tb-border); border-radius: var(--tb-card-radius);
  padding: 16px; background: var(--tb-card);
}
.positions-detail .evidence-item {
  padding: 10px 14px; border-bottom: 1px solid var(--tb-border-subtle);
  border-radius: 0;
}
.positions-detail .evidence-item:last-child { border-bottom: none; }
@media (max-width: 767px) {
  .positions-layout { grid-template-columns: 1fr; }
}

/* ===== PREVIEW CARD (post form) ===== */
.preview-card {
  background: var(--tb-bg);
  border: 1px solid var(--tb-border);
  border-radius: var(--tb-card-radius);
  padding: 16px;
  margin-top: 16px;
}
.preview-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--tb-text-tertiary); margin-bottom: 8px;
}

/* ===== RENDERED MARKDOWN ===== */
.preview-card ul, .preview-card ol { padding-left: 1.5em; }
.preview-card blockquote {
  margin: 8px 0; padding: 8px 14px;
  border-left: 3px solid var(--tb-border); color: var(--tb-text-secondary);
}
.preview-card code { background: var(--tb-border-subtle); padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.preview-card pre { background: var(--tb-border-subtle); padding: 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0; }
.preview-card pre code { background: none; padding: 0; }
.preview-card p { margin-bottom: 8px; }
.preview-card p:last-child { margin-bottom: 0; }

/* ===== UTILITY ===== */
.text-secondary { color: var(--tb-text-secondary); }
.text-tertiary { color: var(--tb-text-tertiary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
/* ===== PAGINATION ===== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 2px; margin-top: 16px; margin-bottom: 8px;
}
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 6px;
  font-size: 13px; font-weight: 500; color: var(--tb-text-secondary);
  border: 1px solid var(--tb-border); border-radius: 4px;
  text-decoration: none; cursor: pointer; transition: all 0.15s;
  background: var(--tb-card);
}
.page-link:hover:not(.disabled):not(.active) { border-color: var(--tb-interactive); color: var(--tb-interactive); }
.page-link.active { background: var(--tb-interactive); color: white; border-color: var(--tb-interactive); }
.page-link.disabled { color: var(--tb-border); cursor: default; }

/* ===== CREDIBILITY DASHBOARD ===== */
.cred-list { border: 1px solid var(--tb-border); border-radius: var(--tb-card-radius); overflow: hidden; }
.cred-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--tb-border-subtle); text-decoration: none; color: inherit;
  transition: background 0.15s; cursor: pointer;
}
.cred-row:last-child { border-bottom: none; }
.cred-row:hover { background: var(--tb-border-subtle); }
.cred-handle { font-size: 13px; font-weight: 500; min-width: 140px; }
.cred-bar-container { flex: 1; height: 5px; background: var(--tb-border-subtle); border-radius: 3px; overflow: hidden; }
.cred-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #86EFAC, var(--tb-agree)); }
.cred-weight { font-size: 13px; font-weight: 600; min-width: 36px; text-align: right; }
.cred-detail { font-size: 11px; color: var(--tb-text-tertiary); margin-top: 1px; }

/* ===== UTILITIES ===== */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
