.markdownCopy {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  height: 20px;
  color: var(--ant-color-text);
}

.controlGroup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.previewToggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.previewLabel {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
}

.markdownViewer {
  flex: 1;
  min-height: 300px;
  max-height: 300px;
  overflow: auto;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background-color: #fff;
  max-width: 100%;

  :global {
    .x-markdown {
      max-width: 100%;
      overflow-wrap: break-word;
      word-break: break-word;
    }

    pre {
      border-radius: 6px;
      overflow-x: auto;
      height: auto;
      margin: 0;

      code {
        background: transparent;
        padding: 0;
        margin: 0;
        font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
          monospace;
        font-size: 13px;
        line-height: 1.6;
        white-space: pre-wrap;
        word-break: break-word;
      }
    }

    table {
      border-collapse: collapse;
      width: auto;
      margin: 1em 0;
      display: table !important;
      max-width: 100%;
      overflow-x: auto;

      thead,
      tbody,
      tfoot {
        display: table-header-group;
      }

      tbody {
        display: table-row-group;
      }

      tr {
        display: table-row;
      }

      th,
      td {
        display: table-cell;
        border: 1px solid #d0d7de;
        padding: 8px 12px;
        text-align: left;
      }

      th {
        background: #f6f8fa;
        font-weight: 600;
      }

      tr:nth-child(2n) {
        background: #f6f8fa;
      }
    }
  }
}

.textareaContainer {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.textarea {
  font-family: monospace;
  font-size: 13px;
  resize: vertical;
  height: min(100%, clamp(280px, 50vh, 640px));
  min-height: min(240px, 100%);
  max-height: 100%;
  padding: 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
}
