/**
 * Markdown 擴展功能樣式 (WordPress 主題版本)
 * 用於表格、引用區塊、刪除線等
 * 包含 !important 和 WordPress Gutenberg 區塊支援
 */

/* =============== Markdown 表格樣式 =============== */
.markdown-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 2rem 0;
  background: transparent;
  padding: 0;
}

/* 提高選擇器優先權以覆蓋 WordPress 預設樣式 */
.article__content .wp-block-table table,
.article__content table,
.markdown-table,
.wp-block-table table,
table.markdown-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 0.95rem !important;
  line-height: 1.6 !important;
  background: rgba(255, 255, 255, 0.1) !important;
  margin: 2rem 0 !important;
  max-width: 100% !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

/* 表頭樣式 - 提高優先權 */
.article__content .wp-block-table thead,
.article__content table thead,
.markdown-table thead,
.wp-block-table thead {
  border-bottom: 2px solid rgba(255, 255, 255, 0.2) !important;
}

.article__content .wp-block-table th,
.article__content table th,
.markdown-table th,
.wp-block-table th {
  padding: 1rem 1.5rem !important;
  font-weight: 600 !important;
  color: rgba(255, 255, 255, 0.9) !important;
  text-align: left !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* 表格行樣式 - 提高優先權 */
.article__content .wp-block-table tbody tr,
.article__content table tbody tr,
.markdown-table tbody tr,
.wp-block-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
  transition: background 0.3s ease !important;
}

.article__content .wp-block-table tbody tr:last-child,
.article__content table tbody tr:last-child,
.markdown-table tbody tr:last-child,
.wp-block-table tbody tr:last-child {
  border-bottom: none !important;
}

.article__content .wp-block-table tbody tr:hover,
.article__content table tbody tr:hover,
.markdown-table tbody tr:hover,
.wp-block-table tbody tr:hover {
  background: rgba(0, 247, 218, 0.15) !important;
}

/* 儲存格樣式 - 提高優先權 */
.article__content .wp-block-table td,
.article__content table td,
.markdown-table td,
.wp-block-table td {
  padding: 0.875rem 1.5rem !important;
  color: var(--text-secondary, #b8b8b8) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* 第一欄稍微強調 */
.article__content .wp-block-table td:first-child,
.article__content table td:first-child,
.markdown-table td:first-child,
.wp-block-table td:first-child {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* 響應式表格 */
@media screen and (max-width: 768px) {
  .markdown-table,
  .article__content table {
    font-size: 0.875rem;
  }

  .markdown-table th,
  .markdown-table td,
  .article__content table th,
  .article__content table td {
    padding: 0.75rem 1rem;
  }
}

/* =============== 引用區塊樣式 =============== */
.article__content .wp-block-quote,
.article__content blockquote,
.article__quote {
  margin: 2rem 0 !important;
  padding: 2.5rem 2.5rem 2rem 2.5rem !important;
  background-color: rgba(155, 149, 197, 0.1) !important;
  border-left: 4px solid var(--secondary-color, #9B95C5) !important;
  border-radius: 12px !important;
  font-style: italic !important;
  color: var(--primary-color, #00F7DA) !important;
  position: relative !important;
}

.article__content .wp-block-quote::before,
.article__content blockquote::before,
.article__quote::before {
  content: '"' !important;
  position: absolute !important;
  top: 0.5rem !important;
  left: 1.5rem !important;
  font-size: 4rem !important;
  line-height: 1 !important;
  color: var(--secondary-color, #9B95C5) !important;
  opacity: 0.3 !important;
  font-family: Georgia, serif !important;
}

.article__content .wp-block-quote p,
.article__content blockquote p,
.article__quote p {
  margin: 0 !important;
  line-height: 1.8 !important;
  color: var(--primary-color, #00F7DA) !important;
}

.article__content .wp-block-quote cite,
.article__content blockquote cite,
.article__quote cite {
  display: block !important;
  margin-top: 1rem !important;
  font-size: 0.9rem !important;
  color: var(--secondary-color, #9B95C5) !important;
  font-style: normal !important;
  text-align: right !important;
}

/* =============== 連結樣式 =============== */
.article__content a {
  color: var(--primary-color, #00F7DA) !important;
  text-decoration: none !important;
  border-bottom: 1px solid rgba(0, 247, 218, 0.3) !important;
  transition: all 0.3s ease !important;
  position: relative !important;
}

.article__content a:hover {
  color: rgba(0, 247, 218, 0.8) !important;
  border-bottom-color: var(--primary-color, #00F7DA) !important;
  text-shadow: 0 0 8px rgba(0, 247, 218, 0.3) !important;
}

.article__content a:visited {
  color: var(--secondary-color, #9B95C5) !important;
  border-bottom-color: rgba(155, 149, 197, 0.3) !important;
}

.article__content a:visited:hover {
  color: rgba(155, 149, 197, 0.8) !important;
  border-bottom-color: var(--secondary-color, #9B95C5) !important;
  text-shadow: 0 0 8px rgba(155, 149, 197, 0.3) !important;
}

/* =============== 刪除線樣式 =============== */
.article__content del {
  color: rgba(255, 255, 255, 0.4) !important;
  text-decoration: line-through !important;
  text-decoration-color: rgba(255, 87, 87, 0.6) !important;
  text-decoration-thickness: 2px !important;
}

/* =============== 數學公式樣式 (KaTeX) =============== */
.article__content .katex {
  font-size: 1.1em !important;
  color: rgba(255, 255, 255, 0.95) !important;
}

.article__content .katex-display {
  margin: 1.5rem 0 !important;
  padding: 1rem !important;
  background: rgba(0, 247, 218, 0.05) !important;
  border-left: 3px solid var(--primary-color, #00F7DA) !important;
  border-radius: 12px !important;
}

.article__content .katex-display > .katex {
  color: var(--primary-color, #00F7DA) !important;
}
