/* 重置默认样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    margin-bottom: 160px; /* 为pagination和footer预留空间 */
}

/* 头部导航 */
header {
    position: relative;
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    text-align: center;
}

.nav-menu {
    margin-top: 1rem;
    position: relative; /* 为了方便定位子菜单 */
}

.nav-list {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    /*在移动端，默认display:flex; 通过JavaScript和active类控制显示和隐藏*/
    /* position: absolute; */
    /* top: 100%; /* 初始位置在 header 下方 */
    /* left:0; */ */
    /* width: 50%; */
    /* display: none; 默认隐藏 */
    /* flex-direction: column; */
    /* background-color: #2c3e50; */
    padding: 1rem 0;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1001; /* 确保菜单在其他内容之上 */
}

.nav-list.active {
    display: flex;
}

.nav-list li a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

.nav-list li a:hover {
    color: #3498db;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease; /* 添加旋转过渡效果 */
}

/* 搜索框 */
.search-container {
    margin: 1rem 0;
}

#search-input {
    padding: 0.5rem;
    width: 80%;
    max-width: 300px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* 主内容区域 */
.article-blocks {
    padding: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center;
}

.block {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    width: 100%;
    max-width: 350px;
}

.block h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.full-list {
    max-width: 800px; /* 设置最大宽度，限制内容宽度 */
    margin: 2rem auto; /* 上下外边距2rem，左右自动居中 */
    padding: 0 1rem; /* 左右内边距1rem，留出小幅空白 */
}

.full-list h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    text-align: center; /* 标题居中 */
}

.article-list {
    /* list-style: none;   */
    
}

.article-list li {
    /* margin: 0.5rem 0; */
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 8px 0;
}

.article-list li a {
    color: #3498db;
    text-decoration: none;
}

.article-list li a:hover {
    text-decoration: underline;
}

.bullet {
    margin-right: 4px;
    color: #000;
}

.article-date {
    color: #666;
    font-size: 0.9em;
    margin-left: 10px;
    white-space: nowrap;
}

.more-link {
    display: block;
    margin-top: 1rem;
    color: #3498db;
    text-decoration: none;
}

.more-link:hover {
    text-decoration: underline;
}

.returnhome {
    position: fixed; /* 固定在底部 */
    bottom: 60px;    /* 距离底部50px，留出footer空间 */
    left: 0;
    width: 100%;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9); /* 半透明白背景，避免遮挡内容 */
    padding: 0.5rem 0;
    z-index: 1000;   /* 确保在内容之上 */
}

.returnhome1 a {
    background-color: #f0f5fa; /*  一个比父元素略深的浅蓝色，区分度适中 */
    color: #337ab7; /*  与背景色对比明显的深蓝色文字 */
    font-weight: bold;
    text-decoration: none; /* 去除下划线 */
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(27, 26, 26, 0.1);
    padding: 10px 20px; /*  增加了水平padding，让按钮更宽一些 */
    transition: background-color 0.3s ease; /* 添加过渡效果，使点击更顺畅 */
}
.returnhome a{
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none; /* 去除下划线 */
}
.returnhome a:hover {
    background-color: #d0e0f5; /*  鼠标悬停时，背景颜色略微加深 */
}

/* 分页样式 */
.pagination {
    position: fixed; /* 固定在底部 */
    bottom: 60px;    /* 距离底部50px，留出footer空间 */
    left: 0;
    width: 100%;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9); /* 半透明白背景，避免遮挡内容 */
    padding: 0.5rem 0;
    z-index: 1000;   /* 确保在内容之上 */
}

.pagination button {
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:disabled {
    background-color: #7f8c8d;
    cursor: not-allowed;
}

.pagination span {
    font-size: 1rem;
    margin: 0 1rem;
}

/* 文章内容页面 */
.content {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-align: center; /* 保持标题居中 */
  }
  
  .content .meta {
    font-size: 1rem;
    color: #777;
    margin-bottom: 2rem;
    text-align: center; /* 保持元数据居中 */
  }
  
  .content p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
  }
  
  .content img.responsive-img {
    max-width: 100%;
    height: auto;
    display: block;
    /*margin: 1rem 0;*/
    margin: 1rem auto;
  }
  
  .content a {
    color: #007bff;
    text-decoration: underline;
  }


  .share-btn {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 auto;
    display: block;
    /* width: fit-content; */
}
.share-btn:hover {
    background-color: #0056b3;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 1rem;
    background-color: #2c3e50;
    color: white;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}


#contextMenu {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    padding: 5px;
    z-index: 1000;
    display: none;
    min-width: 100px;
    white-space: nowrap; /* 确保菜单项水平排列 */
}

#contextMenu:before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    top: -6px;
    left: 20px;
    box-shadow: -2px -2px 5px rgba(0, 0, 0, 0.05);
}

#contextMenu.upward:before {
    top: auto;
    bottom: -6px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.05);
}

#translatePopup {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 10px 10px 0;
    z-index: 1001;
    display: none;
    font-family: Arial, sans-serif;

}

#translatePopup textarea {
    width: 200px;
    height: 100px;
    resize: none;
    margin-bottom: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}

#translatePopup button {
    display: block;
    margin: 10px auto;
    padding: 5px 10px;
    background: #f4f4f4;
    /* border: none; */
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    /* font-size: 16px; */
}

#copyMessage {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    display: none;
    z-index: 1002;
}

.menu-item {
    padding: 8px 16px;
    cursor: pointer;
    color: #333;
    transition: background 0.2s;
    display: inline-block; /* 水平排列菜单项 */
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-item:active {
    background: #05b655 !important; /* 点击时的背景色 */
    transition: background 0s; /* 立即变色 */
}

/* 可选：添加动画效果 */
@keyframes clickFeedback {
    0% { background: #cf1f1f; }
    100% { background: transparent; }
}

.menu-item.clicked {
    animation: clickFeedback 0.3s ease;
}

.menu-divider {
    display: inline-block;
    margin: 0 5px;
    color: #ccc;
}


.loading-text {
    color: #666;
    font-style: italic;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.translation-content {
    padding: 12px;
    max-width: 400px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: system-ui, -apple-system;
    line-height: 1.5;
      /* 新增全局样式 */
  color: #2c3e50; /* 主文字颜色 */
  font-size: 14px; /* 基准字号 */
  border: 1px solid #ddd;
  }
  
  .translation-content h3 {
    margin: 8px 0;
    font-size: 1.1em;
    color: #2c3e50;
  }
  
  .translation-content ul {
    margin: 4px 0;
    padding-left: 20px;
    list-style-type: disc; /* 明确指定符号类型 */
  }
  
  .translation-content li {
    margin: 4px 0; /* 增大间距 */
    padding-left: 8px; /* 内容缩进 */
  }
  
  .translation-content strong {
    color: #3498db;
    font-weight: 600; /* 加强强调效果 */
  }

  .translation-content h1 {
    font-size: 1.4em;
    margin: 16px 0 8px;
    color: #2c3e50;
  }
  
  .translation-content h2 {
    font-size: 1.3em;
    margin: 14px 0 7px;
    color: #2c3e50;
  }
  
  .translation-content h4 {
    font-size: 1em;
    margin: 10px 0 6px;
    color: #34495e;
  }
  
  /* 段落样式 */
  .translation-content p {
    margin: 4px 0;
    line-height: 1.6;
  }
  
  /* 有序列表 */
  .translation-content ol {
    margin: 4px 0;
    padding-left: 24px;
    list-style-type: decimal;
  }
  
  /* 代码块 */
  .translation-content pre {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    margin: 10px 0;
    overflow-x: auto;
  }
  
  .translation-content code {
    font-family: Monaco, Consolas, monospace;
    font-size: 0.9em;
  }
  
  /* 引用区块 */
  .translation-content blockquote {
    border-left: 4px solid #3498db;
    padding-left: 12px;
    margin: 10px 0;
    color: #7f8c8d;
  }
  
  /* 水平分隔线 */
  .translation-content hr {
    border: 0;
    height: 1px;
    background: #ecf0f1;
    margin: 4px 0;
  }
  
  /* 表格样式 */
  .translation-content table {
    border-collapse: collapse;
    margin: 12px 0;
    width: 100%;
  }
  
  .translation-content td, 
  .translation-content th {
    padding: 8px;
    border: 1px solid #ecf0f1;
  }
  
  .translation-content th {
    background: #f8f9fa;
  }





/* 响应式设计 */
@media (max-width: 768px) {
    .nav-list {
        /* display: none; */
        flex-direction: column;
        position: absolute;
        top: 100%;/* 从菜单按钮下方开始 */
        left: 0;
        width: 100%;
        padding: 1rem 0;
        background-color: #2c3e50; /* 添加背景颜色 */
        border-radius: 5px; /* 添加圆角 */
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); /* 添加阴影 */
        display: flex;
        /*border: 1px solid white;  /*添加白色边框 */
        z-index: 1001;
        
    }

    .nav-list:not(.active){
        display: none; /*隐藏菜单*/
    }
    
    .nav-list.active {
        display: flex;
    }

    .menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: rgb(255, 255, 255);
        cursor: pointer;
        transition: transform 0.3s ease; /* 添加旋转过渡效果 */
    }
    /*  关键部分：根据 active 类改变按钮样式 */
    /* .nav-menu > .nav-list.active ~ .menu-toggle {
        transform: rotate(90deg);
    }
    .nav-menu > .nav-list:not(.active) ~ .menu-toggle {
        transform: rotate(0deg);
    } */

    .article-blocks {
        flex-direction: column;
        align-items: center;
    }

    .block {
        max-width: 100%;
    }

    /* 调整pagination在小屏幕上的样式 */
    .pagination {
        bottom: 40px; /* 在手机上稍微上移 */
    }

    #translatePopup {
        width: 90%;
        max-width: none !important;
        max-height: 80vh !important;
    }
    
    .translation-content {
        font-size: 14px;
        padding: 8px;
    }

    .translation-content h3 {
        font-size: 1.05em;
      }
}




@media (min-width: 769px) and (max-width: 1024px) {
    .block {
        max-width: 45%;
    }
    .menu-toggle {
        display: none;
      }
      .nav-list {
        display: flex;
      }


    
}