/*
 * memory.css — Memory view: graph canvas, temporal slider, memory list,
 *              tier dots, search, and knowledge topology panel.
 */

/* ── Memory Graph ── */
#graph-container {
    height: 52vh; min-height: 280px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; position: relative; margin-bottom: 12px;
}
#graph-container.graph-expanded {
    position: fixed; z-index: 60;
    top: 56px; right: 24px; bottom: 24px; left: 360px;
    height: auto; min-height: 0; margin-bottom: 0;
    box-shadow: 0 0 0 1px rgba(0,255,136,0.18), 0 24px 80px rgba(0,0,0,0.68);
}
#graph-svg { width: 100%; height: 100%; }
.memory-toolbar {
    display: flex; justify-content: flex-end; gap: 8px; margin: -2px 0 8px;
}
.graph-legend {
    position: absolute; top: 10px; right: 10px;
    display: flex; flex-direction: column; gap: 4px;
    background: rgba(0,0,0,0.6); padding: 8px 10px;
    border-radius: var(--radius); border: 1px solid var(--border);
}
.leg-item {
    display: flex; align-items: center; gap: 6px;
    font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim);
}
.leg-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── Temporal Slider ── */
.temporal-wrap {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 18px; margin-bottom: 20px;
}
.slider-labels {
    display: flex; justify-content: space-between;
    font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); margin-bottom: 6px;
}
#temporal-slider {
    width: 100%; -webkit-appearance: none; appearance: none;
    height: 2px; background: var(--border); border-radius: 1px; outline: none; cursor: pointer;
}
#temporal-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
    background: var(--accent); cursor: pointer; border: 2px solid #000;
    box-shadow: 0 0 7px rgba(0,255,136,0.5);
}

/* ── Memory List ── */
.memory-bottom { display: grid; grid-template-columns: 1fr 260px; gap: 12px; }
.mem-search-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.mem-search-row input { flex: 1; border: none; outline: none; font-size: 0.78rem; color: var(--text-main); min-width: 0; }
.mem-search-row input::placeholder { color: var(--text-dim); }
.memory-selection-panel {
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
}
.memory-selection-empty {
    padding: 8px 12px;
    color: var(--text-dim);
    font-size: 0.78rem;
}
.memory-selection-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.memory-selection-head strong {
    color: var(--accent);
    font-family: var(--font-mono);
}
.memory-selection-actions,
.memory-selection-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.memory-selection-chips {
    padding: 0 12px 8px;
}
.memory-code-block {
    margin: 0 12px 10px;
    max-height: 180px;
    overflow: auto;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0,0,0,0.32);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.45;
    white-space: pre-wrap;
}
#mem-list { max-height: 290px; overflow-y: auto; }
.mem-item {
    display: flex; align-items: flex-start; gap: 9px; padding: 9px 12px;
    border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s;
}
.mem-item:last-child { border-bottom: none; }
.mem-item:hover { background: var(--bg-panel); }
.mem-item.selected { background: rgba(0,255,136,0.05); }
.mem-select-btn {
    flex-shrink: 0;
    min-width: 62px;
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    cursor: pointer;
}
.mem-select-btn.active {
    color: var(--accent);
    border-color: rgba(0,255,136,0.32);
    background: rgba(0,255,136,0.08);
}
.tier-dot   { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.t-working  { background: var(--accent); }
.t-episodic { background: var(--secondary); }
.t-semantic { background: var(--violet); }
.mem-title  { font-size: 0.78rem; color: var(--text-main); line-height: 1.4; }
.mem-meta   { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }

@media (max-width: 900px) {
    #graph-container.graph-expanded { left: 16px; right: 16px; top: 56px; bottom: 16px; }
    .memory-bottom { grid-template-columns: 1fr; }
}

/* ── Memory Pyramid (widget container) ── */
.pyramid-wrap {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.pyramid-title {
    font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px;
}
.pyramid-tier {
    display: flex; align-items: center; gap: 9px; margin-bottom: 6px; cursor: pointer;
    padding: 5px 8px; border-radius: var(--radius); transition: background 0.12s;
}
.pyramid-tier:hover { background: var(--bg-panel); }
.pyramid-tier.active { background: rgba(0,255,136,0.06); }
.pyramid-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.pyramid-bar { height: 100%; border-radius: 3px; transition: width 0.5s var(--ease); }
.pyramid-bar.working  { background: var(--accent); }
.pyramid-bar.episodic { background: var(--secondary); }
.pyramid-bar.semantic { background: var(--violet); }
.pyramid-count {
    font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted);
    flex-shrink: 0; min-width: 28px; text-align: right;
}
.pyramid-label {
    font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim);
    flex-shrink: 0; min-width: 72px;
}

/* ── Formation Rate / Promotion Ticker ── */
.mem-formation-rate {
    font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-dim);
    padding: 6px 12px; border-bottom: 1px solid var(--border);
}
.mem-promotion-ticker { max-height: 120px; overflow-y: auto; }
.promotion-row {
    display: flex; align-items: center; gap: 7px;
    padding: 5px 12px; border-bottom: 1px solid var(--border); font-size: 0.78rem;
}
.promotion-row:last-child { border-bottom: none; }
.promotion-from { color: var(--text-dim); font-family: var(--font-mono); }
.promotion-arrow { color: var(--accent); flex-shrink: 0; }
.promotion-to { color: var(--accent); font-family: var(--font-mono); }
.promotion-time { color: var(--text-dim); font-family: var(--font-mono); font-size: 0.78rem; margin-left: auto; flex-shrink: 0; }

/* ── Knowledge Topology ── */
#topo-container {
    height: 44vh; min-height: 240px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; position: relative; margin-bottom: 12px;
}
