.markdown-preview {
  color: var(--color-text);
  line-height: 1.68;
}

.markdown-content {
  width: 100%;
}

/* Headers */
.markdown-preview h1 {
  font-size: 1.6em;
  font-weight: 700;
  margin: 0.4em 0 0.12em 0;
  padding-bottom: 0;
  border-bottom: 0;
  color: var(--color-text);
  line-height: 1.2;
}

.markdown-preview h1:first-child {
  margin-top: 0;
}

.markdown-preview h2 {
  font-size: 1.4em;
  font-weight: 700;
  margin: 0.35em 0 0.12em 0;
  padding-bottom: 0;
  border-bottom: 0;
  color: var(--color-text);
  line-height: 1.25;
}

.markdown-preview h3 {
  font-size: 1.2em;
  font-weight: 600;
  margin: 0.28em 0 0.1em 0;
  color: var(--color-text);
  line-height: 1.3;
}

.markdown-preview h4 {
  font-size: 1.1em;
  font-weight: 600;
  margin: 0.24em 0 0.08em 0;
  color: var(--color-text);
  line-height: 1.3;
}

.markdown-preview h5 {
  font-size: 1em;
  font-weight: 600;
  margin: 0.22em 0 0.08em 0;
  color: var(--color-text);
}

.markdown-preview h6 {
  font-size: 0.95em;
  font-weight: 600;
  margin: 0.2em 0 0.08em 0;
  color: var(--color-text-light);
}

/* Paragraphs */
.markdown-preview p {
  margin: 0.25em 0 0.55em;
  line-height: 1.68;
}

/* Inline code */
.markdown-preview code {
  background-color: var(--color-hover, rgba(255, 255, 255, 0.1));
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family:
    "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.9em;
  color: var(--color-syntax-string, #c3e88d);
}

/* Code blocks */
.markdown-preview pre {
  background-color: var(--color-secondary-bg, rgba(0, 0, 0, 0.2));
  padding: 0.5em;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0.3em 0;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

.markdown-preview pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  color: var(--color-text);
  font-size: 0.95em;
  line-height: 1.5;
}

/* Lists */
.markdown-preview ul,
.markdown-preview ol {
  margin: 0.2em 0 0.55em;
  padding-left: 1.5em;
}

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

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

.markdown-preview li {
  margin: 0.18em 0;
  line-height: 1.62;
}

.markdown-preview li > ul,
.markdown-preview li > ol {
  margin: 0.05em 0;
}

/* Links */
.markdown-preview a {
  color: var(--color-accent, #82aaff);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.markdown-preview a:hover {
  border-bottom-color: var(--color-accent, #82aaff);
}

/* Text formatting */
.markdown-preview strong {
  font-weight: 700;
  color: var(--color-text);
}

.markdown-preview em {
  font-style: italic;
}

.markdown-preview del {
  text-decoration: line-through;
  opacity: 0.7;
}

/* Blockquotes */
.markdown-preview blockquote {
  margin: 0.75em 0;
  padding: 0.5em 1em;
  border-left: 4px solid var(--color-accent, #82aaff);
  background-color: var(--color-hover, rgba(255, 255, 255, 0.05));
  color: var(--color-text-light);
  font-style: italic;
}

.markdown-preview blockquote p {
  margin: 0.2em 0;
}

/* Horizontal rules */
.markdown-preview hr {
  margin: 1em 0;
  border: none;
  border-top: 2px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

/* Images */
.markdown-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 0.75em 0;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

/* Tables */
.markdown-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75em 0;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

.markdown-preview th {
  background-color: var(--color-hover, rgba(255, 255, 255, 0.1));
  padding: 0.75em 1em;
  text-align: left;
  font-weight: 600;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

.markdown-preview td {
  padding: 0.75em 1em;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

.markdown-preview tr:nth-child(even) {
  background-color: var(--color-hover, rgba(255, 255, 255, 0.03));
}

.markdown-preview tr:hover {
  background-color: var(--color-hover, rgba(255, 255, 255, 0.08));
}

/* Line breaks */
.markdown-preview br {
  display: block;
  content: "";
  margin: 0;
  height: 0.3em;
}

/* Task Lists */
.markdown-preview ul.task-list {
  list-style: none;
  padding-left: 1.5em;
}

.markdown-preview .task-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  margin: 0.25em 0;
}

.markdown-preview .task-list-item input[type="checkbox"] {
  margin-top: 0.3em;
  cursor: default;
}

/* Footnotes */
.markdown-preview .footnote-ref {
  font-size: 0.85em;
}

.markdown-preview .footnote-ref a {
  text-decoration: none;
  color: var(--color-accent, #82aaff);
  font-weight: 600;
}

.markdown-preview .footnote-ref a:hover {
  text-decoration: underline;
}

.markdown-preview .footnotes {
  margin-top: 2em;
  padding-top: 1em;
  border-top: 2px solid var(--color-border, rgba(255, 255, 255, 0.1));
  font-size: 0.9em;
  color: var(--color-text-lighter);
}

.markdown-preview .footnotes ol {
  padding-left: 1.5em;
}

.markdown-preview .footnotes li {
  margin: 0.5em 0;
}

.markdown-preview .footnote-backref {
  text-decoration: none;
  color: var(--color-accent, #82aaff);
  font-weight: 600;
}

.markdown-preview .footnote-backref:hover {
  text-decoration: underline;
}
