/* 校园集市 - 简洁移动端优先 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f6f8;
    color: #222;
    line-height: 1.6;
    padding-bottom: 52px;   /* 给固定底栏留空间 */
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
    row-gap: 6px;
}

.logo { font-size: 18px; font-weight: 700; color: #333; text-decoration: none; }

.topbar nav a {
    margin-left: 14px;
    font-size: 14px;
    color: #666;
    text-decoration: none;
}

.container { max-width: 640px; margin: 0 auto; padding: 16px; min-height: 70vh; }

/* 顶部安全提示横幅（精简版，手机单行） */
.notice {
    background: #fff7e6;
    color: #b26a00;
    font-size: 13px;
    text-align: center;
    padding: 9px 12px;
    border-bottom: 1px solid #f3e3c8;
    line-height: 1.7;
    white-space: nowrap;   /* 保证手机上只显示一行 */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 搜索框 */
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.search-bar input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
}
.search-bar button {
    padding: 0 18px;
    border: none;
    border-radius: 8px;
    background: #4a7cf7;
    color: #fff;
    font-size: 15px;
}

/* 分类 Tab */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
    padding: 6px 14px;
    border-radius: 16px;
    background: #fff;
    border: 1px solid #ddd;
    font-size: 14px;
    color: #666;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;   /* 防止标签文字中途断行（如「二手交/易」） */
}
.tab.active { background: #4a7cf7; border-color: #4a7cf7; color: #fff; }

/* 卡片列表 */
.card-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.card {
    width: 100%;
    background: #fff7ec;
    border: 1px solid #f3e3c8;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    max-width: 460px;
    margin: 0 auto;
    cursor: pointer;
}
/* 分类配色：二手交易=绿色，悬赏=橙色（左边条 + 标签） */
.card-secondhand {
    border-left: 4px solid #21a35f;
}
.card-bounty {
    border-left: 4px solid #ff8a1e;
}
.card-secondhand .tag { background: #e2f5ea; color: #1e9e5a; }
.card-bounty .tag { background: #ffeeda; color: #f07c00; }
.card-other {
    border-left: 4px solid #9b6bf7;
}
.card-other .tag { background: #f1e9fd; color: #7a3ff0; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #eef3ff;
    color: #4a7cf7;
}
.price {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: #ff5722;
    padding: 3px 12px;
    border-radius: 14px;
    max-width: 100%;
    word-break: break-all;
}
/* 联系方式单独标记（暖色调） */
.card-contact {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff3e6;
    border: 1px solid #ffdcb8;
    color: #d97b1e;
    font-size: 13px;
}
.card-title { font-size: 16px; margin-bottom: 4px; }
/* 卡片图片：顶部通栏，等比裁剪，圆角 */
.card-img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
    display: block;
    background: #f0e2c8;
}
.card-detail {
    font-size: 14px;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta { margin-top: 8px; font-size: 12px; color: #999; display: flex; gap: 12px; }

.empty { text-align: center; color: #999; padding: 60px 0; }

/* 登录 / 注册 */
.auth-card {
    max-width: 360px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.auth-card h2 { font-size: 20px; margin-bottom: 16px; }
.auth-card label {
    display: block;
    margin: 12px 0 6px;
    font-size: 14px;
    color: #666;
}
.auth-card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    background: #f7f8fa;
}
.auth-card input:focus {
    outline: none;
    border-color: #4a7cf7;
    background: #fff;
}
.auth-card button {
    width: 100%;
    margin-top: 18px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #4a7cf7;
    color: #fff;
    font-size: 15px;
}
.error {
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff0f0;
    color: #e5484d;
    font-size: 14px;
}
.auth-switch { margin-top: 14px; font-size: 14px; color: #666; text-align: center; }
.auth-switch a { color: #4a7cf7; text-decoration: none; }

/* 发布表单 */
.form-card {
    max-width: 480px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.form-card h2 { font-size: 20px; margin-bottom: 16px; }
.form-card label {
    display: block;
    margin: 12px 0 6px;
    font-size: 14px;
    color: #666;
}
.form-card input,
.form-card select,
.form-card textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    background: #f7f8fa;
    font-family: inherit;
}
.form-card input:focus,
.form-card select:focus,
.form-card textarea:focus {
    outline: none;
    border-color: #4a7cf7;
    background: #fff;
}
.form-card textarea { resize: vertical; }
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }
.form-card input[type="file"] {
    padding: 8px;
    background: #fff;
    font-size: 14px;
}
.form-card button {
    width: 100%;
    margin-top: 18px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background: #4a7cf7;
    color: #fff;
    font-size: 15px;
}

.nav-user { margin-left: 14px; font-size: 14px; color: #4a7cf7; }

/* 「更多」下拉菜单 */
.more-menu { position: relative; display: inline-block; margin-left: 14px; }
.more-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    font-family: inherit;
}
.more-items {
    display: none;
    position: absolute;
    right: 0;
    top: 30px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    min-width: 150px;
    padding: 6px;
    z-index: 100;
}
.more-items.open { display: block; }
.more-items a {
    display: block;
    padding: 8px 12px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    margin-left: 0 !important;
}
.more-items a:hover { background: #f5f6f8; color: #4a7cf7; }
.more-sep { height: 1px; background: #eee; margin: 6px 4px; }

/* 卡片标题链接（大厅 / 我的发布） */
.title-link { color: #4a7cf7; text-decoration: none; }
.title-link:hover { text-decoration: underline; }
.view-hint { color: #4a7cf7; font-size: 12px; margin-left: auto; text-decoration: none; }

/* 详情页 */
.detail-card {
    max-width: 480px;
    margin: 20px auto;
    padding: 20px;
    background: #fff7ec;
    border: 1px solid #f3e3c8;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.back-link {
    display: inline-block;
    margin-bottom: 14px;
    color: #666;
    font-size: 14px;
    text-decoration: none;
}
.back-link:hover { color: #4a7cf7; }
.detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 6px; }
/* 详情页大图 */
.detail-img {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
    display: block;
    background: #f0e2c8;
}
.detail-title { font-size: 20px; margin-bottom: 8px; }
.detail-text {
    font-size: 15px;
    color: #444;
    white-space: pre-wrap;
    word-break: break-word;
}
.detail-meta {
    margin-top: 12px;
    font-size: 12px;
    color: #999;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.contact-hint {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff3e6;
    border: 1px solid #ffdcb8;
    color: #d97b1e;
    font-size: 13px;
}
.trade-hint {
    margin-top: 10px;
    font-size: 12px;
    color: #b26a00;
    background: #fff7e6;
    border: 1px solid #f3e3c8;
    border-radius: 8px;
    padding: 8px 12px;
}
.copy-btn {
    margin-left: 8px;
    padding: 3px 10px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    background: #fff;
    color: #666;
    font-size: 12px;
    cursor: pointer;
}
.copy-btn:hover { background: #f0f0f0; }

/* 站内留言 */
.messages { margin-top: 18px; }
.messages-title { font-size: 16px; margin-bottom: 10px; }
.message-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.message-item {
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #f0e2c8;
}
.message-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.message-user { font-size: 13px; font-weight: 600; color: #4a7cf7; }
.message-time { font-size: 11px; color: #aaa; }
.message-content { font-size: 14px; color: #333; white-space: pre-wrap; word-break: break-word; }
.empty-small { color: #999; font-size: 14px; padding: 8px 0; }
.message-form { margin-top: 12px; }
.message-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    resize: vertical;
    font-family: inherit;
}
.message-form textarea:focus { outline: none; border-color: #4a7cf7; }
.message-form button {
    margin-top: 10px;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: #4a7cf7;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.login-hint { margin-top: 12px; font-size: 14px; color: #666; }
.login-hint a { color: #4a7cf7; text-decoration: none; }

/* 我的发布 */
.my-page { max-width: 520px; margin: 20px auto; }
.my-title { font-size: 20px; margin-bottom: 16px; }
.my-hint {
    background: #e8f0ff;
    color: #2f5fc4;
    font-size: 13px;
    padding: 9px 12px;
    border: 1px solid #d3e2ff;
    border-radius: 8px;
    margin-bottom: 14px;
}
.status { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.status-on { background: #e2f5ea; color: #1e9e5a; }
.status-off { background: #f2f2f2; color: #999; }
.status-expired { background: #fff0f0; color: #e5484d; }
.duration-select {
    padding: 5px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: #666;
}
.message-box { margin-top: 10px; }
.message-box-title { font-size: 13px; font-weight: 600; color: #666; margin-bottom: 6px; }
.toggle-form { margin-top: 10px; }
.btn-secondary {
    padding: 6px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    background: #fff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
}
.btn-secondary:hover { background: #f0f0f0; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.card-actions form { margin: 0; }
.btn-danger {
    padding: 6px 16px;
    border: 1px solid #e5484d;
    border-radius: 8px;
    background: #fff;
    color: #e5484d;
    font-size: 13px;
    cursor: pointer;
}
.btn-danger:hover { background: #fff0f0; }
.btn-small { padding: 3px 10px; font-size: 12px; border-radius: 6px; }
.admin-close-form { margin-top: 10px; }
.btn-edit {
    display: inline-block;
    text-decoration: none;
    padding: 6px 16px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    background: #fff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    box-sizing: border-box;
}
.btn-edit:hover { background: #f0f0f0; }
.edit-img {
    display: block;
    max-width: 200px;
    max-height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin: 4px 0 8px;
}

/* 举报链接（卡片内小号红色文字） */
.report-area { margin-top: 12px; text-align: right; }
.report-link {
    color: #e5484d;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}
.report-link:hover { text-decoration: underline; }

/* 举报成功提示横幅（绿色） */
.flash-ok {
    background: #e8f7ee;
    color: #1e9e5a;
    font-size: 13px;
    text-align: center;
    padding: 8px;
    border: 1px solid #ccecd8;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* 举报表单 */
.report-target { font-size: 14px; color: #666; margin-bottom: 8px; }
.report-target a { color: #4a7cf7; text-decoration: none; }
.form-hint { font-size: 12px; color: #999; margin-top: 4px; }

/* 我的发布：已过期状态 */
.status-expired { background: #fff0f0; color: #e5484d; }

/* 举报管理页面 */
.admin-reports { max-width: 520px; margin: 20px auto; }
.admin-reports-title { font-size: 20px; margin-bottom: 16px; }
.report-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.report-item {
    background: #fff7ec;
    border: 1px solid #f3e3c8;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.report-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
}
.report-listing { color: #4a7cf7; font-size: 15px; font-weight: 600; text-decoration: none; }
.report-listing:hover { text-decoration: underline; }
.report-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #ffeeda;
    color: #f07c00;
}
.report-reason {
    font-size: 14px;
    color: #444;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 6px 0;
}
.report-meta {
    font-size: 12px;
    color: #999;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.report-actions { display: flex; gap: 8px; margin-top: 10px; }
.report-actions form { margin: 0; }

/* 联系管理员 / 信箱 */
.contact-page { max-width: 520px; margin: 20px auto; }
.contact-desc { font-size: 13px; color: #999; margin-bottom: 12px; }
.admin-reply {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #f1e9fd;
    border: 1px solid #e0d0f8;
}
.admin-reply-user { color: #7a3ff0; }
.reply-waiting { font-size: 12px; color: #999; margin-top: 6px; }
.reply-form { margin-top: 10px; }
.reply-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}
.reply-form textarea:focus { outline: none; border-color: #4a7cf7; }
.reply-form button { margin-top: 8px; }

.footer {
    text-align: center;
    padding: 11px 12px;
    font-size: 13px;
    font-weight: 700;
    color: #666;
    background: #fff;
    border-top: 1px solid #eee;
    position: fixed;       /* 固定底栏：不翻页也能看到安全提示 */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    line-height: 1.5;
}

/* ---------- 大厅：置顶 / 排序 / 换一批 ---------- */
.pinned-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #ffe7ba;
    color: #d97b1e;
    margin-right: 6px;
    font-weight: 600;
}
.sort-bar { display: flex; gap: 6px; }
.sort-link {
    font-size: 13px;
    color: #666;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #ddd;
}
.sort-link.active { background: #4a7cf7; border-color: #4a7cf7; color: #fff; }
.hall-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.shuffle-btn {
    font-size: 13px;
    color: #4a7cf7;
    text-decoration: none;
    padding: 4px 14px;
    border-radius: 14px;
    background: #eef3ff;
    border: 1px solid #cfe0ff;
}
.shuffle-btn:hover { background: #dce9ff; }
.shuffle-hint { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #666; }
.shuffle-exit { font-size: 13px; color: #999; text-decoration: none; }
.shuffle-exit:hover { text-decoration: underline; }
.user-link { color: #4a7cf7; text-decoration: none; }
.user-link:hover { text-decoration: underline; }
.admin-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.admin-actions form { margin: 0; }

/* 私聊按钮（详情页） */
.chat-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 18px;
    border-radius: 8px;
    background: #4a7cf7;
    color: #fff;
    font-size: 14px;
    text-decoration: none;
}
.chat-btn:hover { background: #3a6ae0; }

/* ---------- 消息中心 / 私聊窗口 ---------- */
.chat-page { max-width: 520px; margin: 20px auto; }
.chat-title { font-size: 20px; margin-bottom: 14px; }
.conv-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.conv-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
}
.conv-item:hover { border-color: #cfe0ff; }
.conv-left { min-width: 0; }
.conv-name { font-weight: 600; font-size: 15px; display: block; margin-bottom: 2px; }
.conv-preview {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 280px;
}
.conv-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv-unread {
    background: #e5484d;
    color: #fff;
    font-size: 11px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 5px;
}
.conv-time { font-size: 11px; color: #bbb; }

.chat-room { max-width: 520px; margin: 20px auto; }
.chat-privacy { font-size: 12px; color: #999; margin-bottom: 10px; }
.chat-thread {
    max-height: 55vh;
    overflow-y: auto;
    background: #f7f8fa;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; }
.bubble-me { align-self: flex-end; background: #4a7cf7; color: #fff; border-bottom-right-radius: 4px; }
.bubble-other { align-self: flex-start; background: #fff; border: 1px solid #eee; border-bottom-left-radius: 4px; }
.bubble-head { display: flex; gap: 8px; margin-bottom: 2px; font-size: 11px; opacity: .75; }
.bubble-content { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.chat-form { margin-top: 12px; display: flex; gap: 8px; }
.chat-form textarea {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    resize: vertical;
    font-family: inherit;
}
.chat-form textarea:focus { outline: none; border-color: #4a7cf7; }
.chat-form button {
    padding: 0 20px;
    border: none;
    border-radius: 8px;
    background: #4a7cf7;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

/* ---------- 公告 / 封禁 / 一次性提示 ---------- */
.announce {
    background: #e8f0ff;
    color: #2f5fc4;
    font-size: 13px;
    text-align: center;
    padding: 8px;
    border-bottom: 1px solid #d3e2ff;
}
.ban-banner {
    background: #fff0f0;
    color: #c92a2a;
    font-size: 13px;
    text-align: center;
    padding: 8px;
    border-bottom: 1px solid #f5c6c6;
}
.flash-msg {
    background: #e8f0ff;
    color: #2f5fc4;
    font-size: 13px;
    text-align: center;
    padding: 8px;
    border: 1px solid #d3e2ff;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* 未读红点（导航） */
.badge {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background: #e5484d;
    color: #fff;
    font-size: 11px;
    border-radius: 8px;
    padding: 0 4px;
    margin-left: 4px;
    vertical-align: 1px;
}

/* ---------- 用户管理 / 统计 ---------- */
.status-ban { background: #fff0f0; color: #e5484d; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}
.stat-num { display: block; font-size: 24px; font-weight: 700; color: #4a7cf7; }
.stat-label { font-size: 12px; color: #999; }
.check-label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #666; margin-top: 12px; }
.check-label input { width: auto; }

/* ---------- 维护模式 ---------- */
.maintain-banner {
    background: #fff3e0;
    color: #c2410c;
    font-size: 13px;
    text-align: center;
    padding: 8px;
    border-bottom: 1px solid #ffd8a8;
}
.maintenance-box {
    max-width: 420px;
    margin: 80px auto;
    background: #fff7ec;
    border: 1px solid #f3e3c8;
    border-radius: 16px;
    padding: 40px 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.maintenance-icon { font-size: 48px; margin-bottom: 12px; }
.maintenance-box h2 { font-size: 22px; margin-bottom: 10px; }
.maintenance-box p { font-size: 14px; color: #666; }
.maintenance-sub { font-size: 12px; color: #999; margin-top: 8px; }
.refresh-btn {
    display: inline-block;
    margin-top: 18px;
    padding: 10px 28px;
    border-radius: 8px;
    background: #4a7cf7;
    color: #fff;
    font-size: 15px;
    text-decoration: none;
}
