/* ============================================================
   MEDICAL RAG KNOWLEDGE SYSTEM
   ============================================================ */

/* ── Search Row ── */
.rag-search-row {
    display: flex; gap: 8px; align-items: center; margin-bottom: 10px;
}
.rag-search-bar {
    flex: 1; display: flex; align-items: center; gap: 8px;
    padding: 0 10px; height: 36px;
    background: var(--bg-glass); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); transition: border-color 0.2s;
}
.rag-search-bar:focus-within { border-color: rgba(108,99,255,0.4); }
.rag-search-bar svg { color: var(--text-muted); flex-shrink: 0; }
.rag-search-bar input {
    flex: 1; background: none; border: none; outline: none;
    font-size: 13px; color: var(--text-primary); font-family: var(--font-sans);
}
.rag-search-bar input::placeholder { color: var(--text-muted); font-size: 12px; }
.rag-retrieve-btn {
    padding: 0 12px; height: 36px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none; color: #fff; font-size: 12px; font-weight: 700;
    cursor: pointer; white-space: nowrap; transition: opacity 0.2s;
}
.rag-retrieve-btn:hover { opacity: 0.85; }
.rag-retrieve-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Filter Pills ── */
.rag-filter-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.rag-pill {
    padding: 3px 9px; border-radius: var(--radius-full);
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted); font-size: 11px; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
}
.rag-pill:hover { background: rgba(108,99,255,0.1); border-color: rgba(108,99,255,0.25); color: var(--accent-primary); }
.rag-pill.active { background: rgba(108,99,255,0.15); border-color: rgba(108,99,255,0.35); color: var(--accent-primary); }

/* ── Context Banner ── */
.rag-context-banner {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 10px; border-radius: var(--radius-sm); margin-bottom: 10px;
    background: rgba(108,99,255,0.08); border: 1px solid rgba(108,99,255,0.2);
    font-size: 11px; color: var(--text-secondary);
}
.rag-context-banner svg { color: var(--accent-primary); flex-shrink: 0; }

/* ── Cards Container ── */
.rag-cards-container { display: flex; flex-direction: column; gap: 10px; }

/* ── Empty State ── */
.rag-empty-state { text-align: center; padding: 32px 16px; }
.rag-empty-icon  { font-size: 36px; margin-bottom: 10px; }
.rag-empty-title { font-size: 14px; font-weight: 700; color: var(--text-secondary); margin-bottom: 5px; }
.rag-empty-sub   { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── Knowledge Card ── */
.rag-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.rag-card:hover { border-color: rgba(108,99,255,0.3); box-shadow: 0 4px 16px rgba(0,0,0,0.2); }

.rag-card-header {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 11px 12px; cursor: pointer;
}
.rag-card-type-badge {
    padding: 2px 7px; border-radius: var(--radius-full);
    font-size: 9px; font-weight: 800; letter-spacing: 0.5px;
    white-space: nowrap; flex-shrink: 0; margin-top: 2px;
}
.badge-guideline { background: rgba(108,99,255,0.15); color: var(--accent-primary); border: 1px solid rgba(108,99,255,0.25); }
.badge-pubmed    { background: rgba(0,210,255,0.12);  color: #00D2FF;              border: 1px solid rgba(0,210,255,0.25); }
.badge-cochrane  { background: rgba(74,222,128,0.1);  color: #4ADE80;              border: 1px solid rgba(74,222,128,0.25); }
.badge-drug      { background: rgba(255,177,0,0.1);   color: #FFB100;              border: 1px solid rgba(255,177,0,0.25); }

.rag-card-meta { flex: 1; min-width: 0; }
.rag-card-title   { font-size: 12px; font-weight: 700; color: var(--text-primary); line-height: 1.4; margin-bottom: 3px; }
.rag-card-source  { font-size: 10px; color: var(--text-muted); }
.rag-card-chevron { color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; margin-top: 2px; }
.rag-card.expanded .rag-card-chevron { transform: rotate(180deg); }

/* Evidence level badge */
.rag-evidence-badge {
    font-size: 9px; font-weight: 700;
    padding: 1px 5px; border-radius: 3px; margin-left: 6px;
    background: rgba(74,222,128,0.12); color: #4ADE80;
}
.rag-evidence-badge.lvl-b { background: rgba(255,177,0,0.12); color: #FFB100; }
.rag-evidence-badge.lvl-c { background: rgba(255,255,255,0.06); color: var(--text-muted); }

/* ── Card Body (Expandable) ── */
.rag-card-body {
    max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease, padding 0.2s;
    padding: 0 12px;
}
.rag-card.expanded .rag-card-body { max-height: 400px; padding: 0 12px 12px; }

.rag-card-excerpt {
    font-size: 12px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 10px;
    border-left: 2px solid rgba(108,99,255,0.3); padding-left: 10px;
    font-style: italic;
}
.rag-card-excerpt mark { background: rgba(108,99,255,0.2); color: var(--accent-primary); border-radius: 2px; padding: 0 2px; }

/* Key points */
.rag-key-points { margin-bottom: 10px; }
.rag-key-points-title { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.rag-key-point {
    display: flex; align-items: flex-start; gap: 6px;
    font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; line-height: 1.5;
}
.rag-key-point::before { content: '▸'; color: var(--accent-primary); flex-shrink: 0; margin-top: 1px; }

/* Citation footer */
.rag-citation {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 10px; color: var(--text-muted);
}
.rag-citation-link {
    color: var(--accent-primary); font-weight: 600; cursor: pointer;
    text-decoration: none;
}
.rag-citation-link:hover { text-decoration: underline; }

/* Relevance score */
.rag-relevance {
    display: flex; align-items: center; gap: 5px; margin-top: 2px;
}
.rag-relevance-bar {
    width: 50px; height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden;
}
.rag-relevance-fill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)); }
.rag-relevance-fill.rel-high { background: linear-gradient(90deg, #4ADE80, #22C55E); }
.rag-relevance-fill.rel-mid  { background: linear-gradient(90deg, #FBBF24, #F59E0B); }
.rag-relevance-fill.rel-low  { background: linear-gradient(90deg, #94A3B8, #64748B); }
.rag-relevance-label { font-size: 9px; color: var(--text-muted); }
