/* ===== 全局基础样式 ===== */
body {
    font-family: "Segoe UI", Arial, sans-serif;
    margin: 0;                     /* 移除固定边距，让容器控制 */
    background: #f0f2f5;
    color: #333;
    padding: 20px;
    box-sizing: border-box;
}
.container {
    max-width: 100%;               /* 全宽 */
    width: 100%;
    margin: 0 auto;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    box-sizing: border-box;
}
h1 { color: #1a1a1a; margin-top: 0; }
h2 { color: #444; border-bottom: 2px solid #eee; padding-bottom: 5px; }
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: 600; }
input, textarea {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
}
button, .btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s;
}
button:hover, .btn:hover { background: #0056b3; }
.message { padding: 12px; margin: 10px 0; border-radius: 6px; font-weight: 500; }
.message.success { background: #d4edda; color: #155724; }
.message.error { background: #f8d7da; color: #721c24; }
.message.info { background: #d1ecf1; color: #0c5460; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; background: #fff; }
th, td { border: 1px solid #ddd; padding: 10px; text-align: left; }
th { background: #f8f9fa; font-weight: 600; }
a { color: #007bff; text-decoration: none; }
a:hover { text-decoration: underline; }
.form-inline { display: flex; gap: 10px; align-items: center; margin-bottom: 15px; }
.form-inline input { flex: 1; }
.error { color: #d32f2f; }

/* 附件预览 */
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attach-item { display: flex; flex-direction: column; align-items: center; max-width: 120px; text-align: center; }
.attach-thumb { width: 80px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid #ccc; }
.attach-name { font-size: 11px; word-break: break-all; }
.preview-link { font-size: 12px; }

/* 模态窗 */
.preview-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.preview-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); }
.preview-content { position: relative; max-width: 90%; max-height: 90%; background: white; padding: 10px; border-radius: 8px; overflow: auto; }
.preview-close { position: absolute; top: 5px; right: 10px; font-size: 28px; font-weight: bold; cursor: pointer; color: #333; }

/* 删除按钮 */
.delete-btn { background: #dc3545; margin-left: 5px; }
.delete-btn:hover { background: #b02a37; }

/* 登录页 */
.login-container {
    max-width: 400px;
    margin: 80px auto;
}
.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
}
.login-container .form-group {
    margin-bottom: 20px;
}
.login-container button {
    width: 100%;
    padding: 12px;
}
.alt-link {
    text-align: center;
    margin-top: 15px;
}

/* ===== 文件编辑器 - 全屏适配 ===== */
.editor-wrapper {
    display: flex;
    height: calc(100vh - 180px);    /* 占满视口，预留顶部和底部空间 */
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}
.file-tree {
    width: 260px;
    min-width: 260px;
    background: #fafafa;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    padding: 10px;
}
.file-tree ul {
    list-style: none;
    padding-left: 20px;
    margin: 0;
}
.file-tree li {
    margin: 2px 0;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    user-select: none;
}
.file-tree li:hover { background: #e6f0ff; }
.file-tree li.selected { background: #cce5ff; font-weight: bold; }
.file-tree .dir-label { font-weight: 600; color: #444; }
.file-tree .file-icon { margin-right: 6px; color: #007bff; }
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;                 /* 防止溢出 */
}
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    flex-wrap: wrap;
}
.editor-toolbar button {
    padding: 6px 14px;
    font-size: 14px;
}
.editor-toolbar .file-path {
    font-family: monospace;
    color: #888;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.editor-area {
    flex: 1;
    display: flex;
    border: none;
}
.editor-area textarea {
    flex: 1;
    border: none;
    padding: 15px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    background: #fff;
    color: #222;
}
.commit-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    background: #fff;
}
.commit-item {
    border-bottom: 1px solid #eee;
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.commit-item:last-child { border-bottom: none; }
.commit-message { font-weight: 500; }
.commit-date { font-size: 12px; color: #888; }

/* 帖子系统 */
.post-list { margin-top: 20px; }
.post-item {
    background: #f9f9f9;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.post-item .post-title {
    font-size: 18px;
    font-weight: 600;
    color: #007bff;
    cursor: pointer;
}
.post-meta {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
}
.post-actions button { margin-left: 6px; font-size: 13px; padding: 4px 12px; }
#post-code {
    width: 100%;
    height: 300px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    resize: vertical;
    box-sizing: border-box;
    background: #fafafa;
    color: #222;
    line-height: 1.5;
}
.preview-container {
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.preview-container iframe {
    width: 100%;
    height: 300px;
    border: none;
    background: white;
}
.toolbar-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

/* 隐藏文件上传控件 */
.hidden-input {
    display: none;
}