﻿/* ========================================
   Tank37135 - Sub-components
   代码块 · 表格 · 引用 · 头像
   ======================================== */

/* ===== 代码块 ===== */
.code-block {
  position: relative;
  margin: var(--space-lg) 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(10, 14, 26, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(96, 165, 250, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(96, 165, 250, 0.08);
  transition: box-shadow 0.3s ease;
}.code-block:hover {
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(96, 165, 250, 0.12);
}

/* ── 语言标签 ── */
.code-block::before {
  content: attr(data-lang);
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 0.7rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: rgba(148, 163, 184, 0.5);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  pointer-events: none;
  z-index: 1;
}

/* ── 复制按钮 ── */
.code-block button,
.code-block__copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 14px;
  font-size: 0.75rem;
  font-family: inherit;
  color: rgba(148, 163, 184, 0.8);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;
  opacity: 0;
}
.code-block:hover button,
.code-block:hover .code-block__copy-btn {
  opacity: 1;
}
.code-block button:hover,
.code-block__copy-btn:hover {
  background: rgba(96, 165, 250, 0.2);
  border-color: rgba(96, 165, 250, 0.3);
  color: #fff;
  transform: scale(1.05);
}
.code-block button:active,
.code-block__copy-btn:active {
  transform: scale(0.95);
}
.code-block__copy-btn--copied,
.code-block button.code-block__copy-btn--copied {
  background: rgba(74, 222, 128, 0.15) !important;
  border-color: rgba(74, 222, 128, 0.25) !important;
  color: #4ade80 !important;
}

/* ── pre/code 区域 ── */
/* 高特异性覆盖 style.css 的 section.section pre */
.code-block pre {
  padding: 20px 20px 16px;
  margin: 0;
  overflow-x: auto;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  color: #e2e8f0;
  tab-size: 2;
  -moz-tab-size: 2;
}/* 自定义滚动条（代码块内） */
.code-block pre::-webkit-scrollbar {
  height: 5px;
}
.code-block pre::-webkit-scrollbar-track {
  background: transparent;
}
.code-block pre::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  border-radius: 3px;
}
.code-block pre {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}

/* ── code 元素 ── */
.code-block code {
  display: block;
  font-family: inherit;
  color: inherit;
  background: none !important;
  border: none !important;
}

/* 行号风格（可选） */
.code-block code .line-num {
  display: inline-block;
  width: 2em;
  user-select: none;
  opacity: 0.3;
  padding-right: 1em;
  text-align: right;
}

/* ── 代码语法高亮的基色 ── */
.code-block code .keyword { color: #c084fc; }
.code-block code .string  { color: #86efac; }
.code-block code .number  { color: #fbbf24; }
.code-block code .comment { color: #64748b; font-style: italic; }
.code-block code .func    { color: #60a5fa; }
.code-block code .tag     { color: #f87171; }
.code-block code .attr    { color: #fb923c; }

/* ===== 响应式 ── 移动端代码块按钮常显 ===== */
@media (max-width: 768px) {
  .code-block button,
  .code-block__copy-btn {
    opacity: 1;
    top: 6px;
    right: 6px;
    padding: 3px 10px;
    font-size: 0.7rem;
  }
  .code-block pre {
    padding: 32px 14px 14px;
    font-size: 0.78rem;
  }
}

/* ===== 表格 ===== */
.table-wrapper, .table-container, section.section table {
  width: 100%;
  overflow-x: auto;
  margin: var(--space-lg) 0;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  -webkit-overflow-scrolling: touch;
}
.table-wrapper table, .table-container table, section.section table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}
.table-wrapper thead th, .table-container thead th, section.section table thead th {
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 2px solid rgba(255,255,255,0.08);
  white-space: nowrap;
}
.table-wrapper td, .table-container td, section.section table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--color-white-glass);
  font-size: 0.9rem;
}
.table-wrapper tbody tr:last-child td, .table-container tbody tr:last-child td, section.section table tbody tr:last-child td {
  border-bottom: none;
}
.table-wrapper tbody tr:hover td, .table-container tbody tr:hover td, section.section table tbody tr:hover td {
  background: rgba(255,255,255,0.04);
}
.table-wrapper tbody tr:nth-child(even) td, .table-container tbody tr:nth-child(even) td, section.section table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}
.table-wrapper a, .table-container a, section.section table a {
  color: var(--color-primary-light);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-base);
}
.table-wrapper a:hover, .table-container a:hover, section.section table a:hover {
  color: var(--color-accent-light);
  text-decoration: underline;
}
.table-wrapper img, .table-container img, section.section table img {
  max-width: 40px;
  max-height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}
@media (max-width: 768px) {
  .table-wrapper td, .table-container td, section.section table td {
    padding: 10px 12px;
    font-size: 0.82rem;
  }
  .table-wrapper thead th, .table-container thead th, section.section table thead th {
    padding: 12px;
    font-size: 0.75rem;
  }
}

/* ===== 引用块 ===== */
blockquote {
  position: relative;
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  background: rgba(96, 165, 250, 0.06);
  border-left: 3px solid var(--color-primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-white-glass);
  font-style: italic;
}

/* ===== 头像 ===== */
.avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  padding: 4px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  box-shadow: 0 8px 32px rgba(26,115,232,0.2);
  transition: var(--transition-base);
}
.avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 48px rgba(26,115,232,0.3);
}

.responsive-img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius-md);
  display: block;
  margin: 0 auto;
}

/* ===== 内联代码 ===== */
code:not(.code-block code) {
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.85em;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: #93c5fd;
}
