/* Category combobox picker — styles for partials/_category_combo.html.
 * Tokens-only — no hardcoded colors. See static/css/tokens.css. */

/* ── Combobox trigger ─────────────────────────────── */
.cat-trigger {
  position: relative;
  width: 340px;
  max-width: 100%;
  display: inline-block;
}
.cat-trigger__input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  border-radius: var(--radius-md);
  padding: 9px 36px 9px 36px;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
}
.cat-trigger__input:hover { border-color: var(--border-strong); }
.cat-trigger.is-open .cat-trigger__input {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.cat-trigger__icon {
  position: absolute;
  left: 12px;
  top: 11px;
  color: var(--ink-subtle);
  font-size: 13px;
  pointer-events: none;
}
.cat-trigger.has-value .cat-trigger__icon { color: var(--accent); }
.cat-trigger__caret {
  position: absolute;
  right: 12px;
  top: 12px;
  color: var(--ink-subtle);
  font-size: 11px;
  pointer-events: none;
  transition: transform 150ms ease;
}
.cat-trigger.is-open .cat-trigger__caret { transform: rotate(180deg); }
.cat-trigger.has-value .cat-trigger__input { color: var(--ink); font-weight: 500; }
.cat-trigger:not(.has-value) .cat-trigger__input { color: var(--ink-subtle); }

/* ── Panel ─────────────────────────────── */
.cat-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 540px;
  max-width: 90vw;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(58, 47, 35, 0.12), 0 2px 6px rgba(58, 47, 35, 0.08);
  z-index: 100;
  overflow: hidden;
  display: none;
}
.cat-panel.is-open { display: block; }

.cat-panel__search {
  position: relative;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.cat-panel__search-icon {
  position: absolute;
  left: 24px;
  top: 22px;
  color: var(--ink-subtle);
  font-size: 12px;
  pointer-events: none;
}
.cat-panel__search input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  border-radius: var(--radius-sm);
  padding: 7px 10px 7px 32px;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
}
.cat-panel__search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── Breadcrumb inside panel ─────────────────────────────── */
.cat-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-muted);
  flex-wrap: wrap;
}
.cat-crumbs__home {
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cat-crumbs__home:hover { color: var(--accent-hover); }
.cat-crumb {
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}
.cat-crumb:hover { color: var(--accent-hover); text-decoration: underline; }
.cat-crumb--current {
  color: var(--ink);
  cursor: default;
  font-weight: 600;
}
.cat-crumb--current:hover { color: var(--ink); text-decoration: none; }
.cat-crumbs__sep { color: var(--ink-subtle); }

/* ── List body ─────────────────────────────── */
.cat-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.cat-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  transition: background 100ms ease;
  user-select: none;
}
.cat-list__item:hover { background: var(--accent-soft); }
.cat-list__item--selected {
  background: var(--accent);
  color: var(--surface-raised);
}
.cat-list__item--selected:hover { background: var(--accent-hover); }
.cat-list__name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cat-list__chevron {
  font-size: 11px;
  color: var(--ink-subtle);
}
.cat-list__item:hover .cat-list__chevron { color: var(--accent); }
.cat-list__item--selected .cat-list__chevron { color: var(--accent-soft); }
.cat-list__meta {
  font-size: 11px;
  color: var(--ink-subtle);
}
.cat-list__item--selected .cat-list__meta { color: var(--accent-soft); }
.cat-list__icon {
  width: 20px;
  text-align: center;
  color: var(--ink-subtle);
  font-size: 12px;
}
.cat-list__item--selected .cat-list__icon { color: var(--accent-soft); }
.cat-list__item--leaf .cat-list__chevron { display: none; }

/* "All of <category>" row — lets the user filter by the current parent
   category (and all descendants) rather than only leaf nodes. */
.cat-list__item--all {
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--accent);
}
.cat-list__item--all .cat-list__icon { color: var(--accent); }
.cat-list__item--all.cat-list__item--selected,
.cat-list__item--all.cat-list__item--selected .cat-list__icon { color: var(--surface-raised); }

/* Typeahead match result */
.cat-list__path {
  font-size: 11px;
  color: var(--ink-muted);
  margin-left: 8px;
}
.cat-list__item--selected .cat-list__path { color: var(--accent-soft); }
.cat-list__highlight {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
  padding: 0 2px;
  border-radius: 2px;
}
.cat-list__item--selected .cat-list__highlight {
  background: var(--accent-hover);
  color: var(--surface-raised);
}

/* ── Empty state ─────────────────────────────── */
.cat-empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--ink-subtle);
  font-size: 13px;
}

/* ── Panel footer ─────────────────────────────── */
.cat-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-muted);
}
.cat-foot__kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  padding: 1px 6px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.cat-foot button {
  background: var(--accent);
  color: var(--surface-raised);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.cat-foot button:hover { background: var(--accent-hover); }
.cat-foot button:disabled {
  background: var(--ink-subtle);
  cursor: not-allowed;
}
