/* Varial — flat list workspace (Spot / Positions / DIYvar home lists)
   Shared toolbar, favourite star, row action icons, and archived-row muting.
   Loaded by the three product home templates. */

/* ── Section heading (sits on the page above the card, not inside it) ── */
.list-section-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--varial-gray-900, #131210);
}

/* ── Column-header filter funnel (Status, Created by) ──────── */
.ws-col-head {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
/* A heading and its sort arrow stay on one line, so Status lines up with Name. */
.ws-col-label { white-space: nowrap; }

.ws-col-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 1.25rem;
  height: 1.25rem;
  border: 0;
  background: transparent;
  color: var(--varial-gray-500, #6B6763);
  font-size: 0.7rem;
  line-height: 1;
  border-radius: var(--varial-radius-sm, 0.375rem);
  cursor: pointer;
}

.ws-col-filter-btn:hover {
  color: var(--varial-primary, #1B3AA0);
  background: color-mix(in srgb, var(--varial-primary, #1B3AA0) 10%, transparent);
}

/* Active = the filter is narrowing the list; make the funnel stand out. */
.ws-col-filter-btn.is-active {
  color: var(--varial-primary, #1B3AA0);
  background: color-mix(in srgb, var(--varial-primary, #1B3AA0) 16%, transparent);
}

/* The menu lives inside a thead <th>; undo the header's uppercase/condensed type. */
.list-workspace-filter-menu {
  min-width: 12rem;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
}

.list-workspace-filter-menu .form-check {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.8125rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--varial-gray-800, #292524);
}

.list-workspace-filter-menu .form-check:last-child {
  margin-bottom: 0;
}

.list-workspace-filter-menu .dropdown-divider {
  display: block;
  height: 0;
  margin: 0.4rem 0;
  border-top: 1px solid var(--varial-gray-200, #E7E5E1);
}

/* ── Inline name-column search ─────────────────────────────── */
/* The search box sits in the Name <th>; keep the heading on one line and the
   font weight normal so it reads as an input, not a sortable label. */
.col-name-header .col-name-label {
  font-weight: 600;
}

.list-workspace-search {
  width: 11rem;
  font-weight: 400;
}

.list-workspace-search .form-control {
  padding-left: 1.9rem;
  height: 1.85rem;
}

.list-workspace-search-icon {
  position: absolute;
  top: 50%;
  left: 0.6rem;
  transform: translateY(-50%);
  color: var(--varial-gray-400, #A8A29E);
  font-size: var(--text-xs, 0.75rem);
  pointer-events: none;
}

/* ── Favourite star ───────────────────────────────────────── */
.ws-star {
  color: var(--varial-gray-300, #CCC9C3);
  line-height: 1;
}

.ws-star:hover {
  color: var(--varial-amber, #F59E0B);
}

.ws-star-static {
  color: var(--varial-gray-300, #CCC9C3);
  line-height: 1;
  cursor: default;
}

.ws-star-static.is-featured {
  color: var(--varial-amber, #F59E0B);
}

.ws-star.is-favourite {
  color: var(--varial-amber, #F59E0B);
}

.list-workspace .ws-star-cell {
  width: 2.25rem;
  text-align: center;
}

/* ── Row action icons (right-aligned in the Actions column) ── */
.ws-row-actions .ws-action {
  width: 1.85rem;
  height: 1.85rem;
  flex-shrink: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--varial-gray-500, #78716C);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--varial-radius-sm, 0.375rem);
}

.ws-row-actions .ws-action:hover {
  color: var(--varial-primary, #1B3AA0);
  background: var(--varial-gray-100, #F3F2EF);
  border-color: var(--varial-primary, #1B3AA0);
}

/* Price-it, Value-it, and Positions (Supply/Financial/Retail) share the same
   compact raised-button treatment as the table's Buy now CTA, with a white
   surface for utility actions, so the Actions column looks the same on
   every list-workspace surface. */
.list-workspace .table-forecast .ws-row-actions .ws-action,
.list-workspace .table-valuation .ws-row-actions .ws-action {
  /* Matches the 1.5rem rendered height of the neighbouring .btn-sm Buy now CTA. */
  width: 1.5rem;
  height: 1.5rem;
  color: var(--varial-gray-600, #57534E);
  background: var(--varial-white, #fff);
  border-color: var(--varial-border, #E8E4D8);
  border-radius: var(--varial-radius-sm, 0.375rem);
  box-shadow: var(--varial-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.list-workspace .table-forecast .ws-row-actions .ws-action:hover,
.list-workspace .table-forecast .ws-row-actions .ws-action:focus-visible,
.list-workspace .table-valuation .ws-row-actions .ws-action:hover,
.list-workspace .table-valuation .ws-row-actions .ws-action:focus-visible {
  color: var(--varial-primary, #1B3AA0);
  background: var(--varial-white, #fff);
  border-color: var(--varial-primary, #1B3AA0);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.10), var(--varial-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
}

/* Drop Bootstrap's button focus ring so the icons don't render a stray box. */
.ws-row-actions .ws-action:focus,
.ws-row-actions .ws-action:focus-visible {
  box-shadow: none;
  outline: none;
}

.list-workspace .table-forecast .ws-row-actions .ws-action:focus-visible,
.list-workspace .table-valuation .ws-row-actions .ws-action:focus-visible {
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.10), var(--varial-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.08));
  outline: 2px solid color-mix(in srgb, var(--varial-primary, #1B3AA0) 45%, transparent);
  outline-offset: 2px;
}

/* A real disabled <button> (e.g. mid-duplicate) blocks all interaction. The
   greyed Outputs <span> keeps pointer events so its "Not available" tip can show. */
.ws-row-actions .ws-action:disabled {
  pointer-events: none;
}

.ws-row-actions .ws-action.disabled {
  cursor: default;
}

/* ── Fast hover tooltips for row action icons ───────────────── */
/* Native title tooltips have a ~1s browser delay; this CSS tip shows instantly. */
.ws-action[data-ws-tip] {
  position: relative;
}

/* display:none (not visibility/opacity) so the hidden tooltip box takes no layout
   space — otherwise the rightmost icons' boxes extend the page's scroll width and
   spawn a horizontal scrollbar (the actions column sits in an unclipped wrapper). */
.ws-action[data-ws-tip]::after {
  content: attr(data-ws-tip);
  display: none;
  position: absolute;
  bottom: calc(100% + 0.35rem);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.2rem 0.45rem;
  border-radius: var(--varial-radius-sm, 0.375rem);
  background: var(--chart-tech-black-coal, #1C1917);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
}

/* The rightmost action (Archive/Buy) sits flush against the Actions column's
   right edge — a centred tooltip there extends further right than the icon
   itself, past the table-responsive wrapper's right edge, and briefly
   triggers a horizontal scrollbar on hover (the wrapper needs overflow-y:
   auto for the internal scroll, which browsers compute to overflow-x: auto
   too — visible and auto can't be mixed per-axis). Anchor its tooltip to the
   icon's own right edge instead of centring under it, so it never reaches
   past a boundary the icon itself already respects. */
.ws-row-actions .ws-action:last-child[data-ws-tip]::after {
  left: auto;
  right: 0;
  transform: none;
}

.ws-action[data-ws-tip]:hover::after,
.ws-action[data-ws-tip]:focus-visible::after {
  display: block;
}

/* ── Archived rows ────────────────────────────────────────── */
.list-workspace tr.ws-row.is-archived td,
.list-workspace tr[data-ws-pinned].is-archived td {
  color: var(--varial-gray-500, #6B6763);
}

.list-workspace tr.ws-row.is-archived .ws-action,
.list-workspace tr.ws-row.is-archived a,
.list-workspace tr[data-ws-pinned].is-archived .ws-action,
.list-workspace tr[data-ws-pinned].is-archived a {
  color: var(--varial-gray-500, #6B6763);
}

/* Row names read as dark text with a teal hover, so a long list is not a
   column of coloured links. The shared content link rule in branding.css
   opts these out so this colour applies. */
.list-workspace :is(tbody, tfoot) td > a.fw-medium {
  color: var(--varial-marketing-ink, #102A34);
}
.list-workspace :is(tbody, tfoot) td > a.fw-medium:hover,
.list-workspace :is(tbody, tfoot) td > a.fw-medium:focus-visible {
  color: var(--varial-primary, #0F745B);
}
[data-bs-theme="dark"] .list-workspace :is(tbody, tfoot) td > a.fw-medium {
  color: var(--varial-gray-900, #F8F7F5);
}

/* ── Row actions: icons in a row on wide screens, one "more" button below 576px ── */
.ws-row-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}
.ws-row-actions .ws-more-btn { display: none; }

@media (max-width: 575.98px) {
  .ws-row-actions .ws-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    color: var(--varial-gray-500, #78716C);
    background: transparent;
    border: 1px solid var(--varial-border, #dce4e1);
    border-radius: var(--varial-radius-sm, 0.375rem);
  }
  .ws-row-actions .ws-more-btn[aria-expanded="true"] {
    color: var(--varial-primary, #1B3AA0);
    border-color: var(--varial-primary, #1B3AA0);
  }
  /* A row with no actions to offer (a house view you can only buy) has no menu button either. */
  .ws-row-actions:not(:has(> .ws-action)) .ws-more-btn { display: none; }
  /* The icons live in the dropdown menu below instead (row-actions-menu.js). */
  .ws-row-actions > .ws-action { display: none; }

  /* Tighter cells so a table fits a phone; the hidden columns return from 768px. */
  .list-workspace table th,
  .list-workspace table td,
  .fin-table th,
  .fin-table td { padding-inline: 0.4rem; font-size: 0.8125rem; }
  /* The Actions heading is just the "more" button's column on a phone; the name stays for screen readers. */
  .list-workspace th.col-actions,
  .fin-table th.col-actions { width: 2.5rem; font-size: 0; }
  .fin-table th { font-size: 0.68rem; letter-spacing: 0; }
  .fin-table th .sort-icon { margin-left: 0.15rem; }
  .fin-table .ws-star-cell { width: 1.75rem; padding-inline: 0.2rem; }
  .fin-table .ws-col-head { gap: 0.15rem; }
  /* Names wrap at spaces, not mid-word. */
  .list-workspace td.text-start { min-width: 6.5rem; overflow-wrap: normal; word-break: normal; }
  /* A prompt that spans the table but must not make it wider. */
  .ws-span-cell { max-width: 0; white-space: normal; }
}

/* The dropdown a row's "more" button opens on a phone: one labelled item per action. */
.ws-action-menu {
  position: fixed;
  z-index: 1060;
  min-width: 11rem;
  padding: 0.25rem;
  border: 1px solid var(--varial-border, #dce4e1);
  border-radius: 0.625rem;
  background: var(--varial-card-bg, #fff);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}
.ws-action-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.75rem;
  padding: 0 0.875rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  color: var(--varial-gray-900, #131210);
  font-size: 0.9375rem;
  text-align: left;
}
.ws-action-menu-item i { width: 1.1rem; color: var(--varial-gray-500, #78716C); text-align: center; }
.ws-action-menu-item:hover:not(:disabled), .ws-action-menu-item:focus-visible { background: var(--varial-gray-100, #F3F2EF); outline: none; }
.ws-action-menu-item:disabled { color: var(--varial-gray-500, #78716C); opacity: 0.55; }
