@import "github-markdown-css/github-markdown-dark.css";

@layer components {
  .markdown-body {
    max-width: none;
    background-color: transparent;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    font-weight: var(--font-weight-regular);
    color: var(--text-primary);
  }

  .markdown-body p,
  .markdown-body ul,
  .markdown-body ol,
  .markdown-body blockquote,
  .markdown-body table {
    font-size: inherit;
    line-height: inherit;
    color: inherit;
  }

  .markdown-body h1,
  .markdown-body h2,
  .markdown-body h3,
  .markdown-body h4,
  .markdown-body h5,
  .markdown-body h6 {
    font-family: inherit;
    color: inherit;
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
    margin-top: 0.9em;
    margin-bottom: 0.55em;
  }

  .markdown-body h6 {
    font-size: calc(var(--font-size-base) + 0.5px);
  }

  .markdown-body h5 {
    font-size: calc(var(--font-size-base) + 1px);
  }

  .markdown-body h4 {
    font-size: calc(var(--font-size-base) + 1.5px);
  }

  .markdown-body h3 {
    font-size: calc(var(--font-size-base) + 2px);
  }

  .markdown-body h2 {
    font-size: calc(var(--font-size-base) + 2.5px);
  }

  .markdown-body h1 {
    font-size: calc(var(--font-size-base) + 3px);
  }

  .markdown-body h1,
  .markdown-body h2 {
    border-bottom: none;
    padding-bottom: 0;
  }

  .markdown-body hr {
    display: none;
  }

  .markdown-body strong {
    font-weight: var(--font-weight-regular);
    color: var(--message-assistant-border);
  }

  .markdown-body em {
    font-style: italic;
    border-bottom: none;
    font-size: calc(var(--font-size-base) + 1.5px);
    margin-top: 0.3em;
    margin-bottom: 0.3em;
    display: inline;
  }

  .markdown-body a {
    color: var(--accent-primary);
    text-decoration: none;
  }

  .markdown-body a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
  }

  .markdown-body code {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    background-color: var(--surface-muted);
    border: 1px solid var(--border-base);
    border-radius: 4px;
    padding: 0.15em 0.35em;
  }

  .markdown-body pre code {
    padding: 0;
    border: none;
    background: transparent;
  }

  .markdown-body pre {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
    background-color: var(--surface-code);
    border: 1px solid var(--border-base);
    border-radius: 8px;
    padding: 0.75rem;
    margin: 1rem 0;
  }

  .markdown-body blockquote {
    border-left: 3px solid var(--border-base);
    color: var(--text-secondary);
    background-color: var(--surface-muted);
    padding: 0.5rem 1rem;
    border-radius: 0 8px 8px 0;
  }

  .markdown-body ul,
  .markdown-body ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
  }

  .markdown-body ul {
    list-style-type: disc;
  }

  .markdown-body ol {
    list-style-type: decimal;
  }

  .markdown-body ul li,
  .markdown-body ol li {
    margin: 0.25rem 0;
  }

  .markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    background-color: transparent;
    display: block;
    padding-right: 0.75rem;
  }

  .markdown-body thead,
  .markdown-body tbody,
  .markdown-body tfoot {
    width: 100%;
    display: table;
    table-layout: fixed;
  }

  .markdown-body th,
  .markdown-body td {
    border: 1px solid var(--border-base);
    padding: 0.5rem 0.75rem;
    text-align: left;
  }

  .markdown-body th {
    background-color: var(--surface-secondary);
  }

  .markdown-code-block {
    position: relative;
    margin: 10px 0;
    border-radius: 6px;
    background-color: var(--surface-muted);
    border: 1px solid var(--border-base);
  }

  .code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background-color: var(--surface-secondary);
    border-bottom: 1px solid var(--border-base);
    /* border-top-left-radius: 6px;
    border-top-right-radius: 6px; */
  }

  .code-block-language {
    font-family: var(--font-family-mono);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: var(--font-size-sm);
  }

  .code-block-copy {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background-color: transparent;
    border: 1px solid var(--border-base);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
    margin-left: auto;
    font-size: var(--font-size-sm);
  }

  .code-block-copy:hover {
    background-color: var(--surface-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
  }

  .code-block-copy .copy-icon {
    width: 14px;
    height: 14px;
  }

  .code-block-copy .copy-text,
  .code-block-preview .preview-text {
    font-family: var(--font-family-mono);
  }

  .code-block-preview {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 4px;
    cursor: pointer;
    color: #10b981;
    transition: all 150ms ease;
    font-size: 10px;
    font-weight: 600;
  }

  .code-block-preview:hover {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
  }

  .markdown-code-block pre {
    margin: 0 !important;
    padding: 12px !important;
    overflow-x: auto;
    background-color: transparent !important;
    border-radius: 0;
  }

  .markdown-code-block code {
    background: transparent !important;
    padding: 0 !important;
  }
}