/* ============================================================================
   V2 Watchlist Editor (/app/v2/profile/watchlist-editor)

   This page reuses the .v2-wl-card / .v2-wl-card--active classes that are
   already styled in app-shell.css for visual parity with the in-grid
   WatchlistPanelV2 overlay. Everything here is for the page-level chrome
   (header, two-column layout, filter pills, kind badges, local search dropdown,
   etc.) using the V2 design tokens published in v2-overlay.css.
   ============================================================================ */

#v2-profile-watchlist-editor.v2-tool-pane.active {
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  width: 100%;
  min-width: 0;
}

.v2-wle-page {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  background: var(--v2-bg, #f8fafc);
  color: var(--v2-text-primary, #1f2937);
  font-size: 13px;
}

/* ---- Header ------------------------------------------------------------ */

.v2-wle-page__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--v2-border, #e5e7eb);
  background: var(--v2-bg-surface, #ffffff);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.v2-wle-page__title-wrap {
  flex: 1 1 360px;
  min-width: 0;
}

.v2-wle-page__title {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--v2-text-primary, #1f2937);
  display: flex;
  align-items: center;
  gap: 10px;
}

.v2-wle-page__title i {
  color: var(--v2-accent, #0d7cc4);
  font-size: 16px;
}

.v2-wle-page__subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--v2-text-muted, #6b7280);
  max-width: 720px;
  line-height: 1.5;
}

/* ---- Filter pills ------------------------------------------------------ */

.v2-wle-page__filter-pills {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}

.v2-wle-pill {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--v2-border, #d1d5db);
  background: var(--v2-bg-elevated, #ffffff);
  color: var(--v2-text-muted, #6b7280);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.v2-wle-pill:hover {
  color: var(--v2-text-primary, #1f2937);
  border-color: var(--v2-text-muted, #9ca3af);
}

.v2-wle-pill.is-active {
  background: var(--v2-accent, #0d7cc4);
  border-color: var(--v2-accent, #0d7cc4);
  color: #ffffff;
}

/* ---- Body (sidebar + detail) ------------------------------------------ */

.v2-wle-page__body {
  display: flex;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}

.v2-wle-sidebar {
  width: 320px;
  min-width: 280px;
  max-width: 360px;
  flex-shrink: 0;
  border-right: 1px solid var(--v2-border, #e5e7eb);
  background: var(--v2-bg-surface, #ffffff);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.v2-wle-sidebar__list {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}

/* ---- Sidebar toolbar (search input + sub-type pills) ---- */

.v2-wle-sidebar__toolbar {
  flex-shrink: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--v2-border, #f3f4f6);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--v2-bg-surface, #ffffff);
}

.v2-wle-sidebar__search-row {
  position: relative;
  display: flex;
  align-items: center;
}

.v2-wle-sidebar__search-icon {
  position: absolute;
  left: 10px;
  font-size: 11px;
  color: var(--v2-text-muted, #9ca3af);
  pointer-events: none;
}

.v2-wle-sidebar__search {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px 7px 28px;
  font-size: 12px;
  border: 1px solid var(--v2-border, #d1d5db);
  border-radius: 6px;
  outline: none;
  background: var(--v2-bg-elevated, #ffffff);
  color: var(--v2-text-primary, #1f2937);
}

.v2-wle-sidebar__search:focus {
  border-color: var(--v2-accent, #0d7cc4);
  box-shadow: 0 0 0 3px rgba(13, 124, 196, 0.15);
}

.v2-wle-sidebar__subpills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.v2-wle-subpill {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--v2-border, #d1d5db);
  background: transparent;
  color: var(--v2-text-muted, #6b7280);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.v2-wle-subpill:hover {
  color: var(--v2-text-primary, #1f2937);
  border-color: var(--v2-text-muted, #9ca3af);
}

.v2-wle-subpill.is-active {
  background: rgba(13, 124, 196, 0.12);
  border-color: var(--v2-accent, #0d7cc4);
  color: var(--v2-accent, #0d7cc4);
}

.v2-wle-sidebar__group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--v2-text-muted, #9ca3af);
  margin: 12px 4px 6px 4px;
}

.v2-wle-sidebar__group-label:first-child {
  margin-top: 0;
}

.v2-wle-sidebar__loading,
.v2-wle-sidebar__empty {
  text-align: center;
  color: var(--v2-text-muted, #6b7280);
  font-size: 12px;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.v2-wle-sidebar__empty i {
  font-size: 22px;
  color: #d1d5db;
}

/* The .v2-wl-card / __active styles are inherited from app-shell.css. */
.v2-wle-card { margin-bottom: 6px; }

.v2-wle-card__count {
  font-variant-numeric: tabular-nums;
}

/* ---- Kind badges (Fund / 13F / FOIA) ---------------------------------- */

.v2-wle-kind-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(13, 124, 196, 0.1);
  color: var(--v2-accent, #0d7cc4);
  margin-right: 6px;
  white-space: nowrap;
}

.v2-wle-kind-badge--fund { background: rgba(13, 124, 196, 0.1); color: #0d7cc4; }
.v2-wle-kind-badge--inst { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.v2-wle-kind-badge--foia { background: rgba(245, 158, 11, 0.12); color: #b45309; }

/* ---- Detail panel ----------------------------------------------------- */

.v2-wle-detail {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--v2-bg-surface, #ffffff);
}

.v2-wle-detail__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--v2-text-muted, #6b7280);
  font-size: 13px;
  padding: 32px;
}

.v2-wle-detail__empty i {
  font-size: 32px;
  color: #d1d5db;
}

.v2-wle-detail__header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--v2-border, #e5e7eb);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.v2-wle-detail__heading {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v2-wle-detail__title-input {
  font-size: 16px;
  font-weight: 700;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--v2-text-primary, #1f2937);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.v2-wle-detail__title-input:hover {
  border-color: var(--v2-border, #e5e7eb);
}

.v2-wle-detail__title-input:focus {
  border-color: var(--v2-accent, #0d7cc4);
  background: var(--v2-bg, #ffffff);
}

.v2-wle-detail__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--v2-text-muted, #6b7280);
}

.v2-wle-detail__status {
  font-variant-numeric: tabular-nums;
}

.v2-wle-detail__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.v2-wle-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--v2-border, #d1d5db);
  background: var(--v2-bg-elevated, #ffffff);
  color: var(--v2-text-primary, #1f2937);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.v2-wle-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.v2-wle-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.v2-wle-btn--primary {
  background: var(--v2-accent, #0d7cc4);
  border-color: var(--v2-accent, #0d7cc4);
  color: #ffffff;
}

.v2-wle-btn--primary:hover:not(:disabled) {
  background: var(--v2-accent-hover, #095e95);
  border-color: var(--v2-accent-hover, #095e95);
  color: #ffffff;
}

.v2-wle-btn--danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.v2-wle-btn--danger:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* ---- Search row ------------------------------------------------------- */

.v2-wle-detail__search {
  padding: 10px 20px;
  border-bottom: 1px solid var(--v2-border, #e5e7eb);
  flex-shrink: 0;
  position: relative;
}

.v2-wle-search,
.v2-wle-local-search {
  width: 100%;
  position: relative;
}

.v2-wle-search__input {
  width: 100%;
  padding: 7px 12px;
  font-size: 12px;
  border: 1px solid var(--v2-border, #d1d5db);
  border-radius: 6px;
  outline: none;
  background: var(--v2-bg-elevated, #ffffff);
  color: var(--v2-text-primary, #1f2937);
  box-sizing: border-box;
}

.v2-wle-search__input:focus {
  border-color: var(--v2-accent, #0d7cc4);
  box-shadow: 0 0 0 3px rgba(13, 124, 196, 0.15);
}

.v2-wle-local-search__results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--v2-bg-elevated, #ffffff);
  border: 1px solid var(--v2-border, #e5e7eb);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

.v2-wle-local-search__item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--v2-border, #f3f4f6);
}

.v2-wle-local-search__item:last-child { border-bottom: none; }

.v2-wle-local-search__item:hover {
  background: rgba(13, 124, 196, 0.08);
}

.v2-wle-local-search__primary {
  font-size: 13px;
  font-weight: 600;
  color: var(--v2-text-primary, #1f2937);
}

.v2-wle-local-search__secondary {
  font-size: 11px;
  color: var(--v2-text-muted, #6b7280);
  margin-top: 2px;
}

.v2-wle-local-search__empty {
  padding: 12px;
  text-align: center;
  color: var(--v2-text-muted, #9ca3af);
  font-size: 12px;
}

/* ---- Members grid ----------------------------------------------------- */

.v2-wle-detail__grid-label {
  padding: 10px 20px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--v2-text-muted, #6b7280);
  flex-shrink: 0;
}

.v2-wle-detail__grid-wrap {
  flex: 1 1 0%;
  min-height: 0;
  padding: 0 20px 20px;
  overflow: hidden;
}

.v2-wle-detail__empty-grid {
  padding: 40px 20px;
  text-align: center;
  color: var(--v2-text-muted, #6b7280);
  font-size: 13px;
}

/* ---- Dark mode tweaks ------------------------------------------------- */

.dark-theme .v2-wle-page,
html.dark-theme .v2-wle-page {
  background: #0f1420;
}

html.dark-theme .v2-wle-page__header,
html.dark-theme .v2-wle-sidebar,
html.dark-theme .v2-wle-sidebar__toolbar,
html.dark-theme .v2-wle-sidebar__search,
html.dark-theme .v2-wle-detail,
html.dark-theme .v2-wle-search__input,
html.dark-theme .v2-wle-local-search__results,
html.dark-theme .v2-wle-btn {
  background: #161b26;
  border-color: #1e2433;
  color: #e6e9f0;
}

html.dark-theme .v2-wle-subpill {
  color: #9ca3af;
  border-color: #1e2433;
}

html.dark-theme .v2-wle-subpill.is-active {
  background: rgba(13, 124, 196, 0.2);
  color: #93c5fd;
  border-color: var(--v2-accent, #0d7cc4);
}

html.dark-theme .v2-wle-pill {
  background: #161b26;
  color: #9ca3af;
  border-color: #1e2433;
}

html.dark-theme .v2-wle-pill.is-active {
  background: var(--v2-accent, #0d7cc4);
  color: #ffffff;
  border-color: var(--v2-accent, #0d7cc4);
}

html.dark-theme .v2-wle-detail__title-input {
  color: #e6e9f0;
}

html.dark-theme .v2-wle-btn--primary {
  background: var(--v2-accent, #0d7cc4);
  color: #ffffff;
  border-color: var(--v2-accent, #0d7cc4);
}

html.dark-theme .v2-wle-btn--danger {
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.4);
  background: transparent;
}

html.dark-theme .v2-wle-btn--danger:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.15);
  color: #fecaca;
}

html.dark-theme .v2-wle-local-search__item:hover {
  background: rgba(13, 124, 196, 0.18);
}

/* Responsive: stack columns on narrow viewports */
@media (max-width: 900px) {
  .v2-wle-page__body { flex-direction: column; }
  .v2-wle-sidebar {
    width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--v2-border, #e5e7eb);
    max-height: 320px;
  }
}
