/* Notion-inspired table styling for memories and collections */

/* ── Scroll wrapper ── */
.notion-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Clean table base ── */
.notion-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-small);
}

.notion-table thead th {
  font-weight: 500;
  font-size: var(--text-xsmall);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  background: var(--color-bg);
}

.notion-table tbody tr {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.notion-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.notion-table tbody td {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
}

/* ── Frozen first column ── */
.notion-table th.col-frozen,
.notion-table td.col-frozen {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--color-bg);
}

.notion-table tbody tr:hover td.col-frozen {
  background: #fafafa;
}

/* ── Sticky actions column ── */
.notion-table th.col-actions,
.notion-table td.col-actions {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--color-bg);
}

.notion-table tbody tr:hover td.col-actions {
  background: #fafafa;
}

/* ── Primary column (title + description) ── */
.cell-primary {
  min-width: 200px;
}

.cell-primary a {
  color: var(--color-ink);
  text-decoration: none;
  font-weight: 500;
}

.cell-primary a:hover {
  text-decoration: underline;
}

.cell-primary .cell-subtitle {
  color: var(--color-muted);
  font-size: var(--text-xsmall);
  margin-top: 0.125rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

/* ── Notion solid color palette ── */
.solid-gray    { background: #e3e2e0; color: #32302c; }
.solid-brown   { background: #eee0da; color: #6b4c3b; }
.solid-orange  { background: #fadec9; color: #854c1d; }
.solid-yellow  { background: #fdecc8; color: #73561b; }
.solid-green   { background: #dbeddb; color: #2b593f; }
.solid-blue    { background: #d3e5ef; color: #28456c; }
.solid-purple  { background: #e8deee; color: #6940a5; }
.solid-pink    { background: #f5e0e9; color: #8a2d52; }
.solid-red     { background: #ffe2dd; color: #93291e; }

/* ── Tag / badge cells ── */
.cell-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  font-size: var(--text-xsmall);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

a.cell-tag:hover {
  filter: brightness(0.95);
  text-decoration: none;
}

/* ── Date, source, count ── */
.cell-date {
  color: var(--color-muted);
  font-size: var(--text-xsmall);
  white-space: nowrap;
}

.cell-source {
  font-size: var(--text-xsmall);
  white-space: nowrap;
}

.cell-source a {
  color: var(--color-muted);
  text-decoration: none;
}

.cell-source a:hover {
  color: var(--color-ink);
}

.cell-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0.125rem 0.375rem;
  border-radius: 10px;
  font-size: var(--text-xsmall);
  font-weight: 500;
}

/* ── Property value in collection memory table ── */
.cell-property {
  font-size: var(--text-xsmall);
  color: var(--color-ink);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Field pill badges ── */
.field-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.field-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  font-size: 0.6875rem;
  background: #f0f0f0;
  color: #6b6b6b;
}

/* ── Icon action buttons ── */
.row-actions {
  display: flex;
  gap: 0.25rem;
  white-space: nowrap;
}

.row-actions .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-small);
  border: none;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.875rem;
}

.row-actions .btn-icon:hover {
  background: #f0f0f0;
  color: var(--color-ink);
}

.row-actions .btn-icon--danger:hover {
  background: #fde8e8;
  color: var(--color-danger);
}

.row-actions form {
  display: inline;
}

/* ── Dimmed row for irrelevant search results ── */
.notion-table tbody tr.row-dimmed {
  opacity: 0.5;
}

/* ── Staff debug info ── */
.cell-debug {
  font-size: 0.6875rem;
  line-height: 1.2;
}

/* ── Memory show: Notion-style record page ── */
.memory-page {
  max-width: 720px;
}

.memory-page .memory-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.125rem;
}

.memory-page .memory-description {
  color: var(--color-muted);
  font-size: var(--text-small);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.memory-page .memory-description p:last-child {
  margin-bottom: 0;
}

/* Property list (key-value rows under title) */
.memory-props {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 0.125rem 0;
  margin-bottom: 0;
}

.memory-prop {
  display: flex;
  align-items: baseline;
  padding: 0.25rem 0;
  font-size: var(--text-small);
  gap: 0.75rem;
}

.memory-prop-label {
  min-width: 7rem;
  color: var(--color-muted);
  font-size: var(--text-xsmall);
  flex-shrink: 0;
}

.memory-prop-value {
  color: var(--color-ink);
}

/* Collection section (lighter separator) */
.memory-collection-section {
  margin-top: 0.75rem;
}

.memory-collection-header {
  margin-bottom: 0.375rem;
}

.memory-props--nested {
  border-top: none;
  padding-top: 0;
}

/* Footer metadata line */
.memory-footer {
  font-size: var(--text-xsmall);
  color: var(--color-muted);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}
