/* ===== 基础布局样式 ===== */
.article-detail-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* 文章主体容器 */
.article-detail {
  background: white;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  padding: 2rem;
  position: relative;
}

/* 文章顶部装饰线 */
.article-detail::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #4a6fa5, #166088);
}

/* ===== 文章标题区域 ===== */
.article-title {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--secondary-color);
  position: relative;
  padding-bottom: 1rem;
}

.article-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, #4a6fa5, #166088);
  border-radius: 2px;
}

/* 文章元信息（日期、分类等） */
.article-meta {
  display: flex;
  margin-bottom: 1.5rem;
  color: #666;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

/* ===== 文章内容区域 ===== */
.article-content {
  font-size: 1.1rem;
  line-height: 1.8;
  padding-bottom: 2rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

/* 二级标题样式 */
.article-content h2 {
  position: relative;
  padding-left: 1.5rem;
  margin: 2rem 0 1.2rem;
  color: #166088;
  font-size: 1.6rem;
}

.article-content h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  height: 1.5rem;
  width: 6px;
  background: linear-gradient(180deg, #4a6fa5, #166088);
  border-radius: 3px;
}

/* 列表项样式 */
.article-content li {
  margin-bottom: 0.8rem;
  padding-left: 0.5rem;
  position: relative;
}

.article-content li::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 0.7rem;
  width: 8px;
  height: 8px;
  background: #4a6fa5;
  border-radius: 50%;
}

/* 斜体说明文字 */
.article-content em {
  display: block;
  text-align: right;
  font-style: italic;
  color: #666;
  padding-top: 0.5rem;
  border-top: 1px dashed #e1e8ed;
  margin-top: 1.5rem;
}

/* ===== 返回链接按钮 ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 500;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, #4a6fa5, #166088);
  color: white;
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(22,96,136,0.3);
  margin-top: 1.5rem;
  transition: all .3s;
}

.back-link:hover {
  transform: translateX(-5px);
  box-shadow: 0 6px 20px rgba(22,96,136,0.4);
}

.back-link i {
  transition: transform .3s ease;
}

.back-link:hover i {
  transform: translateX(-3px);
}

/* ===== 代码块样式 ===== */
.code-block {
  position: relative;
  background: #f8f9fa;
  border-radius: 6px;
  padding: 1.5rem;
  border: 1px solid #e1e8ed;
  margin: 1rem 0;
}

/* 代码预格式化文本 */
pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  line-height: 1.5;
  color: #2d3748;
  overflow-x: auto;
}

/* ===== 复制按钮样式 ===== */
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #4a6fa5, #166088);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(22,96,136,0.3);
}

.copy-btn:active {
  transform: translateY(0);
}

/* ===== 复制成功提示 ===== */
.copy-notification {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(40,167,69,0.9);
  color: white;
  padding: 10px 15px;
  border-radius: 4px;
  font-size: 0.9rem;
  z-index: 1000;
  animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; }
  20%, 80% { opacity: 1; }
}

/* ===== 视频容器样式 ===== */
.video-container {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 宽高比 */
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* 桌面和移动端视频容器显示控制 */
.video-container.desktop {
  display: block;
}

.video-container.mobile {
  display: none;
  margin: 1.5rem 0;
  text-align: center;
  width: 100%;
}

/* 移动端图片样式 */
.mobile-image {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mobile-image img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  transition: transform 0.5s ease;
}

.mobile-image:hover img {
  transform: scale(1.02);
}

.mobile-image p {
  margin-top: 12px;
  font-style: italic;
  color: #666;
  font-size: 0.95rem;
}

/* ===== 侧边栏布局 ===== */
.article-detail-container {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  align-items: flex-start;
}

.article-detail {
  flex: 1;
}

.sidebar {
  width: 300px;
  position: sticky;
  top: 5rem;
}

/* ===== 个人介绍卡片 ===== */
.profile-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, #4a6fa5, #166088);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
}

.profile-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

.profile-bio {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.profile-stats {
  display: flex;
  justify-content: space-around;
  margin: 1rem 0;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--secondary-color);
}

.stat-label {
  font-size: 0.8rem;
  color: #666;
}

/* ===== 推荐文章样式 ===== */
.recommendations {
  background: white;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  padding: 1.5rem;
}

.recommendations h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--secondary-color);
  position: relative;
  padding-bottom: 0.5rem;
}

.recommendations h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, #4a6fa5, #166088);
  border-radius: 2px;
}

.recommendation-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recommendation-item {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.recommendation-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.recommendation-link {
  display: flex;
  align-items: flex-start;
  text-decoration: none;
  color: #333;
  transition: all 0.3s ease;
}

.recommendation-link:hover {
  color: #166088;
  transform: translateX(5px);
}

.recommendation-thumb {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  margin-right: 1rem;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4a6fa5;
  font-size: 1.5rem;
}

.recommendation-content {
  flex: 1;
}

.recommendation-title {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.3rem;
}

.recommendation-meta {
  font-size: 0.8rem;
  color: #666;
}

.refresh-btn {
  width: 100%;
  padding: 0.8rem;
  background: linear-gradient(135deg, #4a6fa5, #166088);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  margin-top: 1rem;
}

.refresh-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(22,96,136,0.3);
}

/* ===== 响应式设计 ===== */

/* 平板设备 (max-width: 1024px) */
@media (max-width: 1024px) {
  .article-detail-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    position: static;
  }
  
  .profile-stats {
    justify-content: space-between;
    max-width: 300px;
    margin: 1rem auto;
  }
  
  /* 移动端视频容器显示控制 */
  .video-container.desktop {
    display: none;
  }
  
  .video-container.mobile {
    display: block;
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
    max-width: none;
  }

  .mobile-image {
    border-radius: 0;
    max-width: none;
  }

  .mobile-image img {
    border-radius: 0;
  }
}

/* 手机设备 (max-width: 768px) */
@media (max-width: 768px) {
  .article-detail {
    padding: 1.8rem;
  }
  
  .article-title {
    font-size: 1.8rem;
  }
  
  .article-content h2 {
    font-size: 1.4rem;
  }
  
  .code-block {
    padding: 1.2rem 1rem;
  }
  
  .copy-btn {
    padding: 5px 8px;
    font-size: 0.8rem;
  }
  
  .video-container.mobile {
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    width: calc(100% + 3rem);
  }
  
  .profile-card,
  .recommendations {
    padding: 1.2rem;
  }
  
  .recommendation-link {
    flex-direction: column;
  }
  
  .recommendation-thumb {
    width: 100%;
    height: 120px;
    margin-right: 0;
    margin-bottom: 0.8rem;
  }
}

/* 小屏手机 (max-width: 480px) */
@media (max-width: 480px) {
  .video-container.mobile {
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
  }
}

/* 添加在文档2的响应式设计部分之前 */
/* ===== 长链接响应式处理 ===== */
.article-content a {
  word-break: break-all;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* 针对代码块中的长链接特别处理 */
.code-block pre {
  word-break: break-all;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* 手机端链接特殊处理 */
@media (max-width: 768px) {
  .article-content a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .code-block {
    position: relative;
    padding-right: 80px; /* 给复制按钮留出空间 */
  }
  
  .code-block pre {
    font-size: 0.85rem;
    line-height: 1.4;
  }
  
  .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 0.8rem;
    z-index: 10;
  }
}

/* 超小屏幕特殊处理 */
@media (max-width: 480px) {
  .code-block pre {
    font-size: 0.75rem;
  }
  
  .article-content a {
    word-break: break-word;
    hyphens: auto;
  }
}