/* ===== 留言板样式 ===== */

/* 基础重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f0f2f5;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* 容器 */
.wrapper { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* 头部 */
.header {
    background: linear-gradient(135deg, #2b6de8, #4a8af4);
    color: #fff;
    padding: 30px 0;
    margin-bottom: 20px;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 12px rgba(43, 109, 232, 0.3);
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.logo a { color: #fff; font-size: 28px; font-weight: 700; }
.logo a:hover { text-decoration: none; opacity: 0.9; }
.subtitle { font-size: 15px; opacity: 0.9; }

.header-actions { display: flex; align-items: center; gap: 15px; }
.admin-info { font-size: 14px; opacity: 0.9; }
.btn-logout {
    color: #fff;
    background: rgba(255,255,255,0.2);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.35); text-decoration: none; }

/* 主布局 */
.container { display: flex; gap: 20px; align-items: flex-start; }
.main-content { flex: 1; min-width: 0; }
.sidebar { width: 340px; flex-shrink: 0; position: sticky; top: 20px; }

/* 分类导航 */
.category-nav {
    display: flex;
    gap: 0;
    background: #fff;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.cat-item {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.cat-item:hover { color: #2b6de8; text-decoration: none; background: #f8f9ff; }
.cat-item.active {
    color: #2b6de8;
    border-bottom-color: #2b6de8;
    font-weight: 600;
}

/* 留言列表 */
.message-list { background: #fff; border-radius: 0 0 10px 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.message-item {
    display: flex;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}
.message-item:last-child { border-bottom: none; }
.message-item:hover { background: #fafbfc; }

.msg-floor {
    flex-shrink: 0;
    width: 56px;
    text-align: center;
    font-size: 13px;
    color: #999;
    font-weight: 600;
    padding-top: 2px;
}

.msg-body { flex: 1; min-width: 0; }
.msg-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.msg-date { color: #999; font-size: 12px; }
.msg-cat {
    background: #e8f0fe;
    color: #2b6de8;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
}
.msg-user { color: #333; font-weight: 600; font-size: 14px; }

.msg-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #222;
}
.msg-content {
    color: #444;
    line-height: 1.8;
    word-break: break-word;
}

/* 回复区域 */
.msg-reply {
    margin-top: 12px;
    padding: 12px 15px;
    background: #f5f7fa;
    border-radius: 8px;
    border-left: 3px solid #2b6de8;
}
.reply-tag { color: #2b6de8; font-weight: 600; font-size: 13px; }
.reply-text { color: #555; }
.reply-time { color: #bbb; font-size: 12px; margin-left: 10px; }

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    padding: 20px 0;
    flex-wrap: wrap;
}
.page-btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #555;
    font-size: 13px;
    transition: all 0.2s;
}
.page-btn:hover { border-color: #2b6de8; color: #2b6de8; text-decoration: none; }
.page-btn.active { background: #2b6de8; color: #fff; border-color: #2b6de8; }
.page-info { color: #999; font-size: 13px; margin-left: 10px; }

/* 提交表单 */
.submit-box {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.submit-box h3 {
    font-size: 18px;
    color: #222;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.form-group { margin-bottom: 15px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
}
.required { color: #e74c3c; }

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fafafa;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2b6de8;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(43,109,232,0.1);
}

.char-count { display: block; text-align: right; font-size: 12px; color: #bbb; margin-top: 4px; }

.btn-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #2b6de8, #4a8af4);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}
.btn-submit:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-submit:active { transform: translateY(0); }

.form-tip {
    text-align: center;
    font-size: 12px;
    color: #bbb;
    margin-top: 10px;
}

/* 提示消息 */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #e6f7e6; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-error { background: #fdecea; color: #c62828; border: 1px solid #f5c6cb; }

/* 空状态 */
.empty { text-align: center; padding: 60px 20px; color: #bbb; font-size: 15px; background: #fff; border-radius: 10px; }

/* 底部 */
.footer {
    text-align: center;
    padding: 25px 0;
    color: #aaa;
    font-size: 13px;
    margin-top: 30px;
}

/* ===== 管理后台样式 ===== */
.login-box {
    max-width: 400px;
    margin: 60px auto;
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.login-box h2 { margin-bottom: 24px; text-align: center; color: #222; }

.admin-container {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 30px;
}
.admin-container h2 { font-size: 20px; margin-bottom: 20px; color: #222; }

.admin-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}
.tab {
    padding: 10px 20px;
    color: #666;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab:hover { color: #2b6de8; text-decoration: none; }
.tab.active { color: #2b6de8; border-bottom-color: #2b6de8; font-weight: 600; }

.admin-item {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: background 0.15s;
}
.admin-item.pending { border-left: 4px solid #ff9800; }
.admin-item.rejected { border-left: 4px solid #e74c3c; opacity: 0.7; }

.admin-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}
.admin-item-cat { color: #2b6de8; font-size: 12px; }
.admin-item-title { color: #333; font-weight: 600; }
.admin-item-time { color: #bbb; font-size: 12px; margin-left: auto; }

.admin-item-content { color: #444; margin-bottom: 8px; line-height: 1.7; }
.admin-item-contact { color: #999; font-size: 12px; margin-bottom: 8px; }
.admin-item-reply {
    background: #f0f7ff;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #555;
}
.admin-item-reply .reply-time { color: #bbb; font-size: 11px; }

.admin-item-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 5px;
    font-size: 13px;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: #555;
}
.btn:hover { text-decoration: none; }
.btn-approve { color: #2e7d32; border-color: #a5d6a7; }
.btn-approve:hover { background: #e8f5e9; }
.btn-reject { color: #c62828; border-color: #ef9a9a; }
.btn-reject:hover { background: #ffebee; }
.btn-reply { color: #2b6de8; border-color: #90caf9; }
.btn-reply:hover { background: #e3f2fd; }
.btn-delete { color: #999; border-color: #e0e0e0; }
.btn-delete:hover { background: #fafafa; color: #e74c3c; border-color: #ef9a9a; }
.btn-submit-sm {
    padding: 6px 18px;
    background: #2b6de8;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
}
.btn-submit-sm:hover { opacity: 0.9; }

.reply-form {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #eee;
}
.reply-form textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}
.reply-form textarea:focus { outline: none; border-color: #2b6de8; }

/* 错误提示（index页面短提示用） */
.flash-msg {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
}

/* 响应式 */
@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; position: static; }
    .header-inner { flex-direction: column; text-align: center; }
    .message-item { flex-direction: column; }
    .msg-floor { width: auto; text-align: left; margin-bottom: 6px; }
}
