/* ============================================================
   v6 Phase C — Library filters + song-pattern visual link
   ============================================================
   - .v6-library-filters wrapper sits between search and pattern list
   - .v6-library-chip is the "Used in this song" toggle
   - .pattern-card--in-song gets a left-edge stripe matching the
     pattern color, so cards used by the current song stand out
   - .pattern-group-badge surfaces the composition session label
*/

@layer v6-components {

  .v6-library-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 6px;
    flex-wrap: wrap;
  }

  .v6-library-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 22px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--v6-border, rgba(255, 255, 255, 0.10));
    border-radius: 999px;
    color: var(--text-secondary, #a1a1aa);
    font-family: var(--font-sans, system-ui);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition:
      background var(--duration-fast, 120ms),
      border-color var(--duration-fast, 120ms),
      color var(--duration-fast, 120ms);
  }
  .v6-library-chip .v6-icon {
    width: 11px;
    height: 11px;
  }
  .v6-library-chip:hover {
    background: rgba(139, 92, 246, 0.10);
    color: #fff;
  }
  .v6-library-chip--on {
    background: rgba(139, 92, 246, 0.25);
    border-color: var(--accent-primary, #8b5cf6);
    color: #fff;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.30);
  }
  .v6-library-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-family: var(--font-mono, monospace);
    font-size: 9px;
    font-weight: 700;
  }
  .v6-library-chip--on .v6-library-chip__count {
    background: var(--accent-primary, #8b5cf6);
  }

  /* ============================================================
     In-song highlight on pattern cards
     ============================================================ */
  .pattern-card--in-song {
    position: relative;
    border-color: var(--pattern-color, var(--accent-primary, #8b5cf6)) !important;
    box-shadow: 0 0 0 1px var(--pattern-color, var(--accent-primary, #8b5cf6)) inset,
                0 0 12px color-mix(in srgb, var(--pattern-color, #8b5cf6) 30%, transparent);
  }
  .pattern-card--in-song::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--pattern-color, var(--accent-primary, #8b5cf6));
    border-top-left-radius: inherit;
    border-bottom-left-radius: inherit;
  }
  /* No "● in this song" tag: in a composed song almost every source is
     placed, so it printed on every card and sat on top of the name. The
     stripe above marks placement; .pattern-card--unused marks the exception. */

  /* Composition session label */
  .pattern-group-badge {
    display: inline-block;
    margin: 4px 6px 0;
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--v6-border-faint, rgba(255, 255, 255, 0.04));
    border-radius: 4px;
    color: var(--text-muted, #71717a);
    font-family: var(--font-mono, monospace);
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
