/**
 * ═══════════════════════════════════════════════════════
 * AXION RESEARCH HUB v4 — Freshness Engine
 * ═══════════════════════════════════════════════════════
 */

/* ── LAYOUT ── */
.research-hub { display: grid; grid-template-columns: 320px 1fr; gap: 0; height: calc(100vh - 140px); min-height: 500px; background: var(--bg, #000); border: 1px solid var(--border, #1a1a1a); overflow: hidden; }

/* ── SIDEBAR ── */
.research-sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border, #1a1a1a); background: rgba(5,5,5,0.95); overflow: hidden; }
.research-sidebar-header { padding: 16px 16px 12px; border-bottom: 1px solid var(--border, #1a1a1a); flex-shrink: 0; }
.research-sidebar-title { font-family: var(--sans, 'Inter', sans-serif); font-size: 12px; font-weight: 700; color: #FFC400; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 14px; }

/* ── DROPDOWN ── */
.research-source-label { font-family: var(--mono, monospace); font-size: 8px; color: var(--t3, #555); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; display: block; }
.research-source-select, .rh-sort-select {
  background: var(--surface, #0a0a0a); border: 1px solid var(--border, #1a1a1a); color: var(--t1, #e0e0e0);
  font-family: var(--sans, 'Inter', sans-serif); font-size: 11px; padding: 6px 10px; cursor: pointer; outline: none;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 10px; transition: border-color 0.2s;
}
.research-source-select { width: 100%; }
.rh-sort-select { font-size: 9px; padding: 4px 22px 4px 6px; }
.research-source-select:hover, .research-source-select:focus, .rh-sort-select:hover, .rh-sort-select:focus { border-color: #FFC400; }
.research-source-select option, .rh-sort-select option { background: #0a0a0a; color: #e0e0e0; }

/* ── SEARCH ── */
.research-search { padding: 8px 16px 4px; flex-shrink: 0; }
.research-search-input { width: 100%; background: var(--surface, #0a0a0a); border: 1px solid var(--border, #1a1a1a); color: var(--t1, #e0e0e0); font-family: var(--mono, monospace); font-size: 10px; padding: 7px 10px; outline: none; transition: border-color 0.2s; box-sizing: border-box; }
.research-search-input::placeholder { color: var(--t3, #555); }
.research-search-input:focus { border-color: #FFC400; }

/* ── FILTER PILLS ── */
.rh-filter-pills { display: flex; gap: 4px; padding: 6px 16px 4px; flex-shrink: 0; flex-wrap: wrap; }
.rh-pill {
  font-family: var(--mono, monospace); font-size: 8px; padding: 3px 8px; border: 1px solid var(--border, #1a1a1a);
  background: transparent; color: var(--t3, #555); cursor: pointer; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.3px;
}
.rh-pill:hover { border-color: rgba(255,196,0,0.3); color: var(--t2, #888); }
.rh-pill.active { border-color: #FFC400; color: #FFC400; background: rgba(255,196,0,0.06); }

/* ── SORT ROW ── */
.rh-sort-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 4px; flex-shrink: 0; }
.research-docs-header { font-family: var(--mono, monospace); font-size: 8px; color: var(--t3, #555); text-transform: uppercase; letter-spacing: 0.5px; }
.research-docs-count { color: var(--t2, #888); }

/* ── HARVESTER STATUS ── */
.rh-status-block { margin: 4px 12px 6px; padding: 8px 10px; background: rgba(255,196,0,0.02); border: 1px solid rgba(255,196,0,0.08); flex-shrink: 0; }
.rh-status-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.rh-status-label { font-family: var(--mono, monospace); font-size: 7px; color: var(--t3, #555); text-transform: uppercase; letter-spacing: 1px; }
.rh-status-chevron { font-size: 10px; color: var(--t3, #555); }
.rh-status-line { font-family: var(--mono, monospace); font-size: 9px; color: var(--t1, #e0e0e0); display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.rh-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.rh-dot-online { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.4); }
.rh-dot-stale { background: #FFC400; box-shadow: 0 0 4px rgba(255,196,0,0.4); }
.rh-dot-dead { background: #666; }
.rh-status-detail { font-family: var(--mono, monospace); font-size: 8px; color: var(--t3, #555); margin-top: 2px; padding-left: 12px; }
.rh-status-hint { font-family: var(--mono, monospace); font-size: 8px; color: var(--t3, #555); margin-top: 4px; }
.rh-status-hint code { font-size: 8px; color: var(--t2, #999); background: rgba(255,255,255,0.03); padding: 2px 5px; }

/* ── PER-SOURCE HEALTH ── */
.rh-source-health { margin-top: 8px; border-top: 1px solid rgba(255,255,255,0.04); padding-top: 6px; }
.rh-sh-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-family: var(--mono, monospace); font-size: 8px; }
.rh-sh-name { color: var(--t2, #888); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rh-sh-age { color: var(--t3, #555); font-size: 7px; }
.rh-sh-count { color: var(--t3, #444); min-width: 16px; text-align: right; }

/* ── FRESHNESS DOTS ── */
.rh-fdot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-right: 3px; }
.rh-f-fresh { background: #22c55e; box-shadow: 0 0 3px rgba(34,197,94,0.3); }
.rh-f-aging { background: #f59e0b; box-shadow: 0 0 3px rgba(245,158,11,0.3); }
.rh-f-stale { background: #ef4444; box-shadow: 0 0 3px rgba(239,68,68,0.3); }
.rh-f-unknown { background: #555; }

/* ── DOC LIST ── */
.research-docs-list { flex: 1; overflow-y: auto; padding: 0 10px 10px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.06) transparent; }
.research-docs-list::-webkit-scrollbar { width: 4px; }
.research-docs-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }
.rh-empty-msg { padding: 30px 10px; text-align: center; font-family: var(--mono, monospace); font-size: 10px; color: var(--t3, #555); }

/* ── DOC CARD ── */
.research-doc-card { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--border, #1a1a1a); background: var(--surface, #0a0a0a); margin-bottom: 4px; cursor: pointer; transition: all 0.15s ease; position: relative; font: inherit; color: inherit; outline: none; }
.research-doc-card:hover { border-color: rgba(255,196,0,0.25); background: rgba(255,196,0,0.02); }
.research-doc-card.active { border-color: #FFC400; background: rgba(255,196,0,0.04); box-shadow: inset 0 0 0 1px rgba(255,196,0,0.15), 0 0 16px -6px rgba(255,196,0,0.25); }
.research-doc-card:focus-visible { outline: 2px solid #FFC400; outline-offset: -2px; }
.research-doc-card-body { display: flex; gap: 10px; align-items: flex-start; }
.research-doc-card-logo { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; min-width: 30px; border-radius: 50%; font-size: 8px; font-family: var(--mono, monospace); font-weight: 700; color: #fff; letter-spacing: -0.5px; flex-shrink: 0; }
.research-doc-card-text { flex: 1; min-width: 0; }
.research-doc-card-title { font-family: var(--sans, 'Inter', sans-serif); font-size: 11px; font-weight: 600; color: var(--t1, #e0e0e0); line-height: 1.3; margin-bottom: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rh-card-desc-tag { display: inline-block; padding: 1px 6px; font-family: var(--mono, monospace); font-size: 7px; text-transform: uppercase; letter-spacing: 0.5px; background: rgba(255,196,0,0.06); border: 1px solid rgba(255,196,0,0.12); color: #FFC400; margin-bottom: 3px; }
.research-doc-card-meta { font-family: var(--mono, monospace); font-size: 8px; color: var(--t3, #555); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.research-doc-card-source { color: #FFC400; font-weight: 500; }
.rh-sep { opacity: 0.3; }
.rh-card-freshness-chip { display: flex; align-items: center; gap: 2px; font-family: var(--mono, monospace); font-size: 8px; color: var(--t3, #444); margin-top: 3px; }
.research-badge-new { position: absolute; top: 6px; right: 6px; font-family: var(--mono, monospace); font-size: 6px; font-weight: 700; color: #000; background: #FFC400; padding: 1px 4px; letter-spacing: 0.5px; animation: rh-pulse 2s ease-in-out infinite; }
@keyframes rh-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ── META STRIP ── */
.rh-meta-strip { padding: 10px 16px; background: rgba(255,196,0,0.02); border-bottom: 1px solid var(--border, #1a1a1a); flex-shrink: 0; }
.rh-meta-title { font-family: var(--sans, 'Inter', sans-serif); font-size: 12px; font-weight: 600; color: var(--t1, #e0e0e0); line-height: 1.3; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rh-meta-detail { font-family: var(--mono, monospace); font-size: 9px; color: var(--t3, #555); display: flex; align-items: center; gap: 3px; }

/* ── PDF VIEWER ── */
.research-viewer { display: flex; flex-direction: column; background: #111; overflow: hidden; }
.research-viewer-frame { flex: 1; width: 100%; height: 100%; border: none; background: #1a1a1a; }

/* ── EMPTY STATE ── */
.research-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 14px; padding: 40px; }
.research-empty-icon { opacity: 0.6; }
.research-empty-title { font-family: var(--sans, 'Inter', sans-serif); font-size: 14px; font-weight: 600; color: var(--t2, #888); }
.research-empty-desc { font-family: var(--mono, monospace); font-size: 10px; color: var(--t3, #555); text-align: center; max-width: 300px; line-height: 1.6; }

/* ── SKELETON ── */
.research-skeleton-card { padding: 14px; border: 1px solid var(--border, #1a1a1a); background: var(--surface, #0a0a0a); margin-bottom: 6px; }
.research-skeleton-line { height: 10px; border-radius: 2px; background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%); background-size: 200% 100%; animation: rh-shimmer 1.5s infinite; margin-bottom: 6px; width: 80%; }
.research-skeleton-line.short { width: 55%; height: 8px; }
.research-skeleton-line.shorter { width: 35%; height: 7px; }
@keyframes rh-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── FOOTER ── */
.research-sidebar-footer { padding: 8px 16px; border-top: 1px solid var(--border, #1a1a1a); flex-shrink: 0; display: flex; gap: 14px; }
.research-stat { font-family: var(--mono, monospace); font-size: 8px; color: var(--t3, #555); }
.research-stat-val { color: var(--t1, #e0e0e0); font-weight: 600; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) { .research-hub { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } .research-sidebar { border-right: none; border-bottom: 1px solid var(--border, #1a1a1a); max-height: 340px; } }
