/**
 * CodeBlock styles
 * @countermeasure/web-components/display/code-block
 */

/* ============================================================================
   CODE BLOCK BASE
   ============================================================================ */
.cmm-code-block {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    'Liberation Mono', monospace;
}

/* ============================================================================
   CODE BLOCK HEADER
   ============================================================================ */
.cmm-code-block__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: hsl(var(--muted));
  border-bottom: 1px solid hsl(var(--border));
  font-size: 0.75rem;
}

.cmm-code-block__language {
  color: hsl(var(--text-secondary));
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* ============================================================================
   CODE BLOCK COPY BUTTON
   ============================================================================ */
.cmm-code-block__copy {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition:
    color var(--transition-fast),
    background-color var(--transition-fast);
}

.cmm-code-block__copy:hover {
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
}

.cmm-code-block__copy:focus-visible {
  outline: 2px solid hsl(var(--focus-ring));
  outline-offset: 2px;
}

.cmm-code-block__copy--copied {
  color: hsl(var(--success));
}

/* ============================================================================
   CODE BLOCK BODY
   ============================================================================ */
.cmm-code-block__pre {
  margin: 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.7;
}

.cmm-code-block__code {
  white-space: pre;
}

/* ============================================================================
   CODE BLOCK LINE NUMBERS
   ============================================================================ */
.cmm-code-block__line-numbers {
  display: inline-block;
  text-align: right;
  color: hsl(var(--text-disabled));
  padding-right: 1rem;
  margin-right: 1rem;
  border-right: 1px solid hsl(var(--border));
  user-select: none;
  min-width: 2rem;
}
