/* 校园失物招领平台 · 全站样式（第 10 课 / M4：测试与打磨）——全部本地，无外链
   M2 已有 顶栏/卡片/表单 三块；M3 新增 搜索栏/详情页/留言区；M4 不做大改，只打磨：
   ① 全站配色收成一组"校色"变量，一改全改，不再到处散落色值
   ② 卡片对齐：flex 子元素补 min-width:0，超长无空格文字不再把卡片撑破（测试清单抓的 bug）
   ③ 输入框聚焦有反馈、卡片悬停有反馈，投影演示时看着更"整"
   M1–M3 的样式规则全部保留，只是色值换成了变量 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ---- 校色（第 10 课统一配色）：深蓝主色 + 绿/红/橙三种语义牌色，全站只认这一套 ---- */
:root {
    --school-blue: #2c5f8a;        /* 校色主色：顶栏、按钮、链接、想认领 */
    --school-blue-dark: #24506f;   /* 主色悬停/按下 */
    --accent-green: #3a7d44;       /* 拾到 = 绿牌、发布按钮 */
    --accent-green-dark: #469455;
    --accent-red: #c0392b;         /* 丢失 = 红牌 */
    --accent-orange: #d68910;      /* 我捡到了 = 橙牌 */
    --page-bg: #f0f4f8;            /* 页面底色 */
    --placeholder-bg: #e6edf3;     /* 无照片占位块底色 */
    --placeholder-text: #9db3c8;   /* 无照片占位文字 */
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--page-bg);
    color: #333;
    min-height: 100vh;
}

/* ---- 顶栏：校色底 + 站名 + 右侧按钮，列表页和发布页共用 ---- */
.topbar {
    background: var(--school-blue);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h1 {
    font-size: 20px;
}

.btn {
    background: var(--accent-green);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}

.btn:hover {
    background: var(--accent-green-dark);
}

/* ---- 物品列表页：卡片竖排，一张卡片一件物品 ---- */
.list {
    max-width: 720px;
    margin: 20px auto;
    padding: 0 16px;
}

.card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    margin-bottom: 14px;
    transition: box-shadow 0.15s ease;  /* 悬停浮起的过渡动画（第 10 课打磨） */
}

.card:hover {
    box-shadow: 0 4px 14px rgba(44, 95, 138, 0.18);
}

/* 卡片正文：flex 子元素默认 min-width:auto，超长无空格文字会把卡片撑破顶出屏幕；
   补 min-width:0 让它回到卡片宽度内换行（配合下面各文本块的 overflow-wrap） */
.card-body {
    flex: 1;
    min-width: 0;
}

/* 缩略图统一裁成 96×96 小方图（object-fit: cover 不拉伸变形） */
.thumb {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--placeholder-bg);
    color: var(--placeholder-text);
    font-size: 13px;
}

.card-title {
    font-size: 17px;
    font-weight: bold;
    margin-bottom: 6px;
}

/* 超长连续文字（一整行没有空格）到边界强制折断换行，不再撑破卡片/详情页 */
.card-title,
.card-meta,
.msg-head,
.msg-content,
.detail-desc {
    overflow-wrap: anywhere;
    word-break: break-all;
}

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: normal;
    color: #fff;
    border-radius: 4px;
    padding: 2px 8px;
    margin-right: 8px;
    vertical-align: middle;
}

.badge-found {
    background: var(--accent-green);   /* 拾到 = 绿牌 */
}

.badge-lost {
    background: var(--accent-red);     /* 丢失 = 红牌 */
}

.card-meta {
    color: #555;
    font-size: 14px;
    margin-bottom: 4px;
}

.card-time {
    color: #999;
    font-size: 12px;
}

/* 空状态：白卡片 + 虚线框，投影时一眼能看出"这里是空的、该干什么"（第 10 课打磨） */
.empty {
    text-align: center;
    color: #888;
    background: #ffffff;
    border: 2px dashed #ccd8e4;
    border-radius: 10px;
    padding: 48px 16px;
}

/* ---- 发布页：表单卡片 ---- */
.form-wrap {
    max-width: 560px;
    margin: 24px auto;
    padding: 0 16px;
}

.error {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #c0392b;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.form {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 20px 24px;
}

.form label {
    display: block;
    margin-bottom: 14px;
    font-size: 14px;
    color: #555;
}

.form input[type="text"],
.form select,
.form textarea {
    width: 100%;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form fieldset {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 14px;
}

.form fieldset label.radio {
    display: inline-block;
    margin: 0 16px 0 0;
}

.form button {
    background: var(--school-blue);
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}

.form button:hover {
    background: var(--school-blue-dark);
}

/* 输入框聚焦：校色描边 + 淡淡光晕，演示时能看出"点在哪个框"（第 10 课打磨） */
.form input[type="text"]:focus,
.form select:focus,
.form textarea:focus,
.search input[type="text"]:focus,
.search select:focus {
    border-color: var(--school-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 95, 138, 0.15);
}

/* ---- 第 9 课 / M3 新增：首页搜索栏（关键词 + 分类下拉一行摆放）---- */
.search {
    max-width: 720px;
    margin: 20px auto 0;
    padding: 0 16px;
    display: flex;
    gap: 8px;
}

.search input[type="text"] {
    flex: 1;                /* 关键词框占满剩余宽度 */
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.search select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.search button {
    background: var(--school-blue);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.search button:hover {
    background: var(--school-blue-dark);
}

/* "清空筛选"链接：只在有筛选条件时才出现，点击回不带参数的首页 */
.search-clear {
    color: var(--school-blue);
    font-size: 14px;
    line-height: 34px;      /* 和输入框同高，视觉居中 */
    text-decoration: none;
    white-space: nowrap;
}

.search-clear:hover {
    text-decoration: underline;
}

/* 卡片名称变成详情页链接：平时继承标题色，悬停变色加下划线提示可点 */
.card-link {
    color: inherit;
    text-decoration: none;
}

.card-link:hover {
    color: var(--school-blue);
    text-decoration: underline;
}

/* ---- 详情页：大图卡片 + 信息区 ---- */
.detail-wrap {
    max-width: 720px;
    margin: 20px auto;
    padding: 0 16px;
}

.detail-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 16px;
    margin-bottom: 20px;
}

.detail-photo {
    width: 100%;
    height: 320px;
    object-fit: cover;      /* 大图裁满容器不变形 */
    border-radius: 8px;
    margin-bottom: 14px;
}

.detail-photo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--placeholder-bg);
    color: var(--placeholder-text);
    font-size: 15px;
}

.detail-info .card-title {
    font-size: 19px;
}

.detail-desc {
    color: #444;
    font-size: 15px;
    line-height: 1.6;
    margin: 10px 0;
    white-space: pre-wrap;  /* 描述里手动敲的换行照常显示 */
}

/* 发布者联系方式用浅绿底突出——认领对接全靠它 */
.detail-contact {
    background: #eef6ee;
    border: 1px solid #cfe6cf;
    color: #2f6d38;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    margin-bottom: 8px;
}

/* ---- 留言列表 + 留言表单 ---- */
.msg-title {
    font-size: 16px;
    color: #333;
    margin-bottom: 12px;
}

.msg {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 12px 14px;
    margin-bottom: 10px;
}

.msg-head {
    font-size: 14px;
    margin-bottom: 6px;
}

.msg-contact {
    color: #555;
    font-size: 13px;
    margin-left: 10px;
}

.msg-time {
    color: #999;
    font-size: 12px;
    margin-left: 10px;
}

.msg-content {
    color: #333;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.badge-claim {
    background: var(--school-blue);    /* 想认领 = 蓝牌 */
}

.badge-return {
    background: var(--accent-orange);  /* 我捡到了 = 橙牌 */
}

/* 留言表单沿用 .form 的卡片样式，和上面留言列表拉开一点距离 */
.msg-form {
    margin-top: 18px;
}

