/* style.css - 校园论坛样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #1c2e3a;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background: #2c7da0;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
/* 帖子内容中的代码块样式 */
.post-content pre {
    background: #f6f8fa;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    border: 1px solid #e1e4e8;
}

.post-content code {
    background: #f6f8fa;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85rem;
    color: #e83e8c;
}

.post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

/* 列表样式 */
.post-content ul, .post-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.post-content li {
    margin: 0.5em 0;
}

/* 引用块 */
.post-content blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid #2c7da0;
    background: #f8f9fa;
    color: #555;
}

/* 表格样式 */
.post-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.post-content th, .post-content td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.post-content th {
    background: #f2f2f2;
}
.badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    min-width: 18px;
    text-align: center;
}
/* 红色主题全局覆盖 */
body { background: #f9f9f9; }
.container { max-width: 1200px; margin: 0 auto; }
a { color: #c0392b; text-decoration: none; }
a:hover { text-decoration: underline; }
button, .btn, input[type="submit"] { background: #c0392b; color: white; border: none; border-radius: 30px; padding: 8px 20px; cursor: pointer; }
button:hover { background: #a93226; }
.post-card { background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); transition: transform 0.2s; }
.post-card:hover { transform: translateY(-2px); }
.pagination a.current { background: #c0392b; color: white; border-color: #c0392b; }
/* 消息中心 */
.msg-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid #ddd; }
.tab-btn { background: none; border: none; padding: 8px 16px; cursor: pointer; }
.tab-btn.active { color: #2c7da0; border-bottom: 2px solid #2c7da0; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.chat-item, .request-item, .notice-item { background: white; padding: 12px; margin-bottom: 8px; border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.1); cursor: pointer; }
.chat-item strong { display: block; }
.last-msg { font-size: 0.8rem; color: #666; }
.request-item button { margin-left: 8px; padding: 4px 12px; }
.post-stats { display: flex; gap: 20px; margin-top: 15px; align-items: center; }
.heart { fill: none; stroke: #e74c3c; stroke-width: 2; transition: fill 0.2s; cursor: pointer; }
.heart.liked { fill: #e74c3c; }
.user-actions { margin-top: 20px; display: flex; gap: 10px; }
.btn { display: inline-block; background: #2c7da0; color: white; padding: 8px 16px; text-decoration: none; border-radius: 4px; border: none; cursor: pointer; }
/* 头部整体布局 */
.app-header, header {
    background: #2c7da0;
    color: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    font-weight: bold;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}

/* 搜索框必须可见，设置最小宽度和弹性 */
/* 搜索表单 - 输入框与按钮分离 */
.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border-radius: 30px;
    padding: 2px 2px 2px 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-form input {
    border: none;
    padding: 8px 0;
    font-size: 0.9rem;
    outline: none;
    background: transparent;
    flex: 1;
    min-width: 180px;
}

.search-form button {
    background: #f39c12;
    border: none;
    border-radius: 30px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-form button:hover {
    background: #e67e22;
}

.search-form svg {
    display: block;
} 

/* 按钮样式 - 确保不被压缩 */
/* 头部按钮样式 - 与 404 页面统一 */
.header-bt1 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    padding: 8px 18px;
    border-radius: 40px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: none;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.header-btn:hover {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    color: white;
    text-decoration: none;
}

.header-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* 用户信息区域 */
.user-info {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 响应式：小屏幕下调整间距 */
@media (max-width: 768px) {
    .header-right {
        gap: 8px;
    }
    .search-form {
        min-width: 120px;
        max-width: 200px;
    }
    .header-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    .user-info {
        font-size: 0.85rem;
    }
}

/* 超小屏幕：换行后仍保持搜索框可见 */
@media (max-width: 550px) {
    .header-right {
        justify-content: flex-start;
    }
    .search-form {
        order: 1;
        min-width: 100%;
        max-width: 100%;
        margin-bottom: 5px;
    }
    .header-btn, .user-info {
        order: 2;
    }
}

main {
    flex: 1;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    width: 100%;
}

h1, h2 {
    margin-bottom: 20px;
    color: #2c7da0;
}
/* 确保帖子内容中所有图片自适应容器宽度 */
.post-content img,
.post-content figure img,
.post-content p img,
.post-content div img,
.post-content span img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
    margin: 10px auto !important;
    float: none !important;
    clear: both !important;
}

/* 同时限制外层容器不溢出 */
.post-content {
    overflow-x: auto !important;
    word-wrap: break-word !important;
    max-width: 100% !important;
}

/* 对于 Markdown 渲染的表格、代码块等也可一并限制 */
.post-content pre,
.post-content table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

.post-list, .comment-list {
    list-style: none;
}

.post-list li, .comment-list li {
    background: white;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.post-list h2 {
    margin-bottom: 10px;
}

.post-meta {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
}

.pagination {
    margin: 20px 0;
    text-align: center;
}

.pagination a {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    background: white;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #2c7da0;
}

.pagination a.current {
    background: #2c7da0;
    color: white;
    border-color: #2c7da0;
}

.login-container, .register-container {
    max-width: 400px;
    margin: 80px auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.login-container input, .register-container input, form input, form textarea {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

button {
    background: #2c7da0;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background: #1f5e7a;
}

.error {
    color: #e74c3c;
    margin-bottom: 15px;
}

.success {
    color: #27ae60;
    margin-bottom: 15px;
}

footer {
    background: #1e3b45;
    color: #ccc;
    text-align: center;
    padding: 15px;
    margin-top: 40px;
}

footer a {
    color: #f39c12;
    text-decoration: none;
}

table {
    background: white;
    width: 100%;
    margin: 20px 0;
}

th {
    background: #2c7da0;
    color: white;
    padding: 10px;
}

td {
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

.post-full {
    background: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.comment-form textarea {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
}