/* 增强表格样式 */
.prose table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  margin: 1.5em 0;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 2px solid var(--color-secondary-500);
}

/* 确保表格边框在所有浏览器中都能正确显示 */
.prose table * {
  box-sizing: border-box;
}

.prose thead {
  background-color: var(--color-primary-50);
}

.prose thead th {
  padding: 1rem 1.25rem;
  font-weight: 600;
  text-align: left;
  color: var(--color-primary-900);
  font-size: 0.95rem;
  line-height: 1.5rem;
  white-space: nowrap;
  position: relative;
  vertical-align: middle;
  border-bottom: 2px solid var(--color-secondary-500);
  border-right: 2px solid var(--color-secondary-500);
}

.prose thead th:last-child {
  border-right: none;
}

.prose tbody tr {
  border-bottom: 2px solid var(--color-secondary-500);
}

.prose tbody tr:last-child {
  border-bottom: none;
}

.prose tbody tr:hover {
  background-color: var(--color-secondary-50);
}

.prose tbody td {
  padding: 0.875rem 1.25rem;
  color: var(--color-secondary-800);
  font-size: 0.95rem;
  line-height: 1.5rem;
  vertical-align: middle;
  position: relative;
  border-right: 2px solid var(--color-secondary-500);
  border-bottom: 2px solid var(--color-secondary-500);
}

.prose tbody td:last-child {
  border-right: none;
}

.prose tbody tr:last-child td {
  border-bottom: none;
}

.prose tbody tr:nth-child(even) {
  background-color: var(--color-secondary-50/80);
}

.prose tbody tr:nth-child(even):hover {
  background-color: var(--color-secondary-50);
}

/* 表格内容对齐样式 */
.prose th[align="center"],
.prose td[align="center"] {
  text-align: center;
}

.prose th[align="right"],
.prose td[align="right"] {
  text-align: right;
}

.prose th[align="left"],
.prose td[align="left"] {
  text-align: left;
}

/* 表格内容样式增强 */
.prose td code {
  background-color: var(--color-secondary-100);
  padding: 0.2em 0.4em;
  border-radius: 0.25em;
  font-size: 0.875em;
}

[data-theme="dark"] .prose td code {
  background-color: var(--color-secondary-800);
}

/* 表格内的链接样式 */
.prose td a {
  color: var(--color-primary-600);
  text-decoration: none;
  border-bottom: 1px solid var(--color-primary-300);
  transition: all 0.2s ease;
}

.prose td a:hover {
  color: var(--color-primary-700);
  border-bottom-color: var(--color-primary-500);
}

[data-theme="dark"] .prose td a {
  color: var(--color-primary-400);
  border-bottom-color: var(--color-primary-700);
}

[data-theme="dark"] .prose td a:hover {
  color: var(--color-primary-300);
  border-bottom-color: var(--color-primary-500);
}

/* 表格内复选框样式 */
.prose td input[type="checkbox"] {
  width: 1.25em;
  height: 1.25em;
  margin: 0;
  vertical-align: middle;
  position: relative;
  top: -1px;
  accent-color: var(--color-primary-500);
}

/* 表格内图标样式 */
.prose td svg,
.prose td img:not(.emoji) {
  vertical-align: middle;
  display: inline-block;
  width: auto;
  height: 1.25em;
  margin: 0 0.25em;
}

/* 表格内的状态标记 */
.prose td .status {
  display: inline-flex;
  align-items: center;
  padding: 0.25em 0.75em;
  border-radius: 9999px;
  font-size: 0.75em;
  font-weight: 500;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.prose td .status-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: rgb(6, 95, 70);
}

.prose td .status-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: rgb(146, 64, 14);
}

.prose td .status-error {
  background-color: rgba(239, 68, 68, 0.1);
  color: rgb(153, 27, 27);
}

.prose td .status-info {
  background-color: rgba(59, 130, 246, 0.1);
  color: rgb(30, 64, 175);
}

/* 增强列表样式 */
.prose ul {
  list-style-type: disc;
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-left: 1.625em;
}

.prose ul li {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  padding-left: 0.375em;
}

.prose ul li::marker {
  color: #6b7280;
}

.prose ul li ul {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.prose ol {
  list-style-type: decimal;
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-left: 1.625em;
}

.prose ol li {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  padding-left: 0.375em;
}

.prose ol li::marker {
  color: #6b7280;
}

/* 增强代码块样式 */
.prose pre {
  margin: 1.5em 0;
  padding: 1em;
  border-radius: 0.375rem;
  overflow-x: auto;
}

.prose :not(pre) > code {
  background-color: rgba(0, 0, 0, 0.1);
  padding: 0.2em 0.4em;
  border-radius: 0.25em;
  font-weight: 400;
  white-space: nowrap;
}

/* 移除 Tailwind Typography 添加的引号 */
.prose code::before,
.prose code::after {
  content: none !important;
}

/* 表情符号样式 */
.prose img.emoji {
  height: 1em;
  width: 1em;
  margin: 0 0.05em 0 0.1em;
  vertical-align: -0.1em;
  display: inline-block;
  border: none;
  box-shadow: none;
}

/* 标题样式 */
.prose h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
  color: var(--color-secondary-900);
  border-bottom: 1px solid var(--color-secondary-200);
  padding-bottom: 0.5rem;
  position: relative;
}

.prose h1::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100px;
  height: 3px;
  background: linear-gradient(to right, var(--color-primary-600), var(--color-primary-400));
  border-radius: 3px;
}

.prose h2 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1.25rem;
  color: var(--color-secondary-900);
  border-bottom: 1px solid var(--color-secondary-200);
  padding-bottom: 0.25rem;
  position: relative;
}

.prose h2::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 75px;
  height: 2px;
  background: linear-gradient(to right, var(--color-primary-500), var(--color-primary-300));
  border-radius: 2px;
}

.prose h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 1rem;
  color: var(--color-secondary-900);
  position: relative;
  padding-left: 1rem;
}

.prose h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.25em;
  height: 1em;
  width: 4px;
  background: linear-gradient(to bottom, var(--color-primary-500), var(--color-primary-300));
  border-radius: 2px;
}

.prose h4 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-secondary-900);
}

.prose h5 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--color-secondary-900);
}

.prose h6 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--color-secondary-700);
}

/* 标题锚点样式 */
.prose h1 .anchor,
.prose h2 .anchor,
.prose h3 .anchor,
.prose h4 .anchor,
.prose h5 .anchor,
.prose h6 .anchor {
  visibility: hidden;
  margin-left: 0.5rem;
  color: #a0aec0;
  text-decoration: none;
}

.prose h1:hover .anchor,
.prose h2:hover .anchor,
.prose h3:hover .anchor,
.prose h4:hover .anchor,
.prose h5:hover .anchor,
.prose h6:hover .anchor {
  visibility: visible;
}

/* 暗色模式 */
[data-theme="dark"] .prose {
  color: var(--color-secondary-300);
}

[data-theme="dark"] .prose h1,
[data-theme="dark"] .prose h2,
[data-theme="dark"] .prose h3,
[data-theme="dark"] .prose h4,
[data-theme="dark"] .prose h5 {
  color: var(--color-secondary-100);
}

[data-theme="dark"] .prose h6 {
  color: var(--color-secondary-300);
}

/* 引用样式 */
.prose blockquote {
  margin: 1.5em 0;
  padding: 1em 1.5em;
  border-left: 4px solid var(--color-primary-500);
  background-color: var(--color-gray-100);
  border-radius: 0.5rem;
  font-style: italic;
  color: var(--color-secondary-700);
}

.prose blockquote p {
  margin: 0;
}

.prose blockquote p + p {
  margin-top: 1em;
}

/* 链接样式 */
.prose a {
  color: var(--color-primary-600);
  text-decoration: none;
  border-bottom: 1px solid var(--color-primary-300);
  transition: all 0.2s ease;
}

.prose a:hover {
  color: var(--color-primary-800);
  border-bottom-color: var(--color-primary-600);
}

/* 暗色模式适配 */
[data-theme="dark"] .prose blockquote {
  background-color: var(--color-dark-surface);
  border-left-color: var(--color-primary-400);
  color: var(--color-secondary-300);
}

[data-theme="dark"] .prose a {
  color: var(--color-primary-400);
  border-bottom-color: var(--color-primary-600);
}

[data-theme="dark"] .prose a:hover {
  color: var(--color-primary-300);
  border-bottom-color: var(--color-primary-400);
}

/* 响应式表格样式 */
@media (max-width: 640px) {
  .prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .prose thead th {
    white-space: nowrap;
    padding: 0.75rem 1rem;
  }
  
  .prose tbody td {
    padding: 0.75rem 1rem;
  }
}

/* 表格内容溢出处理 */
.prose td p {
  margin: 0;
}

.prose td > *:first-child {
  margin-top: 0;
}

.prose td > *:last-child {
  margin-bottom: 0;
}

.prose td.truncate {
  max-width: 20rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 确保表格边框在所有情况下都能正确显示 */
.prose table tr td:last-child {
  border-right: none !important;
}

.prose table tr th:last-child {
  border-right: none !important;
}

.prose table tr:last-child td {
  border-bottom: none !important;
}

/* 暗色模式下的边框颜色 */
[data-theme="dark"] .prose table {
  --table-border-color: var(--color-dark-border);
}

/* 增强列表样式 */
.prose ul {
  list-style-type: disc;
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-left: 1.625em;
}

.prose ul li {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  padding-left: 0.375em;
}

.prose ul li::marker {
  color: #6b7280;
}

.prose ul li ul {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.prose ol {
  list-style-type: decimal;
  margin-top: 1.25em;
  margin-bottom: 1.25em;
  padding-left: 1.625em;
}

.prose ol li {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  padding-left: 0.375em;
}

.prose ol li::marker {
  color: #6b7280;
}

/* 添加明确的表格边框样式 */
.prose table {
  border: 2px solid var(--color-secondary-500) !important;
}

.prose th {
  border-right: 2px solid var(--color-secondary-500) !important;
  border-bottom: 2px solid var(--color-secondary-500) !important;
}

.prose td {
  border-right: 2px solid var(--color-secondary-500) !important;
  border-bottom: 2px solid var(--color-secondary-500) !important;
}

.prose th:last-child,
.prose td:last-child {
  border-right: none !important;
}

.prose tr:last-child td {
  border-bottom: none !important;
}

[data-theme="dark"] .prose th,
[data-theme="dark"] .prose td {
  border-color: var(--color-dark-border) !important;
}

[data-theme="dark"] .prose table {
  border-color: var(--color-dark-border) !important;
}

/* 暗色模式表格样式 */
[data-theme="dark"] .prose table {
  border-color: var(--color-dark-border);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  border-radius: 0.75rem;
  border-width: 2px;
}

[data-theme="dark"] .prose thead {
  background-color: var(--color-dark-surface);
}

[data-theme="dark"] .prose thead th {
  color: var(--color-primary-300);
  border-bottom: 2px solid var(--color-dark-border);
  border-right: 2px solid var(--color-dark-border);
  font-weight: 600;
}

[data-theme="dark"] .prose thead th:last-child {
  border-right: none;
}

[data-theme="dark"] .prose tbody tr {
  border-bottom: 2px solid var(--color-dark-border);
}

[data-theme="dark"] .prose tbody tr:last-child {
  border-bottom: none;
}

[data-theme="dark"] .prose tbody td {
  color: var(--color-secondary-200);
  border-right: 2px solid var(--color-dark-border);
  border-bottom: 2px solid var(--color-dark-border);
}

[data-theme="dark"] .prose tbody td:last-child {
  border-right: none;
}

[data-theme="dark"] .prose tbody tr:last-child td {
  border-bottom: none;
}

[data-theme="dark"] .prose tbody tr:hover {
  background-color: var(--color-dark-surface/60);
}

[data-theme="dark"] .prose tbody tr:nth-child(even) {
  background-color: var(--color-dark-surface/40);
}

[data-theme="dark"] .prose tbody tr:nth-child(even):hover {
  background-color: var(--color-dark-surface/60);
}

/* 暗色模式下的状态标记样式 */
[data-theme="dark"] .prose td .status-success {
  background-color: rgba(16, 185, 129, 0.2);
  color: rgb(110, 231, 183);
}

[data-theme="dark"] .prose td .status-warning {
  background-color: rgba(245, 158, 11, 0.2);
  color: rgb(253, 186, 116);
}

[data-theme="dark"] .prose td .status-error {
  background-color: rgba(239, 68, 68, 0.2);
  color: rgb(252, 165, 165);
}

/* 收纳内容样式 */
.details-content {
  margin-left: 1.5em;
  padding: 1em;
  background-color: var(--color-gray-100);
  border-left: 4px solid var(--color-primary-500);
  margin-bottom: 1em;
  border-radius: 0.5rem;
}

[data-theme="dark"] .details-content {
  background-color: var(--color-dark-surface);
  border-left-color: var(--color-primary-400);
}

/* 收纳标题样式 */
.prose details {
  margin: 1.5em 0;
  border-radius: 0.5rem;
  border: 1px solid var(--color-secondary-200);
  background-color: var(--color-gray-50);
  transition: all 0.2s ease;
  overflow: hidden;
}

.prose details summary {
  padding: 1em;
  cursor: pointer;
  position: relative;
  font-weight: 500;
  color: var(--color-secondary-900);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75em;
  transition: all 0.2s ease;
  background: linear-gradient(to right, var(--color-primary-50), var(--color-gray-50));
  border-left: 4px solid var(--color-primary-100);
}

.prose details summary::-webkit-details-marker {
  display: none;
}

.prose details summary::before {
  content: "";
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234b6bff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'%3E%3C/path%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.prose details[open] summary {
  border-left: 4px solid var(--color-primary-500);
  background: linear-gradient(to right, var(--color-primary-100), var(--color-gray-50));
  border-bottom: 1px solid var(--color-secondary-200);
}

.prose details[open] summary::before {
  transform: rotate(90deg);
}

.prose details summary:hover {
  background: linear-gradient(to right, var(--color-primary-100), var(--color-gray-100));
  color: var(--color-primary-700);
}

.prose details > blockquote {
  margin: 0;
  padding: 1.5em;
  border-radius: 0;
  border-left: 4px solid var(--color-primary-500);
  background: linear-gradient(to right, var(--color-primary-50/50), var(--color-gray-50));
}

.prose details > blockquote p:first-child {
  margin-top: 0;
}

.prose details > blockquote p:last-child {
  margin-bottom: 0;
}

/* 暗色模式适配 */
[data-theme="dark"] .prose details {
  border-color: var(--color-dark-border);
  background-color: var(--color-dark-surface);
}

[data-theme="dark"] .prose details summary {
  color: var(--color-secondary-100);
  background: linear-gradient(to right, var(--color-dark-surface), var(--color-dark-card));
  border-left-color: var(--color-primary-800);
}

[data-theme="dark"] .prose details[open] summary {
  border-bottom-color: var(--color-dark-border);
}

[data-theme="dark"] .prose details summary::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23839dff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'%3E%3C/path%3E%3C/svg%3E");
}

[data-theme="dark"] .prose details[open] summary {
  background: linear-gradient(to right, var(--color-dark-card), var(--color-dark-surface));
  border-left-color: var(--color-primary-400);
}

[data-theme="dark"] .prose details summary:hover {
  background: linear-gradient(to right, var(--color-primary-900/30), var(--color-dark-card));
  color: var(--color-primary-400);
}

[data-theme="dark"] .prose details > blockquote {
  background: linear-gradient(to right, var(--color-primary-900/10), var(--color-dark-surface));
  border-left-color: var(--color-primary-400);
}