/* ══════════════════════════════════════════════════════════════════════════
   CYANIX MEMORY v2 — Manage Memories panel
   Cyan-only, no gradients. Uses the tokens already defined in style.css.
════════════════════════════════════════════════════════════════════════════ */

#cx-memory-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

/* ── filter ─────────────────────────────────────────────────────────────── */

.cxm-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 34px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  transition: border-color .18s;
}
.cxm-search:focus-within { border-color: var(--border-3); }
.cxm-search svg          { color: var(--text-4); flex-shrink: 0; }

#cxm-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-1);
  font-size: .84rem;
  font-family: inherit;
}
#cxm-search-input::placeholder { color: var(--text-4); }

/* ── list ───────────────────────────────────────────────────────────────── */

.cxm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Tall enough that an opened file shows its editor AND its action row.
     At 320px the Save/Delete bar fell below the scroll fold, which read as
     "editing does nothing". */
  max-height: min(62vh, 460px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cxm-empty {
  text-align: center;
  padding: 20px 8px;
  font-size: .82rem;
  color: var(--text-4);
  line-height: 1.6;
}

.cxm-file {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color .18s;
}
.cxm-file--open { border-color: var(--border-2); }

.cxm-file-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.cxm-kind {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.cxm-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-1);
}

.cxm-size {
  flex-shrink: 0;
  font-size: .7rem;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}

.cxm-chev {
  flex-shrink: 0;
  display: flex;
  color: var(--text-4);
  transition: transform .22s;
}
.cxm-file--open .cxm-chev { transform: rotate(180deg); }

.cxm-file-desc {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 10px 9px 10px;
  font-size: .75rem;
  color: var(--text-3);
  line-height: 1.45;
}
.cxm-when {
  margin-left: auto;
  flex-shrink: 0;
  font-size: .68rem;
  color: var(--text-4);
}

/* ── editor ─────────────────────────────────────────────────────────────── */

.cxm-file-body { display: none; }
.cxm-file--open .cxm-file-body {
  display: block;
  padding: 0 10px 10px;
  border-top: 1px solid var(--border);
}

.cxm-loading {
  padding: 14px 0;
  font-size: .78rem;
  color: var(--text-4);
  text-align: center;
}

.cxm-editor {
  width: 100%;
  min-height: 120px;
  max-height: 240px;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .76rem;
  line-height: 1.65;
  resize: vertical;
  outline: 0;
  transition: border-color .18s;
}
.cxm-editor:focus { border-color: var(--border-3); }

.cxm-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.cxm-count {
  font-size: .7rem;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}
.cxm-count--over { color: #ef4444; font-weight: 600; }

.cxm-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.cxm-btn {
  padding: 6px 13px;
  border-radius: 7px;
  border: 1.5px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  font-size: .76rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .16s, color .16s, opacity .16s;
}
.cxm-btn:hover:not(:disabled) { border-color: var(--border-3); color: var(--text-1); }
.cxm-btn:disabled             { opacity: .4; cursor: default; }

.cxm-btn--save {
  border-color: var(--accent);
  color: var(--accent);
}
.cxm-btn--save:disabled { border-color: var(--border-2); color: var(--text-3); }

.cxm-btn--danger {
  border-color: rgba(239, 68, 68, .35);
  color: #ef4444;
}
.cxm-btn--danger:hover:not(:disabled) { border-color: #ef4444; color: #ef4444; }

@media (prefers-reduced-motion: reduce) {
  .cxm-chev, .cxm-file, .cxm-search, .cxm-editor, .cxm-btn { transition: none; }
}
