/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: default !important;
}

/* 文本输入区域使用文本选择光标 */
input, textarea, select, [contenteditable] {
    cursor: text !important;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

/* 导航栏样式 */
nav {
    background-color: #333;
    color: #fff;
    padding: 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    list-style: none;
    display: flex;
}

.nav-links li {
    margin-left: 2rem;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.nav-links a:hover {
    background-color: #555;
}

/* 容器样式 */
.container {
    max-width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
    margin-top: 160px; /* 为固定导航栏和搜索框留出空间 */
}

/* 双栏布局样式 */
.main-layout {
    display: grid;
    grid-template-columns: minmax(200px, 25%) 1fr;
    grid-auto-rows: 1fr;
    align-items: stretch;
    gap: 1.5rem;
    min-height: calc(100vh - 140px);
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

/* 侧边导航样式 */
.sidebar {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.8rem;
    position: sticky;
    top: 100px; /* 调整为更靠上的位置 */
    max-height: calc(100vh - 120px); /* 调整最大高度以适应新的顶部位置 */
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    margin: 0 0 1.2rem 0;
    color: #333;
    font-size: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #4CAF50;
    line-height: 1;
}

.nav-articles {
    list-style: none;
    flex-grow: 1;
    overflow-y: auto;
    margin-top: 0;
}

.nav-articles li {
    margin-bottom: 0.8rem;
}

.nav-articles a {
    display: block;
    padding: 8px 12px;
    color: #555;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 13px;
    line-height: 1.4;
    background-color: #f8f9fa;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-articles a:hover {
    background-color: #e8f5e9;
    color: #4CAF50;
    border-left-color: #4CAF50;
    transform: translateX(5px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nav-articles a.active {
    background-color: #4CAF50;
    color: white;
    border-left-color: #3d8b40;
    font-weight: 500;
}

/* 主内容区样式 */
.content-area {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.8rem;
    overflow-x: hidden;
}

/* 确保内容区域内的所有元素都不会超出容器宽度 */
.content-area * {
    max-width: 100%;
    box-sizing: border-box;
}

/* 确保图片响应式显示 */
.content-area img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.content-area .article {
    margin-bottom: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
}

.content-area .article h2 {
    font-size: 1.7rem;
    margin: 0 0 1rem 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    line-height: 1;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #555;
}

/* 移除响应式设计，保持固定布局 */

/* 文章样式 */
.article {
    background-color: #fff;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.article h2 {
    margin-bottom: 1rem;
    color: #333;
}

.article-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.article-content {
    line-height: 1.8;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #555;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.form-group textarea {
    height: 200px;
    resize: vertical;
}

/* 搜索框样式 */
.search-container {
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
    position: fixed;
    top: 70px;
    left: 1rem;
    right: 1rem;
    z-index: 999;
    max-width: calc(100% - 2rem);
    box-sizing: border-box;
}

.search-container:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.search-container form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}

/* 前端搜索框 */
.search-container input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    color: #333;
}

.search-container input[type="text"]:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    background-color: #fff;
}

.search-container input[type="submit"] {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background-color: #4CAF50;
    color: white;
    font-size: 16px;
    font-weight: 500;

    transition: all 0.3s ease;
}

.search-container input[type="submit"]:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.search-container input[type="submit"]:active {
    transform: translateY(0);
}

/* 后端搜索框 */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    align-items: center;
}

.search-form input[type="text"] {
    padding: 10px 14px;
    border: 2px solid #e1e5e9;
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    color: #333;
    width: 250px;
}

.search-form input[type="text"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    background-color: #fff;
}

.search-form input[type="submit"] {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background-color: #007bff;
    color: white;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.search-form input[type="submit"]:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.search-form input[type="submit"]:active {
    transform: translateY(0);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* 分页导航样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    padding: 10px;
}

.pagination .btn {
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin: 0 5px;
    border: none;

    font-size: 14px;
}

.pagination .btn:hover {
    background-color: #45a049;
}

.pagination .page-info {
    margin: 0 15px;
    font-size: 14px;
    color: #333;
}

.admin-container .pagination {
    margin: 20px 0;
}

.admin-container .pagination .btn {
    background-color: #007bff;
}

.admin-container .pagination .btn:hover {
    background-color: #0056b3;
}

/* 文章展开/收起样式 */
.article-preview {
    width: 100%;
    line-height: 1.6;
    margin-bottom: 15px;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    /* 移除 !important 标记，允许JavaScript控制display属性 */
    display: block;
    max-width: 100%;
    overflow-x: hidden;
    word-break: keep-all !important;
    float: none !important;
    clear: both !important;
    box-sizing: border-box;
}

.article-preview.expanded {
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    max-width: 100% !important;
}

.article-full {
    line-height: 1.6;
    margin-bottom: 15px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.toggle-content {
    margin-top: 10px;
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
}

.toggle-content:hover {
    background-color: #45a049;
}

/* 后台管理样式 */
.admin-header {
    background-color: #333;
    color: #fff;
    padding: 1rem;
    margin-bottom: 2rem;
}

.admin-header h1 {
    font-size: 1.5rem;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.admin-panel {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
}

.admin-sidebar {
    background-color: #fff;
    padding: 1rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.admin-sidebar ul {
    list-style: none;
}

.admin-sidebar li {
    margin-bottom: 1rem;
}

.admin-sidebar a {
    color: #333;
    text-decoration: none;
    display: block;
    padding: 0.5rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.admin-sidebar a:hover {
    background-color: #f4f4f4;
}

.admin-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 表格样式 */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

.table th, .table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background-color: #f4f4f4;
    font-weight: bold;
}

/* HTML代码区域样式 */
pre[class*="brush:"] {
    background-color: #e8f5e9 !important;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    position: relative;
    margin-bottom: 1rem;
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* 确保代码块内部的代码也有正确的背景色 */
pre[class*="brush:"] code {
    background-color: transparent !important;
    padding: 0 !important;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
}

/* 代码复制按钮样式 */
pre[class*="brush:"] .copy-button {
    display: inline-block;
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    padding: 6px 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
    z-index: 100 !important;
    opacity: 0.8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

pre[class*="brush:"] .copy-button:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    opacity: 1;
}

pre[class*="brush:"] .copy-button:active {
    transform: translateY(0);
}

/* 登录页面样式 */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.login-container h1 {
    margin-bottom: 2rem;
    text-align: center;
}

/* 表单样式 */
.settings-form, .user-form {
    background: #f9f9f9;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
}

/* 消息提示样式 */
.success-message {
    color: green;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
}

.error-message {
    color: red;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* 移除响应式设计，保持固定布局 */